Package com.oss.asn1

Interface ByteStorage

All Superinterfaces:
Serializable, Storage
All Known Implementing Classes:
OSSByteStorage

public interface ByteStorage extends Storage
The ByteStorage interface extends the Storage interface to include additional methods for accessing and modifying the contents, a byte[] array.
Since:
ASN.1/Java 1.4 beta A
  • Method Details

    • getReader

      InputStream getReader() throws StorageException
      Get the InputStream to read individual octets from the storage. Your implementation is responsible for preventing concurrent read and write accesses to the contents. When the read access is not permitted for some reason (say, when the canRead() returns false), a StorageException is thrown.

      If this object implements indefinite length storage (which occurs when getSize() returns -1) the returned InputStream is expected to be available in multiple contiguous segments. Use the available() method of the stream to determine the length of the next segment. When the end of the stream is reached, the available() method will return 0.

      Returns:
      the instance of InputStream to read the contents of the storage.
      Throws:
      StorageException - if the contents of the storage is not readable.
    • getWriter

      OutputStream getWriter(boolean append) throws StorageException
      Get the OutputStream to modify the contents of the storage. Your implementation is responsible for preventing concurrent read and write accesses to the contents. When the append parameter is false, the current contents of the storage is reset. Otherwise, the octets, that are written to the OutputStream, are appended at the end of the existing value. If write access is not permitted for some reason (say, when canWrite() returns false), a StorageException is thrown.
      Parameters:
      append - false when overwriting the existing octets value, true when appending to the existing octets value.
      Returns:
      the instance of the OutputStream to write the contents of the storage.
      Throws:
      StorageException - if the contents of the storage is not writable.
    • load

      void load(InputStream source, long count, boolean append) throws StorageException
      Load the contents of the storage from a given InputStream. This method reads count octets from the source and, depending on the append parameter, either appends the octets to or overwrites the existing value. Your implementation is responsible for preventing concurrent read and write accesses to the contents. This method can be called by the decoder in order to transfer a number of octets from the input stream to the huge value being decoded.
      Parameters:
      source - input stream to read the octets.
      count - the number of octets to load.
      append - false when overwriting the existing octets value, true when appending to the existing octets value.
      Throws:
      StorageException - if the contents of the storage is not writable.