76 |
* <code>def.deflate()</code> until all bytes from the input buffers |
* <code>def.deflate()</code> until all bytes from the input buffers |
77 |
* are processed. |
* are processed. |
78 |
*/ |
*/ |
79 |
protected void deflate() throws IOException |
protected void deflate () throws IOException |
80 |
{ |
{ |
81 |
while (! def.needsInput()) |
while (! def.needsInput()) |
82 |
{ |
{ |
97 |
* default buffer size. |
* default buffer size. |
98 |
* @param out the output stream where deflated output should be written. |
* @param out the output stream where deflated output should be written. |
99 |
*/ |
*/ |
100 |
public DeflaterOutputStream(OutputStream out) |
public DeflaterOutputStream (OutputStream out) |
101 |
{ |
{ |
102 |
this(out, new Deflater(), 512); |
this (out, new Deflater (), 512); |
103 |
} |
} |
104 |
|
|
105 |
/** |
/** |
108 |
* @param out the output stream where deflated output should be written. |
* @param out the output stream where deflated output should be written. |
109 |
* @param defl the underlying deflater. |
* @param defl the underlying deflater. |
110 |
*/ |
*/ |
111 |
public DeflaterOutputStream(OutputStream out, Deflater defl) |
public DeflaterOutputStream (OutputStream out, Deflater defl) |
112 |
{ |
{ |
113 |
this(out, defl, 512); |
this (out, defl, 512); |
114 |
} |
} |
115 |
|
|
116 |
/** |
/** |
123 |
*/ |
*/ |
124 |
public DeflaterOutputStream(OutputStream out, Deflater defl, int bufsize) |
public DeflaterOutputStream(OutputStream out, Deflater defl, int bufsize) |
125 |
{ |
{ |
126 |
super(out); |
super (out); |
127 |
if (bufsize <= 0) |
if (bufsize <= 0) |
128 |
throw new IllegalArgumentException("bufsize <= 0"); |
throw new IllegalArgumentException("bufsize <= 0"); |
129 |
buf = new byte[bufsize]; |
buf = new byte[bufsize]; |
148 |
* was the only way to ensure that all bytes are flushed in Sun's |
* was the only way to ensure that all bytes are flushed in Sun's |
149 |
* JDK. |
* JDK. |
150 |
*/ |
*/ |
151 |
public void finish() throws IOException |
public void finish () throws IOException |
152 |
{ |
{ |
153 |
def.finish(); |
def.finish(); |
154 |
while (! def.finished()) |
while (! def.finished ()) |
155 |
{ |
{ |
156 |
int len = def.deflate(buf, 0, buf.length); |
int len = def.deflate(buf, 0, buf.length); |
157 |
if (len <= 0) |
if (len <= 0) |