Class SignedBinary
java.lang.Object
org.apache.derby.impl.drda.SignedBinary
Converters from signed binary bytes to Java
short, int, or long.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAS/400, Unix, System/390 byte-order for signed binary representations.static final intIntel 80/86 reversed byte-order for signed binary representations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intbigEndianBytesToInt(byte[] buffer, int offset) Build a Java int from a 4-byte big endian signed binary representation.static longbigEndianBytesToLong(byte[] buffer, int offset) Build a Java long from an 8-byte big endian signed binary representation.static shortbigEndianBytesToShort(byte[] buffer, int offset) Build a Java short from a 2-byte big endian signed binary representation.static intgetInt(byte[] buffer, int offset, int byteOrder) Build a Java int from a 4-byte signed binary representation.static longgetLong(byte[] buffer, int offset, int byteOrder) Build a Java long from an 8-byte signed binary representation.static shortgetShort(byte[] buffer, int offset, int byteOrder) Build a Java short from a 2-byte signed binary representation.static intlittleEndianBytesToInt(byte[] buffer, int offset) Build a Java int from a 4-byte little endian signed binary representation.static longlittleEndianBytesToLong(byte[] buffer, int offset) Build a Java long from an 8-byte little endian signed binary representation.static shortlittleEndianBytesToShort(byte[] buffer, int offset) Build a Java short from a 2-byte little endian signed binary representation.
-
Field Details
-
BIG_ENDIAN
public static final int BIG_ENDIANAS/400, Unix, System/390 byte-order for signed binary representations.- See Also:
-
LITTLE_ENDIAN
public static final int LITTLE_ENDIANIntel 80/86 reversed byte-order for signed binary representations.- See Also:
-
-
Constructor Details
-
SignedBinary
private SignedBinary()
-
-
Method Details
-
getShort
public static short getShort(byte[] buffer, int offset, int byteOrder) Build a Java short from a 2-byte signed binary representation.Depending on machine type, byte orders are
BIG_ENDIANfor signed binary integers, andLITTLE_ENDIANfor pc8087 signed binary integers.- Throws:
IllegalArgumentException- if the specified byte order is not recognized.
-
getInt
public static int getInt(byte[] buffer, int offset, int byteOrder) Build a Java int from a 4-byte signed binary representation.Depending on machine type, byte orders are
BIG_ENDIANfor signed binary integers, andLITTLE_ENDIANfor pc8087 signed binary integers.- Throws:
IllegalArgumentException- if the specified byte order is not recognized.
-
getLong
public static long getLong(byte[] buffer, int offset, int byteOrder) Build a Java long from an 8-byte signed binary representation.Depending on machine type, byte orders are
BIG_ENDIANfor signed binary integers, andLITTLE_ENDIANfor pc8087 signed binary integers.- Throws:
IllegalArgumentException- if the specified byte order is not recognized.
-
bigEndianBytesToShort
public static short bigEndianBytesToShort(byte[] buffer, int offset) Build a Java short from a 2-byte big endian signed binary representation. -
littleEndianBytesToShort
public static short littleEndianBytesToShort(byte[] buffer, int offset) Build a Java short from a 2-byte little endian signed binary representation. -
bigEndianBytesToInt
public static int bigEndianBytesToInt(byte[] buffer, int offset) Build a Java int from a 4-byte big endian signed binary representation. -
littleEndianBytesToInt
public static int littleEndianBytesToInt(byte[] buffer, int offset) Build a Java int from a 4-byte little endian signed binary representation. -
bigEndianBytesToLong
public static long bigEndianBytesToLong(byte[] buffer, int offset) Build a Java long from an 8-byte big endian signed binary representation. -
littleEndianBytesToLong
public static long littleEndianBytesToLong(byte[] buffer, int offset) Build a Java long from an 8-byte little endian signed binary representation.
-