org.entityfs.impl
Class AbstractFileDelegateProxy

java.lang.Object
  extended by org.entityfs.support.lang.ObjectProxySupport<T>
      extended by org.entityfs.impl.AbstractEntityDelegateProxy<FileDelegate,FileAdapter>
          extended by org.entityfs.impl.AbstractFileDelegateProxy
All Implemented Interfaces:
EntityDelegate, FileDelegate
Direct Known Subclasses:
AttributesEnablingFileDelegateProxy

public abstract class AbstractFileDelegateProxy
extends AbstractEntityDelegateProxy<FileDelegate,FileAdapter>
implements FileDelegate

This is an abstract stub implementation of a file delegate proxy. It forwards all method calls to the proxied delegate. This can be used as a starting point for custom implementations.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
entityfs-core

Constructor Summary
protected AbstractFileDelegateProxy(FileDelegate proxied)
           
 
Method Summary
 void delete()
          Delete the file.
 long getDataSize()
           
 long getSize()
           
 ReadableByteChannel openChannelForRead()
           
 WritableByteChannel openChannelForWrite(boolean append)
           
 RandomAccess openForRandomAccess(RandomAccessMode mode)
           
 InputStream openForRead()
           
 OutputStream openForWrite(boolean append)
           
 void replaceContents(FileDelegate fd)
          Replace the contents of this file with the contents of the supplied file.
 
Methods inherited from class org.entityfs.impl.AbstractEntityDelegateProxy
canRead, canWrite, copy, copyAttributes, exists, getDelegateOfTypeOrNull, getEntityAdapter, getFileSystem, getLastModified, getName, getOwner, init, isReadOnly, rename, setLastModified, setOwner
 
Methods inherited from class org.entityfs.support.lang.ObjectProxySupport
equals, getProxied, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.entityfs.impl.EntityDelegate
canRead, canWrite, copy, copyAttributes, exists, getDelegateOfTypeOrNull, getEntityAdapter, getFileSystem, getLastModified, getName, getOwner, init, isReadOnly, rename, setLastModified, setOwner
 

Constructor Detail

AbstractFileDelegateProxy

protected AbstractFileDelegateProxy(FileDelegate proxied)
Method Detail

openForWrite

public OutputStream openForWrite(boolean append)
Specified by:
openForWrite in interface FileDelegate

openChannelForWrite

public WritableByteChannel openChannelForWrite(boolean append)
Specified by:
openChannelForWrite in interface FileDelegate

openForRead

public InputStream openForRead()
Specified by:
openForRead in interface FileDelegate

openChannelForRead

public ReadableByteChannel openChannelForRead()
Specified by:
openChannelForRead in interface FileDelegate

openForRandomAccess

public RandomAccess openForRandomAccess(RandomAccessMode mode)
Specified by:
openForRandomAccess in interface FileDelegate

getSize

public long getSize()
Specified by:
getSize in interface FileDelegate

getDataSize

public long getDataSize()
Specified by:
getDataSize in interface FileDelegate

delete

public void delete()
            throws FileSystemException
Description copied from interface: FileDelegate
Delete the file.

Specified by:
delete in interface FileDelegate
Throws:
FileSystemException - If the file cannot be deleted.

replaceContents

public void replaceContents(FileDelegate fd)
Description copied from interface: FileDelegate
Replace the contents of this file with the contents of the supplied file. Don't delete the other file. That is taken care of by the entity implementation.

Specified by:
replaceContents in interface FileDelegate
Parameters:
fd - The file delegate with the contents that this file's contents should be replaced with. fd is not guaranteed to be in the same file system as this file.