org.apache.derby.client.am
Class UpdateSensitiveLOBLocatorInputStream
java.lang.Object
java.io.InputStream
org.apache.derby.client.am.UpdateSensitiveLOBLocatorInputStream
- All Implemented Interfaces:
- java.io.Closeable
- Direct Known Subclasses:
- UpdateSensitiveBlobLocatorInputStream, UpdateSensitiveClobLocatorInputStream
public abstract class UpdateSensitiveLOBLocatorInputStream
- extends java.io.InputStream
Super-class of the Update sensitive locator streams.
Before a read operation if performed on the stream
this stream verifies that the underlying LOB has not
changed and if it has it recreates the specific streams.
Since Locator streams are specific to Blob and Clob the
sub-classes would take care of creating the appropriate
streams.
Constructor Summary |
protected |
UpdateSensitiveLOBLocatorInputStream(Connection con,
Lob lob,
java.io.InputStream is)
Initializes the InputStream, updateCount, currentPos
and the connection to the appropriate values. |
protected |
UpdateSensitiveLOBLocatorInputStream(Connection con,
Lob lob,
java.io.InputStream is,
long pos,
long len)
Initializes the InputStream, updateCount, currentPos,
length and the connection to the appropriate values. |
Method Summary |
void |
close()
|
private void |
identifyAndReplaceObseleteStream()
Verifies whether the current updateCount matches
the updateCount of the LOB object and if it does
not it recreates the stream. |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
protected abstract java.io.InputStream |
reCreateStream()
Abstract method that will be implemented by
the underlying streams specific to Clob and
Blob. |
Methods inherited from class java.io.InputStream |
available, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
is
private java.io.BufferedInputStream is
con
protected Connection con
lob
private Lob lob
updateCount
private long updateCount
currentPos
protected long currentPos
length
protected long length
UpdateSensitiveLOBLocatorInputStream
protected UpdateSensitiveLOBLocatorInputStream(Connection con,
Lob lob,
java.io.InputStream is)
throws SqlException
- Initializes the InputStream, updateCount, currentPos
and the connection to the appropriate values.
- Parameters:
con
- connection to be used to read the
Lob
value from the serverlob
- Lob
object which could be a
Blob
or a Clob
.is
- an InputStream
that contains the
appropriate locator stream instance.
- Throws:
SqlException
UpdateSensitiveLOBLocatorInputStream
protected UpdateSensitiveLOBLocatorInputStream(Connection con,
Lob lob,
java.io.InputStream is,
long pos,
long len)
throws SqlException
- Initializes the InputStream, updateCount, currentPos,
length and the connection to the appropriate values.
- Parameters:
con
- connection to be used to read the
Lob
value from the serverlob
- Lob
object which could be a
Blob
or a Clob
.is
- an InputStream
that contains the
appropriate locator stream instance.pos
- the position from which the first read begins.len
- the length in bytes of the partial value to be
retrieved.
- Throws:
SqlException
read
public int read()
throws java.io.IOException
- Specified by:
read
in class java.io.InputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read()
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
read
in class java.io.InputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read(byte[], int, int)
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.InputStream
- Throws:
java.io.IOException
identifyAndReplaceObseleteStream
private void identifyAndReplaceObseleteStream()
throws java.io.IOException
- Verifies whether the current updateCount matches
the updateCount of the LOB object and if it does
not it recreates the stream.
- Throws:
java.io.IOException
- If any exception occurs upon
Locator stream creation.
reCreateStream
protected abstract java.io.InputStream reCreateStream()
throws SqlException
- Abstract method that will be implemented by
the underlying streams specific to Clob and
Blob.
- Throws:
SqlException
Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.