\r
import java.awt.image.ColorModel;\r
import java.awt.image.IndexColorModel;\r
+import java.io.BufferedOutputStream;\r
import java.io.DataInputStream;\r
import java.io.IOException;\r
import java.io.InputStream;\r
// here we need to inflate the PNG pixel data, which includes alpha, separate the alpha channel\r
// and then deflate it back again\r
ByteArrayOutputStream baos = new ByteArrayOutputStream();\r
- DeflaterOutputStream dos = new DeflaterOutputStream(baos, new Deflater());\r
+ BufferedOutputStream dos = new BufferedOutputStream(new DeflaterOutputStream(baos, new Deflater()));\r
InputStream in = ((ImageRawStream) image).createInputStream();\r
try {\r
InflaterInputStream infStream = new InflaterInputStream(in, new Inflater());\r
int filter;\r
// here we need to inflate the PNG pixel data, which includes alpha, separate the alpha\r
// channel and then deflate the RGB channels back again\r
- DeflaterOutputStream dos = new DeflaterOutputStream(out, new Deflater());\r
+ BufferedOutputStream dos = new BufferedOutputStream(new DeflaterOutputStream(out, new Deflater()));\r
while ((filter = dataStream.read()) != -1) {\r
byte[] bytes = new byte[bytesPerRow];\r
dataStream.readFully(bytes, 0, bytesPerRow);\r