public abstract Object unpack(Info info, csBuffer buffer);
override public Object unpack(Info vi, csBuffer opb) { int count = 0, maxclass = -1, rangebits; InfoFloor1 info = new InfoFloor1(); /* read partitions */ info.partitions = opb.read(5); /* only 0 to 31 legal */ for (int j = 0; j < info.partitions; j++) { info.partitionclass[j] = opb.read(4); /* only 0 to 15 legal */ if (maxclass < info.partitionclass[j]) { maxclass = info.partitionclass[j]; } } /* read partition classes */ for (int j = 0; j < maxclass + 1; j++) { info.class_dim[j] = opb.read(3) + 1; /* 1 to 8 */ info.class_subs[j] = opb.read(2); /* 0,1,2,3 bits */ if (info.class_subs[j] < 0) { //goto err_out; info.free(); return(null); } if (info.class_subs[j] != 0) { info.class_book[j] = opb.read(8); } if (info.class_book[j] < 0 || info.class_book[j] >= vi.books) { //goto err_out; info.free(); return(null); } for (int k = 0; k < (1 << info.class_subs[j]); k++) { info.class_subbook[j][k] = opb.read(8) - 1; if (info.class_subbook[j][k] < -1 || info.class_subbook[j][k] >= vi.books) { //goto err_out; info.free(); return(null); } } } /* read the post list */ info.mult = opb.read(2) + 1; /* only 1,2,3,4 legal now */ rangebits = opb.read(4); for (int j = 0, k = 0; j < info.partitions; j++) { count += info.class_dim[info.partitionclass[j]]; for (; k < count; k++) { int t = info.postlist[k + 2] = opb.read(rangebits); if (t < 0 || t >= (1 << rangebits)) { //goto err_out; info.free(); return(null); } } } info.postlist[0] = 0; info.postlist[1] = 1 << rangebits; return(info); // err_out: // info.free(); // return(null); }
public abstract void pack(Info info, Object imap, csBuffer buffer);