Quadcap Embeddable Database

com.quadcap.sql.types.ValueBlob Class Reference

Inheritance diagram for com.quadcap.sql.types.ValueBlob:

com.quadcap.sql.types.Value Blob Externalizable com.quadcap.sql.types.ValueClob List of all members.

Detailed Description

A BLOB value.

Author:
Stan Bailes

Definition at line 74 of file ValueBlob.java.

Public Member Functions

String show ()
 ValueBlob ()
 ValueBlob (byte[] bytes)
 ValueBlob (Datafile file, long transId, InputStream is, int length) throws IOException
void init (Datafile file, long transId, InputStream is, int length) throws IOException
byte[] getBytesVal ()
void passivate (Datafile file, long transId) throws IOException
void close ()
void setDatafile (Datafile file)
long getPermBlock ()
long getTempBlock ()
void setPermBlock (long block)
Value unop (int op) throws ValueException
Value binop (int op, Value v) throws ValueException
 Two-level virtual operator dispatch.

Object asJavaObject ()
void fromJavaObject (Object obj) throws ValueException
Type getType () throws SQLException
InputStream getBinaryStream () throws SQLException
byte[] getBytes (long lpos, int length) throws SQLException
 Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes.

long length () throws SQLException
 Returns the number of bytes in the BLOB value designated by this Blob object.

long position (Blob blob, long start) throws SQLException
long position (byte[] pattern, long start) throws SQLException
void readExternal (ObjectInput in) throws IOException, ClassNotFoundException
void writeExternal (ObjectOutput out) throws IOException
Value convert (TypeBlob type) throws ValueException
Value convert (TypeVarBinary type) throws ValueException
void serializeKey (KeyStream out) throws IOException
String toString ()
int setBytes (long lpos, byte[] bytes) throws SQLException
 Writes the given array of bytes to the BLOB value that this Blob object represents, starting at position pos, and returns the number of bytes written.

int setBytes (long lpos, byte[] bytes, int offset, int len) throws SQLException
 Writes all or part of the given byte array to the BLOB value that this Blob object represents and returns the number of bytes written.

java.io.OutputStream setBinaryStream (long lpos) throws SQLException
 Retrieves a stream that can be used to write to the BLOB value that this Blob object represents.

void truncate (long len) throws SQLException
 Truncates the BLOB value that this Blob object represents to be len bytes in length.


Package Functions

RandomAccess getRandomAccess () throws SQLException
final InputStream getPositionedStream (int pos) throws SQLException
 Zero based!


Package Attributes

int mySerial = serial++
Datafile file
long permBlock = -1
long tempBlock = -1
RandomAccess ra
byte[] bytes

Static Package Attributes

final boolean trace = false
int serial = 0


Constructor & Destructor Documentation

com.quadcap.sql.types.ValueBlob.ValueBlob  ) 
 

Definition at line 98 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.show(), and com.quadcap.sql.types.ValueBlob.trace.

com.quadcap.sql.types.ValueBlob.ValueBlob byte[]  bytes  ) 
 

Definition at line 106 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.show(), and com.quadcap.sql.types.ValueBlob.trace.

com.quadcap.sql.types.ValueBlob.ValueBlob Datafile  file,
long  transId,
InputStream  is,
int  length
throws IOException
 

Definition at line 115 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.file, com.quadcap.sql.types.ValueBlob.init(), and com.quadcap.sql.types.ValueBlob.length().


Member Function Documentation

Object com.quadcap.sql.types.ValueBlob.asJavaObject  )  [virtual]
 

Implements com.quadcap.sql.types.Value.

Reimplemented in com.quadcap.sql.types.ValueClob.

Definition at line 229 of file ValueBlob.java.

Value com.quadcap.sql.types.ValueBlob.binop int  op,
Value  v
throws ValueException [virtual]
 

Two-level virtual operator dispatch.

Each subtype implements the same basic template for this abstract function:

 Value binop(int op, Value l) {
    return l.binop(op, this);
 }

 
Then, type overloading allows for each type to implement all ops for which it can be the left hand side for all allowed types on the right hand side: Value binop(int op, ValueInteger l); Value binop(int op, ValueLong l); ...

