|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> store >> raw >> [ data overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.store.raw.data
Class StoredFieldHeader

java.lang.Objectorg.apache.derby.impl.store.raw.data.StoredFieldHeader
- public final class StoredFieldHeader
- extends java.lang.Object
A class to provide static methods to manipulate fields in the field header. A class StoredPage uses to read/write field status and field data length. No attributes exist in this class, this class provides a set of static methods for writing field status and field data length, and for reading field status and field data length.
Stored Field Header Format
The field header is broken into two sections.
Only the Status byte is required to be there.
Field header format:
+--------+-------------------+
| status | |
+--------+-------------------+
Overflow page and overflow id are stored as field data.
If the overflow bit in status is set, the field data is the overflow
information. When the overflow bit is not set in status, then,
fieldData is the actually user data for the field.
That means, field header consists only field status, and field data length.
A non-overflow field:
+--------+-------------------+-------------+
| status | | |
+--------+-------------------+-------------+
An overflow field:
+--------+-------------------+-----------------+--------------+
| status | | | |
+--------+-------------------+-----------------+--------------+
status
The status is 1 byte, it indicates the state of the field. A FieldHeader can be in the following states: NULL - if the field is NULL, no field data length is stored OVERFLOW - indicates the field has been overflowed to another page. overflow page and overflow ID is stored at the end of the user data. field data length must be a number greater or equal to 0, indicating the length of the field that is stored on the current page. The format looks like this: +--------+-----------------+---------------+------------+ |
fieldDataLength
The fieldDataLength is only set if the field is not NULL. It is the length of the field that is stored on the current page. The fieldDataLength is a variable length CompressedInt.
overflowPage and overflowID
The overflowPage is a variable length CompressedLong, overflowID is a variable Length CompressedInt. They are only stored when the field state is OVERFLOW. And they are not stored in the field header. Instead, they are stored at the end of the field data. The reason we do that is to save a copy if the field has to overflow.
MT - Mutable - Immutable identity - Thread Aware
| Field Summary | |
static int |
FIELD_EXTENSIBLE
|
protected static int |
FIELD_FIXED
|
private static int |
FIELD_INITIAL
Constants of the class |
static int |
FIELD_NONEXISTENT
|
private static int |
FIELD_NOT_NULLABLE
|
static int |
FIELD_NULL
|
static int |
FIELD_OVERFLOW
|
static int |
FIELD_TAGGED
|
static int |
STORED_FIELD_HEADER_STATUS_SIZE
|
| Constructor Summary | |
StoredFieldHeader()
|
|
| Method Summary | |
static boolean |
isExtensible(int status)
|
static boolean |
isFixed(int status)
|
static boolean |
isNonexistent(int status)
|
static boolean |
isNull(int status)
Get the status of the field MT - single thread required |
static boolean |
isNullable(int status)
|
static boolean |
isNullorNonExistent(int status)
|
static boolean |
isOverflow(int status)
|
static boolean |
isTagged(int status)
|
static int |
readFieldDataLength(java.io.ObjectInput in,
int status,
int fieldDataSize)
read the field data length |
static int |
readFieldLengthAndSetStreamPosition(byte[] data,
int offset,
int status,
int fieldDataSize,
org.apache.derby.iapi.services.io.ArrayInputStream ais)
|
static int |
readStatus(byte[] page,
int offset)
|
static int |
readStatus(java.io.ObjectInput in)
read the field status |
static int |
readTotalFieldLength(byte[] data,
int offset)
read the length of the field and hdr. |
static int |
setExtensible(int status,
boolean isExtensible)
|
static int |
setFixed(int status,
boolean isFixed)
|
static int |
setInitial()
Set accessors for setting bits in the status field. |
static int |
setNonexistent(int status)
|
static int |
setNull(int status,
boolean isNull)
|
static int |
setOverflow(int status,
boolean isOverflow)
|
static int |
setTagged(int status,
boolean isTagged)
|
static int |
size(int status,
int fieldDataLength,
int fieldDataSize)
|
static java.lang.String |
toDebugString(int status)
|
static int |
write(java.io.OutputStream out,
int status,
int fieldDataLength,
int fieldDataSize)
write out the field status and field data Length |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
FIELD_INITIAL
private static final int FIELD_INITIAL
- Constants of the class
- See Also:
- Constant Field Values
FIELD_NULL
public static final int FIELD_NULL
- See Also:
- Constant Field Values
FIELD_OVERFLOW
public static final int FIELD_OVERFLOW
- See Also:
- Constant Field Values
FIELD_NOT_NULLABLE
private static final int FIELD_NOT_NULLABLE
- See Also:
- Constant Field Values
FIELD_EXTENSIBLE
public static final int FIELD_EXTENSIBLE
- See Also:
- Constant Field Values
FIELD_TAGGED
public static final int FIELD_TAGGED
- See Also:
- Constant Field Values
FIELD_FIXED
protected static final int FIELD_FIXED
- See Also:
- Constant Field Values
FIELD_NONEXISTENT
public static final int FIELD_NONEXISTENT
- See Also:
- Constant Field Values
STORED_FIELD_HEADER_STATUS_SIZE
public static final int STORED_FIELD_HEADER_STATUS_SIZE
- See Also:
- Constant Field Values
| Constructor Detail |
StoredFieldHeader
public StoredFieldHeader()
| Method Detail |
isNull
public static final boolean isNull(int status)
- Get the status of the field
MT - single thread required
isOverflow
public static final boolean isOverflow(int status)
isNonexistent
public static final boolean isNonexistent(int status)
isExtensible
public static final boolean isExtensible(int status)
isNullorNonExistent
public static final boolean isNullorNonExistent(int status)
isTagged
public static final boolean isTagged(int status)
isFixed
public static final boolean isFixed(int status)
isNullable
public static final boolean isNullable(int status)
size
public static final int size(int status,
int fieldDataLength,
int fieldDataSize)
setInitial
public static final int setInitial()
- Set accessors for setting bits in the status field.
setNull
public static final int setNull(int status,
boolean isNull)
setOverflow
public static final int setOverflow(int status,
boolean isOverflow)
setNonexistent
public static final int setNonexistent(int status)
setExtensible
public static final int setExtensible(int status,
boolean isExtensible)
setTagged
public static final int setTagged(int status,
boolean isTagged)
setFixed
public static final int setFixed(int status,
boolean isFixed)
write
public static final int write(java.io.OutputStream out, int status, int fieldDataLength, int fieldDataSize) throws java.io.IOException
- write out the field status and field data Length
readStatus
public static final int readStatus(java.io.ObjectInput in) throws java.io.IOException
- read the field status
readStatus
public static final int readStatus(byte[] page,
int offset)
readTotalFieldLength
public static final int readTotalFieldLength(byte[] data,
int offset)
throws java.io.IOException
- read the length of the field and hdr.
Optimized routine used to skip a field on a page. It returns the total length of the field including the header portion. It operates directly on the array and does no checking of it's own for limits on the array length, so an array out of bounds exception may be thrown - the routine is meant to be used to read a field from a page so this should not happen.
readFieldLengthAndSetStreamPosition
public static final int readFieldLengthAndSetStreamPosition(byte[] data,
int offset,
int status,
int fieldDataSize,
org.apache.derby.iapi.services.io.ArrayInputStream ais)
throws java.io.IOException
readFieldDataLength
public static final int readFieldDataLength(java.io.ObjectInput in, int status, int fieldDataSize) throws java.io.IOException
- read the field data length
toDebugString
public static java.lang.String toDebugString(int status)
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> store >> raw >> [ data overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.derby.impl.store.raw.data.StoredFieldHeader