From: Maxim Valyanskiy Date: Mon, 19 Sep 2011 12:06:58 +0000 (+0000) Subject: HSLF: support for uncompressed OLE embeddings X-Git-Tag: REL_3_8_BETA5~162 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fcb41adacd3a95c25e3d4008b40d53f698b91ef1;p=poi.git HSLF: support for uncompressed OLE embeddings git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1172583 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 69291355a9..bfcdf5aa45 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -47,6 +47,7 @@ XSLFPowerPointExtractor support for including comment authors with comment text Converted XSLFPowerPointExtractor to use UserModel for all text extraction XSLF initial UserModel support for Notes and Comments for Slides + HSLF: support for uncompressed OLE embeddings 51678 - Extracting text from Bug51524.zip is slow diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java index 4fee85ead1..7e6a7593ba 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java @@ -73,13 +73,21 @@ public class ExOleObjStg extends RecordAtom implements PositionDependentRecord, 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 RecordAtom implements PositionDependentRecord, * @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() {