Implements com.quadcap.sql.types.Value.

Reimplemented in com.quadcap.sql.types.ValueClob.

Definition at line 225 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.binop().

Referenced by com.quadcap.sql.types.ValueBlob.binop().

void com.quadcap.sql.types.ValueBlob.close  ) 
 

Definition at line 200 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.file.

Referenced by com.quadcap.jdbc.PreparedStatement.setAsciiStream(), com.quadcap.jdbc.PreparedStatement.setBinaryStream(), and com.quadcap.jdbc.PreparedStatement.setCharacterStream().

Value com.quadcap.sql.types.ValueBlob.convert TypeVarBinary  type  )  throws ValueException
 

Reimplemented from com.quadcap.sql.types.Value.

Definition at line 364 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.length().

Value com.quadcap.sql.types.ValueBlob.convert TypeBlob  type  )  throws ValueException
 

Reimplemented from com.quadcap.sql.types.Value.

Definition at line 360 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.convert().

Referenced by com.quadcap.sql.types.ValueBlob.convert().

void com.quadcap.sql.types.ValueBlob.fromJavaObject Object  obj  )  throws ValueException [virtual]
 

Implements com.quadcap.sql.types.Value.

Reimplemented in com.quadcap.sql.types.ValueClob.

Definition at line 233 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.fromJavaObject().

Referenced by com.quadcap.sql.types.ValueBlob.fromJavaObject().

InputStream com.quadcap.sql.types.ValueBlob.getBinaryStream  )  throws SQLException
 

Definition at line 241 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.bytes, and com.quadcap.sql.types.ValueBlob.getRandomAccess().

Referenced by com.quadcap.sql.types.ValueClob.getAsciiStream(), and com.quadcap.sql.types.ValueClob.getCharacterStream().

byte [] com.quadcap.sql.types.ValueBlob.getBytes long  lpos,
int  length
throws SQLException
 

Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes.

This byte array contains up to length consecutive bytes starting at position pos.

Parameters:
pos the ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 1
length the number of consecutive bytes to be copied
Returns:
a byte array containing up to length consecutive bytes from the BLOB value designated by this Blob object, starting with the byte at position pos
Exceptions:
SQLException if there is an error accessing the BLOB value
See also:
setBytes
Since:
1.2

Definition at line 284 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.bytes, com.quadcap.sql.types.ValueBlob.getBytes(), com.quadcap.sql.types.ValueBlob.getRandomAccess(), com.quadcap.sql.types.ValueBlob.length(), and com.quadcap.sql.file.RandomAccess.read().

Referenced by com.quadcap.sql.types.ValueBlob.getBytes().

byte [] com.quadcap.sql.types.ValueBlob.getBytesVal  ) 
 

Definition at line 163 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.bytes.

Referenced by com.quadcap.sql.TableOps.holdBlobsInRow().

long com.quadcap.sql.types.ValueBlob.getPermBlock  ) 
 

Definition at line 208 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.permBlock.

Referenced by com.quadcap.sql.TableOps.freeBlobsInRow(), com.quadcap.sql.TableOps.holdBlobsInRow(), com.quadcap.sql.UpdateRow.redo(), and com.quadcap.sql.InsertRow.redo().

final InputStream com.quadcap.sql.types.ValueBlob.getPositionedStream int  pos  )  throws SQLException [package]
 

Zero based!

Definition at line 325 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.bytes, com.quadcap.sql.types.ValueBlob.getPositionedStream(), com.quadcap.sql.types.ValueBlob.getRandomAccess(), and com.quadcap.sql.file.RandomAccessInputStream.setPosition().

Referenced by com.quadcap.sql.types.ValueBlob.getPositionedStream().

RandomAccess com.quadcap.sql.types.ValueBlob.getRandomAccess  )  throws SQLException [package]
 

Definition at line 252 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.file, com.quadcap.sql.file.Datafile.getFile(), com.quadcap.sql.file.BlockFile.getStream(), com.quadcap.sql.types.ValueBlob.permBlock, and com.quadcap.sql.types.ValueBlob.ra.

