Package com.oss.asn1
Interface Storage
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
ByteStorage
,CharStorage
,ObjectStorage<T>
- All Known Implementing Classes:
OSSByteStorage
,OSSCharStorage
,OSSFileStorage
,OSSObjectStorage
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 TypeMethodDescriptionboolean
canRead()
Indicates if this storage object is readable.boolean
canWrite()
Indicates if this storage object is writable.copy()
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
getKind()
Identifies the kind of storage.long
getSize()
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 eitherSTORAGE_BYTES
,STORAGE_CHARS
orSTORAGE_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
Discard current contents of the storage object. After the call to this method the storage object becomes empty and thegetSize()
method will return 0. Unlike thedeallocate()
method, thereset()
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
Destroy the storage object and release all external resources, associated with the object. For example, if the contents is stored in the disk file, thedeallocate()
may delete the file. Your implementation should call this method from thefinalize()
method to avoid resource leaks.- Throws:
StorageException
- if any error occurs when destroying the storage object.
-
copy
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.
-