Class OSSFileStorage

java.lang.Object
com.oss.storage.OSSFileStorage
All Implemented Interfaces:
Storage, Serializable, Cloneable
Direct Known Subclasses:
OSSByteStorage, OSSCharStorage, OSSObjectStorage

public abstract class OSSFileStorage extends Object implements Storage, Cloneable
The OSSFileStorage class is the common superclass for the OSSByteStorage, OSSCharStorage and OSSObjectStorage.
Since:
ASN.1/Java 1.4-beta A
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicate if this storage object is readable.
    boolean
    Indicate if this storage object is writable.
    Implements deep copy.
    Create another storage object with identical contents.
    void
    Destroy the storage object and delete associated disk file.
    long
    Return the number of data items (bytes, characters or objects), contained in this storage object.
    void
    reset(boolean zeroize)
    Discard current contents of the storage object.
    Return a string representation of this object.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.oss.asn1.Storage

    getKind
  • Method Details

    • getSize

      public long getSize()
      Return the number of data items (bytes, characters or objects), contained in this storage object.
      Specified by:
      getSize in interface Storage
      Returns:
      item count.
    • reset

      public 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.
      Specified by:
      reset in interface Storage
      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

      public void deallocate() throws StorageException
      Destroy the storage object and delete associated disk file.
      Specified by:
      deallocate in interface Storage
      Throws:
      StorageException - if any error occurs when destroying the storage object.
    • copy

      public Storage copy() throws StorageException
      Create another storage object with identical contents.
      Specified by:
      copy in interface Storage
      Returns:
      a copy of this storage object.
      Throws:
      StorageException - if the copy operation fails.
    • clone

      public Object clone() throws CloneNotSupportedException
      Implements deep copy.
      Throws:
      CloneNotSupportedException
    • toString

      public String toString()
      Return a string representation of this object. The string returned specifies the file name of the associated File object.
      Overrides:
      toString in class Object
      Returns:
      file name of the associated file object
    • canRead

      public boolean canRead()
      Indicate if this storage object is readable.
      Specified by:
      canRead in interface Storage
      Returns:
      true if the application is permitted to read the contents of this storage object.
    • canWrite

      public boolean canWrite()
      Indicate if this storage object is writable.
      Specified by:
      canWrite in interface Storage
      Returns:
      true if the application is permitted to modify the contents of this storage object.