You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ma...@apache.org on 2011/09/19 14:06:58 UTC

svn commit: r1172583 - in /poi/trunk/src: documentation/content/xdocs/status.xml scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java

Author: maxcom
Date: Mon Sep 19 12:06:58 2011
New Revision: 1172583

URL: http://svn.apache.org/viewvc?rev=1172583&view=rev
Log:
HSLF: support for uncompressed OLE embeddings

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1172583&r1=1172582&r2=1172583&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Mon Sep 19 12:06:58 2011
@@ -47,6 +47,7 @@
            <action dev="poi-developers" type="add">XSLFPowerPointExtractor support for including comment authors with comment text</action>
            <action dev="poi-developers" type="fix">Converted XSLFPowerPointExtractor to use UserModel for all text extraction</action>
            <action dev="poi-developers" type="add">XSLF initial UserModel support for Notes and Comments for Slides</action>
+           <action dev="poi-developers" type="add">HSLF: support for uncompressed OLE embeddings</action>
         </release>
         <release version="3.8-beta4" date="2011-08-26">
            <action dev="poi-developers" type="fix">51678 - Extracting text from Bug51524.zip is slow</action>

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java?rev=1172583&r1=1172582&r2=1172583&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java Mon Sep 19 12:06:58 2011
@@ -73,13 +73,21 @@ public class ExOleObjStg extends RecordA
         System.arraycopy(source,start+8,_data,0,len-8);
     }
 
+    public boolean isCompressed() {
+        return LittleEndian.getShort(_header, 0)!=0;
+    }
+
     /**
      * Gets the uncompressed length of the data.
      *
      * @return the uncompressed length of the data.
      */
     public int getDataLength() {
-        return LittleEndian.getInt(_data, 0);
+        if (isCompressed()) {
+            return LittleEndian.getInt(_data, 0);
+        } else {
+            return _data.length;
+        }
     }
 
     /**
@@ -88,8 +96,12 @@ public class ExOleObjStg extends RecordA
      * @return the data input stream.
      */
     public InputStream getData() {
-        InputStream compressedStream = new ByteArrayInputStream(_data, 4, _data.length);
-        return new InflaterInputStream(compressedStream);
+        if (isCompressed()) {
+            InputStream compressedStream = new ByteArrayInputStream(_data, 4, _data.length);
+            return new InflaterInputStream(compressedStream);
+        } else {
+            return new ByteArrayInputStream(_data, 0, _data.length);
+        }
     }
 
     public byte[] getRawData() {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org