HSLF: support for uncompressed OLE embeddings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1172583 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maxim Valyanskiy 2011-09-19 12:06:58 +00:00
parent 29f7fe9eb2
commit fcb41adacd
2 changed files with 16 additions and 3 deletions

View File

@ -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>

View File

@ -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() {
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() {
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() {