rossi.fstools.fs
Class FsUtils

java.lang.Object
  extended byrossi.fstools.fs.FsUtils

public class FsUtils
extends java.lang.Object

Utility class for converting numbers from on-disk format.


Field Summary
static boolean bigEndian
          Controls endian-ness.
 
Constructor Summary
FsUtils()
           
 
Method Summary
static int getS16(byte[] buffer, int offset)
          Read a 16 bit signed number off the disk.
static long getS32(byte[] buffer, int offset)
          Read a 32 bit signed number off the disk.
static long getS64(byte[] buffer, int offset)
          This is the same as getU64().
static int getU16(byte[] buffer, int offset)
          Read a 16 bit unsigned number off the disk.
static long getU32(byte[] buffer, int offset)
          Read a 32 bit unsigned number off the disk.
static long getU64(byte[] buffer, int offset)
          Read a 64 bit unsigned number off the disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bigEndian

public static boolean bigEndian
Controls endian-ness.

Constructor Detail

FsUtils

public FsUtils()
Method Detail

getU64

public static long getU64(byte[] buffer,
                          int offset)
Read a 64 bit unsigned number off the disk. Note that Java doesn't support unsigned 64 bit integers, so this will not work correctly for very big numbers.

Parameters:
buffer - a byte[] containing the data
offset - a int offset into the buffer
Returns:
a long read from the buffer

getS64

public static long getS64(byte[] buffer,
                          int offset)
This is the same as getU64().

Parameters:
buffer - a byte[] containing the data
offset - a int offset into the buffer
Returns:
a long read from the buffer
See Also:
getU64(byte[],int)

getU32

public static long getU32(byte[] buffer,
                          int offset)
Read a 32 bit unsigned number off the disk. Note that Java doesn't support unsigned integers, so this will be returned in a 64 bit value.

Parameters:
buffer - a byte[] containing the data
offset - a int offset into the buffer
Returns:
a long read from the buffer

getS32

public static long getS32(byte[] buffer,
                          int offset)
Read a 32 bit signed number off the disk. Note that Java doesn't support unsigned integers, so this will be returned in a 64 bit value.

Parameters:
buffer - a byte[] containing the data
offset - a int offset into the buffer
Returns:
a long read from the buffer

getU16

public static int getU16(byte[] buffer,
                         int offset)
Read a 16 bit unsigned number off the disk. Note that Java doesn't support unsigned integers, so this will be returned in a 32 bit value.

Parameters:
buffer - a byte[] containing the data
offset - a int offset into the buffer
Returns:
a long read from the buffer

getS16

public static int getS16(byte[] buffer,
                         int offset)
Read a 16 bit signed number off the disk. Note that Java doesn't support unsigned integers, so this will be returned in a 32 bit value.

Parameters:
buffer - a byte[] containing the data
offset - a int offset into the buffer
Returns:
a long read from the buffer