Referenced by com.quadcap.sql.types.ValueBlob.getBinaryStream(), com.quadcap.sql.types.ValueBlob.getBytes(), com.quadcap.sql.types.ValueClob.getChars(), com.quadcap.sql.types.ValueBlob.getPositionedStream(), com.quadcap.sql.types.ValueBlob.length(), com.quadcap.sql.types.ValueBlob.setBinaryStream(), com.quadcap.sql.types.ValueBlob.setBytes(), and com.quadcap.sql.types.ValueBlob.truncate().

long com.quadcap.sql.types.ValueBlob.getTempBlock  ) 
 

Definition at line 209 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.tempBlock.

Type com.quadcap.sql.types.ValueBlob.getType  )  throws SQLException [virtual]
 

Implements com.quadcap.sql.types.Value.

Reimplemented in com.quadcap.sql.types.ValueClob.

Definition at line 237 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.length().

void com.quadcap.sql.types.ValueBlob.init Datafile  file,
long  transId,
InputStream  is,
int  length
throws IOException
 

Definition at line 122 of file ValueBlob.java.

References com.quadcap.sql.file.RandomAccessOutputStream.close(), com.quadcap.sql.types.ValueBlob.file, com.quadcap.sql.file.Datafile.getFile(), com.quadcap.sql.file.Datafile.getFileLock(), com.quadcap.sql.file.BlockFile.getOutputStream(), com.quadcap.sql.file.Datafile.getTempFile(), com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.types.ValueBlob.length(), com.quadcap.sql.file.BlockFile.newPage(), com.quadcap.sql.types.ValueBlob.permBlock, com.quadcap.sql.file.RandomAccessOutputStream.resize(), com.quadcap.sql.types.ValueBlob.show(), com.quadcap.sql.types.ValueBlob.tempBlock, com.quadcap.sql.types.ValueBlob.trace, and com.quadcap.sql.file.RandomAccessOutputStream.write().

Referenced by com.quadcap.sql.types.ValueBlob.init(), and com.quadcap.sql.types.ValueBlob.ValueBlob().

long com.quadcap.sql.types.ValueBlob.length  )  throws SQLException
 

Returns the number of bytes in the BLOB value designated by this Blob object.

Returns:
length of the BLOB in bytes
Exceptions:
SQLException if there is an error accessing the length of the BLOB
Since:
1.2

Reimplemented in com.quadcap.sql.types.ValueClob.

Definition at line 307 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.bytes, com.quadcap.sql.types.ValueBlob.getRandomAccess(), and com.quadcap.sql.file.RandomAccess.size().

Referenced by com.quadcap.sql.types.ValueBlob.convert(), com.quadcap.sql.types.ValueBlob.getBytes(), com.quadcap.sql.types.ValueBlob.getType(), com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.types.ValueBlob.toString(), and com.quadcap.sql.types.ValueBlob.ValueBlob().

void com.quadcap.sql.types.ValueBlob.passivate Datafile  file,
long  transId
throws IOException
 

Definition at line 167 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.bytes, com.quadcap.sql.file.RandomAccessOutputStream.close(), com.quadcap.sql.types.ValueBlob.file, com.quadcap.sql.file.Datafile.getFile(), com.quadcap.sql.file.Datafile.getFileLock(), com.quadcap.sql.file.BlockFile.getOutputStream(), com.quadcap.sql.file.Datafile.getTempFile(), com.quadcap.sql.file.BlockFile.newPage(), com.quadcap.sql.types.ValueBlob.passivate(), com.quadcap.sql.types.ValueBlob.permBlock, com.quadcap.sql.file.RandomAccessOutputStream.resize(), com.quadcap.sql.types.ValueBlob.show(), com.quadcap.sql.types.ValueBlob.tempBlock, com.quadcap.sql.types.ValueBlob.trace, and com.quadcap.sql.file.RandomAccessOutputStream.write().

Referenced by com.quadcap.sql.types.ValueBlob.passivate().

long com.quadcap.sql.types.ValueBlob.position byte[]  pattern,
long  start
throws SQLException
 

Definition at line 338 of file ValueBlob.java.

long com.quadcap.sql.types.ValueBlob.position Blob  blob,
long  start
throws SQLException
 

