org.schmant.task.at4j.bzip2
Class BZip2NewWritableFileProxy

java.lang.Object
  extended by org.schmant.task.at4j.bzip2.AbstractBZip2WritableFileProxy
      extended by org.schmant.task.at4j.bzip2.BZip2NewWritableFileProxy
All Implemented Interfaces:
Lockable, WriteLockable, WritableFile, NewWritableFile

public class BZip2NewWritableFileProxy
extends AbstractBZip2WritableFileProxy
implements NewWritableFile

This proxy bzip2 encodes data written to another WritableFile. The file is created the first time that it is requested. This proxy can be used together with the ArgumentInterpreter.

The proxy uses an OverwriteStrategy to decide what to do if it finds an already existing entity where it wants to create the file.

The difference between this object and the BZip2WritableFile is that this object uses the ArgumentInterpreter for interpreting the proxied file object.

The proxied object is interpreted using InterpretAsNewWritableFileStrategy.

Since:
0.8
Author:
Karl Gustafsson
See Also:
GZipNewWritableFileProxy, LzmaNewWritableFileProxy, BZip2ExistingWritableFileProxy, BZip2ReadableFileProxy
Task_package:
org.at4j

Constructor Summary
BZip2NewWritableFileProxy(Object proxied)
          Create a new bzip2 writable file proxy.
BZip2NewWritableFileProxy(Object proxied, BZip2WritableFileSettings settings)
          Create a new bzip2 writable file proxy.
BZip2NewWritableFileProxy(Object proxied, BZip2WritableFileSettings settings, OverwriteStrategy overwriteStrategy)
          Create a new bzip2 writable file proxy.
BZip2NewWritableFileProxy(Object proxied, OverwriteStrategy overwriteStrategy)
          Create a new bzip2 writable file proxy.
BZip2NewWritableFileProxy(Object proxied, OverwriteStrategy overwriteStrategy, CompressionLevel level, boolean writeFileHeader)
          Deprecated. 
BZip2NewWritableFileProxy(Object proxied, OverwriteStrategy overwriteStrategy, int blockSize, boolean writeFileHeader)
          Deprecated. 
 
Method Summary
protected  WritableFile getFileFromArgumentInterpreter(Object proxied)
           
 
Methods inherited from class org.schmant.task.at4j.bzip2.AbstractBZip2WritableFileProxy
getFile, getWriteLock, isWriteLockedByCurrentThread, lockForWriting, openChannelForAppend, openChannelForWrite, openForAppend, openForWrite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.entityfs.WritableFile
openChannelForAppend, openChannelForWrite, openForAppend, openForWrite
 
Methods inherited from interface org.entityfs.lock.WriteLockable
getWriteLock, isWriteLockedByCurrentThread, lockForWriting
 

Constructor Detail

BZip2NewWritableFileProxy

public BZip2NewWritableFileProxy(Object proxied)
Create a new bzip2 writable file proxy. The proxy will use the default bzip2 block size (900kb) and write the bzip2 file header. It will use the default overwrite strategy DontOverwriteAndThrowException.

Parameters:
proxied - The proxied object. This will be interpreted into a new writable file when the client writes to the proxy.
Since:
1.1

BZip2NewWritableFileProxy

public BZip2NewWritableFileProxy(Object proxied,
                                 OverwriteStrategy overwriteStrategy)
Create a new bzip2 writable file proxy. The proxy will use the default bzip2 block size (900kb) and write the bzip2 file header.

Parameters:
proxied - The proxied object. This will be interpreted into a new writable file when the client writes to the proxy.
overwriteStrategy - The overwrite strategy to use if an entity already exists in the target file's location.

BZip2NewWritableFileProxy

public BZip2NewWritableFileProxy(Object proxied,
                                 BZip2WritableFileSettings settings)
Create a new bzip2 writable file proxy. The proxy will use the bzip2 settings from the supplied settings object. It will use the default overwrite strategy DontOverwriteAndThrowException.

Parameters:
proxied - The proxied object. This will be interpreted into a new writable file when the client writes to the proxy.
settings - The bzip2 settings. The settings object is cloned by the created proxy.
Since:
1.1

BZip2NewWritableFileProxy

public BZip2NewWritableFileProxy(Object proxied,
                                 BZip2WritableFileSettings settings,
                                 OverwriteStrategy overwriteStrategy)
Create a new bzip2 writable file proxy. The proxy will use the bzip2 settings from the supplied settings object.

Parameters:
proxied - The proxied object. This will be interpreted into a new writable file when the client writes to the proxy.
settings - The bzip2 settings. The settings object is cloned by the created proxy.
overwriteStrategy - The overwrite strategy to use if an entity already exists in the target file's location.
Since:
1.0.1

BZip2NewWritableFileProxy

@Deprecated
public BZip2NewWritableFileProxy(Object proxied,
                                            OverwriteStrategy overwriteStrategy,
                                            int blockSize,
                                            boolean writeFileHeader)
                          throws IllegalArgumentException
Deprecated. 

Create a new bzip2 writable file proxy for the proxied object. The proxy will use the supplied bzip2 block size.

Parameters:
proxied - The proxied object.
overwriteStrategy - The overwrite strategy to use if an entity already exists in the target file's location.
blockSize - The bzip2 block size, in 100kb increments.
writeFileHeader - This property is deprecated and is now always true.
Throws:
IllegalArgumentException - If the block size is not between 1 and 9 (inclusive).

BZip2NewWritableFileProxy

@Deprecated
public BZip2NewWritableFileProxy(Object proxied,
                                            OverwriteStrategy overwriteStrategy,
                                            CompressionLevel level,
                                            boolean writeFileHeader)
Deprecated. 

Create a new bzip2 writable file proxy for the proxied object. The proxy will use the supplied compression level.

Parameters:
proxied - The proxied object.
overwriteStrategy - The overwrite strategy to use if an entity already exists in the target file's location.
level - The compression level.
writeFileHeader - This property is deprecated and is now always true.
Since:
1.0
Method Detail

getFileFromArgumentInterpreter

protected WritableFile getFileFromArgumentInterpreter(Object proxied)
Specified by:
getFileFromArgumentInterpreter in class AbstractBZip2WritableFileProxy