ASF Bugzilla – Attachment 21967 Details for
Bug 45003
Patch to add function write to all POIDocuments and to process Visio embedds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for issue
HGDFDocument.patch (text/plain), 4.10 KB, created by
Yury Batrakov
on 2008-05-15 04:57:29 UTC
(
hide
)
Description:
patch for issue
Filename:
MIME Type:
Creator:
Yury Batrakov
Created:
2008-05-15 04:57:29 UTC
Size:
4.10 KB
patch
obsolete
>Index: src/java/org/apache/poi/POIDocument.java >=================================================================== >--- src/java/org/apache/poi/POIDocument.java (revision 655041) >+++ src/java/org/apache/poi/POIDocument.java (working copy) >@@ -20,6 +20,7 @@ > import java.io.ByteArrayInputStream; > import java.io.ByteArrayOutputStream; > import java.io.IOException; >+import java.io.OutputStream; > import java.util.Iterator; > import java.util.List; > >@@ -170,6 +171,11 @@ > } > } > >+ public void write(OutputStream out) >+ { >+ System.err.println("Not implemented in this class"); >+ } >+ > /** > * Writes out a given ProperySet > * @param name the (POIFS Level) name of the property to write >Index: src/scratchpad/src/org/apache/poi/hdgf/HDGFDiagram.java >=================================================================== >--- src/scratchpad/src/org/apache/poi/hdgf/HDGFDiagram.java (revision 655041) >+++ src/scratchpad/src/org/apache/poi/hdgf/HDGFDiagram.java (working copy) >@@ -27,6 +27,7 @@ > import org.apache.poi.hdgf.streams.Stream; > import org.apache.poi.hdgf.streams.StringsStream; > import org.apache.poi.hdgf.streams.TrailerStream; >+import org.apache.poi.poifs.filesystem.DirectoryNode; > import org.apache.poi.poifs.filesystem.DocumentEntry; > import org.apache.poi.poifs.filesystem.POIFSFileSystem; > import org.apache.poi.util.LittleEndian; >@@ -53,43 +54,47 @@ > private PointerFactory ptrFactory; > > public HDGFDiagram(POIFSFileSystem fs) throws IOException { >- super(fs); >- >- DocumentEntry docProps = >- (DocumentEntry)filesystem.getRoot().getEntry("VisioDocument"); >+ this(fs.getRoot(), fs); >+ } >+ >+ public HDGFDiagram(DirectoryNode dir, POIFSFileSystem fs) throws IOException { >+ super(fs); > >- // Grab the document stream >- _docstream = new byte[docProps.getSize()]; >- filesystem.createDocumentInputStream("VisioDocument").read(_docstream); >- >- // Read in the common POI streams >- readProperties(); >- >- // Check it's really visio >- String typeString = new String(_docstream, 0, 20); >- if(! typeString.equals(VISIO_HEADER)) { >- throw new IllegalArgumentException("Wasn't a valid visio document, started with " + typeString); >- } >- >- // Grab the version number, 0x1a -> 0x1b >- version = LittleEndian.getShort(_docstream, 0x1a); >- // Grab the document size, 0x1c -> 0x1f >- docSize = LittleEndian.getUInt(_docstream, 0x1c); >- // ??? 0x20 -> 0x23 >- >- // Create the Chunk+Pointer Factories for the document version >- ptrFactory = new PointerFactory(version); >- chunkFactory = new ChunkFactory(version); >- >- // Grab the pointer to the trailer >- trailerPointer = ptrFactory.createPointer(_docstream, 0x24); >- >- // Now grab the trailer >- trailer = (TrailerStream) >- Stream.createStream(trailerPointer, _docstream, chunkFactory, ptrFactory); >- >- // Finally, find all our streams >- trailer.findChildren(_docstream); >+ DocumentEntry docProps = >+ (DocumentEntry)dir.getEntry("VisioDocument"); >+ >+ // Grab the document stream >+ _docstream = new byte[docProps.getSize()]; >+ dir.createDocumentInputStream("VisioDocument").read(_docstream); >+ >+ // Read in the common POI streams >+ readProperties(); >+ >+ // Check it's really visio >+ String typeString = new String(_docstream, 0, 20); >+ if(! typeString.equals(VISIO_HEADER)) { >+ throw new IllegalArgumentException("Wasn't a valid visio document, started with " + typeString); >+ } >+ >+ // Grab the version number, 0x1a -> 0x1b >+ version = LittleEndian.getShort(_docstream, 0x1a); >+ // Grab the document size, 0x1c -> 0x1f >+ docSize = LittleEndian.getUInt(_docstream, 0x1c); >+ // ??? 0x20 -> 0x23 >+ >+ // Create the Chunk+Pointer Factories for the document version >+ ptrFactory = new PointerFactory(version); >+ chunkFactory = new ChunkFactory(version); >+ >+ // Grab the pointer to the trailer >+ trailerPointer = ptrFactory.createPointer(_docstream, 0x24); >+ >+ // Now grab the trailer >+ trailer = (TrailerStream) >+ Stream.createStream(trailerPointer, _docstream, chunkFactory, ptrFactory); >+ >+ // Finally, find all our streams >+ trailer.findChildren(_docstream); > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45003
:
21967
|
21968