org.netbeans.mdr.persistence.btreeimpl.btreeindex
Class IntInfo

java.lang.Object
  extended by org.netbeans.mdr.persistence.btreeimpl.btreeindex.EntryTypeInfo
      extended by org.netbeans.mdr.persistence.btreeimpl.btreeindex.IntInfo

public class IntInfo
extends EntryTypeInfo

EntryTypeInfo implementation for integer data.


Constructor Summary
IntInfo()
           
 
Method Summary
 byte compare(byte[] key1Buffer, byte[] key2Buffer, int offset, int length)
          Compares two integers stored in byte arrays
 java.lang.Object fromBuffer(byte[] buffer)
          Reads an integer from a byte array
 int fromBuffer(byte[] buffer, int offset)
          Returns an int read from the 4 bytes starting at the location passed in.
 int getLength()
          Returns the length of an integer
 boolean isFixedLength()
          Returns true if this is a fixed length type, otherwise returns false;
 byte[] toBuffer(java.lang.Object i)
          Store an integer in a byte array
 java.lang.String typeName()
          Returns the name of this type as a String.
 
Methods inherited from class org.netbeans.mdr.persistence.btreeimpl.btreeindex.EntryTypeInfo
getEntryTypeInfo, objectFromBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntInfo

public IntInfo()
Method Detail

typeName

public java.lang.String typeName()
Description copied from class: EntryTypeInfo
Returns the name of this type as a String.

Specified by:
typeName in class EntryTypeInfo

toBuffer

public byte[] toBuffer(java.lang.Object i)
Store an integer in a byte array

Specified by:
toBuffer in class EntryTypeInfo
Parameters:
i - Integer to be stored
Returns:
byte array containing the integer

fromBuffer

public java.lang.Object fromBuffer(byte[] buffer)
Reads an integer from a byte array

Specified by:
fromBuffer in class EntryTypeInfo
Parameters:
buffer - byte array containing an integer
Returns:
new Integer containing the value read from the byte array

fromBuffer

public int fromBuffer(byte[] buffer,
                      int offset)
Returns an int read from the 4 bytes starting at the location passed in.


compare

public byte compare(byte[] key1Buffer,
                    byte[] key2Buffer,
                    int offset,
                    int length)
Compares two integers stored in byte arrays

Specified by:
compare in class EntryTypeInfo
Parameters:
key1Buffer - byte array containing integer search key
key2Buffer - byte array containing integer target key
offset - offset into key2Buffer of target key
length - should always be 4
Returns:
Returns one of:

EQUAL if the two keys are equal

GREATER if search key is greater than target key

LESS if search key is less than target key


getLength

public int getLength()
Returns the length of an integer

Specified by:
getLength in class EntryTypeInfo
Returns:
always returns 4

isFixedLength

public boolean isFixedLength()
Description copied from class: EntryTypeInfo
Returns true if this is a fixed length type, otherwise returns false;

Specified by:
isFixedLength in class EntryTypeInfo


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.