|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectloci.formats.DataTools
A utility class with convenience methods for reading, writing and decoding words.
| Constructor Summary | |
DataTools()
|
|
| Method Summary | |
static int |
bytesToInt(byte[] bytes,
boolean little)
Translates up to the first 4 bytes of a byte array to an int. |
static int |
bytesToInt(byte[] bytes,
int off,
boolean little)
Translates up to the first 4 bytes of a byte array beyond the given offset to an int. |
static int |
bytesToInt(byte[] bytes,
int off,
int len,
boolean little)
Translates up to the first len bytes of a byte array beyond the given offset to an int. |
static int |
bytesToInt(short[] bytes,
boolean little)
Translates up to the first 4 bytes of a byte array to an int. |
static int |
bytesToInt(short[] bytes,
int off,
boolean little)
Translates up to the first 4 bytes of a byte array beyond the given offset to an int. |
static int |
bytesToInt(short[] bytes,
int off,
int len,
boolean little)
Translates up to the first len bytes of a byte array beyond the given offset to an int. |
static long |
bytesToLong(byte[] bytes,
boolean little)
Translates up to the first 8 bytes of a byte array to a long. |
static long |
bytesToLong(byte[] bytes,
int off,
boolean little)
Translates up to the first 8 bytes of a byte array beyond the given offset to a long. |
static long |
bytesToLong(byte[] bytes,
int off,
int len,
boolean little)
Translates up to the first len bytes of a byte array beyond the given offset to a long. |
static long |
bytesToLong(short[] bytes,
boolean little)
Translates up to the first 8 bytes of a byte array to a long. |
static long |
bytesToLong(short[] bytes,
int off,
boolean little)
Translates up to the first 8 bytes of a byte array beyond the given offset to a long. |
static long |
bytesToLong(short[] bytes,
int off,
int len,
boolean little)
Translates up to the first len bytes of a byte array beyond the given offset to a long. |
static short |
bytesToShort(byte[] bytes,
boolean little)
Translates up to the first 2 bytes of a byte array to a short. |
static short |
bytesToShort(byte[] bytes,
int off,
boolean little)
Translates up to the first 2 bytes of a byte array beyond the given offset to a short. |
static short |
bytesToShort(byte[] bytes,
int off,
int len,
boolean little)
Translates up to the first len bytes of a byte array beyond the given offset to a short. |
static short |
bytesToShort(short[] bytes,
boolean little)
Translates up to the first 2 bytes of a byte array to a short. |
static short |
bytesToShort(short[] bytes,
int off,
boolean little)
Translates up to the first 2 bytes of a byte array byond the given offset to a short. |
static short |
bytesToShort(short[] bytes,
int off,
int len,
boolean little)
Translates up to the first len bytes of a byte array byond the given offset to a short. |
static String |
bytesToString(short[] bytes)
Translates bytes from the given array into a string. |
static String |
bytesToString(short[] bytes,
int off)
Translates bytes from the given array into a string. |
static String |
bytesToString(short[] bytes,
int off,
int len)
Translates bytes from the given array into a string. |
static short |
read2SignedBytes(RandomAccessFile in,
boolean little)
Reads 2 signed bytes [-32768, 32767]. |
static int |
read2UnsignedBytes(RandomAccessFile in,
boolean little)
Reads 2 unsigned bytes [0, 65535]. |
static int |
read4SignedBytes(RandomAccessFile in,
boolean little)
Reads 4 signed bytes [-2147483648, 2147483647]. |
static long |
read4UnsignedBytes(RandomAccessFile in,
boolean little)
Reads 4 unsigned bytes [0, 4294967296]. |
static long |
read8SignedBytes(RandomAccessFile in,
boolean little)
Reads 8 signed bytes [-9223372036854775808, 9223372036854775807]. |
static double |
readDouble(RandomAccessFile in,
boolean little)
Reads 8 bytes in double precision IEEE format. |
static float |
readFloat(RandomAccessFile in,
boolean little)
Reads 4 bytes in single precision IEEE format. |
static void |
readFully(RandomAccessFile in,
byte[] bytes)
Reads bytes from the given random access file or array. |
static byte |
readSignedByte(RandomAccessFile in)
Reads 1 signed byte [-128, 127]. |
static short |
readUnsignedByte(RandomAccessFile in)
Reads 1 unsigned byte [0, 255]. |
static void |
writeInt(RandomAccessFile out,
int v)
Writes an integer to the given random access file in little-endian format. |
static void |
writeReverseInt(RandomAccessFile out,
int v)
Writes an integer to the given random access file in big-endian format. |
static void |
writeReverseShort(RandomAccessFile out,
int v)
Writes a short to the given random access file in big-endian format. |
static void |
writeShort(RandomAccessFile out,
int v)
Writes a short to the given random access file in little-endian format. |
static void |
writeString(RandomAccessFile out,
String s)
Writes a string to the given random access file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DataTools()
| Method Detail |
public static void readFully(RandomAccessFile in,
byte[] bytes)
throws IOException
IOException
public static byte readSignedByte(RandomAccessFile in)
throws IOException
IOException
public static short readUnsignedByte(RandomAccessFile in)
throws IOException
IOException
public static short read2SignedBytes(RandomAccessFile in,
boolean little)
throws IOException
IOException
public static int read2UnsignedBytes(RandomAccessFile in,
boolean little)
throws IOException
IOException
public static int read4SignedBytes(RandomAccessFile in,
boolean little)
throws IOException
IOException
public static long read4UnsignedBytes(RandomAccessFile in,
boolean little)
throws IOException
IOException
public static long read8SignedBytes(RandomAccessFile in,
boolean little)
throws IOException
IOException
public static float readFloat(RandomAccessFile in,
boolean little)
throws IOException
IOException
public static double readDouble(RandomAccessFile in,
boolean little)
throws IOException
IOException
public static void writeString(RandomAccessFile out,
String s)
throws IOException
IOException
public static void writeInt(RandomAccessFile out,
int v)
throws IOException
IOException
public static void writeShort(RandomAccessFile out,
int v)
throws IOException
IOException
public static void writeReverseInt(RandomAccessFile out,
int v)
throws IOException
IOException
public static void writeReverseShort(RandomAccessFile out,
int v)
throws IOException
IOException
public static short bytesToShort(byte[] bytes,
int off,
int len,
boolean little)
public static short bytesToShort(byte[] bytes,
int off,
boolean little)
public static short bytesToShort(byte[] bytes,
boolean little)
public static short bytesToShort(short[] bytes,
int off,
int len,
boolean little)
public static short bytesToShort(short[] bytes,
int off,
boolean little)
public static short bytesToShort(short[] bytes,
boolean little)
public static int bytesToInt(byte[] bytes,
int off,
int len,
boolean little)
public static int bytesToInt(byte[] bytes,
int off,
boolean little)
public static int bytesToInt(byte[] bytes,
boolean little)
public static int bytesToInt(short[] bytes,
int off,
int len,
boolean little)
public static int bytesToInt(short[] bytes,
int off,
boolean little)
public static int bytesToInt(short[] bytes,
boolean little)
public static long bytesToLong(byte[] bytes,
int off,
int len,
boolean little)
public static long bytesToLong(byte[] bytes,
int off,
boolean little)
public static long bytesToLong(byte[] bytes,
boolean little)
public static long bytesToLong(short[] bytes,
int off,
int len,
boolean little)
public static long bytesToLong(short[] bytes,
int off,
boolean little)
public static long bytesToLong(short[] bytes,
boolean little)
public static String bytesToString(short[] bytes,
int off,
int len)
public static String bytesToString(short[] bytes,
int off)
public static String bytesToString(short[] bytes)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||