Definition at line 316 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.position().

Referenced by com.quadcap.sql.types.ValueBlob.position().

void com.quadcap.sql.types.ValueBlob.readExternal ObjectInput  in  )  throws IOException, ClassNotFoundException
 

Reimplemented in com.quadcap.sql.types.ValueClob.

Definition at line 350 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.permBlock, and com.quadcap.sql.types.ValueBlob.readExternal().

Referenced by com.quadcap.sql.types.ValueBlob.readExternal().

void com.quadcap.sql.types.ValueBlob.serializeKey KeyStream  out  )  throws IOException [virtual]
 

Implements com.quadcap.sql.types.Value.

Definition at line 373 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.serializeKey().

Referenced by com.quadcap.sql.types.ValueBlob.serializeKey().

java.io.OutputStream com.quadcap.sql.types.ValueBlob.setBinaryStream long  lpos  )  throws SQLException
 

Retrieves a stream that can be used to write to the BLOB value that this Blob object represents.

The stream begins at position pos.

Parameters:
pos the position in the BLOB value at which to start writing
Returns:
a java.io.OutputStream object to which data can be written
Exceptions:
SQLException if there is an error accessing the BLOB value
See also:
getBinaryStream
Since:
1.4

Definition at line 467 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.getRandomAccess(), com.quadcap.sql.types.ValueBlob.setBinaryStream(), and com.quadcap.sql.file.RandomAccessOutputStream.setPosition().

Referenced by com.quadcap.sql.types.ValueBlob.setBinaryStream().

int com.quadcap.sql.types.ValueBlob.setBytes long  lpos,
byte[]  bytes,
int  offset,
int  len
throws SQLException
 

Writes all or part of the given byte array to the BLOB value that this Blob object represents and returns the number of bytes written.

Writing starts at position pos in the BLOB value; len bytes from the given byte array are written.

Parameters:
pos the position in the BLOB object at which to start writing
bytes the array of bytes to be written to this BLOB object
offset the offset into the array bytes at which to start reading the bytes to be set
len the number of bytes to be written to the BLOB value from the array of bytes bytes
Returns:
the number of bytes written
Exceptions:
SQLException if there is an error accessing the BLOB value
See also:
getBytes
Since:
1.4

Definition at line 441 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.bytes, com.quadcap.sql.types.ValueBlob.getRandomAccess(), and com.quadcap.sql.file.RandomAccess.write().

int com.quadcap.sql.types.ValueBlob.setBytes long  lpos,
byte[]  bytes
throws SQLException
 

Writes the given array of bytes to the BLOB value that this Blob object represents, starting at position pos, and returns the number of bytes written.

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
Exceptions:
SQLException if there is an error accessing the BLOB value
See also:
getBytes
Since:
1.4

Definition at line 408 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.bytes, com.quadcap.sql.types.ValueBlob.getRandomAccess(), com.quadcap.sql.types.ValueBlob.setBytes(), and com.quadcap.sql.file.RandomAccess.write().

Referenced by com.quadcap.sql.types.ValueBlob.setBytes().

void com.quadcap.sql.types.ValueBlob.setDatafile Datafile  file  ) 
 

Reimplemented from com.quadcap.sql.types.Value.

Definition at line 204 of file ValueBlob.java.

References com.quadcap.sql.file.Datafile.file, and com.quadcap.sql.types.ValueBlob.setDatafile().

Referenced by com.quadcap.sql.types.ValueBlob.setDatafile().

void com.quadcap.sql.types.ValueBlob.setPermBlock long  block  ) 
 

Definition at line 211 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.permBlock, and com.quadcap.sql.types.ValueBlob.setPermBlock().

Referenced by com.quadcap.sql.UpdateRow.redo(), com.quadcap.sql.InsertRow.redo(), and com.quadcap.sql.types.ValueBlob.setPermBlock().

String com.quadcap.sql.types.ValueBlob.show  ) 
 

Definition at line 85 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.mySerial.

Referenced by com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.types.ValueBlob.passivate(), and com.quadcap.sql.types.ValueBlob.ValueBlob().

String com.quadcap.sql.types.ValueBlob.toString  ) 
 

