public class BZip2OutputStream extends OutputStream
OutputStream
for bzip2 compressing data.
For more information on the inner workings of bzip2, see the Wikipedia article on bzip2.
This stream is not safe for concurrent access by several writing threads. A client must provide external synchronization to use this from several threads.
BZip2OutputStreamSettings
,
BZip2InputStream
Constructor and Description |
---|
BZip2OutputStream(OutputStream wrapped)
Create a new bzip2 compressing output stream with default settings.
|
BZip2OutputStream(OutputStream wrapped,
BZip2OutputStreamSettings settings)
Create a new bzip2 compressing output stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static BZip2EncoderExecutorService |
createExecutorService()
Create a
BZip2EncoderExecutorService that can be shared between
several BZip2OutputStream :s to spread the bzip2 encoding work
over several threads. |
static BZip2EncoderExecutorService |
createExecutorService(int noThreads)
Create a
BZip2EncoderExecutorService that can be shared between
several BZip2OutputStream :s to spread the bzip2 encoding work
over several threads. |
boolean |
equals(Object o) |
protected void |
finalize()
Close the stream if the client has been sloppy about it.
|
int |
hashCode() |
void |
write(byte[] data) |
void |
write(byte[] data,
int offset,
int len) |
void |
write(int b) |
flush
public BZip2OutputStream(OutputStream wrapped) throws IOException
wrapped
- Compressed data is written to this stream.IOException
- On errors writing the file header.BZip2OutputStream(OutputStream, BZip2OutputStreamSettings)
public BZip2OutputStream(OutputStream wrapped, BZip2OutputStreamSettings settings) throws IOException
wrapped
- Compressed data is written to this stream.settings
- Compression settings.IOException
- On errors writing the file header.BZip2OutputStream(OutputStream)
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] data) throws IOException
write
in class OutputStream
IOException
public void write(byte[] data, int offset, int len) throws IOException, IndexOutOfBoundsException
write
in class OutputStream
IOException
IndexOutOfBoundsException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
protected void finalize() throws Throwable
public static BZip2EncoderExecutorService createExecutorService(int noThreads)
BZip2EncoderExecutorService
that can be shared between
several BZip2OutputStream
:s to spread the bzip2 encoding work
over several threads. The created executor service can be passed to the
BZip2OutputStream
constructor in a
BZip2OutputStreamSettings
object.noThreads
- The number of threads available to the executor.public static BZip2EncoderExecutorService createExecutorService()
BZip2EncoderExecutorService
that can be shared between
several BZip2OutputStream
:s to spread the bzip2 encoding work
over several threads. The created executor service can be passed to the
BZip2OutputStream
constructor in a
BZip2OutputStreamSettings
object.
The created executor will have as many threads available to it as there are CPU:s available to the JVM.