|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jimageanalyst.Util
public final class Util
Utility class with widely used methods.
| Field Summary | |
|---|---|
static float |
METER_TO_INCH_FACTOR
Factor to convert meter to inch. |
| Method Summary | |
|---|---|
static boolean |
compare(byte[] data1,
int offset1,
byte[] data2,
int offset2,
int num)
Compares two byte arrays with each other. |
static int |
getInt(boolean littleEndian,
byte[] data,
int offs)
Converts a four bytes long byte[] to an int
value. |
static int |
getIntBigEndian(byte[] data,
int offset)
Converts a four bytes long byte[] to an int
value. |
static int |
getIntLittleEndian(byte[] data,
int offset)
Converts a four bytes long byte[] to an int
value. |
static int |
getShort(boolean littleEndian,
byte[] data,
int offset)
Converts a two bytes long byte[] to an int
value. |
static int |
getShortBigEndian(byte[] data,
int offset)
Converts a two bytes long byte[] to an int
value. |
static int |
getShortLittleEndian(byte[] data,
int offset)
Converts a two bytes long byte[] to an int
value. |
static boolean |
isIn(long item,
long... items)
Checks if an item is in a array of items. |
static java.lang.String |
printHex(byte[] data)
Returns a human readable hex dump of the given data. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final float METER_TO_INCH_FACTOR
| Method Detail |
|---|
public static int getIntBigEndian(byte[] data,
int offset)
byte[] to an int
value. The used byte order is big endian (most significant byte first).
data - the byte[] from where the int
should be extractedoffset - the position to start reading
int represented by the extracted bytesgetIntLittleEndian(byte[], int),
getInt(boolean, byte[], int),
getShort(boolean, byte[], int),
getShortBigEndian(byte[], int),
getShortLittleEndian(byte[], int)
public static int getIntLittleEndian(byte[] data,
int offset)
byte[] to an int
value. The used byte order is little endian (least significant byte
first).
data - the byte[] from where the int
should be extractedoffset - the position to start reading
int represented by the extracted bytesgetIntBigEndian(byte[], int),
getInt(boolean, byte[], int),
getShort(boolean, byte[], int),
getShortBigEndian(byte[], int),
getShortLittleEndian(byte[], int)
public static int getInt(boolean littleEndian,
byte[] data,
int offs)
byte[] to an int
value. The used byte order depends on the littleEndian
parameter - if true, little endian is used, if false big endian is used.
littleEndian - defines if little or big endian should be used to
convert the byte[]data - the byte[] from where the
int should be extractedoffs - the position to start reading
int represented by the extracted bytesgetIntBigEndian(byte[], int),
getIntLittleEndian(byte[], int),
getShort(boolean, byte[], int),
getShortBigEndian(byte[], int),
getShortLittleEndian(byte[], int)
public static int getShortBigEndian(byte[] data,
int offset)
byte[] to an int
value. The used byte order is big endian (most significant byte first).
data - the byte[] from where the int
should be extractedoffset - the position to start reading
int represented by the extracted bytesgetShortLittleEndian(byte[], int),
getShort(boolean, byte[], int),
getInt(boolean, byte[], int),
getIntBigEndian(byte[], int),
getIntLittleEndian(byte[], int)
public static int getShortLittleEndian(byte[] data,
int offset)
byte[] to an int
value. The used byte order is little endian (least significant byte
first).
data - the byte[] from where the int
should be extractedoffset - the position to start reading
int represented by the extracted bytesgetShortBigEndian(byte[], int),
getShort(boolean, byte[], int),
getInt(boolean, byte[], int),
getIntBigEndian(byte[], int),
getIntLittleEndian(byte[], int)
public static int getShort(boolean littleEndian,
byte[] data,
int offset)
byte[] to an int
value. The used byte order depends on the littleEndian
parameter - if true, little endian is used, if false big endian is used.
littleEndian - defines if little or big endian should be used to
convert the byte[]data - the byte[] from where the
int should be extractedoffset - the position to start reading
int represented by the extracted bytesgetShortBigEndian(byte[], int),
getShortLittleEndian(byte[], int),
getInt(boolean, byte[], int),
getIntBigEndian(byte[], int),
getIntLittleEndian(byte[], int)
public static boolean compare(byte[] data1,
int offset1,
byte[] data2,
int offset2,
int num)
true
if both byte arrays (the compared range) match - false
otherwise.
data1 - the first byte arrayoffset1 - the start position of the first byte arraydata2 - the second byte arrayoffset2 - the start position of the second byte arraynum - the amount of bytes to compare
true if both byte arrays (the compared range)
match - false otherwisepublic static java.lang.String printHex(byte[] data)
data - data to hex dump
public static boolean isIn(long item,
long... items)
item is in a array of items.
Returns true if the item was found, otherwise
false.
item - the item to search foritems - the items to search in
true if the item was found,
otherwise false.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||