Class ZipFileObject

    • Field Detail

      • entry

        protected java.util.zip.ZipEntry entry
        The ZipEntry.
    • Constructor Detail

      • ZipFileObject

        protected ZipFileObject​(AbstractFileName fileName,
                                java.util.zip.ZipEntry entry,
                                ZipFileSystem fileSystem,
                                boolean zipExists)
        Constructs a new instance.
        Parameters:
        fileName - the file name.
        entry - The zip entry.
        fileSystem - the file system.
        zipExists - whether the zip file exists.
    • Method Detail

      • attachChild

        public void attachChild​(FileName childName)
        Attaches a child.

        TODO: Shouldn't this method have package-only visibility? Cannot change this without breaking binary compatibility.

        Parameters:
        childName - The name of the child.
      • doAttach

        protected void doAttach()
                         throws java.lang.Exception
        Description copied from class: AbstractFileObject
        Attaches this file object to its file resource.

        This method is called before any of the doBlah() or onBlah() methods. Sub-classes can use this method to perform lazy initialization.

        This implementation does nothing.

        Overrides:
        doAttach in class AbstractFileObject<ZipFileSystem>
        Throws:
        java.lang.Exception - if an error occurs.
      • doDetach

        protected void doDetach()
                         throws java.lang.Exception
        Description copied from class: AbstractFileObject
        Detaches this file object from its file resource.

        Called when this file is closed. Note that the file object may be reused later, so should be able to be reattached.

        This implementation does nothing.

        Overrides:
        doDetach in class AbstractFileObject<ZipFileSystem>
        Throws:
        java.lang.Exception - if an error occurs.
      • doGetInputStream

        protected java.io.InputStream doGetInputStream​(int bufferSize)
                                                throws java.lang.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<ZipFileSystem>
        Parameters:
        bufferSize - Buffer size hint.
        Returns:
        An InputStream to read the file content.
        Throws:
        java.lang.Exception - if an error occurs.
      • doListChildren

        protected java.lang.String[] doListChildren()
        Lists the children of the file.
        Specified by:
        doListChildren in class AbstractFileObject<ZipFileSystem>
        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.
      • setZipEntry

        protected void setZipEntry​(java.util.zip.ZipEntry entry)
        Sets the details for this file object.
        Parameters:
        entry - ZIP information related to this file.