jvm/filesystem/iso9660/ByteParser.java

44 lines
979 B
Java

package filesystem.iso9660;
public class ByteParser {
byte[] array;
int offset;
public ByteParser(byte[] array, int offset) {
this.array = array;
this.offset = offset;
}
public static int shortLE(int i0, int i1) {
return ((i1 << 8)
| (i0 << 0));
}
public static int intLE(int i0, int i1, int i2, int i3) {
return ((i3 << 24)
| (i2 << 16)
| (i1 << 8)
| (i0 << 0));
}
public int getByte(int pos) {
return array[offset + pos];
}
public int getShortLE(int pos) {
int i0 = array[offset + pos + 0];
int i1 = array[offset + pos + 1];
return shortLE(i0, i1);
}
public int getIntLE(int pos) {
int i0 = array[offset + pos + 0];
int i1 = array[offset + pos + 1];
int i2 = array[offset + pos + 2];
int i3 = array[offset + pos + 3];
return intLE(i0, i1, i2, i3);
}
}