Return-Path: Delivered-To: apmail-poi-commits-archive@locus.apache.org Received: (qmail 56444 invoked from network); 17 Aug 2008 16:37:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Aug 2008 16:37:02 -0000 Received: (qmail 60246 invoked by uid 500); 17 Aug 2008 16:37:01 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 60212 invoked by uid 500); 17 Aug 2008 16:37:01 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 60203 invoked by uid 99); 17 Aug 2008 16:37:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Aug 2008 09:37:01 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Aug 2008 16:36:12 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A3BEA2388988; Sun, 17 Aug 2008 09:36:41 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r686621 - in /poi/trunk/src: java/org/apache/poi/poifs/dev/POIFSLister.java scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java Date: Sun, 17 Aug 2008 16:36:41 -0000 To: commits@poi.apache.org From: nick@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080817163641.A3BEA2388988@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nick Date: Sun Aug 17 09:36:40 2008 New Revision: 686621 URL: http://svn.apache.org/viewvc?rev=686621&view=rev Log: Few little tweaks to dev helpers Modified: poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java Modified: poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java?rev=686621&r1=686620&r2=686621&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java Sun Aug 17 09:36:40 2008 @@ -45,37 +45,54 @@ System.exit(1); } - for (int j = 0; j < args.length; j++) - { - viewFile(args[ j ]); + boolean withSizes = false; + for (int j = 0; j < args.length; j++) { + if(args[j].equalsIgnoreCase("-size") || + args[j].equalsIgnoreCase("-sizes")) { + withSizes = true; + } else { + viewFile(args[j], withSizes); + } } } - public static void viewFile(final String filename) throws IOException + public static void viewFile(final String filename, boolean withSizes) throws IOException { POIFSFileSystem fs = new POIFSFileSystem( new FileInputStream(filename) ); - displayDirectory(fs.getRoot(), ""); + displayDirectory(fs.getRoot(), "", withSizes); } - public static void displayDirectory(DirectoryNode dir, String indent) { + public static void displayDirectory(DirectoryNode dir, String indent, boolean withSizes) { System.out.println(indent + dir.getName() + " -"); String newIndent = indent + " "; + boolean hadChildren = false; for(Iterator it = dir.getEntries(); it.hasNext(); ) { + hadChildren = true; Object entry = it.next(); if(entry instanceof DirectoryNode) { - displayDirectory((DirectoryNode)entry, newIndent); + displayDirectory((DirectoryNode)entry, newIndent, withSizes); } else { DocumentNode doc = (DocumentNode)entry; String name = doc.getName(); + String size = ""; if(name.charAt(0) < 10) { String altname = "(0x0" + (int)name.charAt(0) + ")" + name.substring(1); name = name.substring(1) + " <" + altname + ">"; } - System.out.println(newIndent + name); + if(withSizes) { + size = " [" + + doc.getSize() + " / 0x" + + Integer.toHexString(doc.getSize()) + + "]"; + } + System.out.println(newIndent + name + size); } } + if(!hadChildren) { + System.out.println(newIndent + "(no children)"); + } } } \ No newline at end of file Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java?rev=686621&r1=686620&r2=686621&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java Sun Aug 17 09:36:40 2008 @@ -66,12 +66,12 @@ dump.dumpContents(); dump.dumpEnvelope(); dump.dumpEscher(); + dump.dump001CompObj(dump.fs.getRoot()); + dump.dumpQuill(); // Still to go: // (0x03)Internal - // (0x01)CompObj // Objects - // Quill } /** @@ -126,5 +126,55 @@ System.out.println(""); System.out.println("Contents - " + data.length + " bytes long:"); + + // 8 bytes, always seems to be + // E8 AC 2C 00 E8 03 05 01 + // E8 AC 2C 00 E8 03 05 01 + + // 4 bytes - size of contents + // 13/15 00 00 01 + + // .... + + // E8 03 08 08 0C 20 03 00 00 00 00 88 16 00 00 00 ..... .......... + + // 01 18 27 00 03 20 00 00 E8 03 08 08 0C 20 03 00 ..'.. ....... .. + + // 01 18 30 00 03 20 00 00 + // E8 03 06 08 07 08 08 08 09 10 01 00 0C 20 04 00 + // 00 00 00 88 1E 00 00 00 + + // 01 18 31 00 03 20 00 00 + // E8 03 06 08 07 08 08 08 09 10 01 00 0C 20 04 00 + // 00 00 00 88 1E 00 00 00 + + // 01 18 32 00 03 20 00 00 + // E8 03 06 08 07 08 08 08 09 10 01 00 0C 20 04 00 + // 00 00 00 88 1E 00 00 00 + } + + public void dumpCONTENTS(DirectoryNode dir) throws IOException { + byte[] data = getData(dir, "CONTENTS"); + + System.out.println(""); + System.out.println("CONTENTS - " + data.length + " bytes long:"); + + // Dump out up to 0x200 + + // Text from 0x200 onwards for a bit + } + + protected void dump001CompObj(DirectoryNode dir) { + // TODO + } + + public void dumpQuill() throws IOException { + DirectoryNode quillDir = (DirectoryNode) + fs.getRoot().getEntry("Quill"); + DirectoryNode quillSubDir = (DirectoryNode) + quillDir.getEntry("QuillSub"); + + dump001CompObj(quillSubDir); + dumpCONTENTS(quillSubDir); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org