Class OffsetInputStreamFilter
public class OffsetInputStreamFilter extends FilterInputStream
{
// Constructors
public OffsetInputStreamFilter (InputStream i);
// Methods
public long getOffset ();
public void mark(int readlimit);
public synchronized int read() throws IOException;
public synchronized int read (byte b[], int off, int len)
throws IOException;
public void reset() throws IOException;
public synchronized long skip (long n) throws IOException;
public synchronized long skipToAlignment (int align)
throws IOException;
}
This class represents a filter input stream that keeps track of the byte offset into the stream.
FilterInputStream
|
+--OffsetInputStreamFilter
public OffsetInputStreamFilter (InputStream i);
Creates an OffsetInputStreamFilter object from the specified input stream.
Parameter | Description |
i
| The input stream.
|
public long getOffset ();
Retrieves the current byte offset into the input stream.
Return Value:
Returns the current byte offset into the input stream.
public void mark(int readlimit);
Marks the current position in the input stream.
Return Value:
No return value.
Parameter | Description |
readlimit
| The number of bytes that can be read without invalidating the mark.
|
public synchronized int read() throws IOException;
Reads a single byte from the input stream.
Return Value:
Returns the byte that was read from the input stream.
Exceptions:
IOException
if an error occurs while attempting to read.
public synchronized int read (byte b[], int off, int len)
throws IOException;
Reads a sequence of bytes from the input stream into the buffer.
Return Value:
Returns the number of bytes read.
Parameter | Description |
b
| The buffer to store the bytes in.
|
off
| The offset in the buffer where the first byte read is stored.
|
len
| The number of bytes to read.
|
Exceptions:
IOException
if an error occurs while attempting to read.
public void reset() throws IOException;
Resets the byte offset of the input stream to the last marked position.
Return Value:
No return value.
Exceptions:
IOException
if the mark is invalid or has not been set.
public synchronized long skip (long n) throws IOException;
Skips a number of bytes in the input stream and updates the byte offset to reflect the new position in the stream.
Return Value:
Returns the actual number of bytes skipped.
Parameter | Description |
n
| The number of bytes to skip.
|
Exceptions:
IOException
if an I/O error occurs.
public synchronized long skipToAlignment (int align) throws IOException;
Skips bytes in the input stream until the byte offset is a multiple of the alignment.
Return Value:
Returns the actual number of bytes skipped.
Parameter | Description |
align
| The alignment.
|
Exceptions:
IOException
if an I/O error occurs.