org.schmant.arg
Class GZipNewWritableFileProxy

java.lang.Object
  extended by org.schmant.arg.AbstractGZipWritableFileProxy
      extended by org.schmant.arg.GZipNewWritableFileProxy
All Implemented Interfaces:
Lockable, WriteLockable, WritableFile, NewWritableFile

public class GZipNewWritableFileProxy
extends AbstractGZipWritableFileProxy
implements NewWritableFile

This proxy gzip 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 GZipWritableFile 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:
BZip2NewWritableFileProxy, LzmaNewWritableFileProxy, GZipExistingWritableFileProxy, GZipReadableFileProxy

Constructor Summary
GZipNewWritableFileProxy(Object proxied)
          Create a new gzip writable file proxy for the proxied object.
GZipNewWritableFileProxy(Object proxied, int bufSize)
          Create a new gzip writable file proxy for the proxied object.
GZipNewWritableFileProxy(Object proxied, OverwriteStrategy overwriteStrategy)
          Create a new gzip writable file proxy for the proxied object.
GZipNewWritableFileProxy(Object proxied, OverwriteStrategy overwriteStrategy, int bufSize)
          Create a new gzip writable file proxy for the proxied object.
 
Method Summary
protected  WritableFile getFileFromArgumentInterpreter(Object proxied)
           
 
Methods inherited from class org.schmant.arg.AbstractGZipWritableFileProxy
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

GZipNewWritableFileProxy

public GZipNewWritableFileProxy(Object proxied)
Create a new gzip writable file proxy for the proxied object. The proxy will use the default gzip buffer size and the overwrite strategy DontOverwriteAndThrowException.

Parameters:
proxied - The proxied object
Since:
1.1

GZipNewWritableFileProxy

public GZipNewWritableFileProxy(Object proxied,
                                OverwriteStrategy overwriteStrategy)
Create a new gzip writable file proxy for the proxied object. The proxy will use the default gzip buffer size.

Parameters:
proxied - The proxied object
overwriteStrategy - The overwrite strategy to use if an entity already exists in the target file's location.

GZipNewWritableFileProxy

public GZipNewWritableFileProxy(Object proxied,
                                int bufSize)
                         throws IllegalArgumentException
Create a new gzip writable file proxy for the proxied object. The proxy will use the supplied gzip buffer size and the overwrite strategy DontOverwriteAndThrowException.

Parameters:
proxied - The proxied object.
bufSize - The gzip buffer size, in bytes.
Throws:
IllegalArgumentException - If the buffer size is less than or equal to 0 bytes.
Since:
1.1

GZipNewWritableFileProxy

public GZipNewWritableFileProxy(Object proxied,
                                OverwriteStrategy overwriteStrategy,
                                int bufSize)
                         throws IllegalArgumentException
Create a new gzip writable file proxy for the proxied object. The proxy will use the supplied gzip buffer size.

Parameters:
proxied - The proxied object.
overwriteStrategy - The overwrite strategy to use if an entity already exists in the target file's location.
bufSize - The gzip buffer size, in bytes.
Throws:
IllegalArgumentException - If the buffer size is less than or equal to 0 bytes.
Method Detail

getFileFromArgumentInterpreter

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