@Override public OutputStream getOutputStream(OutputStream outputStream) throws IOException { final DeflaterOutputStream os = new DeflaterOutputStream(outputStream); if (flushMethod == FlushMethod.SYNC_FLUSH) { os.setSyncFlush(true); } return os; } }
public ZOutputStream(OutputStream out, int level, boolean nowrap) throws IOException { super(out); this.out=out; Deflater deflater = new Deflater(level, nowrap); dos = new DeflaterOutputStream(out, deflater); compress=true; }
break; case 1: os = new DeflaterOutputStream(out, new Deflater(gzlevel)); break; case 2: switch (gztype) { case 1: ((DeflaterOutputStream) os).finish(); break; case 2:
public static byte[] processBitmap(Bitmap bmp) throws IOException { Log.d(TAG, "processBitmap 1"); ByteArrayOutputStream bZData = new ByteArrayOutputStream(); DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(bZData, new Deflater(9, 10)); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(deflaterOutputStream); processRgb(bmp, bufferedOutputStream); Log.d(TAG, "processBitmap 2"); bufferedOutputStream.close(); deflaterOutputStream.close(); byte[] zdata = bZData.toByteArray(); ByteArrayOutputStream bOutData = new ByteArrayOutputStream(); bOutData.write('T'); bOutData.write('O'); bOutData.write('I'); bOutData.write('f'); writeTwoBytes(bOutData, bmp.getWidth()); writeTwoBytes(bOutData, bmp.getHeight()); writeFourBytes(bOutData, zdata.length - 6); bOutData.write(zdata, 2, zdata.length - 6); Log.d(TAG, "processBitmap 3"); return bOutData.toByteArray(); }
public void close() throws IOException { if (!closed) { finish(); if (mydeflater){ deflater.end(); } if(close_out) out.close(); closed = true; } }
public void flush() throws IOException { if (syncFlush && !deflater.finished()) { while (true) { int err = deflate(JZlib.Z_SYNC_FLUSH); if (deflater.next_out_index < buffer.length) break; if (err == JZlib.Z_STREAM_END) break; } } out.flush(); }
public void write(int b) throws IOException { buf1[0] = (byte)(b & 0xff); write(buf1, 0, 1); }
public long getTotalOut() { if(compress) return dos.getTotalOut(); else return inflater.total_out; }
public long getTotalIn() { if(compress) return dos.getTotalIn(); else return inflater.total_in; }
public ZOutputStream(OutputStream out, int level, boolean nowrap) throws IOException { super(out); this.out=out; Deflater deflater = new Deflater(level, nowrap); dos = new DeflaterOutputStream(out, deflater); compress=true; }
public synchronized void end() { if(end) return; if(compress){ try { dos.finish(); } catch(Exception e){} } else{ inflater.end(); } end=true; } public void close() throws IOException {
public void finish() throws IOException { while (!deflater.finished()) { deflate(JZlib.Z_FINISH); } }
public void write(int b) throws IOException { buf1[0] = (byte)(b & 0xff); write(buf1, 0, 1); }
public long getTotalOut() { if(compress) return dos.getTotalOut(); else return inflater.total_out; }
public long getTotalIn() { if(compress) return dos.getTotalIn(); else return inflater.total_in; }
@Override public OutputStream getOutputStream(OutputStream outputStream) throws IOException { final DeflaterOutputStream os = new DeflaterOutputStream(outputStream); if (flushMethod == FlushMethod.SYNC_FLUSH) { os.setSyncFlush(true); } return os; } }
public ZOutputStream(OutputStream out, int level, boolean nowrap) throws IOException { super(out); this.out=out; Deflater deflater = new Deflater(level, nowrap); dos = new DeflaterOutputStream(out, deflater); compress=true; }
public void close() throws IOException { if (!closed) { finish(); if (mydeflater){ deflater.end(); } if(close_out) out.close(); closed = true; } }
public void finish() throws IOException { while (!deflater.finished()) { deflate(JZlib.Z_FINISH); } }
public void write(int b) throws IOException { buf1[0] = (byte)(b & 0xff); write(buf1, 0, 1); }