Package org.apache.derby.impl.drda
Class EXTDTAInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.derby.impl.drda.EXTDTAInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
class EXTDTAInputStream extends java.io.InputStreamEXTDTAObjectHolder provides Externalized Large Object representation that does not hold locks until the end of the transaction (DERBY-255) It serves as a holder for lob data and is only valid as long as the original result set from which it came is on the same row.
-
-
Field Summary
Fields Modifier and Type Field Description private java.sql.Blob_blobprivate java.sql.Clob_clobprivate java.io.InputStreambinaryInputStream(package private) intcolumnNumberColumn index starting with 1(package private) intndrdaTypeDRDA Type of column/parameter(package private) EngineResultSetrsResultSet that contains the stream
-
Constructor Summary
Constructors Modifier Constructor Description privateEXTDTAInputStream(java.sql.Blob blob, int ndrdaType)privateEXTDTAInputStream(java.sql.Clob clob, int ndrdaType)privateEXTDTAInputStream(java.sql.ResultSet rs, int columnNumber, int ndrdaType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()private static voidbadDRDAType(int drdaType)voidclose()booleanequals(java.lang.Object arg0)protected voidfinalize()private java.io.InputStreamgetBinaryStream()private java.io.ReadergetCharacterStream()static EXTDTAInputStreamgetEXTDTAStream(java.sql.CallableStatement cs, int column, int drdaType)Create a new EXTDTAInputStream from a CallableStatement.static EXTDTAInputStreamgetEXTDTAStream(java.sql.ResultSet rs, int column, int drdaType)Create a new EXTDTAInputStream.inthashCode()voidinitInputStream()This method takes information of ResultSet and initializes the binaryInputStream variable of this object with not empty stream by calling getBinaryStream or getCharacterStream() as appropriate.protected booleanisEmptyStream()booleanisNull()Is the value null?private longlength()voidmark(int arg0)booleanmarkSupported()intread()RequiresinitInputStream()be called before we can read from the streamintread(byte[] arg0)intread(byte[] arg0, int arg1, int arg2)voidreset()longskip(long arg0)
-
-
-
Field Detail
-
binaryInputStream
private java.io.InputStream binaryInputStream
-
ndrdaType
int ndrdaType
DRDA Type of column/parameter
-
rs
EngineResultSet rs
ResultSet that contains the stream
-
columnNumber
int columnNumber
Column index starting with 1
-
_clob
private java.sql.Clob _clob
-
_blob
private java.sql.Blob _blob
-
-
Method Detail
-
getEXTDTAStream
public static EXTDTAInputStream getEXTDTAStream(java.sql.ResultSet rs, int column, int drdaType)
Create a new EXTDTAInputStream. Before read the stream must be initialized by the user withinitInputStream()- Parameters:
rs- result set from which to retrieve the lobcolumn- column numberdrdaType- FD:OCA type of object one of DRDAConstants.DRDA_TYPE_NLOBBYTES DRDAConstants.DRDA_TYPE_LOBBYTES DRDAConstants.DRDA_TYPE_NLOBCMIXED DRDAConstants.DRDA_TYPE_LOBCMIXED- Returns:
- null if the value is null or a new EXTDTAInputStream corresponding to rs.getBinaryStream(column) value and associated length
- Throws:
java.sql.SQLException- See Also:
DDMWriter.writeScalarStream(boolean, int, org.apache.derby.impl.drda.EXTDTAInputStream, boolean),initInputStream()
-
getEXTDTAStream
public static EXTDTAInputStream getEXTDTAStream(java.sql.CallableStatement cs, int column, int drdaType) throws java.sql.SQLException
Create a new EXTDTAInputStream from a CallableStatement.- Parameters:
cs- CallableStatement from which to retrieve the lobcolumn- column numberdrdaType- FD:OCA type of object one of DRDAConstants.DRDA_TYPE_NLOBBYTES DRDAConstants.DRDA_TYPE_LOBBYTES DRDAConstants.DRDA_TYPE_NLOBCMIXED DRDAConstants.DRDA_TYPE_LOBCMIXED- Throws:
java.sql.SQLException
-
read
public int read() throws java.io.IOExceptionRequiresinitInputStream()be called before we can read from the stream- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException- See Also:
InputStream.read()
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException- See Also:
InputStream.available()
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException- See Also:
InputStream.close()
-
equals
public boolean equals(java.lang.Object arg0)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
mark
public void mark(int arg0)
- Overrides:
markin classjava.io.InputStream- See Also:
InputStream.mark(int)
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classjava.io.InputStream- See Also:
InputStream.markSupported()
-
read
public int read(byte[] arg0) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException- See Also:
InputStream.read(byte[])
-
read
public int read(byte[] arg0, int arg1, int arg2) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException- See Also:
InputStream.read(byte[], int, int)
-
reset
public void reset() throws java.io.IOException- Overrides:
resetin classjava.io.InputStream- Throws:
java.io.IOException- See Also:
InputStream.reset()
-
skip
public long skip(long arg0) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException- See Also:
InputStream.skip(long)
-
isEmptyStream
protected boolean isEmptyStream() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
length
private long length() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
initInputStream
public void initInputStream() throws java.sql.SQLExceptionThis method takes information of ResultSet and initializes the binaryInputStream variable of this object with not empty stream by calling getBinaryStream or getCharacterStream() as appropriate. The Reader returned from getCharacterStream() will be encoded in binarystream.- Throws:
java.sql.SQLException
-
getBinaryStream
private java.io.InputStream getBinaryStream() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getCharacterStream
private java.io.Reader getCharacterStream() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
badDRDAType
private static void badDRDAType(int drdaType)
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
isNull
public boolean isNull() throws java.sql.SQLExceptionIs the value null? Null status is obtained from the underlying EngineResultSet or LOB, so that it can be determined before the stream is retrieved.- Returns:
- true if this value is null
- Throws:
java.sql.SQLException
-
-