org.entityfs.impl
Interface FileDelegate

All Superinterfaces:
EntityDelegate
All Known Implementing Classes:
AbstractFileDelegateProxy, AttributesEnablingFileDelegateProxy, FileDelegateImpl

public interface FileDelegate
extends EntityDelegate

This defines the delegate of a file entity.

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

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 interface org.entityfs.impl.EntityDelegate
canRead, canWrite, copy, copyAttributes, exists, getDelegateOfTypeOrNull, getEntityAdapter, getFileSystem, getLastModified, getName, getOwner, init, isReadOnly, rename, setLastModified, setOwner
 

Method Detail

openForWrite

OutputStream openForWrite(boolean append)

openChannelForWrite

WritableByteChannel openChannelForWrite(boolean append)

openForRead

InputStream openForRead()

openChannelForRead

ReadableByteChannel openChannelForRead()

openForRandomAccess

RandomAccess openForRandomAccess(RandomAccessMode mode)

getSize

long getSize()

getDataSize

long getDataSize()

delete

void delete()
            throws FileSystemException
Delete the file.

Throws:
FileSystemException - If the file cannot be deleted.

replaceContents

void replaceContents(FileDelegate fd)
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.

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.