Hi,
this is my firtst mail to a mailing list.
I asumed that just copy via streaming would consume only little memory. Why
do i get 750m ram consumption for a 12m file?
Is there any way to replace a Sheet in a Workbook without consuming tons of
memory?
try (OPCPackage pkg = OPCPackage.open (sourceFilename,
PackageAccess.READ)) {
PackagePart srcPart = getPackagePart(pkg, sheetName);
try (OPCPackage dest = OPCPackage.open(destFilename)) {
PackagePart destPart = getPackagePart(dest, sheetName);
try (OutputStream os = destPart.getOutputStream();
InputStream is = srcPart.getInputStream()) {
byte buf[] = new byte[1024];
for (int readBytes; (readBytes = is.read(buf)) != -1;
os.write(buf, 0, readBytes))
os.flush();
;
}
}
}
regards,
Jan