added a set accessor for embedded ole data
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@656699 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8cd5e9d411
commit
193ac0db79
@ -90,8 +90,18 @@ public class ExOleObjStg extends RecordAtom implements PersistRecord {
|
|||||||
return new InflaterInputStream(compressedStream);
|
return new InflaterInputStream(compressedStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(byte[] data) throws IOException {
|
/**
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream(data.length);
|
* Sets the embedded data.
|
||||||
|
*
|
||||||
|
* @param data the embedded data.
|
||||||
|
*/
|
||||||
|
public void setData(byte[] data) throws IOException {
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
//first four bytes is the length of the raw data
|
||||||
|
byte[] b = new byte[4];
|
||||||
|
LittleEndian.putInt(b, data.length);
|
||||||
|
out.write(b);
|
||||||
|
|
||||||
DeflaterOutputStream def = new DeflaterOutputStream(out);
|
DeflaterOutputStream def = new DeflaterOutputStream(out);
|
||||||
def.write(data, 0, data.length);
|
def.write(data, 0, data.length);
|
||||||
def.finish();
|
def.finish();
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package org.apache.poi.hslf.usermodel;
|
package org.apache.poi.hslf.usermodel;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.poi.hslf.record.ExOleObjStg;
|
import org.apache.poi.hslf.record.ExOleObjStg;
|
||||||
|
|
||||||
@ -49,6 +50,15 @@ public class ObjectData {
|
|||||||
return storage.getData();
|
return storage.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the embedded data.
|
||||||
|
*
|
||||||
|
* @param data the embedded data.
|
||||||
|
*/
|
||||||
|
public void setData(byte[] data) throws IOException {
|
||||||
|
storage.setData(data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the record that contains the object data.
|
* Return the record that contains the object data.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user