|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.biffle.cliff.pearl.Util
Utility functions -- anything I found myself repeating over and over.
| Method Summary | |
static int |
getLEInt(byte[] src,
int offset)
Converts four bytes from an array (representing a little-endian integer) into an int. |
static long |
getLELong(byte[] src,
int offset)
Converts eight bytes from an array (representing a little-endian long) into a long. |
static void |
putLEInt(int value,
byte[] target,
int offset)
Writes an int into a byte array as a little-endian integer. |
static void |
putLELong(long value,
byte[] target,
int offset)
Writes a long into a byte array as a little-endian long. |
static java.lang.String |
ridOfFile(java.io.RandomAccessFile f)
Computes the RID (a sort of quick hash) of a file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static int getLEInt(byte[] src,
int offset)
public static void putLEInt(int value,
byte[] target,
int offset)
public static long getLELong(byte[] src,
int offset)
public static void putLELong(long value,
byte[] target,
int offset)
public static java.lang.String ridOfFile(java.io.RandomAccessFile f)
throws java.io.IOException
if(length of file <= 64k) {
return MD5(file);
} else {
A = MD5(first 64k);
B = MD5(last 64k);
C = MD5(64k starting at (length - 64k)/2);
return A ^ B ^ C;
}
This is probably designed to be an optimization for large files;
it's used by the Karma (and apparently the Empeg before it) to
hash music files.
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||