* @return The deserialized Object
*/
public Object read(byte[] data) throws IOException {
- return read(data, ByteOrder.LITTLE_ENDIAN);
+ return read(data, PageChannel.DEFAULT_BYTE_ORDER);
}
/**
private byte[] readLongValue(byte[] lvalDefinition)
throws IOException
{
- ByteBuffer def = ByteBuffer.wrap(lvalDefinition);
- def.order(ByteOrder.LITTLE_ENDIAN);
+ ByteBuffer def = ByteBuffer.wrap(lvalDefinition)
+ .order(PageChannel.DEFAULT_BYTE_ORDER);
int length = ByteUtil.get3ByteInt(def);
// bail out gracefully here as we don't understand the format
if (length < 0)
}
/**
- * Serialize an Object into a raw byte value for this column in little endian order
+ * Serialize an Object into a raw byte value for this column in little
+ * endian order
* @param obj Object to serialize
* @return A buffer containing the bytes
*/
public ByteBuffer write(Object obj, int remainingRowLength)
throws IOException
{
- return write(obj, remainingRowLength, ByteOrder.LITTLE_ENDIAN);
+ return write(obj, remainingRowLength, PageChannel.DEFAULT_BYTE_ORDER);
}
/**
private static final int MAX_TEXT_INDEX_CHAR_LENGTH =
(JetFormat.TEXT_FIELD_MAX_LENGTH / JetFormat.TEXT_FIELD_UNIT_SIZE);
+
+ private static final ByteOrder ENTRY_BYTE_ORDER = ByteOrder.BIG_ENDIAN;
/** type attributes for Entries which simplify comparisons */
public enum EntryType {
List<Entry> entries = new ArrayList<Entry>();
TempBufferHolder tmpEntryBufferH =
TempBufferHolder.newHolder(TempBufferHolder.Type.HARD, true,
- ByteOrder.BIG_ENDIAN);
+ ENTRY_BYTE_ORDER);
Entry prevEntry = FIRST_ENTRY;
for (int i = 0; i < entryMaskLength; i++) {
throws IOException
{
// always write in big endian order
- return column.write(value, 0, ByteOrder.BIG_ENDIAN).array();
+ return column.write(value, 0, ENTRY_BYTE_ORDER).array();
}
/**
buffer.get(_entryBytes);
// read the rowId
- int page = ByteUtil.get3ByteInt(buffer, ByteOrder.BIG_ENDIAN);
+ int page = ByteUtil.get3ByteInt(buffer, ENTRY_BYTE_ORDER);
int row = ByteUtil.getUnsignedByte(buffer);
_rowId = new RowId(page, row);
buffer.put(_entryBytes, prefix.length,
(_entryBytes.length - prefix.length));
ByteUtil.put3ByteInt(buffer, getRowId().getPageNumber(),
- ByteOrder.BIG_ENDIAN);
+ ENTRY_BYTE_ORDER);
} else if(prefix.length <= (_entryBytes.length + 3)) {
// and copy last bytes to output buffer
ByteBuffer tmp = ByteBuffer.allocate(3);
ByteUtil.put3ByteInt(tmp, getRowId().getPageNumber(),
- ByteOrder.BIG_ENDIAN);
+ ENTRY_BYTE_ORDER);
tmp.flip();
tmp.position(prefix.length - _entryBytes.length);
buffer.put(tmp);
// we need 4 trailing bytes for the sub-page number
super(buffer, entryLen, 4);
- _subPageNumber = ByteUtil.getInt(buffer, ByteOrder.BIG_ENDIAN);
+ _subPageNumber = ByteUtil.getInt(buffer, ENTRY_BYTE_ORDER);
}
@Override
@Override
protected void write(ByteBuffer buffer, byte[] prefix) throws IOException {
super.write(buffer, prefix);
- ByteUtil.putInt(buffer, _subPageNumber, ByteOrder.BIG_ENDIAN);
+ ByteUtil.putInt(buffer, _subPageNumber, ENTRY_BYTE_ORDER);
}
@Override