|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.cjdbc.driver.Blob
The representation (mapping) in the Java TM
programming language of an SQL BLOB value. By default drivers
implement 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. But since this
is highly database-specific, we are unable to do that and implement Blobs
using a simple private byte array copy instead. This may consume a lot of
memory but this is both portable across databases and even legal from a JDBC
standard point of view as long as our method
DatabaseMetaData.locatorsUpdateCopy()
returns true.
Blob,
Serialized Form| Field Summary | |
(package private) byte[] |
internalArray
The binary data that makes up this BLOB. |
| Constructor Summary | |
Blob(byte[] src)
Creates a new Blob object built from a copy of the given
byte array. |
|
| Method Summary | |
private void |
checkInitialized()
|
private static void |
checkSQLRangeIsSupported(long sqlStart,
int len)
Checks that indexes (sqlStart) and (sqlStart+len) are correct. |
void |
free()
This method frees the Blob object and releases the resources that it holds. |
java.io.InputStream |
getBinaryStream()
|
byte[] |
getBytes(long sqlPos,
int length)
|
(package private) byte[] |
getInternalByteArray()
BlobOutputStream needs it |
long |
length()
|
long |
position(java.sql.Blob pattern,
long sqlStart)
|
long |
position(byte[] pattern,
long sqlStart)
|
private byte[] |
resizedByteArray(byte[] src,
int srcStart,
int newSize)
Returns a copy of the byte array argument starting at srcFrom and extended or shortened to newLength. srcFrom index starts from zero (regular style). |
java.io.OutputStream |
setBinaryStream(long sqlStart)
|
int |
setBytes(long sqlStartPos,
byte[] srcArray)
|
int |
setBytes(long sqlStartPos,
byte[] srcArray,
int srcArrayOffset,
int copiedLength)
|
void |
truncate(long newLen)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
byte[] internalArray
BLOB.
| Constructor Detail |
public Blob(byte[] src)
Blob object built from a copy of the given
byte array.
src - the array to copy| Method Detail |
public long length()
throws java.sql.SQLException
length in interface java.sql.Blobjava.sql.SQLExceptionBlob.length()
public byte[] getBytes(long sqlPos,
int length)
throws java.sql.SQLException
getBytes in interface java.sql.Blobjava.sql.SQLExceptionBlob.getBytes(long, int)
public java.io.InputStream getBinaryStream()
throws java.sql.SQLException
getBinaryStream in interface java.sql.Blobjava.sql.SQLExceptionBlob.getBinaryStream()
public long position(byte[] pattern,
long sqlStart)
throws java.sql.SQLException
position in interface java.sql.Blobjava.sql.SQLExceptionBlob.position(byte[], long)
public long position(java.sql.Blob pattern,
long sqlStart)
throws java.sql.SQLException
position in interface java.sql.Blobjava.sql.SQLExceptionBlob.position(java.sql.Blob, long)
public int setBytes(long sqlStartPos,
byte[] srcArray)
throws java.sql.SQLException
setBytes in interface java.sql.Blobjava.sql.SQLExceptionBlob.setBytes(long, byte[], int, int)
public int setBytes(long sqlStartPos,
byte[] srcArray,
int srcArrayOffset,
int copiedLength)
throws java.sql.SQLException
setBytes in interface java.sql.Blobjava.sql.SQLExceptionBlob.setBytes(long, byte[], int, int)
public java.io.OutputStream setBinaryStream(long sqlStart)
throws java.sql.SQLException
setBinaryStream in interface java.sql.Blobjava.sql.SQLExceptionBlob.setBinaryStream(long)
public void truncate(long newLen)
throws java.sql.SQLException
truncate in interface java.sql.Blobjava.sql.SQLExceptionBlob.truncate(long)public void free()
byte[] getInternalByteArray()
private void checkInitialized()
throws DriverSQLException
DriverSQLException
private static void checkSQLRangeIsSupported(long sqlStart,
int len)
throws java.sql.SQLException
sqlStart - start indexlen - length
java.sql.SQLException
private byte[] resizedByteArray(byte[] src,
int srcStart,
int newSize)
This roughly double the memory used... *sigh* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4655503 is tagged "fixed" but nothing changed ?!
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||