org.apache.derby.impl.drda
Class EXTDTAInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.derby.impl.drda.EXTDTAInputStream
All Implemented Interfaces:
java.io.Closeable

 class EXTDTAInputStream
extends java.io.InputStream

EXTDTAObjectHolder 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
private  java.io.InputStream binaryInputStream
           
(package private)  int columnNumber
          Column index starting with 1
(package private)  int ndrdaType
          DRDA Type of column
(package private)  EngineResultSet rs
          ResultSet that contains the stream
 
Constructor Summary
private EXTDTAInputStream(java.sql.ResultSet rs, int columnNumber, int ndrdaType)
           
 
Method Summary
 int available()
           
 void close()
           
 boolean equals(java.lang.Object arg0)
           
protected  void finalize()
           
static EXTDTAInputStream getEXTDTAStream(java.sql.ResultSet rs, int column, int drdaType)
          Create a new EXTDTAInputStream.
 int hashCode()
           
 void initInputStream()
          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  boolean isEmptyStream()
           
 boolean isNull()
          Is the value null?
 void mark(int arg0)
           
 boolean markSupported()
           
 int read()
          Requires initInputStream() be called before we can read from the stream
 int read(byte[] arg0)
           
 int read(byte[] arg0, int arg1, int arg2)
           
 void reset()
           
 long skip(long arg0)
           
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

binaryInputStream

private java.io.InputStream binaryInputStream

rs

EngineResultSet rs
ResultSet that contains the stream


columnNumber

int columnNumber
Column index starting with 1


ndrdaType

int ndrdaType
DRDA Type of column

Constructor Detail

EXTDTAInputStream

private EXTDTAInputStream(java.sql.ResultSet rs,
                          int columnNumber,
                          int ndrdaType)
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 with initInputStream()

Parameters:
rs - result set from which to retrieve the lob
column - column number
drdaType - 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()

read

public int read()
         throws java.io.IOException
Requires initInputStream() be called before we can read from the stream

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read()

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.available()

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
See Also:
InputStream.close()

equals

public boolean equals(java.lang.Object arg0)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

mark

public void mark(int arg0)
Overrides:
mark in class java.io.InputStream
See Also:
InputStream.mark(int)

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream
See Also:
InputStream.markSupported()

read

public int read(byte[] arg0)
         throws java.io.IOException
Overrides:
read in class java.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:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read(byte[], int, int)

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.reset()

skip

public long skip(long arg0)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.skip(long)

isEmptyStream

protected boolean isEmptyStream()
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

initInputStream

public void initInputStream()
                     throws java.sql.SQLException
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. The Reader returned from getCharacterStream() will be encoded in binarystream.

Throws:
java.sql.SQLException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

isNull

public boolean isNull()
               throws java.sql.SQLException
Is the value null? Null status is obtained from the underlying EngineResultSet, so that it can be determined before the stream is retrieved.

Returns:
true if this value is null
Throws:
java.sql.SQLException

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.