Improve performance of HSLFPictureData#write

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887022 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Marius Volkhart 2021-03-01 00:37:11 +00:00
parent 8ab53c6489
commit a134b9abb3
1 changed files with 3 additions and 13 deletions

View File

@ -237,23 +237,13 @@ public abstract class HSLFPictureData implements PictureData, GenericRecord {
* Write this picture into <code>OutputStream</code> * Write this picture into <code>OutputStream</code>
*/ */
public void write(OutputStream out) throws IOException { public void write(OutputStream out) throws IOException {
byte[] data; LittleEndian.putUShort(getSignature(), out);
data = new byte[LittleEndianConsts.SHORT_SIZE];
LittleEndian.putUShort(data, 0, getSignature());
out.write(data);
data = new byte[LittleEndianConsts.SHORT_SIZE];
PictureType pt = getType(); PictureType pt = getType();
LittleEndian.putUShort(data, 0, pt.nativeId + EscherRecordTypes.BLIP_START.typeID); LittleEndian.putUShort(pt.nativeId + EscherRecordTypes.BLIP_START.typeID, out);
out.write(data);
byte[] rd = getRawData(); byte[] rd = getRawData();
LittleEndian.putInt(rd.length, out);
data = new byte[LittleEndianConsts.INT_SIZE];
LittleEndian.putInt(data, 0, rd.length);
out.write(data);
out.write(rd); out.write(rd);
} }