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(List<SeekableByteChannel> channels)
Concatenates the given channels.
|
Modifier and Type | Method and Description |
---|---|
static SeekableByteChannel |
buildFromLastSplitSegment(File lastSegmentFile)
Concatenates zip split files from the last segment(the extension SHOULD be .zip)
|
static SeekableByteChannel |
forFiles(File... files)
Concatenates the given files.
|
static SeekableByteChannel |
forFiles(File lastSegmentFile,
Iterable<File> files)
Concatenates the given files.
|
static SeekableByteChannel |
forOrderedSeekableByteChannels(SeekableByteChannel... channels)
Concatenates the given channels.
|
static SeekableByteChannel |
forOrderedSeekableByteChannels(SeekableByteChannel lastSegmentChannel,
Iterable<SeekableByteChannel> channels)
Concatenates the given channels.
|
public ZipSplitReadOnlySeekableByteChannel(List<SeekableByteChannel> channels) throws 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 concatenateNullPointerException
- if channels is nullIOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static SeekableByteChannel forOrderedSeekableByteChannels(SeekableByteChannel... channels) throws 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)NullPointerException
- if channels is nullIOException
- if reading channels failspublic static SeekableByteChannel forOrderedSeekableByteChannels(SeekableByteChannel lastSegmentChannel, Iterable<SeekableByteChannel> channels) throws 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)NullPointerException
- if lastSegmentChannel or channels is nullIOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static SeekableByteChannel buildFromLastSplitSegment(File lastSegmentFile) throws IOException
lastSegmentFile
- the last segment of zip split files, note that the extension SHOULD be .zipIllegalArgumentException
- if the lastSegmentFile's extension is NOT .zipIOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static SeekableByteChannel forFiles(File... files) throws 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)NullPointerException
- if files is nullIOException
- if opening a channel for one of the files failsIOException
- if the first channel doesn't seem to hold
the beginning of a split archivepublic static SeekableByteChannel forFiles(File lastSegmentFile, Iterable<File> files) throws 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)IOException
- if the first channel doesn't seem to hold
the beginning of a split archiveNullPointerException
- if files or lastSegmentFile is nullCopyright © 2020 The Apache Software Foundation. All rights reserved.