Package org.irods.irods4j.high_level.io
Class IRODSDataObjectInputStream
java.lang.Object
java.io.InputStream
org.irods.irods4j.high_level.io.IRODSDataObjectInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
A buffered input stream that makes it easy to read iRODS data objects.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new instance with a buffer size of 65536 bytes.IRODSDataObjectInputStream(int bufferSize) Initializes a new instance with a custom buffer size.IRODSDataObjectInputStream(IRODSApi.RcComm comm, String logicalPath) Initializes a new instance and opens a data object for reading.IRODSDataObjectInputStream(IRODSApi.RcComm comm, String logicalPath, long replicaNumber) Initializes a new instance and opens a specific replica for reading.IRODSDataObjectInputStream(IRODSApi.RcComm comm, String logicalPath, String rootResourceName) Initializes a new instance and opens a replica for reading. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intReturns the native handle to the stream.longReturns the replica number of the open replica.Returns the replica token associated with the stream.booleanisOpen()Checks if the stream is open.voidopen(IRODSApi.RcComm comm, String logicalPath) Opens a data object for reading.voidopen(IRODSApi.RcComm comm, String logicalPath, long replicaNumber) Opens a specific replica for reading.voidopen(IRODSApi.RcComm comm, String logicalPath, String rootResourceName) Opens a replica for reading.intread()voidseek(int offset, IRODSDataObjectStream.SeekDirection direction) Changes the position to read from.Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
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:
IOExceptionIRODSException- 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:
IOExceptionIRODSException- 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:
IOExceptionIRODSException- Since:
- 0.1.0
-
-
Method Details
-
open
Opens a data object for reading.- Parameters:
comm- The connection to the iRODS server.logicalPath- The absolute logical path to a data object.- Throws:
IOExceptionIRODSException- 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:
IOExceptionIRODSException- 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:
IOExceptionIRODSException- 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
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:
IOExceptionIRODSException- Since:
- 0.1.0
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-