jxUtil 0.6

org.sourceforge.jxutil.sql.type
Class AbstractBLOB

java.lang.Object
  |
  +--org.sourceforge.jxutil.sql.type.AbstractBLOB
All Implemented Interfaces:
Blob
Direct Known Subclasses:
DefaultBLOB

public abstract class AbstractBLOB
extends Object
implements Blob

AbstractBLOB implements generics of the Blob interface. It defines the (get|set)BinaryStream accessor functions which delegate their work to the (get|set)Bytes functions.
When extending this class, You still have to define:

TODO:

Version:
$Revision: 1.1 $
Author:
Keve Müller

Constructor Summary
AbstractBLOB()
           
 
Method Summary
 InputStream getBinaryStream()
          Retrieves the BLOB value designated by this Blob instance as a stream.
private static void reThrow(SQLException ex)
           
 OutputStream setBinaryStream(long opos)
          Returns a stream that can be used to write to the BLOB value that this Blob object represents.
abstract  int setBytes(long pos, byte[] bytes)
          Writes the array of bytes bytes to this Blob object starting at position pos.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Blob
getBytes, length, position, position, setBytes, truncate
 

Constructor Detail

AbstractBLOB

public AbstractBLOB()
Method Detail

getBinaryStream

public InputStream getBinaryStream()
                            throws SQLException
Retrieves the BLOB value designated by this Blob instance as a stream. This implementation creates an instance of BufferedInputStream which delegates to the corresponding functions of this class.

Specified by:
getBinaryStream in interface Blob
Returns:
a stream containing the BLOB data
Throws:
SQLException - if there is an error accessing the BLOB value
See Also:
Blob.length(), Blob.getBytes(long,int), BufferedInputStream

reThrow

private static final void reThrow(SQLException ex)
                           throws IOException
IOException

setBinaryStream

public OutputStream setBinaryStream(long opos)
                             throws SQLException
Returns a stream that can be used to write to the BLOB value that this Blob object represents. The stream begins at position pos. This implementation creates an instance of BufferedOutputStream which delegates to the corresponding functions of this class.

Specified by:
setBinaryStream in interface Blob
Parameters:
opos - the position in the BLOB value at which to start writing
Returns:
a java.io.OutputStream object to which data can be written
Throws:
SQLException - if there is an error accessing the BLOB value
See Also:
setBytes(long,byte[]), BufferedOutputStream

setBytes

public abstract int setBytes(long pos,
                             byte[] bytes)
                      throws SQLException
Writes the array of bytes bytes to this Blob object starting at position pos.

Specified by:
setBytes in interface Blob
Parameters:
pos - the position in the BLOB object at which to start writing
bytes - the array of bytes to be written to the BLOB value that this Blob object represents
Returns:
the number of bytes written
Throws:
SQLException - if there is an error accessing the BLOB value

jxUtil 0.6

Copyright © 2001,2002 Keve Müller, et al.; see LICENSE file for details.