Interface ArtifactEntry

All Superinterfaces:
EnclosedEntity, Entity

public interface ArtifactEntry extends EnclosedEntity
Represents an Entry within a Container. Note that Container does not require hashCode/equals, and thus should not be used as a key in HashMaps, etc.
  • Method Details

    • convertToContainer

      ArtifactContainer convertToContainer()
      Attempt to convert this entry into a Container.

      Returned container may be a new type of artifact, check ArtifactContainer.isRoot() on the return.

      Returns:
      Container if conversion is possible, null otherwise.
    • convertToContainer

      ArtifactContainer convertToContainer(boolean localOnly)
      Attempt to convert this entry into a ArtifactContainer.

      Returned container may be a new type of artifact, check ArtifactContainer.isRoot() on the return.

      Parameters:
      localOnly - pass true if conversion should be restricted to returning Containers where isRoot returns false.
      Returns:
      ArtifactContainer if conversion is possible, null otherwise.
    • getInputStream

      InputStream getInputStream() throws IOException
      Obtain inputstream for entry.
      Returns:
      inputStream if possible for this entry, or null otherwise.
      Throws:
      IOException - if there is supposed to be a stream, but an error occurred obtaining it.
    • getSize

      long getSize()
      Obtain size of this Entries data, if any.
      Returns:
      number of bytes this Entry represents.
    • getLastModified

      long getLastModified()
      Obtain the time that this entry was last modified
      Returns:
      A long value indicating the last modified time or 0L if the value is not available
    • getResource

      URL getResource()

      This method should return a URL suitable for the ServletContext.getResource(String path) method.

      If this Entry represents a container then this method will not work because some implementations of this API may map more than one location to a single container. Therefore to load all of the locations that contribute to a container you should do:

      Container container = entry.convertToContainer();
      if (container != null) {
        Collection<URI> allUrisForContainer = container.getUri();
      }

      This may return null if this Entry is a virtual container that does not have a real location on disk.

      Returns:
      The URL pointing to this entry on disk