From d8849d8c50acf506d57076c337d9770356f2db34 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 15 Oct 2012 10:28:12 +0000 Subject: [PATCH] Support output to a specified stream git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1398234 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hsmf/dev/HSMFDump.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hsmf/dev/HSMFDump.java b/src/scratchpad/src/org/apache/poi/hsmf/dev/HSMFDump.java index 436298de4..5f72fabf2 100644 --- a/src/scratchpad/src/org/apache/poi/hsmf/dev/HSMFDump.java +++ b/src/scratchpad/src/org/apache/poi/hsmf/dev/HSMFDump.java @@ -19,6 +19,7 @@ package org.apache.poi.hsmf.dev; import java.io.FileInputStream; import java.io.IOException; +import java.io.PrintStream; import org.apache.poi.hsmf.datatypes.Chunk; import org.apache.poi.hsmf.datatypes.ChunkGroup; @@ -38,24 +39,27 @@ public class HSMFDump { } public void dump() throws IOException { + dump(System.out); + } + public void dump(PrintStream out) throws IOException { ChunkGroup[] chunkGroups = POIFSChunkParser.parse(fs); for(ChunkGroup chunks : chunkGroups) { - System.out.println(chunks.getClass().getSimpleName()); + out.println(chunks.getClass().getSimpleName()); for(Chunk chunk : chunks.getChunks()) { MAPIProperty attr = MAPIProperty.get(chunk.getChunkId()); if (chunk instanceof PropertiesChunk) { PropertiesChunk props = (PropertiesChunk)chunk; - System.out.println( + out.println( " Properties - " + props.getProperties().size() + ":" ); for (MAPIProperty prop : props.getProperties().keySet()) { - System.out.println( + out.println( " * " + prop ); for (PropertyValue v : props.getValues(prop)) { - System.out.println( + out.println( " = " + v.toString() ); } @@ -66,15 +70,15 @@ public class HSMFDump { idName = chunk.getChunkId() + " - (unknown)"; } - System.out.println( + out.println( " " + idName + " - " + chunk.getType().getName() ); - System.out.println( + out.println( " " + chunk.toString() ); } } - System.out.println(); + out.println(); } }