org.priha.core.binary
Interface BinarySource

All Known Implementing Classes:
FileBinarySource, MemoryBinarySource

public interface BinarySource

Represents a source of binary data. Implementations of this class are used to represent the Binary data type instead of just a plain stream. This allows hiding of whether the data is kept in-memory (e.g. MemoryBinarySource) or on disk FileBinarySource. Different Providers can then implement their own ways of getting the stream out of the repository.


Method Summary
 BinarySource clone()
          Duplicates the BinarySource object.
 long getLength()
          Return the length of the object represented by this BinarySource.
 java.io.InputStream getStream()
          Returns the contents of the BinarySource as an InputStream.
 

Method Detail

getStream

java.io.InputStream getStream()
                              throws java.io.IOException
Returns the contents of the BinarySource as an InputStream. Note that this must always return a valid stream pointing at the beginning of the binary object.

Returns:
An InputStream representing the binary item.
Throws:
java.io.IOException - If the stream could not be opened.

getLength

long getLength()
               throws java.io.IOException
Return the length of the object represented by this BinarySource.

Returns:
The length of the object.
Throws:
java.io.IOException - If the length cannot be determined.

clone

BinarySource clone()
Duplicates the BinarySource object.

Returns:
A new BinarySource which represents the same object.