Class TarFileObject
- java.lang.Object
-
- org.apache.commons.vfs2.provider.AbstractFileObject<TarFileSystem>
-
- org.apache.commons.vfs2.provider.tar.TarFileObject
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Comparable<FileObject>,java.lang.Iterable<FileObject>,FileObject
public class TarFileObject extends AbstractFileObject<TarFileSystem>
A file in a Tar file system.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTarFileObject(AbstractFileName name, org.apache.commons.compress.archivers.tar.TarArchiveEntry entry, TarFileSystem fs, boolean tarExists)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidattachChild(FileName childName)Attaches a child.protected longdoGetContentSize()Returns the size of the file content (in bytes).protected java.io.InputStreamdoGetInputStream()Creates an input stream to read the file content from.protected longdoGetLastModifiedTime()Returns the last modified time of this file.protected FileTypedoGetType()Returns the file's type.protected java.lang.String[]doListChildren()Lists the children of the file.booleanisWriteable()Determines if this file can be written to.protected voidsetTarEntry(org.apache.commons.compress.archivers.tar.TarArchiveEntry entry)Sets the details for this file object.-
Methods inherited from class org.apache.commons.vfs2.provider.AbstractFileObject
canRenameTo, childrenChanged, close, compareTo, copyFrom, createFile, createFolder, delete, delete, deleteAll, doAttach, doCreateFileContent, doCreateFolder, doDelete, doDetach, doGetAttributes, doGetCertificates, doGetOutputStream, doGetRandomAccessContent, doIsExecutable, doIsHidden, doIsReadable, doIsSameFile, doIsWriteable, doListChildrenResolved, doRemoveAttribute, doRename, doSetAttribute, doSetExecutable, doSetLastModifiedTime, 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, iterator, listFiles, moveTo, notifyAllStreamsClosed, onChange, onChildrenChanged, refresh, resolveFile, resolveFile, setExecutable, setReadable, setWritable, toString
-
-
-
-
Constructor Detail
-
TarFileObject
protected TarFileObject(AbstractFileName name, org.apache.commons.compress.archivers.tar.TarArchiveEntry entry, TarFileSystem fs, boolean tarExists) throws FileSystemException
- Throws:
FileSystemException
-
-
Method Detail
-
setTarEntry
protected void setTarEntry(org.apache.commons.compress.archivers.tar.TarArchiveEntry entry)
Sets the details for this file object. Consider this method package private. TODO Might be made package private in the next major version.
-
attachChild
protected void attachChild(FileName childName)
Attaches a child.- Parameters:
childName- Name of child to remember.
-
isWriteable
public boolean isWriteable() throws FileSystemExceptionDetermines if this file can be written to.- Specified by:
isWriteablein interfaceFileObject- Overrides:
isWriteablein classAbstractFileObject<TarFileSystem>- Returns:
trueif this file is writeable,falseif not.- Throws:
FileSystemException- if an error occurs.
-
doGetType
protected FileType doGetType()
Returns the file's type.- Specified by:
doGetTypein classAbstractFileObject<TarFileSystem>- Returns:
- the type of the file.
-
doListChildren
protected java.lang.String[] doListChildren()
Lists the children of the file.- Specified by:
doListChildrenin classAbstractFileObject<TarFileSystem>- Returns:
- a possible empty String array if the file is a directory or null or an exception if the file is not a directory or can't be read.
-
doGetContentSize
protected long doGetContentSize()
Returns the size of the file content (in bytes). Is only called ifdoGetType()returnsFileType.FILE.- Specified by:
doGetContentSizein classAbstractFileObject<TarFileSystem>- Returns:
- The size of the file in bytes.
-
doGetLastModifiedTime
protected long doGetLastModifiedTime() throws java.lang.ExceptionReturns the last modified time of this file.- Overrides:
doGetLastModifiedTimein classAbstractFileObject<TarFileSystem>- Returns:
- The last modification time.
- Throws:
java.lang.Exception- if an error occurs.
-
doGetInputStream
protected java.io.InputStream doGetInputStream() throws java.lang.ExceptionCreates an input stream to read the file content from. Is only called ifdoGetType()returnsFileType.FILE. The input stream returned by this method is guaranteed to be closed before this method is called again.- Specified by:
doGetInputStreamin classAbstractFileObject<TarFileSystem>- Returns:
- An InputStream to read the file content.
- Throws:
java.lang.Exception- if an error occurs.
-
-