org.apache.derby.client.am
Class SignedBinary

java.lang.Object
  extended by org.apache.derby.client.am.SignedBinary

public class SignedBinary
extends java.lang.Object


Field Summary
static int BIG_ENDIAN
          Unix byte-order for signed binary representations.
static int LITTLE_ENDIAN
          Intel 80/86 reversed byte-order for signed binary representations.
static long MAX_LONG_6_BYTES_SIGNED
          Maximum value that cen be encoded by 6 bytes (signed).
 
Constructor Summary
private SignedBinary()
           
 
Method Summary
static int getInt(byte[] buffer, int offset)
          Build a Java int from a 4-byte signed binary representation.
static long getLong(byte[] buffer, int offset)
          Build a Java long from an 8-byte signed binary representation.
static short getShort(byte[] buffer, int offset)
          Build a Java short from a 2-byte signed binary representation.
static void intToBigEndianBytes(byte[] buffer, int offset, int v)
          Write a Java int to a 4-byte big endian signed binary representation.
static void long6BytesToBigEndianBytes(byte[] buffer, int offset, long v)
          Writes a Java long to a 6-byte big endian signed binary representation.
static void longToBigEndianBytes(byte[] buffer, int offset, long v)
          Write a Java long to an 8-byte big endian signed binary representation.
static void shortToBigEndianBytes(byte[] buffer, int offset, short v)
          Write a Java short to a 2-byte big endian signed binary representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LONG_6_BYTES_SIGNED

public static final long MAX_LONG_6_BYTES_SIGNED
Maximum value that cen be encoded by 6 bytes (signed).

See Also:
Constant Field Values

BIG_ENDIAN

public static final int BIG_ENDIAN
Unix byte-order for signed binary representations.

See Also:
Constant Field Values

LITTLE_ENDIAN

public static final int LITTLE_ENDIAN
Intel 80/86 reversed byte-order for signed binary representations.

See Also:
Constant Field Values
Constructor Detail

SignedBinary

private SignedBinary()
Method Detail

getShort

public static final short getShort(byte[] buffer,
                                   int offset)
Build a Java short from a 2-byte signed binary representation.

Throws:
java.lang.IllegalArgumentException - if the specified byte order is not recognized.

getInt

public static final int getInt(byte[] buffer,
                               int offset)
Build a Java int from a 4-byte signed binary representation.

Throws:
java.lang.IllegalArgumentException - if the specified byte order is not recognized.

getLong

public static final long getLong(byte[] buffer,
                                 int offset)
Build a Java long from an 8-byte signed binary representation.

Throws:
java.lang.IllegalArgumentException - if the specified byte order is not recognized.

shortToBigEndianBytes

public static final void shortToBigEndianBytes(byte[] buffer,
                                               int offset,
                                               short v)
Write a Java short to a 2-byte big endian signed binary representation.


intToBigEndianBytes

public static final void intToBigEndianBytes(byte[] buffer,
                                             int offset,
                                             int v)
Write a Java int to a 4-byte big endian signed binary representation.


long6BytesToBigEndianBytes

public static void long6BytesToBigEndianBytes(byte[] buffer,
                                              int offset,
                                              long v)
Writes a Java long to a 6-byte big endian signed binary representation.

Parameters:
buffer - the buffer to write into
offset - the offset at which to start writing
v - the value to be written
Throws:
java.lang.IllegalArgumentException - if the long value is too large to be represented by six bytes.

longToBigEndianBytes

public static final void longToBigEndianBytes(byte[] buffer,
                                              int offset,
                                              long v)
Write a Java long to an 8-byte big endian signed binary representation.


Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.