use of org.apache.poi.util.LittleEndianInput in project poi by apache.
the class TestArrayPtg method confirmOperandClassDecoding.
private static void confirmOperandClassDecoding(byte operandClass) {
byte[] fullData = concat(ENCODED_PTG_DATA, ENCODED_CONSTANT_DATA);
// Force encoded operand class for tArray
fullData[0] = (byte) (ArrayPtg.sid + operandClass);
LittleEndianInput in = TestcaseRecordInputStream.createLittleEndian(fullData);
Ptg[] ptgs = Ptg.readTokens(ENCODED_PTG_DATA.length, in);
assertEquals(1, ptgs.length);
ArrayPtg aPtg = (ArrayPtg) ptgs[0];
assertEquals(operandClass, aPtg.getPtgClass());
}
use of org.apache.poi.util.LittleEndianInput in project poi by apache.
the class TestAttrPtg method testReserializeAttrChoose.
/**
* Fix for bug visible around svn r706772.
*/
public void testReserializeAttrChoose() {
byte[] data = HexRead.readFromString("19, 04, 03, 00, 08, 00, 11, 00, 1A, 00, 23, 00");
LittleEndianInput in = TestcaseRecordInputStream.createLittleEndian(data);
Ptg[] ptgs = Ptg.readTokens(data.length, in);
byte[] data2 = new byte[data.length];
try {
Ptg.serializePtgs(ptgs, data2, 0);
} catch (ArrayIndexOutOfBoundsException e) {
throw new AssertionFailedError("incorrect re-serialization of tAttrChoose");
}
assertArrayEquals(data, data2);
}
Aggregations