/** * Return the 4 character hex encoded version, as used in file endings */ public String asFileEnding() { return Types.asFileEnding(id); } }
public static String asName(int typeId) { MAPIType type = builtInTypes.get(typeId); if (type != null) { return type.name; } return asCustomName(typeId); }
private void list(ArrayList<MAPIProperty> list, PrintStream out) { for(MAPIProperty attr : list) { String id = Integer.toHexString(attr.id); while(id.length() < 4) { id = "0"+id; } out.println("0x" + id + " - " + attr.name); out.println(" " + attr.id + " - " + Types.asName(attr.usualType) + " (" + attr.usualType + ") - " + attr.mapiProperty); } }
int typeId = Integer.parseInt(ids.substring(4, 8), 16); MAPIType type = Types.getById(typeId); if (type == null) { type = Types.createCustom(typeId);
public static MAPIType createCustom(int typeId) { // Check they're not being silly, and asking for a built-in one... if (getById(typeId) != null) { return getById(typeId); } // Try to get an existing definition of this MAPIType type = customTypes.get(typeId); // If none, do a thread-safe creation if (type == null) { synchronized (customTypes) { type = customTypes.get(typeId); if (type == null) { type = new MAPIType(typeId, -1); } } } return type; } }
MAPIType type = Types.getById(typeId); if (type == null) { type = Types.createCustom(typeId);
MAPIType type = Types.getById(typeID); MAPIProperty prop = MAPIProperty.get(id);
/** * Creates all the chunks for a given Directory, but * doesn't recurse or descend */ protected static void processChunks(DirectoryNode node, ChunkGroup grouping) { for(Entry entry : node) { if(entry instanceof DocumentNode) { process(entry, grouping); } else if(entry instanceof DirectoryNode) { if(entry.getName().endsWith(Types.asFileEnding(Types.DIRECTORY))) { process(entry, grouping); } } } }
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(); } }