com.github.junrar.io
Class Raw

java.lang.Object
  extended by com.github.junrar.io.Raw

public class Raw
extends Object

Read / write numbers to a byte[] regarding the endianness of the array

Version:
$LastChangedRevision$
Author:
$LastChangedBy$

Constructor Summary
Raw()
           
 
Method Summary
static void incShortLittleEndian(byte[] array, int pos, int dv)
          Increment a short value at the specified position by the specified amount (little endian).
static int readIntBigEndian(byte[] array, int pos)
          Read a int value from the byte array at the given position (Big Endian)
static int readIntLittleEndian(byte[] array, int pos)
          Read an int value from the byte array at the given position (little Endian)
static long readIntLittleEndianAsLong(byte[] array, int pos)
          Read an long value(unsigned int) from the byte array at the given position (little Endian)
static long readLongBigEndian(byte[] array, int pos)
          Read a long value from the byte array at the given position (Big Endian)
static long readLongLittleEndian(byte[] array, int pos)
          Read a long value from the byte array at the given position (little Endian)
static short readShortBigEndian(byte[] array, int pos)
          Read a short value from the byte array at the given position (Big Endian)
static short readShortLittleEndian(byte[] array, int pos)
          Read a short value from the byte array at the given position (little Endian)
static void writeIntBigEndian(byte[] array, int pos, int value)
          Write an int value into the byte array at the given position (Big endian)
static void writeIntLittleEndian(byte[] array, int pos, int value)
          Write an int value into the byte array at the given position (little endian)
static void writeLongBigEndian(byte[] array, int pos, long value)
          Write a long value into the byte array at the given position (Big endian)
static void writeLongLittleEndian(byte[] array, int pos, long value)
          Write a long value into the byte array at the given position (little endian)
static void writeShortBigEndian(byte[] array, int pos, short value)
          Write a short value into the byte array at the given position (Big endian)
static void writeShortLittleEndian(byte[] array, int pos, short value)
          Write a short value into the byte array at the given position (little endian)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Raw

public Raw()
Method Detail

readShortBigEndian

public static final short readShortBigEndian(byte[] array,
                                             int pos)
Read a short value from the byte array at the given position (Big Endian)

Parameters:
array - the array to read from
pos - the position
Returns:
the value

readIntBigEndian

public static final int readIntBigEndian(byte[] array,
                                         int pos)
Read a int value from the byte array at the given position (Big Endian)

Parameters:
array - the array to read from
pos - the offset
Returns:
the value

readLongBigEndian

public static final long readLongBigEndian(byte[] array,
                                           int pos)
Read a long value from the byte array at the given position (Big Endian)

Parameters:
array - the array to read from
pos - the offset
Returns:
the value

readShortLittleEndian

public static final short readShortLittleEndian(byte[] array,
                                                int pos)
Read a short value from the byte array at the given position (little Endian)

Parameters:
array - the array to read from
pos - the offset
Returns:
the value

readIntLittleEndian

public static final int readIntLittleEndian(byte[] array,
                                            int pos)
Read an int value from the byte array at the given position (little Endian)

Parameters:
array - the array to read from
pos - the offset
Returns:
the value

readIntLittleEndianAsLong

public static final long readIntLittleEndianAsLong(byte[] array,
                                                   int pos)
Read an long value(unsigned int) from the byte array at the given position (little Endian)

Parameters:
array -
pos -
Returns:

readLongLittleEndian

public static final long readLongLittleEndian(byte[] array,
                                              int pos)
Read a long value from the byte array at the given position (little Endian)

Parameters:
array - the array to read from
pos - the offset
Returns:
the value

writeShortBigEndian

public static final void writeShortBigEndian(byte[] array,
                                             int pos,
                                             short value)
Write a short value into the byte array at the given position (Big endian)

Parameters:
array - the array
pos - the offset
value - the value to write

writeIntBigEndian

public static final void writeIntBigEndian(byte[] array,
                                           int pos,
                                           int value)
Write an int value into the byte array at the given position (Big endian)

Parameters:
array - the array
pos - the offset
value - the value to write

writeLongBigEndian

public static final void writeLongBigEndian(byte[] array,
                                            int pos,
                                            long value)
Write a long value into the byte array at the given position (Big endian)

Parameters:
array - the array
pos - the offset
value - the value to write

writeShortLittleEndian

public static final void writeShortLittleEndian(byte[] array,
                                                int pos,
                                                short value)
Write a short value into the byte array at the given position (little endian)

Parameters:
array - the array
pos - the offset
value - the value to write

incShortLittleEndian

public static final void incShortLittleEndian(byte[] array,
                                              int pos,
                                              int dv)
Increment a short value at the specified position by the specified amount (little endian).


writeIntLittleEndian

public static final void writeIntLittleEndian(byte[] array,
                                              int pos,
                                              int value)
Write an int value into the byte array at the given position (little endian)

Parameters:
array - the array
pos - the offset
value - the value to write

writeLongLittleEndian

public static final void writeLongLittleEndian(byte[] array,
                                               int pos,
                                               long value)
Write a long value into the byte array at the given position (little endian)

Parameters:
array - the array
pos - the offset
value - the value to write


Copyright © 2012. All Rights Reserved.