Implement the load method on MemoryPackagePart
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1086909 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5addb68f08
commit
44ea0035a6
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.8-beta2" date="2011-??-??">
|
<release version="3.8-beta2" date="2011-??-??">
|
||||||
|
<action dev="poi-developers" type="add">Implement the load method on MemoryPackagePart</action>
|
||||||
<action dev="poi-developers" type="add">50967 - Support for continued ExtSSTRecords</action>
|
<action dev="poi-developers" type="add">50967 - Support for continued ExtSSTRecords</action>
|
||||||
<action dev="poi-developers" type="add">48968 - Support for HOUR, MINUTE and SECOND date formulas</action>
|
<action dev="poi-developers" type="add">48968 - Support for HOUR, MINUTE and SECOND date formulas</action>
|
||||||
<action dev="poi-developers" type="add">Added NPOIFS constructors to most POIDocument classes and their extractors, and more widely deprecated the Document(DirectoryNode, POIFSFileSystem) constructor in favour of the more general Document(DirectoryNode) one</action>
|
<action dev="poi-developers" type="add">Added NPOIFS constructors to most POIDocument classes and their extractors, and more widely deprecated the Document(DirectoryNode, POIFSFileSystem) constructor in favour of the more general Document(DirectoryNode) one</action>
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
package org.apache.poi.openxml4j.opc.internal;
|
package org.apache.poi.openxml4j.opc.internal;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
@ -27,6 +29,7 @@ import org.apache.poi.openxml4j.opc.OPCPackage;
|
|||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePartName;
|
import org.apache.poi.openxml4j.opc.PackagePartName;
|
||||||
import org.apache.poi.openxml4j.opc.internal.marshallers.ZipPartMarshaller;
|
import org.apache.poi.openxml4j.opc.internal.marshallers.ZipPartMarshaller;
|
||||||
|
import org.apache.poi.util.IOUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memory version of a package part. Use to
|
* Memory version of a package part. Use to
|
||||||
@ -111,7 +114,20 @@ public final class MemoryPackagePart extends PackagePart {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean load(InputStream ios) throws InvalidFormatException {
|
public boolean load(InputStream ios) throws InvalidFormatException {
|
||||||
throw new InvalidFormatException("Method not implemented");
|
// Grab the data
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
|
IOUtils.copy(ios, baos);
|
||||||
|
} catch(IOException e) {
|
||||||
|
throw new InvalidFormatException(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save it
|
||||||
|
data = baos.toByteArray();
|
||||||
|
length = data.length;
|
||||||
|
|
||||||
|
// All done
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user