|
|||||||||
| Home >> All >> com >> mysql >> [ jdbc overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.mysql.jdbc
Class Blob

java.lang.Objectcom.mysql.jdbc.Blob
- All Implemented Interfaces:
- java.sql.Blob, OutputStreamWatcher
- public class Blob
- extends java.lang.Object
- implements java.sql.Blob, OutputStreamWatcher
- extends java.lang.Object
The representation (mapping) in the JavaTM programming language of an SQL BLOB value. An SQL BLOB is a built-in type that stores a Binary Large Object as a column value in a row of a database table. The driver implements Blob using an SQL locator(BLOB), which means that a Blob object contains a logical pointer to the SQL BLOB data rather than the data itself. A Blob object is valid for the duration of the transaction in which is was created. Methods in the interfaces ResultSet, CallableStatement, and PreparedStatement, such as getBlob and setBlob allow a programmer to access an SQL BLOB value. The Blob interface provides methods for getting the length of an SQL BLOB (Binary Large Object) value, for materializing a BLOB value on the client, and for determining the position of a pattern of bytes within a BLOB value. This class is new in the JDBC 2.0 API.
- Version:
- $Id: Blob.java,v 1.9.2.10 2004/08/09 22:15:12 mmatthew Exp $
| Field Summary | |
private byte[] |
binaryData
The binary data that makes up this BLOB |
private int |
columnIndex
The column that this BLOB came from |
private ResultSet |
creatorResultSet
The ResultSet that created this BLOB |
| Constructor Summary | |
(package private) |
Blob(byte[] data)
Creates a BLOB encapsulating the given binary data |
(package private) |
Blob(byte[] data,
ResultSet creatorResultSet,
int columnIndex)
Creates an updatable BLOB that can update in-place (not implemented yet). |
| Method Summary | |
private byte[] |
getBinaryData()
|
java.io.InputStream |
getBinaryStream()
Retrieves the BLOB designated by this Blob instance as a stream. |
byte[] |
getBytes(long pos,
int length)
Returns as an array of bytes, part or all of the BLOB value that this Blob object designates. |
long |
length()
Returns the number of bytes in the BLOB value designated by this Blob object. |
long |
position(java.sql.Blob pattern,
long start)
Finds the position of the given pattern in this BLOB. |
long |
position(byte[] pattern,
long start)
This method returns the index into this Blob at which the
first instance of the specified bytes occur. |
private void |
setBinaryData(byte[] newBinaryData)
|
java.io.OutputStream |
setBinaryStream(long indexToWriteAt)
Returns a binary stream that writes into this Blob,
starting at the specified index. |
int |
setBytes(long writeAt,
byte[] bytes)
Writes the specified data into this Blob, starting at the
specified index. |
int |
setBytes(long writeAt,
byte[] bytes,
int offset,
int length)
Writes a portion of the specified data into this Blob,
starting at the specified index. |
void |
streamClosed(WatchableOutputStream out)
Called when the OutputStream being watched has .close() called |
void |
truncate(long arg0)
Truncates this Blob to be at most the specified number of
bytes long. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
creatorResultSet
private ResultSet creatorResultSet
- The ResultSet that created this BLOB
binaryData
private byte[] binaryData
- The binary data that makes up this BLOB
columnIndex
private int columnIndex
- The column that this BLOB came from
| Constructor Detail |
Blob
Blob(byte[] data)
- Creates a BLOB encapsulating the given binary data
Blob
Blob(byte[] data,
ResultSet creatorResultSet,
int columnIndex)
- Creates an updatable BLOB that can update in-place
(not implemented yet).
| Method Detail |
setBinaryStream
public java.io.OutputStream setBinaryStream(long indexToWriteAt) throws java.sql.SQLException
- Description copied from interface:
java.sql.Blob - Returns a binary stream that writes into this
Blob, starting at the specified index.- Specified by:
setBinaryStreamin interfacejava.sql.Blob
getBinaryStream
public java.io.InputStream getBinaryStream() throws java.sql.SQLException
- Retrieves the BLOB designated by this Blob instance as a stream.
- Specified by:
getBinaryStreamin interfacejava.sql.Blob
setBytes
public int setBytes(long writeAt,
byte[] bytes,
int offset,
int length)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Blob - Writes a portion of the specified data into this
Blob, starting at the specified index.- Specified by:
setBytesin interfacejava.sql.Blob
setBytes
public int setBytes(long writeAt,
byte[] bytes)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Blob - Writes the specified data into this
Blob, starting at the specified index.- Specified by:
setBytesin interfacejava.sql.Blob
getBytes
public byte[] getBytes(long pos,
int length)
throws java.sql.SQLException
- Returns as an array of bytes, part or all of the BLOB value that this
Blob object designates.
- Specified by:
getBytesin interfacejava.sql.Blob
length
public long length()
throws java.sql.SQLException
- Returns the number of bytes in the BLOB value designated by this Blob
object.
- Specified by:
lengthin interfacejava.sql.Blob
position
public long position(java.sql.Blob pattern, long start) throws java.sql.SQLException
- Finds the position of the given pattern in this BLOB.
- Specified by:
positionin interfacejava.sql.Blob
position
public long position(byte[] pattern,
long start)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Blob - This method returns the index into this
Blobat which the first instance of the specified bytes occur. The searching starts at the specified index into thisBlob.- Specified by:
positionin interfacejava.sql.Blob
streamClosed
public void streamClosed(WatchableOutputStream out)
- Description copied from interface:
OutputStreamWatcher - Called when the OutputStream being watched has .close() called
- Specified by:
streamClosedin interfaceOutputStreamWatcher
truncate
public void truncate(long arg0)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Blob - Truncates this
Blobto be at most the specified number of bytes long.- Specified by:
truncatein interfacejava.sql.Blob
setBinaryData
private void setBinaryData(byte[] newBinaryData)
getBinaryData
private byte[] getBinaryData()
|
|||||||||
| Home >> All >> com >> mysql >> [ jdbc overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.mysql.jdbc.Blob