Packages

final class ArchiveExtractor extends Closeable

Common archive extractor for all kinds of archive formats, it uses format auto-detection insides and provides generic access to archive entries. Unlike Creator or Updater, it requires user manually closing since it leaks streams out to user through entries, and have no ideas whether user is still using the streams.

Linear Supertypes
Closeable, AutoCloseable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ArchiveExtractor
  2. Closeable
  3. AutoCloseable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ArchiveExtractor()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def archiveFormat: ArchiveFormat

    Gets the format of this archive.

    Gets the format of this archive.

    returns

    the format of this archive

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. def close(): Unit

    Closes this extractor and releases resources.

    Closes this extractor and releases resources. After this operation, extractTo and foreach can't be called anymore, and it's also not safe to use ExtractionEntry acquired from foreach anymore. In a word, close destroys this extractor.

    Definition Classes
    ArchiveExtractor → Closeable → AutoCloseable
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def extractTo(dst: OutputStream): ArchiveExtractor

    If and only if this archive's format only supports single entry compression, this method extracts the very single entry to an OutputStream.

    If and only if this archive's format only supports single entry compression, this method extracts the very single entry to an OutputStream. extractTo can be called for multiple times.

    dst

    OutputStream to extract to

    returns

    extractor itself so that method calls can be chained

  11. def extractTo(dst: Path): ArchiveExtractor

    Extracts the entire archive to directory represented by dst.

    Extracts the entire archive to directory represented by dst.

    Note that it's more efficient to use this extractTo than call entry's independent extractTo within foreach if you intend to extract the entire archive. extractTo can be called for multiple times.

    dst

    directory to extract to

    returns

    extractor itself so that method calls can be chained

  12. def foreach(f: (ExtractionEntry) => Unit): ArchiveExtractor

    Do some thing on each archive entry.

    Do some thing on each archive entry. You can gain access to each entry's properties and extract them independently. foreach can be called for multiple times.

    f

    function to process each entry

    returns

    extractor itself so that method calls can be chained

  13. def from(src: Either[Path, InputStream]): ArchiveExtractor

    Specifies where archive stream comes from.

    Specifies where archive stream comes from.

    For Path, it reads the given file and closes it eventually after extraction. For InputStream, it reads all bytes from the input stream which costs O(N) both on space and time. Therefore, it's usually more efficient to pass Path when you intend to provide data from a file.

    Additionally, in the second case, remember to close InputStream on your own afterwards.

    src

    where archive stream comes from

    returns

    extractor itself so that method calls can be chained

  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. def numberOfEntries: Int

    Gets the number of entries in this archive.

    Gets the number of entries in this archive.

    returns

    the number of entries

  21. def onEachEnd(f: (ExtractOperationResult) => Unit): ArchiveExtractor

    Provides callback triggered after each entry's extraction.

    Provides callback triggered after each entry's extraction. And only this extractor's extractTo method triggers it, while foreach and entry's independent extractTo method doesn't.

    TODO: not guaranteed to be exactly called after each entry's extraction

    f

    ExtractOperationResult(enumeration) => Unit

    returns

    extractor itself so that method calls can be chained

  22. def onProcess(progressTracker: (Long, Long) => Unit): ArchiveExtractor

    Provides callback triggered during extraction operation resulting from this extractor's extractTo method, while foreach and entry's independent extractTo method doesn't.

    Provides callback triggered during extraction operation resulting from this extractor's extractTo method, while foreach and entry's independent extractTo method doesn't.

    First parameter of the callback is the number of bytes completed extraction, the second one is the total number of bytes to extract. Together, they can describe the progress of extraction.

    Note that the time and frequency of this callback's trigger is unknown. And it's only relevant with the bytes to extract, nothing to do with the entries.

    progressTracker

    (completed, total) => Unit

    returns

    extractor itself so that method calls can be chained

  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. def toString(): String
    Definition Classes
    AnyRef → Any
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. def withPassword(passwd: String): ArchiveExtractor

    Provides password for encrypted archive.

    Provides password for encrypted archive. Note that supplying no password for encrypted archive will result in a silent failure.

    passwd

    password

    returns

    extractor itself so that method calls can be chained

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Closeable

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped