Class MemoryMappedArchive

  • All Implemented Interfaces:
    org.glassfish.api.deployment.archive.Archive, org.glassfish.api.deployment.archive.ReadableArchive

    @Service
    @PerLookup
    public class MemoryMappedArchive
    extends JarArchive
    implements org.glassfish.api.deployment.archive.ReadableArchive
    Author:
    Jerome Dochez
    • Constructor Detail

      • MemoryMappedArchive

        protected MemoryMappedArchive()
        Creates a new instance of MemoryMappedArchive
      • MemoryMappedArchive

        public MemoryMappedArchive​(byte[] bits)
      • MemoryMappedArchive

        public MemoryMappedArchive​(org.glassfish.api.deployment.archive.ReadableArchive source)
                            throws IOException
        Throws:
        IOException
    • Method Detail

      • getByteArray

        public byte[] getByteArray()
      • open

        public void open​(URI uri)
                  throws IOException
        Specified by:
        open in interface org.glassfish.api.deployment.archive.ReadableArchive
        Throws:
        IOException
      • close

        public void close()
                   throws IOException
        close the abstract archive
        Specified by:
        close in interface org.glassfish.api.deployment.archive.Archive
        Throws:
        IOException
      • delete

        public boolean delete()
        delete the archive
        Specified by:
        delete in interface org.glassfish.api.deployment.archive.ReadableArchive
      • entries

        public Enumeration entries()
        Specified by:
        entries in interface org.glassfish.api.deployment.archive.Archive
        Returns:
        an @see java.util.Enumeration of entries in this abstract archive
      • entries

        public Enumeration entries​(Enumeration embeddedArchives)
        Returns:
        an @see java.util.Enumeration of entries in this abstract archive, providing the list of embedded archive to not count their entries as part of this archive
      • exists

        public boolean exists()
        Specified by:
        exists in interface org.glassfish.api.deployment.archive.ReadableArchive
        Returns:
        true if this archive exists
      • getPath

        public String getPath()
        Returns:
        the archive uri
      • getURI

        public URI getURI()
        Specified by:
        getURI in interface org.glassfish.api.deployment.archive.Archive
      • setURI

        public void setURI​(URI uri)
      • getSubArchive

        public org.glassfish.api.deployment.archive.ReadableArchive getSubArchive​(String name)
                                                                           throws IOException
        create or obtain an embedded archive within this abstraction.
        Specified by:
        getSubArchive in interface org.glassfish.api.deployment.archive.ReadableArchive
        Parameters:
        name - the name of the embedded archive.
        Throws:
        IOException
      • exists

        public boolean exists​(String name)
                       throws IOException
        Returns the existence of the given entry name The file name must be relative to the root of the module.
        Specified by:
        exists in interface org.glassfish.api.deployment.archive.ReadableArchive
        Overrides:
        exists in class JarArchive
        Parameters:
        name - the file name relative to the root of the module.
        Returns:
        the existence the given entry name.
        Throws:
        IOException
      • getEntry

        public InputStream getEntry​(String name)
                             throws IOException
        Specified by:
        getEntry in interface org.glassfish.api.deployment.archive.ReadableArchive
        Parameters:
        name - the entry name
        Returns:
        a @see java.io.InputStream for an existing entry in the current abstract archive
        Throws:
        IOException
      • getEntrySize

        public long getEntrySize​(String name)
        Returns the entry size for a given entry name or 0 if not known
        Specified by:
        getEntrySize in interface org.glassfish.api.deployment.archive.ReadableArchive
        Parameters:
        name - the entry name
        Returns:
        the entry size
      • getManifest

        public Manifest getManifest()
                             throws IOException
        Specified by:
        getManifest in interface org.glassfish.api.deployment.archive.Archive
        Returns:
        the manifest information for this abstract archive
        Throws:
        IOException
      • renameTo

        public boolean renameTo​(String name)
        rename the archive
        Specified by:
        renameTo in interface org.glassfish.api.deployment.archive.ReadableArchive
        Parameters:
        name - the archive name
      • getName

        public String getName()
        Returns the name for the archive.

        For a MemoryMappedArhive there is no name, so an empty string is returned.

        Specified by:
        getName in interface org.glassfish.api.deployment.archive.Archive
        Overrides:
        getName in class JarArchive
        Returns:
        the name of the archive