Class ZipContent.Entry

java.lang.Object
org.springframework.boot.loader.zip.ZipContent.Entry
Enclosing class:
ZipContent

public class ZipContent.Entry extends Object
A single zip content entry.
  • Method Details

    • getLookupIndex

      public int getLookupIndex()
      Return the lookup index of the entry. Each entry has a unique lookup index but they aren't the same as the order that the entry was loaded.
      Returns:
      the entry lookup index
    • isDirectory

      public boolean isDirectory()
      Return true if this is a directory entry.
      Returns:
      if the entry is a directory
    • hasNameStartingWith

      public boolean hasNameStartingWith(CharSequence prefix)
      Returns true if this entry has a name starting with the given prefix.
      Parameters:
      prefix - the required prefix
      Returns:
      if the entry name starts with the prefix
    • getName

      public String getName()
      Return the name of this entry.
      Returns:
      the entry name
    • getCompressionMethod

      public int getCompressionMethod()
      Return the compression method for this entry.
      Returns:
      the compression method
      See Also:
    • getUncompressedSize

      public int getUncompressedSize()
      Return the uncompressed size of this entry.
      Returns:
      the uncompressed size
    • openContent

      public CloseableDataBlock openContent() throws IOException
      Open a DataBlock providing access to raw contents of the entry (not including the local file header).

      To release resources, the ZipContent.close() method of the data block should be called explicitly or by try-with-resources.

      Returns:
      the contents of the entry
      Throws:
      IOException - on I/O error
    • as

      public <E extends ZipEntry> E as(Function<String,E> factory)
      Adapt the raw entry into a ZipEntry or ZipEntry subclass.
      Type Parameters:
      E - the entry type
      Parameters:
      factory - the factory used to create the ZipEntry
      Returns:
      a fully populated zip entry
    • as

      public <E extends ZipEntry> E as(BiFunction<ZipContent.Entry,String,E> factory)
      Adapt the raw entry into a ZipEntry or ZipEntry subclass.
      Type Parameters:
      E - the entry type
      Parameters:
      factory - the factory used to create the ZipEntry
      Returns:
      a fully populated zip entry