Reimplemented in com.quadcap.sql.types.ValueClob.

Definition at line 377 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.length().

void com.quadcap.sql.types.ValueBlob.truncate long  len  )  throws SQLException
 

Truncates the BLOB value that this Blob object represents to be len bytes in length.

Parameters:
len the length, in bytes, to which the BLOB value that this Blob object represents should be truncated
Exceptions:
SQLException if there is an error accessing the BLOB value.
Since:
1.4

Definition at line 487 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.getRandomAccess(), com.quadcap.sql.file.RandomAccess.resize(), and com.quadcap.sql.types.ValueBlob.truncate().

Referenced by com.quadcap.sql.types.ValueBlob.truncate().

Value com.quadcap.sql.types.ValueBlob.unop int  op  )  throws ValueException
 

Reimplemented from com.quadcap.sql.types.Value.

Reimplemented in com.quadcap.sql.types.ValueClob.

Definition at line 215 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.unop().

Referenced by com.quadcap.sql.types.ValueBlob.unop().

void com.quadcap.sql.types.ValueBlob.writeExternal ObjectOutput  out  )  throws IOException
 

Reimplemented in com.quadcap.sql.types.ValueClob.

Definition at line 356 of file ValueBlob.java.

References com.quadcap.sql.types.ValueBlob.permBlock, and com.quadcap.sql.types.ValueBlob.writeExternal().

Referenced by com.quadcap.sql.types.ValueBlob.writeExternal().


Member Data Documentation

byte [] com.quadcap.sql.types.ValueBlob.bytes [package]
 

Definition at line 96 of file ValueBlob.java.

Referenced by com.quadcap.sql.types.ValueBlob.getBinaryStream(), com.quadcap.sql.types.ValueBlob.getBytes(), com.quadcap.sql.types.ValueBlob.getBytesVal(), com.quadcap.sql.types.ValueBlob.getPositionedStream(), com.quadcap.sql.types.ValueBlob.length(), com.quadcap.sql.types.ValueBlob.passivate(), and com.quadcap.sql.types.ValueBlob.setBytes().

Datafile com.quadcap.sql.types.ValueBlob.file [package]
 

Definition at line 90 of file ValueBlob.java.

Referenced by com.quadcap.sql.types.ValueBlob.close(), com.quadcap.sql.types.ValueBlob.getRandomAccess(), com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.types.ValueBlob.passivate(), and com.quadcap.sql.types.ValueBlob.ValueBlob().

int com.quadcap.sql.types.ValueBlob.mySerial = serial++ [package]
 

Definition at line 84 of file ValueBlob.java.

Referenced by com.quadcap.sql.types.ValueBlob.show().

long com.quadcap.sql.types.ValueBlob.permBlock = -1 [package]
 

Definition at line 91 of file ValueBlob.java.

Referenced by com.quadcap.sql.types.ValueBlob.getPermBlock(), com.quadcap.sql.types.ValueBlob.getRandomAccess(), com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.types.ValueBlob.passivate(), com.quadcap.sql.types.ValueBlob.readExternal(), com.quadcap.sql.types.ValueBlob.setPermBlock(), and com.quadcap.sql.types.ValueBlob.writeExternal().

RandomAccess com.quadcap.sql.types.ValueBlob.ra [package]
 

Definition at line 94 of file ValueBlob.java.

Referenced by com.quadcap.sql.types.ValueBlob.getRandomAccess().

int com.quadcap.sql.types.ValueBlob.serial = 0 [static, package]
 

Definition at line 83 of file ValueBlob.java.

long com.quadcap.sql.types.ValueBlob.tempBlock = -1 [package]
 

Definition at line 92 of file ValueBlob.java.

Referenced by com.quadcap.sql.types.ValueBlob.getTempBlock(), com.quadcap.sql.types.ValueBlob.init(), and com.quadcap.sql.types.ValueBlob.passivate().

final boolean com.quadcap.sql.types.ValueBlob.trace = false [static, package]
 

Definition at line 82 of file ValueBlob.java.

Referenced by com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.types.ValueBlob.passivate(), and com.quadcap.sql.types.ValueBlob.ValueBlob().