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 2cd1847dd4
commit da5a8477e8
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="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="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">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>
<release version="3.8-beta4" date="2011-08-26"> <release version="3.8-beta4" date="2011-08-26">
<action dev="poi-developers" type="fix">51678 - Extracting text from Bug51524.zip is slow</action> <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); 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. * Gets the uncompressed length of the data.
* *
* @return the uncompressed length of the data. * @return the uncompressed length of the data.
*/ */
public int getDataLength() { 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. * @return the data input stream.
*/ */
public InputStream getData() { public InputStream getData() {
InputStream compressedStream = new ByteArrayInputStream(_data, 4, _data.length); if (isCompressed()) {
return new InflaterInputStream(compressedStream); InputStream compressedStream = new ByteArrayInputStream(_data, 4, _data.length);
return new InflaterInputStream(compressedStream);
} else {
return new ByteArrayInputStream(_data, 0, _data.length);
}
} }
public byte[] getRawData() { public byte[] getRawData() {