Class TarFileObject

java.lang.Object
org.apache.commons.vfs2.provider.AbstractFileObject<TarFileSystem>
org.apache.commons.vfs2.provider.tar.TarFileObject
All Implemented Interfaces:
Closeable, AutoCloseable, Comparable<FileObject>, Iterable<FileObject>, FileObject

public class TarFileObject extends AbstractFileObject<TarFileSystem>
A file in a Tar file system.
  • Field Details

    • entry

      private org.apache.commons.compress.archivers.tar.TarArchiveEntry entry
      The TarArchiveEntry
    • children

      private final HashSet<String> children
    • type

      private FileType type
  • Constructor Details

    • TarFileObject

      protected TarFileObject(AbstractFileName name, org.apache.commons.compress.archivers.tar.TarArchiveEntry entry, TarFileSystem fs, boolean tarExists)
  • Method Details

    • 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.
      Parameters:
      entry - Tar archive entry.
    • attachChild

      protected void attachChild(FileName childName)
      Attaches a child.
      Parameters:
      childName - Name of child to remember.
    • isWriteable

      public boolean isWriteable() throws FileSystemException
      Determines if this file can be written to.
      Specified by:
      isWriteable in interface FileObject
      Overrides:
      isWriteable in class AbstractFileObject<TarFileSystem>
      Returns:
      true if this file is writable, false if not.
      Throws:
      FileSystemException - if an error occurs.
    • doGetType

      protected FileType doGetType()
      Returns the file's type.
      Specified by:
      doGetType in class AbstractFileObject<TarFileSystem>
      Returns:
      the type of the file.
    • doListChildren

      protected String[] doListChildren()
      Lists the children of the file.
      Specified by:
      doListChildren in class AbstractFileObject<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 if doGetType() returns FileType.FILE.
      Specified by:
      doGetContentSize in class AbstractFileObject<TarFileSystem>
      Returns:
      The size of the file in bytes.
    • doGetLastModifiedTime

      protected long doGetLastModifiedTime() throws Exception
      Returns the last modified time of this file.
      Overrides:
      doGetLastModifiedTime in class AbstractFileObject<TarFileSystem>
      Returns:
      The last modification time.
      Throws:
      Exception - if an error occurs.
    • doGetInputStream

      protected InputStream doGetInputStream(int bufferSize) throws Exception
      Creates an input stream to read the file content from. Is only called if doGetType() returns FileType.FILE. The input stream returned by this method is guaranteed to be closed before this method is called again.
      Overrides:
      doGetInputStream in class AbstractFileObject<TarFileSystem>
      Parameters:
      bufferSize - Buffer size hint.
      Returns:
      An InputStream to read the file content.
      Throws:
      Exception - if an error occurs.