|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
org.apache.derby.impl.jdbc.BinaryToRawStream
org.apache.derby.impl.jdbc.AutoPositioningStream
final class AutoPositioningStream
This Stream is a wrapper for PositionedStoreStream to set the position correctly before performing any operation on it. All the read and skip methods ensure that the PositionedStoreStream is set to right position before actually performing these operations. PositionedStoreStream is accessed within synchronized block to ensure exclusive access to it. This class must be constructed while synchronizing on ConnectionChild.getConnectionSynchronization
Field Summary | |
---|---|
private ConnectionChild |
conChild
ConnectionChild to get synchronizion object |
private long |
pos
|
private PositionedStoreStream |
positionedStream
|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
AutoPositioningStream(ConnectionChild conChild,
java.io.InputStream in,
java.lang.Object parent)
Constructs AutoPositioningStream object. |
Method Summary | |
---|---|
int |
read()
Reads a single byte from the underlying stream. |
int |
read(byte[] b)
Reads a number of bytes from the underlying stream and stores them in the specified byte array. |
int |
read(byte[] b,
int off,
int len)
Reads a number of bytes from the underlying stream and stores them in the specified byte array at the specified offset. |
private void |
setPosition()
Checks if positionedStream's position was changed since last used, sets the position to right position if its changed. |
long |
skip(long n)
Skips up to the specified number of bytes from the underlying stream. |
Methods inherited from class org.apache.derby.impl.jdbc.BinaryToRawStream |
---|
getLength |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final ConnectionChild conChild
private long pos
private final PositionedStoreStream positionedStream
Constructor Detail |
---|
AutoPositioningStream(ConnectionChild conChild, java.io.InputStream in, java.lang.Object parent) throws java.io.IOException
conChild
- ConnectionChild to get synchronization object
before accessing PositionedStoreStreamin
- InputStreamparent
- Parent of the stream to prevent it from being
gc.
java.io.IOException
- if an I/O error occursMethod Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occurspublic int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occurspublic long skip(long n) throws java.io.IOException
skip
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occurspublic int read(byte[] b) throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occursprivate void setPosition() throws java.io.IOException
java.io.IOException
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |