|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream com.levigo.jadice.document.io.SeekableInputStream com.levigo.jadice.document.io.UncloseableSeekableInputStream
public class UncloseableSeekableInputStream
A SeekableInputStream
implementation which ignores any calls of the close()
method and
delegates everything else to its delegate stream.
Field Summary |
---|
Fields inherited from class com.levigo.jadice.document.io.SeekableInputStream |
---|
bitOffset, byteOrder, flushedPos |
Constructor Summary | |
---|---|
UncloseableSeekableInputStream(SeekableInputStream delegate)
|
Method Summary | |
---|---|
void |
close()
Closes this seekable input stream. |
void |
flushBefore(long pos)
|
int |
getBitOffset()
|
ByteOrder |
getByteOrder()
|
long |
getFlushedPosition()
|
long |
getSizeEstimate()
A rough estimated size for this stream instance, which is used for internal cache management. |
long |
getStreamPosition()
|
boolean |
isCached()
Default implementation returns false. |
boolean |
isCachedFile()
Default implementation returns false. |
boolean |
isCachedMemory()
Default implementation returns false. |
long |
length()
Returns the length of this stream contents, if available. |
void |
mark()
Pushes the current stream position onto a stack of marked positions. |
int |
read()
Reads a single byte from the stream and returns it as an int between 0 and 255. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes from the stream, and stores them into b
starting at index off . |
void |
reset()
Resets the current stream byte and bit positions from the stack of marked positions. |
void |
resetToInitialState()
Resets the current stream byte, bit positions from the stack of marked positions, the flushed position and seeks to 0 . |
void |
seek(long pos)
Sets the current stream position, measured from the beginning of this data stream, at which the next read occurs. |
void |
setBitOffset(int bitOffset)
|
void |
setByteOrder(ByteOrder byteOrder)
|
Methods inherited from class com.levigo.jadice.document.io.SeekableInputStream |
---|
checkClosed, finalize, flush, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedInt, readUnsignedShort, readUTF, skip, skipBytes, skipBytes |
Methods inherited from class java.io.InputStream |
---|
available, markSupported |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UncloseableSeekableInputStream(SeekableInputStream delegate)
Method Detail |
---|
public void close() throws IOException
SeekableInputStream
IOException
s. Additional attempts to SeekableInputStream.close()
, however, have no effect.
close
in interface Closeable
close
in interface ImageInputStream
close
in class SeekableInputStream
IOException
InputStream.close()
public long getStreamPosition() throws IOException
IOException
public long getSizeEstimate()
SeekableInputStream
getSizeEstimate
in class SeekableInputStream
public long length() throws IOException
SeekableInputStream
length
in interface ImageInputStream
length
in class SeekableInputStream
IOException
- if an I/O error occurs.public int read() throws IOException
SeekableInputStream
int
between 0 and 255. If
EOF is reached, -1
is returned.
Subclasses must provide an implementation for this method. The subclass implementation should update the stream position before exiting.
The bit offset within the stream must be reset to zero before the read occurs.
read
in interface ImageInputStream
read
in class SeekableInputStream
-1
if EOF is reached.
IOException
- if the stream has been closed.public int read(byte[] b, int off, int len) throws IOException
SeekableInputStream
len
bytes from the stream, and stores them into b
starting at index off
. If no bytes can be read because the end of the stream has
been reached, -1
is returned.
The bit offset within the stream must be reset to zero before the read occurs.
Subclasses must provide an implementation for this method. The subclass implementation should update the stream position before exiting.
read
in interface ImageInputStream
read
in class SeekableInputStream
b
- an array of bytes to be written to.off
- the starting position within b
to write to.len
- the maximum number of bytes to read.
-1
to indicate EOF.
IOException
- if an I/O error occurs.public void seek(long pos) throws IOException
SeekableInputStream
EOFException
will be thrown
only if a read is performed. The bit offset is set to 0.
An IndexOutOfBoundsException
will be thrown if pos
is smaller than
the flushed position (as returned by getflushedPosition
).
It is legal to seek past the end of the file; an EOFException
will be thrown only
if a read is performed.
seek
in interface ImageInputStream
seek
in class SeekableInputStream
pos
- a long
containing the desired file pointer position.
IOException
- if any other I/O error occurs.public void setByteOrder(ByteOrder byteOrder)
setByteOrder
in interface ImageInputStream
setByteOrder
in class SeekableInputStream
ImageInputStream.setByteOrder(java.nio.ByteOrder)
public ByteOrder getByteOrder()
getByteOrder
in interface ImageInputStream
getByteOrder
in class SeekableInputStream
ImageInputStream.getByteOrder()
public void setBitOffset(int bitOffset) throws IOException
setBitOffset
in interface ImageInputStream
setBitOffset
in class SeekableInputStream
IOException
ImageInputStream.setBitOffset(int)
public int getBitOffset() throws IOException
getBitOffset
in interface ImageInputStream
getBitOffset
in class SeekableInputStream
IOException
ImageInputStream.getBitOffset()
public void reset() throws IOException
SeekableInputStream
An IOException
will be thrown if the previous marked position lies in the
discarded portion of the stream.
reset
in interface ImageInputStream
reset
in class SeekableInputStream
IOException
- if an I/O error occurs.public void resetToInitialState() throws IOException
SeekableInputStream
0
.
resetToInitialState
in class SeekableInputStream
IOException
- if an I/O error occurs.public void mark()
SeekableInputStream
mark
in interface ImageInputStream
mark
in class SeekableInputStream
public boolean isCached()
SeekableInputStream
isCached
in interface ImageInputStream
isCached
in class SeekableInputStream
ImageInputStream.isCached()
public boolean isCachedFile()
SeekableInputStream
isCachedFile
in interface ImageInputStream
isCachedFile
in class SeekableInputStream
ImageInputStream.isCachedFile()
public boolean isCachedMemory()
SeekableInputStream
isCachedMemory
in interface ImageInputStream
isCachedMemory
in class SeekableInputStream
ImageInputStream.isCachedMemory()
public void flushBefore(long pos) throws IOException
flushBefore
in interface ImageInputStream
flushBefore
in class SeekableInputStream
IOException
ImageInputStream.flushBefore(long)
public long getFlushedPosition()
getFlushedPosition
in interface ImageInputStream
getFlushedPosition
in class SeekableInputStream
ImageInputStream.getFlushedPosition()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |