public void dump() throws IOException { ChunkGroup[] chunkGroups = POIFSChunkParser.parse(fs); for(ChunkGroup chunks : chunkGroups) { System.out.println(chunks.getClass().getSimpleName()); for(Chunk chunk : chunks.getChunks()) { MAPIProperty attr = MAPIProperty.get(chunk.getChunkId()); String idName = attr.id + " - " + attr.name; if(attr == MAPIProperty.UNKNOWN) { idName = chunk.getChunkId() + " - (unknown)"; } System.out.println( " " + idName + " - " + Types.asName(chunk.getType()) ); System.out.println( " " + chunk.toString() ); } System.out.println(); } }
/** * Called once the parent ChunkGroup has been populated, to match up the * Chunks in it with our Variable Sized Properties. */ protected void matchVariableSizedPropertiesToChunks() { // Index the Parent Group chunks for easy lookup // TODO Is this the right way? Map<Integer, Chunk> chunks = new HashMap<>(); for (Chunk chunk : parentGroup.getChunks()) { chunks.put(chunk.getChunkId(), chunk); } // Loop over our values, looking for chunk based ones for (PropertyValue val : properties.values()) { if (val instanceof ChunkBasedPropertyValue) { ChunkBasedPropertyValue cVal = (ChunkBasedPropertyValue) val; Chunk chunk = chunks.get(cVal.getProperty().id); // System.err.println(cVal.getProperty() + " = " + cVal + " -> " // + HexDump.toHex(cVal.data)); // TODO Make sense of the raw offset value if (chunk != null) { cVal.setValue(chunk); } else { logger.log(POILogger.WARN, "No chunk found matching Property " + cVal); } } } }
for(ChunkGroup chunks : chunkGroups) { out.println(chunks.getClass().getSimpleName()); for(Chunk chunk : chunks.getChunks()) { MAPIProperty attr = MAPIProperty.get(chunk.getChunkId());