Class IRODSDataObjectInputStream

java.lang.Object
java.io.InputStream
org.irods.irods4j.high_level.io.IRODSDataObjectInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class IRODSDataObjectInputStream extends InputStream
A buffered input stream that makes it easy to read iRODS data objects.
Since:
0.1.0
  • Constructor Details

    • IRODSDataObjectInputStream

      public IRODSDataObjectInputStream()
      Initializes a new instance with a buffer size of 65536 bytes.
      Since:
      0.1.0
    • IRODSDataObjectInputStream

      public IRODSDataObjectInputStream(int bufferSize)
      Initializes a new instance with a custom buffer size.
      Parameters:
      bufferSize - The size of the internal buffer.
      Since:
      0.1.0
    • IRODSDataObjectInputStream

      public IRODSDataObjectInputStream(IRODSApi.RcComm comm, String logicalPath) throws IOException, IRODSException
      Initializes a new instance and opens a data object for reading.

      The internal buffer will have a size of 65536.

      Parameters:
      comm - The connection to the iRODS server.
      logicalPath - The absolute logical path to a data object.
      Throws:
      IOException
      IRODSException
      Since:
      0.1.0
    • IRODSDataObjectInputStream

      public IRODSDataObjectInputStream(IRODSApi.RcComm comm, String logicalPath, String rootResourceName) throws IOException, IRODSException
      Initializes a new instance and opens a replica for reading.

      The internal buffer will have a size of 65536.

      Parameters:
      comm - The connection to the iRODS server.
      logicalPath - The absolute logical path to a data object.
      rootResourceName - The root resource which contains the target replica.
      Throws:
      IOException
      IRODSException
      Since:
      0.1.0
    • IRODSDataObjectInputStream

      public IRODSDataObjectInputStream(IRODSApi.RcComm comm, String logicalPath, long replicaNumber) throws IOException, IRODSException
      Initializes a new instance and opens a specific replica for reading.

      The internal buffer will have a size of 65536.

      Parameters:
      comm - The connection to the iRODS server.
      logicalPath - The absolute logical path to a data object.
      replicaNumber - The replica number which identifies the target replica.
      Throws:
      IOException
      IRODSException
      Since:
      0.1.0
  • Method Details

    • open

      public void open(IRODSApi.RcComm comm, String logicalPath) throws IOException, IRODSException
      Opens a data object for reading.
      Parameters:
      comm - The connection to the iRODS server.
      logicalPath - The absolute logical path to a data object.
      Throws:
      IOException
      IRODSException
      Since:
      0.1.0
    • open

      public void open(IRODSApi.RcComm comm, String logicalPath, String rootResourceName) throws IOException, IRODSException
      Opens a replica for reading.
      Parameters:
      comm - The connection to the iRODS server.
      logicalPath - The absolute logical path to a data object.
      rootResourceName - The root resource which contains the target replica.
      Throws:
      IOException
      IRODSException
      Since:
      0.1.0
    • open

      public void open(IRODSApi.RcComm comm, String logicalPath, long replicaNumber) throws IOException, IRODSException
      Opens a specific replica for reading.
      Parameters:
      comm - The connection to the iRODS server.
      logicalPath - The absolute logical path to a data object.
      replicaNumber - The replica number which identifies the target replica.
      Throws:
      IOException
      IRODSException
      Since:
      0.1.0
    • isOpen

      public boolean isOpen()
      Checks if the stream is open.
      Since:
      0.1.0
    • getNativeHandle

      public int getNativeHandle()
      Returns the native handle to the stream.
      Since:
      0.1.0
    • getReplicaNumber

      public long getReplicaNumber()
      Returns the replica number of the open replica.
      Since:
      0.1.0
    • getReplicaToken

      public String getReplicaToken()
      Returns the replica token associated with the stream.
      Since:
      0.1.0
    • seek

      public void seek(int offset, IRODSDataObjectStream.SeekDirection direction) throws IOException, IRODSException
      Changes the position to read from.
      Parameters:
      offset - The number of bytes to move.
      direction - Describes how the offset is to be interpreted.
      Throws:
      IOException
      IRODSException
      Since:
      0.1.0
    • read

      public int read() throws IOException
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream