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

    Constructors
    Constructor
    Description
    Creates a new BitstreamByteSource for the given bitstream.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the underlying bitstream.
    Opens a new input stream for reading the bitstream content.
    long
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BitstreamByteSource

      public BitstreamByteSource(Bitstream bitstream)
      Creates a new BitstreamByteSource for the given bitstream.
      Parameters:
      bitstream - the DSpace bitstream to wrap
  • Method Details

    • getBitstream

      public Bitstream getBitstream()
      Gets the underlying bitstream.
      Returns:
      the DSpace bitstream object
    • openStream

      public InputStream openStream() throws IOException
      Opens a new input stream for reading the bitstream content.
      Specified by:
      openStream in class com.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

      public long size() throws IOException
      Gets the size of the bitstream in bytes.
      Overrides:
      size in class com.google.common.io.ByteSource
      Returns:
      the size of the bitstream in bytes
      Throws:
      IOException - if there is an error accessing the size