Package org.dict.zip
Class DictZipOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.dict.zip.DictZipOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class DictZipOutputStream extends FilterOutputStream
Test of DictZipOutputStream.
-
-
Constructor Summary
Constructors Constructor Description DictZipOutputStream(RandomAccessOutputStream out, int buflen, long size)
Constructor.DictZipOutputStream(RandomAccessOutputStream out, int buflen, long size, int level)
Constructor.DictZipOutputStream(RandomAccessOutputStream out, long size)
Constructor.DictZipOutputStream(RandomAccessOutputStream out, Deflater defl, int inBufferSize, long size, int level)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the output stream.protected void
deflate()
Writes next block of compressed data to the output stream.void
finish()
Finish compression, as same function as GZIPOutputStream.void
write(byte[] b, int off, int len)
Writes an array of bytes to the compressed output stream.void
write(int b)
Writes a byte to the compressed output stream.-
Methods inherited from class java.io.FilterOutputStream
flush, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
DictZipOutputStream
public DictZipOutputStream(RandomAccessOutputStream out, long size) throws IOException, IllegalArgumentException
Constructor.- Parameters:
out
- output stream to filter.size
- total data of test file.- Throws:
IOException
- if I/O error occored.IllegalArgumentException
- if parameter is invalid.
-
DictZipOutputStream
public DictZipOutputStream(RandomAccessOutputStream out, int buflen, long size) throws IOException, IllegalArgumentException
Constructor.- Parameters:
out
- output stream to filter.buflen
- size of buffer to write.size
- total data of test file.- Throws:
IOException
- if I/O error occored.IllegalArgumentException
- if parameter is invalid.
-
DictZipOutputStream
public DictZipOutputStream(RandomAccessOutputStream out, int buflen, long size, int level) throws IOException, IllegalArgumentException
Constructor.- Parameters:
out
- output stream to filter.level
- level of compression, 9=best, 1=fast.buflen
- size of buffer to write.size
- total data of test file.- Throws:
IOException
- if I/O error occored.IllegalArgumentException
- if parameter is invalid.
-
DictZipOutputStream
public DictZipOutputStream(RandomAccessOutputStream out, Deflater defl, int inBufferSize, long size, int level) throws IOException, IllegalArgumentException
Constructor.- Parameters:
out
- output stream to filter.defl
- custom deflater class, should be child of Deflater class.inBufferSize
- size of buffer to write.size
- total data of test file.level
- compression level.- Throws:
IOException
- if I/O error occored.IllegalArgumentException
- if parameter is invalid.
-
-
Method Detail
-
close
public void close() throws IOException
Closes the output stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
- if an I/O error has occurred
-
deflate
protected void deflate() throws IOException
Writes next block of compressed data to the output stream.- Throws:
IOException
- if an I/O error has occurred
-
write
public void write(byte[] b, int off, int len) throws IOException
Writes an array of bytes to the compressed output stream.This method will block until all the bytes are written.
- Overrides:
write
in classFilterOutputStream
- Parameters:
b
- the data to be writtenoff
- the start offset of the datalen
- the length of the data- Throws:
IOException
- if an I/O error has occurred
-
write
public void write(int b) throws IOException
Writes a byte to the compressed output stream.This method will block until the byte can be written.
- Overrides:
write
in classFilterOutputStream
- Parameters:
b
- the byte to be written- Throws:
IOException
- if an I/O error has occurred
-
finish
public final void finish() throws IOException
Finish compression, as same function as GZIPOutputStream.- Throws:
IOException
- if I/O error occured.
-
-