org.schmant.task.at4j.lzma
Class LzmaNewWritableFileProxy

java.lang.Object
  extended by org.schmant.task.at4j.lzma.AbstractLzmaWritableFileProxy
      extended by org.schmant.task.at4j.lzma.LzmaNewWritableFileProxy
All Implemented Interfaces:
Lockable, WriteLockable, WritableFile, NewWritableFile

public class LzmaNewWritableFileProxy
extends AbstractLzmaWritableFileProxy
implements NewWritableFile

This proxy LZMA 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.

Warning: LZMA compression does not seem to work reliably. Sometimes, when compressing, it seems to want to allocate too much (very much) memory, and that often leads to an OutOfMemoryError. Avoid using this class until the issue is fixed.

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 LzmaWritableFile 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, BZip2NewWritableFileProxy, LzmaExistingWritableFileProxy, LzmaReadableFileProxy
Task_package:
org.at4j

Constructor Summary
LzmaNewWritableFileProxy(Object proxied, OverwriteStrategy overwriteStrategy)
          Create a new LZMA writable file proxy for the proxied object.
LzmaNewWritableFileProxy(Object proxied, OverwriteStrategy overwriteStrategy, LzmaOutputStreamSettings settings)
          Create a new LZMA writable file proxy for the proxied object.
 
Method Summary
protected  WritableFile getFileFromArgumentInterpreter(Object proxied)
           
 
Methods inherited from class org.schmant.task.at4j.lzma.AbstractLzmaWritableFileProxy
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

LzmaNewWritableFileProxy

public LzmaNewWritableFileProxy(Object proxied,
                                OverwriteStrategy overwriteStrategy)
Create a new LZMA writable file proxy for the proxied object. The proxy will use the default LZMA compression settings.

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

LzmaNewWritableFileProxy

public LzmaNewWritableFileProxy(Object proxied,
                                OverwriteStrategy overwriteStrategy,
                                LzmaOutputStreamSettings settings)
Create a new LZMA writable file proxy for the proxied object. The proxy will use the supplied compression settings.

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

getFileFromArgumentInterpreter

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