Interface Archive

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
ReadableArchive, WritableArchive
All Known Implementing Classes:
ReadableArchiveAdapter

public interface Archive extends AutoCloseable
This interface is an abstraction for accessing a module archive.
Author:
Jerome Dochez
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    closes this archive and releases all resources
    Returns an enumeration of the module file entries.
    entries(String prefix)
    Returns an enumeration of the module file entries with the specified prefix.
    long
    Returns the size of the archive.
    Returns the enumeration of first level directories in this archive
    Returns the manifest information for this archive
    Returns the name of the archive.
    Returns the path used to create or open the underlying archive
    boolean
    Returns true if the entry is a directory or a plain file
  • Method Details

    • close

      void close() throws IOException
      closes this archive and releases all resources
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • entries

      Enumeration<String> entries()
      Returns an enumeration of the module file entries. All elements in the enumeration are of type String. Each String represents a file name relative to the root of the module.
      Returns:
      an enumeration of the archive file entries.
    • entries

      Enumeration<String> entries(String prefix)
      Returns an enumeration of the module file entries with the specified prefix. All elements in the enumeration are of type String. Each String represents a file name relative to the root of the module.
      Parameters:
      prefix - the prefix of entries to be included
      Returns:
      an enumeration of the archive file entries.
    • getDirectories

      Collection<String> getDirectories() throws IOException
      Returns the enumeration of first level directories in this archive
      Returns:
      enumeration of directories under the root of this archive
      Throws:
      IOException
    • isDirectory

      boolean isDirectory(String name)
      Returns true if the entry is a directory or a plain file
      Parameters:
      name - name is one of the entries returned by entries()
      Returns:
      true if the entry denoted by the passed name is a directory
    • getManifest

      Manifest getManifest() throws IOException
      Returns the manifest information for this archive
      Returns:
      the manifest info
      Throws:
      IOException
    • getURI

      URI getURI()
      Returns the path used to create or open the underlying archive

      TODO: abstraction breakage: Several callers, most notably DeploymentContext.getSourceDir() implementation, assumes that this URI is an URL, and in fact file URL.

      If this needs to be URL, use of URI is misleading. And furthermore, if its needs to be a file URL, this should be File.

      Returns:
      the path for this archive.
    • getArchiveSize

      long getArchiveSize() throws SecurityException
      Returns the size of the archive.
      Returns:
      long indicating the size of the archive
      Throws:
      SecurityException
    • getName

      String getName()
      Returns the name of the archive.

      Implementations should not return null.

      Returns:
      the name of the archive