Interface Archive

All Known Implementing Classes:
TgzArchiveWrapper, ZipArchiveWrapper

public interface Archive
The interface Archive contains the common description for a ZIP and tar.gz archive.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    The interface Entry contains the wrapper definition for an archive entry.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The method close provides means to close the stream.
    void
    The method closeEntry provides means to close the current entry.
    The method getName provides means to retrieve the file name.
    The method getNextEntry provides means to move to the next entry.
    The method getStream provides means to get the InputStream for the current entry.
    static Archive
    of(@NonNull String name, InputStream in)
    The method of provides means to create a wrapper for an archive file.
    static Archive
    tgz(String name, InputStream in)
    The method tgz provides means to create a wrapper for a tar.gz file.
    static Archive
    zip(String name, InputStream in)
    The method zip provides means to create a wrapper for a ZIP file.
  • Method Details

    • of

      static Archive of(@NonNull @NonNull String name, InputStream in) throws IOException
      The method of provides means to create a wrapper for an archive file.
      Parameters:
      name - the file name
      in - the file to wrap
      Returns:
      the new archive wrapper for the file
      Throws:
      IOException - in case of an I/O error
    • tgz

      The method tgz provides means to create a wrapper for a tar.gz file.
      Parameters:
      name - the file name
      in - the file to wrap
      Returns:
      the new archive wrapper for the file
      Throws:
      IOException - in case of an I/O error
      FileNotFoundException - in case the file has not been found.
    • zip

      static Archive zip(String name, InputStream in) throws FileNotFoundException
      The method zip provides means to create a wrapper for a ZIP file.
      Parameters:
      name - the file name
      in - the file content
      Returns:
      the new archive wrapper for the file
      Throws:
      FileNotFoundException - in case the file has not been found.
    • close

      void close() throws IOException
      The method close provides means to close the stream.
      Throws:
      IOException - in case of an I/O error
    • closeEntry

      void closeEntry() throws IOException
      The method closeEntry provides means to close the current entry.
      Throws:
      IOException - in case of an I/O error
    • getName

      String getName()
      The method getName provides means to retrieve the file name.
      Returns:
      the file name or null
    • getNextEntry

      Archive.Entry getNextEntry() throws IOException
      The method getNextEntry provides means to move to the next entry.
      Returns:
      the next entry
      Throws:
      IOException - in case of an I/O error
    • getStream

      InputStream getStream()
      The method getStream provides means to get the InputStream for the current entry.
      Returns:
      the InputStream for the current entry