Package com.oss.asn1

Interface Storage

All Superinterfaces:
Serializable
All Known Subinterfaces:
ByteStorage, CharStorage, ObjectStorage<T>
All Known Implementing Classes:
OSSByteStorage, OSSCharStorage, OSSFileStorage, OSSObjectStorage

public interface Storage extends Serializable
The Storage interface specifies the functionality an object should implement to serve as an external storage for huge values. Specific sub-interfaces define additional methods to access/modify the contents of the storage, depending on the storage class. Since the Storage is used to store the serializable values, the implementing class should have the ability to serialize/deserialize itself.
Since:
ASN.1/Java 1.4 beta A
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates if this storage object is readable.
    boolean
    Indicates if this storage object is writable.
    Create another storage object with identical contents to 'this' object.
    void
    Destroy the storage object and release all external resources, associated with the object.
    int
    Identifies the kind of storage.
    long
    Returns the number of items (bytes, characters or objects), contained in this storage object.
    void
    reset(boolean zeroize)
    Discard current contents of the storage object.
  • Method Details

    • getKind

      int getKind()
      Identifies the kind of storage. The value returned is either STORAGE_BYTES, STORAGE_CHARS or STORAGE_OBJECTS.
      Returns:
      the kind of this storage object.
    • getSize

      long getSize()
      Returns the number of items (bytes, characters or objects), contained in this storage object. If the storage object's size is not known return value is -1. Currently only the indefinite length BER encoder is capable of processing values of unknown size.
      Returns:
      item count or -1 if item count is not known.
    • reset

      void reset(boolean zeroize) throws StorageException
      Discard current contents of the storage object. After the call to this method the storage object becomes empty and the getSize() method will return 0. Unlike the deallocate() method, the reset() does not release external resources, used by this storage object. For example, if the contents is stored in the disk file, the file is reset to zero length but is not deleted.
      Parameters:
      zeroize - true indicates that the contents should be cleared by setting the contents to all zeroes before resetting the storage.
      Throws:
      StorageException - if any error occurs when resetting the contents of the storage.
    • deallocate

      void deallocate() throws StorageException
      Destroy the storage object and release all external resources, associated with the object. For example, if the contents is stored in the disk file, the deallocate() may delete the file. Your implementation should call this method from the finalize() method to avoid resource leaks.
      Throws:
      StorageException - if any error occurs when destroying the storage object.
    • copy

      Storage copy() throws StorageException
      Create another storage object with identical contents to 'this' object.
      Returns:
      a copy of 'this' storage object.
      Throws:
      StorageException - if the copy operation fails.
    • canRead

      boolean canRead()
      Indicates if this storage object is readable.
      Returns:
      true if the application is permitted to read the contents of 'this' storage object.
    • canWrite

      boolean canWrite()
      Indicates if this storage object is writable.
      Returns:
      true if the application is permitted to modify the contents of this storage object.