public class KeyDescription
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
FLAG_BUS |
static int |
FLAG_CASE_INSENSITIVE |
static int |
FLAG_DESCENDING |
static int |
FLAG_NUMERIC
Deprecated.
|
static int |
FLAG_ORDERED_NUMERIC |
static int |
FLAG_UNIQUE |
Constructor and Description |
---|
KeyDescription() |
KeyDescription(int p_keyNum,
byte[] p_data,
int p_offset,
int p_end)
Constructor from a byte array in FIN format.
|
KeyDescription(int p_keyNum,
byte[] p_data,
int p_offset,
int p_end,
boolean p_extended)
Constructor from a byte array in FIN or XFIN format.
|
KeyDescription(java.util.List<KeySegment> p_segments,
boolean p_unique)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
checkSegments(int p_errorCode) |
void |
checkSegments(java.lang.String p_filename,
int p_errorCode)
Helper function to check and make sure that segments are valid for an
MKEYED file.
|
KeyDescription |
clone() |
boolean |
equals(java.lang.Object p_other) |
void |
fixDescendingSegments(byte[] p_fromKey,
int p_fromKeyLen,
byte[] p_toKey,
int p_toKeyLen,
boolean p_mangle)
Fix descending segments so that they are switched to/from normal.
|
void |
fixDescendingSegments(byte[] p_fromKey,
int p_fromOffset,
int p_fromKeyLen,
byte[] p_toKey,
int p_toOffset,
int p_toKeyLen,
boolean p_mangle)
Fix descending segments so that they are switched to/from normal.
|
void |
fixDescendingSegments(byte[] p_fromKey,
int p_fromOffset,
int p_fromKeyLen,
byte[] p_toKey,
int p_toOffset,
int p_toKeyLen,
java.util.Locale p_locale,
java.nio.charset.Charset p_charset,
boolean p_mangle)
Fix descending segments so that they are switched to/from normal.
|
void |
fixDescendingSegments(ByteBuf p_fromKey,
ByteBuf p_toKey,
java.util.Locale p_locale,
java.nio.charset.Charset p_charset,
boolean p_mangle)
Fix descending segments so that they are switched to/from normal.
|
void |
getAndFixKeyForRecord(ByteBuf p_record,
int p_actualRecordSize,
ByteBuf p_key,
boolean p_checkFields,
java.util.Locale p_locale,
java.nio.charset.Charset p_charset,
boolean p_mangle) |
void |
getAndFixKeyForRecord(java.lang.String p_filename,
ByteBuf p_record,
int p_actualRecordSize,
ByteBuf p_key,
boolean p_checkFields,
java.util.Locale p_locale,
java.nio.charset.Charset p_charset,
boolean p_mangle) |
static java.util.List<KeyDescription> |
getKeyDescriptions(byte[] p_data,
int p_offset,
int p_end) |
static java.util.List<KeyDescription> |
getKeyDescriptions(java.lang.String p_filename,
byte[] p_data,
int p_offset,
int p_end)
Helper function to pull a list of
KeyDescription objects out
of a byte array. |
static int |
getKeyDescriptionsSize(KeyDescription[] p_keyDesc)
Return number of bytes needed to encode an array of
KeyDescription objects in FIN format. |
static int |
getKeyDescriptionsSize(java.util.List<KeyDescription> p_keyDesc)
Return number of bytes needed to encode a list of
KeyDescription objects in FIN format. |
void |
getKeyForRecord(byte[] p_record,
int p_size,
byte[] p_key) |
void |
getKeyForRecord(byte[] p_record,
int p_size,
byte[] p_key,
boolean p_checkFields) |
void |
getKeyForRecord(byte[] p_record,
int p_roffset,
int p_size,
byte[] p_key,
int p_koffset,
int p_klength) |
void |
getKeyForRecord(byte[] p_record,
int p_roffset,
int p_size,
byte[] p_key,
int p_koffset,
int p_klength,
boolean p_checkFields) |
void |
getKeyForRecord(byte[] p_record,
int p_roffset,
int p_size,
byte[] p_key,
int p_koffset,
int p_klength,
boolean p_checkFields,
java.nio.charset.Charset p_charset) |
void |
getKeyForRecord(byte[] p_record,
int p_roffset,
int p_size,
int p_actualRecordSize,
byte[] p_key,
int p_koffset,
int p_klength,
boolean p_checkFields) |
void |
getKeyForRecord(byte[] p_record,
int p_roffset,
int p_size,
int p_actualRecordSize,
byte[] p_key,
int p_koffset,
int p_klength,
boolean p_checkFields,
java.nio.charset.Charset p_charset) |
void |
getKeyForRecord(ByteBuf p_record,
int p_actualRecordSize,
ByteBuf p_key,
boolean p_checkFields,
java.nio.charset.Charset p_charset) |
void |
getKeyForRecord(java.lang.String p_filename,
byte[] p_record,
int p_size,
byte[] p_key)
Get the derived key value for a record.
|
void |
getKeyForRecord(java.lang.String p_filename,
byte[] p_record,
int p_size,
byte[] p_key,
boolean p_checkFields)
Get the derived key value for a record.
|
void |
getKeyForRecord(java.lang.String p_filename,
byte[] p_record,
int p_roffset,
int p_size,
byte[] p_key,
int p_koffset,
int p_klength)
Get the derived key value for a record.
|
void |
getKeyForRecord(java.lang.String p_filename,
byte[] p_record,
int p_roffset,
int p_size,
byte[] p_key,
int p_koffset,
int p_klength,
boolean p_checkFields)
Get the derived key value for a record.
|
void |
getKeyForRecord(java.lang.String p_filename,
byte[] p_record,
int p_roffset,
int p_size,
byte[] p_key,
int p_koffset,
int p_klength,
boolean p_checkFields,
java.nio.charset.Charset p_charset)
Get the derived key value for a record.
|
void |
getKeyForRecord(java.lang.String p_filename,
byte[] p_record,
int p_roffset,
int p_size,
int p_actualRecordSize,
byte[] p_key,
int p_koffset,
int p_klength,
boolean p_checkFields) |
void |
getKeyForRecord(java.lang.String p_filename,
byte[] p_record,
int p_roffset,
int p_size,
int p_actualRecordSize,
byte[] p_key,
int p_koffset,
int p_klength,
boolean p_checkFields,
java.nio.charset.Charset p_charset) |
void |
getKeyForRecord(java.lang.String p_filename,
ByteBuf p_record,
int p_actualRecordSize,
ByteBuf p_key,
boolean p_checkFields,
java.nio.charset.Charset p_charset) |
java.util.List<KeySegment> |
getKeySegments()
Get list of key segments (copy of internal list).
|
int |
getKeySize()
Get the key size (sum of lengths of the segments).
|
static java.util.List<KeyDescription> |
getXKeyDescriptions(byte[] p_data,
int p_offset,
int p_end) |
static java.util.List<KeyDescription> |
getXKeyDescriptions(java.lang.String p_filename,
byte[] p_data,
int p_offset,
int p_end)
Helper function to pull a list of
KeyDescription objects out
of a byte array in XFIN format. |
static int |
getXKeyDescriptionsSize(KeyDescription p_keyDesc)
Return number of bytes needed to encode a list of
KeyDescription objects in XFIN format. |
static int |
getXKeyDescriptionsSize(KeyDescription[] p_keyDesc)
Return number of bytes needed to encode an array of
KeyDescription objects in XFIN format. |
static int |
getXKeyDescriptionsSize(java.util.List<KeyDescription> p_keyDesc)
Return number of bytes needed to encode a list of
KeyDescription objects in XFIN format. |
int |
hashCode() |
boolean |
hasSpecialType(int p_special)
Helper method to see if any of the segments have a given special type.
|
boolean |
isLastSegmentFielded()
Is the last key segment fielded?
|
boolean |
isUnique()
Get whether this key is unique.
|
static int |
putKeyDescriptions(KeyDescription[] p_keyDesc,
byte[] p_data,
int p_offset,
int p_length)
Helper function to put
KeyDescription objects into a byte
array. |
static int |
putKeyDescriptions(java.util.List<KeyDescription> p_keyDesc,
byte[] p_data,
int p_offset,
int p_length)
Helper function to put
KeyDescription objects into a byte
array. |
static int |
putXKeyDescriptions(KeyDescription[] p_keyDesc,
byte[] p_data,
int p_offset,
int p_length)
Helper function to put
KeyDescription objects into a byte
array. |
static int |
putXKeyDescriptions(KeyDescription p_keyDesc,
byte[] p_data,
int p_offset,
int p_length)
Helper function to put
KeyDescription objects into a byte
array. |
static int |
putXKeyDescriptions(java.util.List<KeyDescription> p_keyDesc,
byte[] p_data,
int p_offset,
int p_length)
Helper function to put
KeyDescription objects into a byte
array. |
void |
setUnique(boolean p_unique)
Set that this key is unique.
|
java.lang.String |
toString() |
public static final int FLAG_DESCENDING
public static final int FLAG_UNIQUE
public static final int FLAG_BUS
@Deprecated public static final int FLAG_NUMERIC
public static final int FLAG_ORDERED_NUMERIC
public static final int FLAG_CASE_INSENSITIVE
public KeyDescription()
public KeyDescription(java.util.List<KeySegment> p_segments, boolean p_unique) throws FilesystemException
p_segments
- List of KeySegment objects describing the segments of this
key.p_unique
- true if the key is unique.FilesystemException
- If a filesystem problem occurs.public KeyDescription(int p_keyNum, byte[] p_data, int p_offset, int p_end) throws FilesystemException
p_keyNum
- Key number to extract from the buffer.p_data
- Buffer with the key information.p_offset
- Offset in the buffer to start extracting.p_end
- End of the buffer to extract keys.FilesystemException
- If a filesystem problem occurs.public KeyDescription(int p_keyNum, byte[] p_data, int p_offset, int p_end, boolean p_extended) throws FilesystemException
p_keyNum
- Key number to extract from the buffer.p_data
- Buffer with the key information.p_offset
- Offset in the buffer to start extracting.p_end
- End of the buffer to extract keys.p_extended
- true if the byte array is in XFIN format.FilesystemException
- If a filesystem problem occurs.public boolean equals(java.lang.Object p_other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isLastSegmentFielded()
public boolean hasSpecialType(int p_special)
p_special
- Special type to look for.public void checkSegments(int p_errorCode) throws FilesystemException
FilesystemException
public void checkSegments(java.lang.String p_filename, int p_errorCode) throws FilesystemException
p_filename
- p_errorCode
- Error code to use for violations.FilesystemException
- If a filesystem problem occurs.public int getKeySize()
public void setUnique(boolean p_unique)
p_unique
- Is this key unique?public boolean isUnique()
public java.util.List<KeySegment> getKeySegments()
public final void getKeyForRecord(byte[] p_record, int p_size, byte[] p_key) throws FilesystemException
FilesystemException
public final void getKeyForRecord(java.lang.String p_filename, byte[] p_record, int p_size, byte[] p_key) throws FilesystemException
p_filename
- p_record
- Record to derive key for.p_size
- Size of the record.p_key
- Buffer to fill with the key value.FilesystemException
public final void getKeyForRecord(byte[] p_record, int p_size, byte[] p_key, boolean p_checkFields) throws FilesystemException
FilesystemException
public final void getKeyForRecord(java.lang.String p_filename, byte[] p_record, int p_size, byte[] p_key, boolean p_checkFields) throws FilesystemException
p_filename
- p_record
- Record to derive key for.p_size
- Size of the record.p_key
- Buffer to fill with the key value.p_checkFields
- Should field existence be enforced?FilesystemException
public final void getKeyForRecord(byte[] p_record, int p_roffset, int p_size, byte[] p_key, int p_koffset, int p_klength) throws FilesystemException
FilesystemException
public final void getKeyForRecord(java.lang.String p_filename, byte[] p_record, int p_roffset, int p_size, byte[] p_key, int p_koffset, int p_klength) throws FilesystemException
p_filename
- p_record
- Record to derive key for.p_roffset
- Record offset.p_size
- Size of the record.p_key
- Buffer to fill with the key value.p_koffset
- Key offset.p_klength
- Key Length.FilesystemException
public final void getKeyForRecord(byte[] p_record, int p_roffset, int p_size, byte[] p_key, int p_koffset, int p_klength, boolean p_checkFields) throws FilesystemException
FilesystemException
public final void getKeyForRecord(java.lang.String p_filename, byte[] p_record, int p_roffset, int p_size, byte[] p_key, int p_koffset, int p_klength, boolean p_checkFields) throws FilesystemException
p_filename
- p_record
- Record to derive key for.p_roffset
- Record offset.p_size
- Size of the record.p_key
- Buffer to fill with the key value.p_koffset
- Key offset.p_klength
- Key Length.p_checkFields
- Should field existence be enforced?FilesystemException
public final void getKeyForRecord(byte[] p_record, int p_roffset, int p_size, int p_actualRecordSize, byte[] p_key, int p_koffset, int p_klength, boolean p_checkFields) throws FilesystemException
FilesystemException
public final void getKeyForRecord(java.lang.String p_filename, byte[] p_record, int p_roffset, int p_size, int p_actualRecordSize, byte[] p_key, int p_koffset, int p_klength, boolean p_checkFields) throws FilesystemException
FilesystemException
public final void getKeyForRecord(byte[] p_record, int p_roffset, int p_size, byte[] p_key, int p_koffset, int p_klength, boolean p_checkFields, java.nio.charset.Charset p_charset) throws FilesystemException
FilesystemException
public final void getKeyForRecord(java.lang.String p_filename, byte[] p_record, int p_roffset, int p_size, byte[] p_key, int p_koffset, int p_klength, boolean p_checkFields, java.nio.charset.Charset p_charset) throws FilesystemException
p_filename
- p_record
- Record to derive key for.p_roffset
- Record offset.p_size
- Size of the record.p_key
- Buffer to fill with the key value.p_koffset
- Key offset.p_klength
- Key Length.p_checkFields
- Should field existence be enforced?p_charset
- Charset for decoding/encoding strings.FilesystemException
public final void getKeyForRecord(byte[] p_record, int p_roffset, int p_size, int p_actualRecordSize, byte[] p_key, int p_koffset, int p_klength, boolean p_checkFields, java.nio.charset.Charset p_charset) throws FilesystemException
FilesystemException
public final void getKeyForRecord(java.lang.String p_filename, byte[] p_record, int p_roffset, int p_size, int p_actualRecordSize, byte[] p_key, int p_koffset, int p_klength, boolean p_checkFields, java.nio.charset.Charset p_charset) throws FilesystemException
FilesystemException
public final void getKeyForRecord(ByteBuf p_record, int p_actualRecordSize, ByteBuf p_key, boolean p_checkFields, java.nio.charset.Charset p_charset) throws FilesystemException
FilesystemException
public final void getKeyForRecord(java.lang.String p_filename, ByteBuf p_record, int p_actualRecordSize, ByteBuf p_key, boolean p_checkFields, java.nio.charset.Charset p_charset) throws FilesystemException
FilesystemException
public final void getAndFixKeyForRecord(ByteBuf p_record, int p_actualRecordSize, ByteBuf p_key, boolean p_checkFields, java.util.Locale p_locale, java.nio.charset.Charset p_charset, boolean p_mangle) throws FilesystemException
FilesystemException
public final void getAndFixKeyForRecord(java.lang.String p_filename, ByteBuf p_record, int p_actualRecordSize, ByteBuf p_key, boolean p_checkFields, java.util.Locale p_locale, java.nio.charset.Charset p_charset, boolean p_mangle) throws FilesystemException
FilesystemException
public final void fixDescendingSegments(byte[] p_fromKey, int p_fromKeyLen, byte[] p_toKey, int p_toKeyLen, boolean p_mangle)
p_fromKey
- Key to convert.p_fromKeyLen
- Length of the key to convert.p_toKey
- Key buffer to fill.p_toKeyLen
- Length of the key buffer to fill.p_mangle
- true if numeric fields should be adjusted for descending.public final void fixDescendingSegments(byte[] p_fromKey, int p_fromOffset, int p_fromKeyLen, byte[] p_toKey, int p_toOffset, int p_toKeyLen, boolean p_mangle)
p_fromKey
- Key to convert.p_fromOffset
- Starting offset.p_fromKeyLen
- Length of the key to convert.p_toKey
- Key buffer to fill.p_toOffset
- Starting offset.p_toKeyLen
- Length of the key buffer to fill.p_mangle
- true if numeric fields should be adjusted for descending.public final void fixDescendingSegments(byte[] p_fromKey, int p_fromOffset, int p_fromKeyLen, byte[] p_toKey, int p_toOffset, int p_toKeyLen, java.util.Locale p_locale, java.nio.charset.Charset p_charset, boolean p_mangle)
p_fromKey
- Key to convert.p_fromOffset
- Starting offset.p_fromKeyLen
- Length of the key to convert.p_toKey
- Key buffer to fill.p_toOffset
- Starting offset.p_toKeyLen
- Length of the key buffer to fill.p_locale
- Locale for case insensitive segments.p_charset
- Charset for decoding/encoding stringsp_mangle
- true if numeric fields should be adjusted for descending.public final void fixDescendingSegments(ByteBuf p_fromKey, ByteBuf p_toKey, java.util.Locale p_locale, java.nio.charset.Charset p_charset, boolean p_mangle)
p_fromKey
- Key to convert.p_toKey
- Key buffer to fill.p_locale
- Locale for case insensitive segments.p_charset
- Charset for decoding/encoding stringsp_mangle
- true if numeric fields should be adjusted for descending.public java.lang.String toString()
toString
in class java.lang.Object
public KeyDescription clone()
clone
in class java.lang.Object
public static java.util.List<KeyDescription> getKeyDescriptions(byte[] p_data, int p_offset, int p_end) throws FilesystemException
FilesystemException
public static java.util.List<KeyDescription> getKeyDescriptions(java.lang.String p_filename, byte[] p_data, int p_offset, int p_end) throws FilesystemException
KeyDescription
objects out
of a byte array.p_filename
- p_data
- Buffer with keys.p_offset
- Offset in buffer to start looking for keys.p_end
- End in the buffer to look for keys.FilesystemException
- If a filesystem problem occurs.public static int getKeyDescriptionsSize(KeyDescription[] p_keyDesc)
KeyDescription
objects in FIN format.p_keyDesc
- Array of KeyDescription
objects.public static int getKeyDescriptionsSize(java.util.List<KeyDescription> p_keyDesc)
KeyDescription
objects in FIN format.p_keyDesc
- List of KeyDescription
objects.public static int putXKeyDescriptions(KeyDescription[] p_keyDesc, byte[] p_data, int p_offset, int p_length)
KeyDescription
objects into a byte
array.p_keyDesc
- Array of key descriptions.p_data
- Buffer to put key information in.p_offset
- Offset in the buffer to start placing key information.p_length
- Length of the buffer that we are allowed to place key
information in.public static int putXKeyDescriptions(java.util.List<KeyDescription> p_keyDesc, byte[] p_data, int p_offset, int p_length)
KeyDescription
objects into a byte
array.p_keyDesc
- List of key descriptions.p_data
- Buffer to put key information in.p_offset
- Offset in the buffer to start placing key information.p_length
- Length of the buffer that we are allowed to place key
information in.public static int putXKeyDescriptions(KeyDescription p_keyDesc, byte[] p_data, int p_offset, int p_length)
KeyDescription
objects into a byte
array.p_keyDesc
- List of key descriptions.p_data
- Buffer to put key information in.p_offset
- Offset in the buffer to start placing key information.p_length
- Length of the buffer that we are allowed to place key
information in.public static java.util.List<KeyDescription> getXKeyDescriptions(byte[] p_data, int p_offset, int p_end) throws FilesystemException
FilesystemException
public static java.util.List<KeyDescription> getXKeyDescriptions(java.lang.String p_filename, byte[] p_data, int p_offset, int p_end) throws FilesystemException
KeyDescription
objects out
of a byte array in XFIN format.p_filename
- p_data
- Buffer with keys.p_offset
- Offset in buffer to start looking for keys.p_end
- End in the buffer to look for keys.FilesystemException
- If a filesystem problem occurs.public static int getXKeyDescriptionsSize(KeyDescription[] p_keyDesc)
KeyDescription
objects in XFIN format.p_keyDesc
- Array of KeyDescription
objects.public static int getXKeyDescriptionsSize(java.util.List<KeyDescription> p_keyDesc)
KeyDescription
objects in XFIN format.p_keyDesc
- List of KeyDescription
objects.public static int getXKeyDescriptionsSize(KeyDescription p_keyDesc)
KeyDescription
objects in XFIN format.p_keyDesc
- List of KeyDescription
objects.public static int putKeyDescriptions(KeyDescription[] p_keyDesc, byte[] p_data, int p_offset, int p_length)
KeyDescription
objects into a byte
array.p_keyDesc
- Array of key descriptions.p_data
- Buffer to put key information in.p_offset
- Offset in the buffer to start placing key information.p_length
- Length of the buffer that we are allowed to place key
information in.public static int putKeyDescriptions(java.util.List<KeyDescription> p_keyDesc, byte[] p_data, int p_offset, int p_length)
KeyDescription
objects into a byte
array.p_keyDesc
- List of key descriptions.p_data
- Buffer to put key information in.p_offset
- Offset in the buffer to start placing key information.p_length
- Length of the buffer that we are allowed to place key
information in.