futils
Class Endian

java.lang.Object
  extended by futils.Endian

public class Endian
extends java.lang.Object

Utilities for reading little endian data from a stream.


Constructor Summary
Endian()
           
 
Method Summary
static long[] get_quad(byte[] data, int pos)
           
static boolean readLittleEndianBoolean(byte[] data, int start)
           
static int readLittleEndianByte(byte[] data, int start)
           
static int readLittleEndianByte(java.io.InputStream input)
           
static int readLittleEndianInt(byte[] data, int start)
           
static int readLittleEndianInt(java.io.InputStream input)
           
static long readLittleEndianLong(byte[] data, int offset)
           
static int readLittleEndianWord(byte[] data, int start)
           
static int readLittleEndianWord(java.io.InputStream input)
           
static byte[] swap(byte[] bytes, int offset, int count)
           
static int swap(int value)
          Swap the bytes of an integer
static long swap(long value)
          Swap the bytes of a long value
static void write_long(byte[] data, int start, int val)
           
static void write_quad(byte[] data, int start, long hi, long lo)
           
static void writeUnsignedInt(byte[] data, long val, int offset)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Endian

public Endian()
Method Detail

swap

public static int swap(int value)
Swap the bytes of an integer


swap

public static byte[] swap(byte[] bytes,
                          int offset,
                          int count)

swap

public static long swap(long value)
Swap the bytes of a long value


readLittleEndianByte

public static int readLittleEndianByte(java.io.InputStream input)
                                throws java.io.IOException
Throws:
java.io.IOException

readLittleEndianWord

public static int readLittleEndianWord(java.io.InputStream input)
                                throws java.io.IOException
Throws:
java.io.IOException

readLittleEndianInt

public static int readLittleEndianInt(java.io.InputStream input)
                               throws java.io.IOException
Throws:
java.io.IOException

readLittleEndianByte

public static int readLittleEndianByte(byte[] data,
                                       int start)

readLittleEndianWord

public static int readLittleEndianWord(byte[] data,
                                       int start)

readLittleEndianBoolean

public static boolean readLittleEndianBoolean(byte[] data,
                                              int start)

readLittleEndianInt

public static int readLittleEndianInt(byte[] data,
                                      int start)

readLittleEndianLong

public static long readLittleEndianLong(byte[] data,
                                        int offset)

get_quad

public static long[] get_quad(byte[] data,
                              int pos)

writeUnsignedInt

public static void writeUnsignedInt(byte[] data,
                                    long val,
                                    int offset)

write_quad

public static void write_quad(byte[] data,
                              int start,
                              long hi,
                              long lo)

write_long

public static void write_long(byte[] data,
                              int start,
                              int val)