Package com.artifex.solib
Class SOInputStream
java.lang.Object
java.io.InputStream
com.artifex.solib.SOInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This class implements an InputStream that can be used to read from both
regular and secure files.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.voidclose()Closes this input stream and releases any system resources associated with the stream.voidmark(int readLimit) Marks the current position in this input stream.booleanTests if this input stream supports the mark and reset methodsintread()Reads the next byte of data from the input stream.intread(byte[] b) Reads some number of bytes from the input stream and stores them into the buffer array bintread(byte[] b, int off, int len) Reads up to len bytes of data from the input stream into an array of bytes.voidreset()Repositions this stream to the position at the time the mark method was last called on this input stream.longskip(long n) Skips over and discards n bytes of data from this input streamMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
SOInputStream
Constructor- Parameters:
path- Full path to the 'input' file.
-
-
Method Details
-
available
public int available()Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.- Overrides:
availablein classInputStream- Returns:
- The estimate. 0 on EOF.
-
close
public void close()Closes this input stream and releases any system resources associated with the stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-
mark
public void mark(int readLimit) Marks the current position in this input stream. This is not implemented for the SecureFS case. The feature is disabled in markSupported().- Overrides:
markin classInputStream- Parameters:
readLimit- The maximum limit of bytes that can be read before the mark position becomes invalid.
-
markSupported
public boolean markSupported()Tests if this input stream supports the mark and reset methods- Overrides:
markSupportedin classInputStream- Returns:
- True if it is, False if not.
-
read
public int read()Reads the next byte of data from the input stream.- Specified by:
readin classInputStream- Returns:
- The byte. -1 on EOF
-
read
public int read(byte[] b, int off, int len) Reads up to len bytes of data from the input stream into an array of bytes.- Overrides:
readin classInputStream- Parameters:
b- The buffer into which the data is read.off- The start offset in array b at which the data is written.len- The maximum number of bytes to read.- Returns:
- The total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
-
read
public int read(byte[] b) Reads some number of bytes from the input stream and stores them into the buffer array b- Overrides:
readin classInputStream- Parameters:
b- The buffer into which the data is read.- Returns:
- The total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
-
reset
public void reset()Repositions this stream to the position at the time the mark method was last called on this input stream. This is not implemented for the SecureFS case. The feature is disabled in markSupported().- Overrides:
resetin classInputStream
-
skip
public long skip(long n) Skips over and discards n bytes of data from this input stream- Overrides:
skipin classInputStream
-