deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.model.spatialschema
Class ByteUtils

java.lang.Object
  extended by org.deegree.model.spatialschema.ByteUtils

public class ByteUtils
extends Object

Utilities for reading and writing the components of binary files.

Version:
$Revision: 18195 $ $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $ modified Last changes:
25.11.1999 ap: memory allocation dynaminized
17.01.2000 ap: method SHPPoint readPoint(byte[] b, int off) modified
17.01.2000 ap: method SHPEnvelope readBox(byte[] b, int off) modified
17.01.2000 ap: method writePoint(..) modified
25.01.2000 ap: method writeBELong(..) added
25.01.2000 ap: method writeBEDouble(..) added
25.01.2000 ap: method readBELong(..) added
25.01.2000 ap: method readBEDouble(..) added
22.04.2000 ap: method readBEShort(byte[] b, int off) added
22.04.2000 ap: method readLEShort(byte[] b, int off) added
22.04.2000 ap: method writeBEShort(byte[] b, int off) added
22.04.2000 ap: method writeLEShort(byte[] b, int off) added

----------------------------------------------------------------------------

, $Revision: 18195 $ $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $

Author:
Tom Mitchell , Andreas Poth

Constructor Summary
ByteUtils()
           
 
Method Summary
static double readBEDouble(byte[] b, int off)
          method: readBEDouble(byte[] b, int off)
Reads a big endian double.
static float readBEFloat(byte[] b, int off)
          Reads a big endian float.
static int readBEInt(byte[] b, int off)
          Reads a big endian integer.
static long readBELong(byte[] b, int off)
          method: readBELong(byte[] b, int off)
Reads a little endian 8 byte integer.
static int readBEShort(byte[] b, int off)
          method: readBEShort(byte[] b, int off)
Reads a big endian small integer.
static double readLEDouble(byte[] b, int off)
          method: readLEDouble(byte[] b, int off)
Reads a little endian double.
static float readLEFloat(byte[] b, int off)
          Reads a little endian float.
static int readLEInt(byte[] b, int off)
          Reads a little endian integer.
static long readLELong(byte[] b, int off)
          method: readLELong(byte[] b, int off)
Reads a little endian 8 byte integer.
static int readLEShort(byte[] b, int off)
          method: readLEShort(byte[] b, int off)
Reads a little endian small integer.
static int writeBEDouble(byte[] b, int off, double val)
          method: writeBEDouble(byte[] b, int off, double val)
Writes the given double to the given buffer at the given location in big endian format.
static int writeBEInt(byte[] b, int off, int val)
          method: writeBEInt(byte[] b, int off, int val)
Writes the given integer to the given buffer at the given location in big endian format.
static int writeBELong(byte[] b, int off, long val)
          method: writeBELong(byte[] b, int off, long val)
Writes the given long to the given buffer at the given location in big endian format.
static int writeBEShort(byte[] b, int off, int val)
          method: writeBEShort(byte[] b, int off, int val)
Writes the given short to the given buffer at the given location in big endian format.
static int writeLEDouble(byte[] b, int off, double val)
          method: writeLEDouble(byte[] b, int off, double val)
Writes the given double to the given buffer at the given location in little endian format.
static int writeLEInt(byte[] b, int off, int val)
          method: writeLEInt(byte[] b, int off, int val)
Writes the given integer to the given buffer at the given location in little endian format.
static int writeLELong(byte[] b, int off, long val)
          method: writeLELong(byte[] b, int off, long val)
Writes the given long to the given buffer at the given location in little endian format.
static int writeLEShort(byte[] b, int off, int val)
          method: writeLEShort(byte[] b, int off, int val)
Writes the given short to the given buffer at the given location in big endian format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteUtils

public ByteUtils()
Method Detail

readBEShort

public static int readBEShort(byte[] b,
                              int off)
method: readBEShort(byte[] b, int off)
Reads a big endian small integer.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the int resides
Returns:
the int read from the buffer at the offset location not tested!

readLEShort

public static int readLEShort(byte[] b,
                              int off)
method: readLEShort(byte[] b, int off)
Reads a little endian small integer.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the int resides
Returns:
the int read from the buffer at the offset location not tested!

readBEInt

