public static org.apache.poi.hdgf.chunks.ChunkHeader | createChunkHeader(int documentVersion, byte[] data, int offset)Creates the appropriate ChunkHeader for the Chunk Header at
the given location, for the given document version.
if(documentVersion >= 6) {
ChunkHeaderV6 ch;
if(documentVersion > 6) {
ch = new ChunkHeaderV11();
} else {
ch = new ChunkHeaderV6();
}
ch.type = (int)LittleEndian.getUInt(data, offset + 0);
ch.id = (int)LittleEndian.getUInt(data, offset + 4);
ch.unknown1 = (int)LittleEndian.getUInt(data, offset + 8);
ch.length = (int)LittleEndian.getUInt(data, offset + 12);
ch.unknown2 = LittleEndian.getShort(data, offset + 16);
ch.unknown3 = (short)LittleEndian.getUnsignedByte(data, offset + 18);
return ch;
} else if(documentVersion == 5) {
throw new RuntimeException("TODO");
} else {
throw new IllegalArgumentException("Visio files with versions below 5 are not supported, yours was " + documentVersion);
}
|