From 36d74af3e4d2d1cb04fb415cebf198f53f6579ee Mon Sep 17 00:00:00 2001 From: "Andrew C. Oliver" Date: Sat, 23 Mar 2002 23:35:21 +0000 Subject: [PATCH] Started work PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352267 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hdf/model/HDFObjectFactory.java | 47 +++++++++++++++---- src/targets/interactive.xtarget | 1 + src/types/styles/hdftype.xsl | 20 +------- 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java b/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java index ba7f5c30e..251d73e6e 100644 --- a/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java +++ b/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java @@ -7,10 +7,18 @@ package org.apache.poi.hdf.model; -import java.io.*; +//import java.io; + +import java.util.ArrayList; +import java.io.InputStream; +import java.io.IOException; +import java.util.List; +import java.util.TreeSet; + import org.apache.poi.hdf.model.hdftypes.*; -import org.apache.poi.hdf.model.util.*; +//import org.apache.poi.hdf.model.util.*; + import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSDocument; import org.apache.poi.poifs.filesystem.DocumentEntry; @@ -41,13 +49,14 @@ public class HDFObjectFactory private FontTable _fonts; /** text pieces */ - BTreeSet _text = new BTreeSet(); + //BTreeSet _text = new BTreeSet(); + TreeSet _text = new TreeSet(); /** document sections */ - BTreeSet _sections = new BTreeSet(); + TreeSet _sections = new TreeSet(); /** document paragraphs */ - BTreeSet _paragraphs = new BTreeSet(); + TreeSet _paragraphs = new TreeSet(); /** document character runs */ - BTreeSet _characterRuns = new BTreeSet(); + TreeSet _characterRuns = new TreeSet(); /** main document stream buffer*/ byte[] _mainDocument; @@ -78,9 +87,31 @@ public class HDFObjectFactory initTextPieces(); initFormattingProperties(); - istream.close(); - } + + public static List getTypes(InputStream istream) throws IOException + { + List results = new ArrayList(1); + + //do Ole stuff + POIFSFileSystem filesystem = new POIFSFileSystem(istream); + + DocumentEntry headerProps = + (DocumentEntry)filesystem.getRoot().getEntry("WordDocument"); + + byte[] mainDocument = new byte[headerProps.getSize()]; + filesystem.createDocumentInputStream("WordDocument").read(mainDocument); + + FileInformationBlock fib = new FileInformationBlock(mainDocument); + + // initTableStream(); + // initTextPieces(); + // initFormattingProperties(); + + results.add(fib); + return results; + } + /** * Initializes the table stream * diff --git a/src/targets/interactive.xtarget b/src/targets/interactive.xtarget index d6413bcce..3dce9949d 100644 --- a/src/targets/interactive.xtarget +++ b/src/targets/interactive.xtarget @@ -24,6 +24,7 @@ + Please select a target diff --git a/src/types/styles/hdftype.xsl b/src/types/styles/hdftype.xsl index 95a173348..091b89bfb 100644 --- a/src/types/styles/hdftype.xsl +++ b/src/types/styles/hdftype.xsl @@ -79,7 +79,7 @@ import org.apache.poi.hdf.model.hdftypes.HDFType; public class Type implements HDFType { - public final static short sid = ; + private ; @@ -110,18 +110,6 @@ public class Type return buffer.toString(); } - public int serialize(int offset, byte[] data) - { - LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, (short)(getSize() - 4)); - - - - - - return getSize(); - } - /** * Size of record (exluding 4 byte header) */ @@ -134,10 +122,6 @@ public class Type ; } - public short getSid() - { - return this.sid; - } @@ -172,7 +156,7 @@ public class Type - private BitField = new BitField(); + private BitField = new BitField(); public final static = ;