loadPffmTable(szPfmTable);
FileInputStream fis = new FileInputStream(szIntTempFile);
ByteBuffer bb = ByteBuffer.allocate(nIntByteSize * 3);
ByteOrder bo = ByteOrder.BIG_ENDIAN;
fis.read(bb.array());
IntBuffer ib = bb.asIntBuffer();
boolean swap = (ib.get(2) < 0 || ib.get(2) > MAX_NUM_CLASS_PRUNERS);
if (swap) {
bo = ByteOrder.LITTLE_ENDIAN;
bb.order(bo);
ib = bb.asIntBuffer();
}
int unicharset_size = ib.get(0);
int NumClasses = ib.get(1);
int NumClassPruners = ib.get(2);
int version_id = 0;
if (NumClasses < 0) {
// handle version id
version_id = -NumClasses;
fis.read(bb.array(), 0, 4);
NumClasses = ib.get(0);
}
//this.ClassPruner.ensureCapacity(NumClassPruners);
bb = ByteBuffer.allocate(nShortByteSize * unicharset_size);
bb.order(bo);
fis.read(bb.array());
ShortBuffer sb = bb.asShortBuffer();
for (int i=0; i<unicharset_size; i++) {
this.IndexFor[i] = sb.get(i);
}
bb = ByteBuffer.allocate(nIntByteSize * NumClasses);
bb.order(bo);
fis.read(bb.array());
ib = bb.asIntBuffer();
for (int i=0; i<NumClasses; i++) {
this.ClassIdFor[i] = ib.get(i);
}
ArrayList<byte[][][][]> ClassPruners = new ArrayList<byte[][][][]>();
for (int i=0; i<NumClassPruners; i++) {
byte[][][][] Pruner =
new byte[NUM_CP_BUCKETS][NUM_CP_BUCKETS][NUM_CP_BUCKETS][];
bb = ByteBuffer.allocate(nIntByteSize * NUM_CP_BUCKETS *
NUM_CP_BUCKETS * NUM_CP_BUCKETS * WERDS_PER_CP_VECTOR);
bb.order(bo);
fis.read(bb.array());
ib = bb.asIntBuffer();
int p = 0;
for (int j=0; j<NUM_CP_BUCKETS; j++) {
for (int k=0; k<NUM_CP_BUCKETS; k++) {
for (int l=0; l<NUM_CP_BUCKETS; l++) {
Pruner[j][k][l] =
new byte[CLASSES_PER_CP];
int nClass = 0;
for (int m=0; m<WERDS_PER_CP_VECTOR; m++) {
int nWord = ib.get(p++);
for (int n=0; n<CLASSES_PER_CP_WERD; n++) {
Pruner[j][k][l][nClass++] = (byte) (nWord & 3);
nWord >>>= 2;
}
}