public static int readBEInt(byte[] b,
                            int off)
Reads a big endian integer.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the int resides
Returns:
the int read from the buffer at the offset location

readLEInt

public static int readLEInt(byte[] b,
                            int off)
Reads a little endian integer.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the int resides
Returns:
the int read from the buffer at the offset location

readLELong

public static long readLELong(byte[] b,
                              int off)
method: readLELong(byte[] b, int off)
Reads a little endian 8 byte integer.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the long resides
Returns:
the long read from the buffer at the offset location

readBELong

public static long readBELong(byte[] b,
                              int off)
method: readBELong(byte[] b, int off)
Reads a little endian 8 byte integer.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the long resides
Returns:
the long read from the buffer at the offset location

readLEFloat

public static float readLEFloat(byte[] b,
                                int off)
Reads a little endian float.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the float resides
Returns:
the float read from the buffer at the offset location

readBEFloat

public static float readBEFloat(byte[] b,
                                int off)
Reads a big endian float.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the float resides
Returns:
the float read from the buffer at the offset location

readLEDouble

public static double readLEDouble(byte[] b,
                                  int off)
method: readLEDouble(byte[] b, int off)
Reads a little endian double.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the double resides
Returns:
the double read from the buffer at the offset location

readBEDouble

public static double readBEDouble(byte[] b,
                                  int off)
method: readBEDouble(byte[] b, int off)
Reads a big endian double.

Parameters:
b - the raw data buffer
off - the offset into the buffer where the double resides
Returns:
the double read from the buffer at the offset location

writeBEShort

public static int writeBEShort(byte[] b,
                               int off,
                               int val)
method: writeBEShort(byte[] b, int off, int val)
Writes the given short to the given buffer at the given location in big endian format.

Parameters:
b - the data buffer
off - the offset into the buffer where writing should occur
val - the short to write
Returns:
the number of bytes written not tested!

writeLEShort

public static int writeLEShort(byte[] b,
                               int off,
                               int val)
method: writeLEShort(byte[] b, int off, int val)
Writes the given short to the given buffer at the given location in big endian format.

Parameters:
b - the data buffer
off - the offset into the buffer where writing should occur
val - the short to write
Returns:
the number of bytes written not tested!

writeBEInt

public static int writeBEInt(byte[] b,
                             int off,
                             int val)
method: writeBEInt(byte[] b, int off, int val)
Writes the given integer to the given buffer at the given location in big endian format.

Parameters:
b - the data buffer
off - the offset into the buffer where writing should occur
val - the integer to write
Returns:
the number of bytes written

writeLEInt

public static int writeLEInt(byte[] b,
                             int off,
                             int val)
method: writeLEInt(byte[] b, int off, int val)
Writes the given integer to the given buffer at the given location in little endian format.

Parameters:
b - the data buffer
off - the offset into the buffer where writing should occur
val - the integer to write
Returns:
the number of bytes written

writeLELong

public static int writeLELong(byte[] b,
                              int off,
                              long val)
method: writeLELong(byte[] b, int off, long val)
Writes the given long to the given buffer at the given location in little endian format.

Parameters:
b - the data buffer
off - the offset into the buffer where writing should occur
val - the long to write
Returns:
the number of bytes written

writeBELong

public static int writeBELong(byte[] b,
                              int off,
                              long val)
method: writeBELong(byte[] b, int off, long val)
Writes the given long to the given buffer at the given location in big endian format.

Parameters:
b - the data buffer
off - the offset into the buffer where writing should occur
val - the long to write
Returns:
the number of bytes written

writeLEDouble

public static int writeLEDouble(byte[] b,
                                int off,
                                double val)
method: writeLEDouble(byte[] b, int off, double val)
Writes the given double to the given buffer at the given location in little endian format.

Parameters:
b - the data buffer
off - the offset into the buffer where writing should occur
val - the double to write
Returns:
the number of bytes written

writeBEDouble

public static int writeBEDouble(byte[] b,
                                int off,
                                double val)
method: writeBEDouble(byte[] b, int off, double val)
Writes the given double to the given buffer at the given location in big endian format.

Parameters:
b - the data buffer
off - the offset into the buffer where writing should occur
val - the double to write
Returns:
the number of bytes written

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org