au.com.objectix.jgridshift
Class Util

java.lang.Object
  extended byau.com.objectix.jgridshift.Util

public class Util
extends java.lang.Object

A set of static utility methods for reading the NTv2 file format

Author:
Peter Yuill

Method Summary
static double getDouble(byte[] b, boolean bigEndian)
          Get a double from the first 8 bytes of a byte array, in either Big Endian or Little Endian format.
static float getFloat(byte[] b, boolean bigEndian)
          Get a float from the first 4 bytes of a byte array, in either Big Endian or Little Endian format.
static int getInt(byte[] b, boolean bigEndian)
          Get an int from the first 4 bytes of a byte array, in either Big Endian or Little Endian format.
static int getIntBE(byte[] b, int i)
          Get a Big Endian int from four bytes of a byte array
static int getIntLE(byte[] b, int i)
          Get a Little Endian int from four bytes of a byte array
static boolean isNioAvailable()
          Does the current VM support the New IO api
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getIntLE

public static final int getIntLE(byte[] b,
                                 int i)
Get a Little Endian int from four bytes of a byte array

Parameters:
b - the byte array
i - the index of the first data byte in the array
Returns:
the int

getIntBE

public static final int getIntBE(byte[] b,
                                 int i)
Get a Big Endian int from four bytes of a byte array

Parameters:
b - the byte array
i - the index of the first data byte in the array
Returns:
the int

getInt

public static final int getInt(byte[] b,
                               boolean bigEndian)
Get an int from the first 4 bytes of a byte array, in either Big Endian or Little Endian format.

Parameters:
b - the byte array
bigEndian - is the byte array Big Endian?
Returns:
the int

getFloat

public static final float getFloat(byte[] b,
                                   boolean bigEndian)
Get a float from the first 4 bytes of a byte array, in either Big Endian or Little Endian format.

Parameters:
b - the byte array
bigEndian - is the byte array Big Endian?
Returns:
the float

getDouble

public static final double getDouble(byte[] b,
                                     boolean bigEndian)
Get a double from the first 8 bytes of a byte array, in either Big Endian or Little Endian format.

Parameters:
b - the byte array
bigEndian - is the byte array Big Endian?
Returns:
the double

isNioAvailable

public static boolean isNioAvailable()
Does the current VM support the New IO api

Returns:
true or false