Class OSSByteStorage

java.lang.Object
com.oss.storage.OSSFileStorage
com.oss.storage.OSSByteStorage
All Implemented Interfaces:
ByteStorage, Storage, Serializable, Cloneable

public class OSSByteStorage extends OSSFileStorage implements ByteStorage
Implements external storage for the data, whose contents is an array of bytes.
Since:
ASN.1/Java 1.4-beta A
See Also:
  • Constructor Details

    • OSSByteStorage

      public OSSByteStorage()
      The default constructor. Bypasses the default constructor of the superclass that creates a temporary file and associates the file with this storage object.
    • OSSByteStorage

      public OSSByteStorage(File file)
      Create an OSSByteStorage object and associate it with an existing disk file.
      Parameters:
      file - disk file to associate with this storage object.
      Throws:
      StorageException - if the specified file does not exist or is not an ordinary (normal) file.
  • Method Details

    • getKind

      public int getKind()
      Identify the kind of storage this object implements.
      Specified by:
      getKind in interface Storage
      Returns:
      StorageManager.STORAGE_BYTES.
    • getReader

      public InputStream getReader() throws StorageException
      Return an InputStream to read the contents of the storage.
      Specified by:
      getReader in interface ByteStorage
      Returns:
      an InputStream.
      Throws:
      StorageException - if read access to the contents was denied.
    • getWriter

      public OutputStream getWriter(boolean append) throws StorageException
      Return an output stream to modify the contents of the storage.
      Specified by:
      getWriter in interface ByteStorage
      Parameters:
      append - false if the new data will overwrite the value, true when the new data will append to the current contents.
      Returns:
      an OutputStream.
      Throws:
      StorageException - if write access to the contents was denied.
    • load

      public void load(InputStream in, long count, boolean append) throws StorageException
      Load the contents from an InputStream. Current implementation of the OSSByteStorage does not support the NOCOPY feature, so the method simply copies the octets from the source input stream to the storage object.
      Specified by:
      load in interface ByteStorage
      Parameters:
      in - source input stream.
      count - the number of octets to load from the source.
      append - false if the new data will overwrite the value, true when the new data will append to the current contents.
      Throws:
      StorageException - if any error occurs when reading the source input stream or if the storage objects denies writing.