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.
- Alphabetic
- By Inheritance
- ArchiveExtractor
- Closeable
- AutoCloseable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ArchiveExtractor()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def archiveFormat: ArchiveFormat
Gets the format of this archive.
Gets the format of this archive.
- returns
the format of this archive
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def close(): Unit
Closes this extractor and releases resources.
Closes this extractor and releases resources. After this operation,
extractTo
andforeach
can't be called anymore, and it's also not safe to useExtractionEntry
acquired fromforeach
anymore. In a word, close destroys this extractor.- Definition Classes
- ArchiveExtractor → Closeable → AutoCloseable
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- 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
- 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 independentextractTo
withinforeach
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
- 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
- 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. ForInputStream
, it reads all bytes from the input stream which costs O(N) both on space and time. Therefore, it's usually more efficient to passPath
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
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def numberOfEntries: Int
Gets the number of entries in this archive.
Gets the number of entries in this archive.
- returns
the number of entries
- 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, whileforeach
and entry's independentextractTo
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
- def onProcess(progressTracker: (Long, Long) => Unit): ArchiveExtractor
Provides callback triggered during extraction operation resulting from this extractor's
extractTo
method, whileforeach
and entry's independentextractTo
method doesn't.Provides callback triggered during extraction operation resulting from this extractor's
extractTo
method, whileforeach
and entry's independentextractTo
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
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated