public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableByteChannel
MultiReadOnlySeekableByteChannel
that knows what a split ZIP archive should look like.
If you want to read a split archive using ZipFile
then create an instance of this class from the parts of
the archive.
Constructor and Description |
---|
ZipSplitReadOnlySeekableByteChannel(java.util.List<java.nio.channels.SeekableByteChannel> channels)
Concatenates the given channels.
|
Modifier and Type | Method and Description |
---|---|
static java.nio.channels.SeekableByteChannel |
buildFromLastSplitSegment(java.io.File lastSegmentFile)
Concatenates zip split files from the last segment(the extension SHOULD be .zip)
|
static java.nio.channels.SeekableByteChannel |
buildFromLastSplitSegment(java.nio.file.Path lastSegmentPath)
Concatenates zip split files from the last segment (the extension MUST be .zip)
|
static java.nio.channels.SeekableByteChannel |
forFiles(java.io.File... files)
Concatenates the given files.
|
static java.nio.channels.SeekableByteChannel |
forFiles(java.io.File lastSegmentFile,
java.lang.Iterable<java.io.File> files)
Concatenates the given files.
|
static java.nio.channels.SeekableByteChannel |
forOrderedSeekableByteChannels(java.nio.channels.SeekableByteChannel... channels)
Concatenates the given channels.
|
static java.nio.channels.SeekableByteChannel |
forOrderedSeekableByteChannels(java.nio.channels.SeekableByteChannel lastSegmentChannel,
java.lang.Iterable<java.nio.channels.SeekableByteChannel> channels)
Concatenates the given channels.
|
static java.nio.channels.SeekableByteChannel |
forPaths(java.nio.file.Path... paths)
Concatenates the given file paths.
|
static java.nio.channels.SeekableByteChannel |
forPaths(java.nio.file.Path lastSegmentPath,
java.lang.Iterable<java.nio.file.Path> paths)
Concatenates the given file paths.
|
public ZipSplitReadOnlySeekableByteChannel(java.util.List<java.nio.channels.SeekableByteChannel> channels) throws java.io.IOException
The channels should be add in ascending order, e.g. z01, z02, ... z99, zip please note that the .zip file is the last segment and should be added as the last one in the channels
channels
- the channels to concatenatejava.lang.NullPointerException
- if channels is nulljava.io.IOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static java.nio.channels.SeekableByteChannel forOrderedSeekableByteChannels(java.nio.channels.SeekableByteChannel... channels) throws java.io.IOException
channels
- the channels to concatenate, note that the LAST CHANNEL of channels should be the LAST SEGMENT(.zip)
and theses channels should be added in correct order (e.g. .z01, .z02... .z99, .zip)java.lang.NullPointerException
- if channels is nulljava.io.IOException
- if reading channels failspublic static java.nio.channels.SeekableByteChannel forOrderedSeekableByteChannels(java.nio.channels.SeekableByteChannel lastSegmentChannel, java.lang.Iterable<java.nio.channels.SeekableByteChannel> channels) throws java.io.IOException
lastSegmentChannel
- channel of the last segment of split zip segments, its extension should be .zipchannels
- the channels to concatenate except for the last segment,
note theses channels should be added in correct order (e.g. .z01, .z02... .z99)java.lang.NullPointerException
- if lastSegmentChannel or channels is nulljava.io.IOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static java.nio.channels.SeekableByteChannel buildFromLastSplitSegment(java.io.File lastSegmentFile) throws java.io.IOException
lastSegmentFile
- the last segment of zip split files, note that the extension SHOULD be .zipjava.lang.IllegalArgumentException
- if the lastSegmentFile's extension is NOT .zipjava.io.IOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static java.nio.channels.SeekableByteChannel buildFromLastSplitSegment(java.nio.file.Path lastSegmentPath) throws java.io.IOException
lastSegmentPath
- the last segment of zip split files, note that the extension MUST be .zipjava.lang.IllegalArgumentException
- if the lastSegmentPath's extension is NOT .zipjava.io.IOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static java.nio.channels.SeekableByteChannel forFiles(java.io.File... files) throws java.io.IOException
files
- the files to concatenate, note that the LAST FILE of files should be the LAST SEGMENT(.zip)
and theses files should be added in correct order (e.g. .z01, .z02... .z99, .zip)java.lang.NullPointerException
- if files is nulljava.io.IOException
- if opening a channel for one of the files failsjava.io.IOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static java.nio.channels.SeekableByteChannel forPaths(java.nio.file.Path... paths) throws java.io.IOException
paths
- the file paths to concatenate, note that the LAST FILE of files should be the LAST SEGMENT(.zip)
and these files should be added in correct order (e.g.: .z01, .z02... .z99, .zip)java.lang.NullPointerException
- if files is nulljava.io.IOException
- if opening a channel for one of the files failsjava.io.IOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static java.nio.channels.SeekableByteChannel forFiles(java.io.File lastSegmentFile, java.lang.Iterable<java.io.File> files) throws java.io.IOException
lastSegmentFile
- the last segment of split zip segments, its extension should be .zipfiles
- the files to concatenate except for the last segment,
note theses files should be added in correct order (e.g. .z01, .z02... .z99)java.io.IOException
- if the first channel doesn't seem to hold
the beginning of a split archivejava.lang.NullPointerException
- if files or lastSegmentFile is nullpublic static java.nio.channels.SeekableByteChannel forPaths(java.nio.file.Path lastSegmentPath, java.lang.Iterable<java.nio.file.Path> paths) throws java.io.IOException
lastSegmentPath
- the last segment path of split zip segments, its extension must be .zippaths
- the file paths to concatenate except for the last segment,
note these files should be added in correct order (e.g.: .z01, .z02... .z99)java.io.IOException
- if the first channel doesn't seem to hold
the beginning of a split archivejava.lang.NullPointerException
- if files or lastSegmentPath is nullCopyright © 2010 - 2023 Adobe. All Rights Reserved