Package com.oss.storage
Class OSSByteStorage
java.lang.Object
com.oss.storage.OSSFileStorage
com.oss.storage.OSSByteStorage
- All Implemented Interfaces:
ByteStorage
,Storage
,Serializable
,Cloneable
Implements external storage for the data, whose contents is an array
of bytes.
- Since:
- ASN.1/Java 1.4-beta A
- See Also:
-
Constructor Summary
ConstructorDescriptionThe default constructor.OSSByteStorage
(File file) Create an OSSByteStorage object and associate it with an existing disk file. -
Method Summary
Modifier and TypeMethodDescriptionint
getKind()
Identify the kind of storage this object implements.Return an InputStream to read the contents of the storage.getWriter
(boolean append) Return an output stream to modify the contents of the storage.void
load
(InputStream in, long count, boolean append) Load the contents from an InputStream.Methods inherited from class com.oss.storage.OSSFileStorage
canRead, canWrite, clone, copy, deallocate, getSize, reset, toString
-
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
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. -
getReader
Return an InputStream to read the contents of the storage.- Specified by:
getReader
in interfaceByteStorage
- Returns:
- an InputStream.
- Throws:
StorageException
- if read access to the contents was denied.
-
getWriter
Return an output stream to modify the contents of the storage.- Specified by:
getWriter
in interfaceByteStorage
- 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
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 interfaceByteStorage
- 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.
-