|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.iapi.types.ClobStreamHeaderGenerator
public final class ClobStreamHeaderGenerator
Generates stream headers for Clob data values.
THREAD SAFETY NOTE: This class is considered thread safe, even though it strictly speaking isn't. However, with the assumption that an instance of this class cannot be shared across databases with different versions, the only bad thing that can happen is that the mode is obtained several times.
| Field Summary | |
|---|---|
private StringDataValue |
callbackDVD
Reference to "owning" DVD, used to update it with information about whether the database is being accessed in soft upgrade mode or not. |
private static CharStreamHeaderGenerator |
CHARHDRGEN
Header generator for the pre 10.5 header format. |
private java.lang.Boolean |
inSoftUpgradeMode
true if database is being accessed in soft upgrade mode,
false is not. |
private static byte |
MAGIC_BYTE
Magic byte for the 10.5 stream header format. |
private static byte[] |
UNKNOWN_LENGTH
Bytes for a 10.5 unknown length header. |
| Fields inherited from interface org.apache.derby.iapi.types.StreamHeaderGenerator |
|---|
DERBY_EOF_MARKER |
| Constructor Summary | |
|---|---|
ClobStreamHeaderGenerator(boolean inSoftUpgradeMode)
Creates a new generator for a database in the given mode. |
|
ClobStreamHeaderGenerator(StringDataValue dvd)
Creates a new generator that will use the context manager to determine if the database is being accessed in soft upgrade mode or not. |
|
| Method Summary | |
|---|---|
private void |
determineMode()
Determines if the database being accessed is accessed in soft upgrade mode or not. |
boolean |
expectsCharCount()
Tells if the header encodes a character or byte count. |
int |
generateInto(byte[] buf,
int offset,
long valueLength)
Generates the header for the specified length and writes it into the provided buffer, starting at the specified offset. |
int |
generateInto(java.io.ObjectOutput out,
long valueLength)
Generates the header for the specified length. |
int |
writeEOF(byte[] buffer,
int offset,
long valueLength)
Writes a Derby-specific end-of-stream marker to the buffer for a stream of the specified character length, if required. |
int |
writeEOF(java.io.ObjectOutput out,
long valueLength)
Writes a Derby-specific end-of-stream marker to the destination stream for the specified character length, if required. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final byte MAGIC_BYTE
private static final byte[] UNKNOWN_LENGTH
private static final CharStreamHeaderGenerator CHARHDRGEN
private final StringDataValue callbackDVD
This is an optimization to avoid having to consult the data dictionary on every request to generate a header when a data value descriptor is reused.
private java.lang.Boolean inSoftUpgradeMode
true if database is being accessed in soft upgrade mode,
false is not. If null, the mode will be determined by
obtaining the database context through the context service.
| Constructor Detail |
|---|
public ClobStreamHeaderGenerator(StringDataValue dvd)
dvd - the owning data value descriptorpublic ClobStreamHeaderGenerator(boolean inSoftUpgradeMode)
inSoftUpgradeMode - true if the database is being accessed
in soft upgrade mode, false if not| Method Detail |
|---|
public boolean expectsCharCount()
Currently the header expects a character count if the header format is 10.5 (or newer), and a byte count if we are accessing a database in soft upgrade mode.
expectsCharCount in interface StreamHeaderGeneratorfalse if in soft upgrade mode, true if not.
public int generateInto(byte[] buf,
int offset,
long valueLength)
generateInto in interface StreamHeaderGeneratorbuf - the buffer to write intooffset - starting offset in the buffervalueLength - the length to encode in the header
public int generateInto(java.io.ObjectOutput out,
long valueLength)
throws java.io.IOException
generateInto in interface StreamHeaderGeneratorout - the destination streamvalueLength - the length to encode in the header
java.io.IOException - if writing to the destination stream fails
public int writeEOF(byte[] buffer,
int offset,
long valueLength)
writeEOF in interface StreamHeaderGeneratorbuffer - the buffer to write intooffset - starting offset in the buffervalueLength - the length of the stream
public int writeEOF(java.io.ObjectOutput out,
long valueLength)
throws java.io.IOException
writeEOF in interface StreamHeaderGeneratorout - the destination streamvalueLength - the length of the stream
java.io.IOException - if writing to the destination stream failsprivate void determineMode()
|
Built on Sat 2009-11-28 18:44:18-0800, from revision 885187 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||