AFS - A subclass of AbstractFileSystem.public class DelegateFileObject<AFS extends AbstractFileSystem> extends AbstractFileObject<AFS> implements FileListener
TODO - Extract subclass that overlays the children.
| Constructor and Description |
|---|
DelegateFileObject(AbstractFileName name,
AFS fileSystem,
FileObject file) |
| Modifier and Type | Method and Description |
|---|---|
void |
attachChild(FileName baseName,
FileType type)
Adds a child to this file.
|
void |
close()
Close the delegated file.
|
protected void |
doCreateFolder()
Creates this file as a folder.
|
protected void |
doDelete()
Deletes the file.
|
protected Map<String,Object> |
doGetAttributes()
Returns the attributes of this file.
|
protected Certificate[] |
doGetCertificates()
Returns the certificates of this file.
|
protected FileContentInfo |
doGetContentInfo()
Return file content info.
|
protected long |
doGetContentSize()
Returns the size of the file content (in bytes).
|
protected InputStream |
doGetInputStream()
Creates an input stream to read the file content from.
|
protected long |
doGetLastModifiedTime()
Returns the last-modified time of this file.
|
protected OutputStream |
doGetOutputStream(boolean bAppend)
Creates an output stream to write the file content to.
|
protected RandomAccessContent |
doGetRandomAccessContent(RandomAccessMode mode)
Creates access to the file for random i/o.
|
protected FileType |
doGetType()
Determines the type of the file, returns null if the file does not
exist.
|
protected boolean |
doIsExecutable()
Determines if this file is executable.
|
protected boolean |
doIsHidden()
Determines if this file is hidden.
|
protected boolean |
doIsReadable()
Determines if this file can be read.
|
protected boolean |
doIsWriteable()
Determines if this file can be written to.
|
protected String[] |
doListChildren()
Lists the children of the file.
|
protected void |
doRemoveAttribute(String atttrName)
Removes an attribute of this file.
|
protected void |
doRename(FileObject newFile)
Renames the file.
|
protected void |
doSetAttribute(String atttrName,
Object value)
Sets an attribute of this file.
|
protected boolean |
doSetLastModifiedTime(long modtime)
Sets the last-modified time of this file.
|
void |
fileChanged(FileChangeEvent event)
Called when a file is changed.
|
void |
fileCreated(FileChangeEvent event)
Called when a file is created.
|
void |
fileDeleted(FileChangeEvent event)
Called when a file is deleted.
|
FileObject |
getDelegateFile()
Get access to the delegated file.
|
void |
refresh()
Refresh file information.
|
void |
setFile(FileObject file)
Attaches or detaches the target file.
|
canRenameTo, childrenChanged, compareTo, copyFrom, createFile, createFolder, delete, delete, deleteAll, doAttach, doCreateFileContent, doDetach, doIsSameFile, doListChildrenResolved, doSetExecutable, doSetReadable, doSetWritable, endOutput, exists, finalize, findFiles, findFiles, getAbstractFileSystem, getChild, getChildren, getContent, getFileContentInfoFactory, getFileOperations, getFileSystem, getInputStream, getName, getOutputStream, getOutputStream, getParent, getPublicURIString, getRandomAccessContent, getType, getURL, handleChanged, handleCreate, handleDelete, holdObject, injectType, isAttached, isContentOpen, isExecutable, isFile, isFolder, isHidden, isReadable, isSameFile, isWriteable, iterator, listFiles, moveTo, notifyAllStreamsClosed, onChange, onChildrenChanged, resolveFile, resolveFile, setExecutable, setReadable, setWritable, toStringpublic DelegateFileObject(AbstractFileName name, AFS fileSystem, FileObject file) throws FileSystemException
FileSystemExceptionpublic FileObject getDelegateFile()
public void attachChild(FileName baseName, FileType type) throws Exception
baseName - The base FileName.type - The FileType.Exception - if an error occurs.public void setFile(FileObject file) throws Exception
file - The FileObject.Exception - if an error occurs.protected FileType doGetType() throws FileSystemException
doGetType in class AbstractFileObject<AFS extends AbstractFileSystem>FileSystemExceptionprotected boolean doIsReadable()
throws FileSystemException
doIsReadable in class AbstractFileObject<AFS extends AbstractFileSystem>FileSystemExceptionprotected boolean doIsWriteable()
throws FileSystemException
doIsWriteable in class AbstractFileObject<AFS extends AbstractFileSystem>FileSystemExceptionprotected boolean doIsExecutable()
throws FileSystemException
doIsExecutable in class AbstractFileObject<AFS extends AbstractFileSystem>FileSystemExceptionprotected boolean doIsHidden()
throws FileSystemException
doIsHidden in class AbstractFileObject<AFS extends AbstractFileSystem>FileSystemExceptionprotected String[] doListChildren() throws Exception
doListChildren in class AbstractFileObject<AFS extends AbstractFileSystem>Exception - if an error occurs.protected void doCreateFolder()
throws Exception
doCreateFolder in class AbstractFileObject<AFS extends AbstractFileSystem>Exception - if an error occurs.protected void doDelete()
throws Exception
doDelete in class AbstractFileObject<AFS extends AbstractFileSystem>Exception - if an error occurs.protected long doGetContentSize()
throws Exception
doGetType() returns FileType.FILE.doGetContentSize in class AbstractFileObject<AFS extends AbstractFileSystem>Exception - if an error occurs.protected Map<String,Object> doGetAttributes() throws Exception
doGetAttributes in class AbstractFileObject<AFS extends AbstractFileSystem>Exception - if an error occurs.protected void doSetAttribute(String atttrName, Object value) throws Exception
doSetAttribute in class AbstractFileObject<AFS extends AbstractFileSystem>atttrName - The attribute name.value - The value to be associated with the attribute name.Exception - if an error occurs.protected Certificate[] doGetCertificates() throws Exception
doGetCertificates in class AbstractFileObject<AFS extends AbstractFileSystem>Exception - if an error occurs.protected long doGetLastModifiedTime()
throws Exception
doGetLastModifiedTime in class AbstractFileObject<AFS extends AbstractFileSystem>Exception - if an error occurs.protected boolean doSetLastModifiedTime(long modtime)
throws Exception
doSetLastModifiedTime in class AbstractFileObject<AFS extends AbstractFileSystem>modtime - The last modification time.Exception - Any Exception thrown is wrapped in FileSystemException.protected InputStream doGetInputStream() throws Exception
doGetInputStream in class AbstractFileObject<AFS extends AbstractFileSystem>Exception - if an error occurs.protected OutputStream doGetOutputStream(boolean bAppend) throws Exception
doGetOutputStream in class AbstractFileObject<AFS extends AbstractFileSystem>bAppend - true if the file should be appended to, false if it should be overwritten.Exception - if an error occurs.public void fileCreated(FileChangeEvent event) throws Exception
fileCreated in interface FileListenerevent - The FileChangeEvent.Exception - if an error occurs.public void fileDeleted(FileChangeEvent event) throws Exception
fileDeleted in interface FileListenerevent - The FileChangeEvent.Exception - if an error occurs.public void fileChanged(FileChangeEvent event) throws Exception
This will only happen if you monitor the file using FileMonitor.
fileChanged in interface FileListenerevent - The FileChangeEvent.Exception - if an error occurs.public void close()
throws FileSystemException
close in interface Closeableclose in interface AutoCloseableclose in interface FileObjectclose in class AbstractFileObject<AFS extends AbstractFileSystem>FileSystemException - if an error occurs.FileContent.close()public void refresh()
throws FileSystemException
refresh in interface FileObjectrefresh in class AbstractFileObject<AFS extends AbstractFileSystem>FileSystemException - if an error occurs.protected FileContentInfo doGetContentInfo() throws Exception
Exception - Any thrown Exception is wrapped in FileSystemException.protected void doRename(FileObject newFile) throws Exception
doRename in class AbstractFileObject<AFS extends AbstractFileSystem>newFile - the new location/name.Exception - Any thrown Exception is wrapped in FileSystemException.protected void doRemoveAttribute(String atttrName) throws Exception
doRemoveAttribute in class AbstractFileObject<AFS extends AbstractFileSystem>atttrName - The name of the attribute to remove.Exception - if an error occurs.protected RandomAccessContent doGetRandomAccessContent(RandomAccessMode mode) throws Exception
doGetRandomAccessContent in class AbstractFileObject<AFS extends AbstractFileSystem>mode - The mode to access the file.Exception - if an error occurs.Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.