public class BZip2WritableFile extends Object implements org.entityfs.WritableFile
WritableFile
that transparently compresses the data written
to a file using bzip2 compression.
The bzip2 output stream is opened on a buffered output stream on the backing file. The size of that buffer can be configured.
This file cannot be appended to. The openForAppend
methods throw an
UnsupportedOperationException
.
BZip2ReadableFile
,
GZipWritableFile
,
LzmaWritableFile
,
BZip2OutputStream
Constructor and Description |
---|
BZip2WritableFile(org.entityfs.WritableFile adapted)
Create a new adapter using the default bzip2 block size (900kb).
|
BZip2WritableFile(org.entityfs.WritableFile adapted,
BZip2WritableFileSettings settings)
Create a new adapter using the supplied bzip2 buffer size.
|
BZip2WritableFile(org.entityfs.WritableFile adapted,
CompressionLevel level)
Create a new adapter using the supplied compression level.
|
BZip2WritableFile(org.entityfs.WritableFile adapted,
CompressionLevel level,
boolean writeMagicBytes)
Deprecated.
The magic bytes are always written starting from At4J 1.1.
|
BZip2WritableFile(org.entityfs.WritableFile adapted,
int blockSize,
boolean writeMagicBytes,
int bufferSize)
Deprecated.
The magic bytes are always written starting from At4J 1.1.
|
Modifier and Type | Method and Description |
---|---|
org.entityfs.lock.EntityLock |
getWriteLock() |
boolean |
isWriteLockedByCurrentThread() |
org.entityfs.lock.EntityLock |
lockForWriting() |
WritableByteChannel |
openChannelForAppend()
This method always throws an
UnsupportedOperationException . |
WritableByteChannel |
openChannelForWrite() |
OutputStream |
openForAppend()
This method always throws an
UnsupportedOperationException . |
OutputStream |
openForWrite() |
public BZip2WritableFile(org.entityfs.WritableFile adapted)
Note: Starting with At4J 1.1, the written bzip2 data will be prefixed with the bzip2 stream header "BZ".
adapted
- The writable file to adapt.public BZip2WritableFile(org.entityfs.WritableFile adapted, CompressionLevel level)
Note: Starting with At4J 1.1, the written bzip2 data will be prefixed with the bzip2 stream header "BZ".
adapted
- The writable file to adapt.level
- The compression level.@Deprecated public BZip2WritableFile(org.entityfs.WritableFile adapted, CompressionLevel level, boolean writeMagicBytes)
adapted
- The writable file to adapt.level
- The compression level.writeMagicBytes
- Should the written data be prefixed by the two
magic bytes, "BZ"? Starting with At4J 1.1, this property must be
true
.@Deprecated public BZip2WritableFile(org.entityfs.WritableFile adapted, int blockSize, boolean writeMagicBytes, int bufferSize) throws IllegalArgumentException
adapted
- The writable file to adapt.blockSize
- The size of bzip2 dictionary in 100k units. This must be
a value between 1
and 9
(inclusive). A higher value gives
a higher compression, but it will also make the compression and future
decompressions use more memory.writeMagicBytes
- Should the written data be prefixed by the two
magic bytes, "BZ"? Starting with At4J 1.1, this property must be
true
.bufferSize
- The size of the memory buffer used for buffering the
written output before it is compressed.IllegalArgumentException
- If the block size is less than 1
or greater than 10
, or if the buffer size is less than 1
.public BZip2WritableFile(org.entityfs.WritableFile adapted, BZip2WritableFileSettings settings) throws IllegalArgumentException
adapted
- The writable file to adapt.settings
- Settings. A clone of the settings object is stored in the
created object.IllegalArgumentException
- If the block size is less than 1
or greater than 10
, or if the buffer size is less than 1
.public WritableByteChannel openChannelForAppend() throws UnsupportedOperationException
UnsupportedOperationException
.openChannelForAppend
in interface org.entityfs.WritableFile
UnsupportedOperationException
- Always.public WritableByteChannel openChannelForWrite() throws org.entityfs.lock.WriteLockRequiredException, org.entityfs.security.AccessDeniedException, org.entityfs.exception.ReadOnlyException
openChannelForWrite
in interface org.entityfs.WritableFile
org.entityfs.lock.WriteLockRequiredException
org.entityfs.security.AccessDeniedException
org.entityfs.exception.ReadOnlyException
public OutputStream openForAppend() throws UnsupportedOperationException
UnsupportedOperationException
.openForAppend
in interface org.entityfs.WritableFile
UnsupportedOperationException
- Always.public OutputStream openForWrite() throws org.entityfs.lock.WriteLockRequiredException, org.entityfs.security.AccessDeniedException, org.entityfs.exception.ReadOnlyException
openForWrite
in interface org.entityfs.WritableFile
org.entityfs.lock.WriteLockRequiredException
org.entityfs.security.AccessDeniedException
org.entityfs.exception.ReadOnlyException
public org.entityfs.lock.EntityLock getWriteLock()
getWriteLock
in interface org.entityfs.lock.WriteLockable
public boolean isWriteLockedByCurrentThread()
isWriteLockedByCurrentThread
in interface org.entityfs.lock.WriteLockable
public org.entityfs.lock.EntityLock lockForWriting() throws org.entityfs.exception.LockTimeoutException
lockForWriting
in interface org.entityfs.lock.WriteLockable
org.entityfs.exception.LockTimeoutException