Package org.dspace.storage.bitstore
Class BitstreamByteSource
java.lang.Object
com.google.common.io.ByteSource
org.dspace.storage.bitstore.BitstreamByteSource
public class BitstreamByteSource
extends com.google.common.io.ByteSource
A ByteSource implementation that provides access to DSpace Bitstream content.
Extends Google Guava's ByteSource to allow streaming access to bitstream data.
Author: Mark Diggory, Nathan Buckingham
-
Constructor Summary
ConstructorsConstructorDescriptionBitstreamByteSource(Bitstream bitstream) Creates a new BitstreamByteSource for the given bitstream. -
Method Summary
Modifier and TypeMethodDescriptionGets the underlying bitstream.Opens a new input stream for reading the bitstream content.longsize()Gets the size of the bitstream in bytes.Methods inherited from class com.google.common.io.ByteSource
asCharSource, concat, concat, concat, contentEquals, copyTo, copyTo, empty, hash, isEmpty, openBufferedStream, read, read, sizeIfKnown, slice, wrap
-
Constructor Details
-
BitstreamByteSource
Creates a new BitstreamByteSource for the given bitstream.- Parameters:
bitstream- the DSpace bitstream to wrap
-
-
Method Details
-
getBitstream
Gets the underlying bitstream.- Returns:
- the DSpace bitstream object
-
openStream
Opens a new input stream for reading the bitstream content.- Specified by:
openStreamin classcom.google.common.io.ByteSource- Returns:
- an input stream containing the bitstream data
- Throws:
IOException- if there is an error retrieving the bitstream, including SQL or authorization errors
-
size
Gets the size of the bitstream in bytes.- Overrides:
sizein classcom.google.common.io.ByteSource- Returns:
- the size of the bitstream in bytes
- Throws:
IOException- if there is an error accessing the size
-