ZipArchiveOutputStream when creating a split archive.
| Modifier and Type | Field and Description |
|---|---|
| private FileChannel | |
| private long | |
| private int | |
| private final List | |
| private boolean | |
| private FileRandomAccessOutputStream | |
| private final TreeMap | |
| private final byte[] | |
| private final long | |
| private long | |
| private static final long | |
| private static final long | ZIP_SEGMENT_MIN_SIZE
8.5.1 Capacities for split archives are as follows: Maximum number of segments = 4,294,967,295 - 1 Maximum .ZIP segment size = 4,294,967,295 bytes (refer to section 8.5.6) Minimum segment size = 64K Maximum PKSFX segment size = 2,147,483,647 bytes |
| private Path |
| Access | Constructor and Description |
|---|---|
| pack-priv | ZipSplitOutputStream(final File
the ZIP file to write to zipFile, final long the split size splitSize)Creates a split ZIP. |
| pack-priv | ZipSplitOutputStream(final Path
the path to ZIP file to write to zipFile, final long the split size splitSize)Creates a split ZIP. |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public void | close()
Overrides java. Implements java. |
| private Path | createNewSplitSegmentFile(final Integer zipSplitSegmentSuffixIndex)
Creates the new ZIP split segment, the last ZIP segment should be .zip, and the ZIP split segments' suffix should be like .z01, .z02, .z03, ... |
| private void | |
| public long | |
| public int | |
| private Path | |
| private void | |
| public long | position()
Implements abstract org. |
| public void | prepareToWriteUnsplittableContent(final long unsplittableContentSize)
Some data can not be written to different split segments, for example: 4.4.1.5 The end of central directory record and the Zip64 end of central directory locator record MUST reside on the same disk when splitting or spanning an archive. |
| public void | write(final byte[]
the data. b)Overrides java. b.length bytes from the specified byte array
to this output stream.
|
| public void | write(final byte[]
data to write b, final int offset of the start of data in param b off, final int the length of data to write len)Overrides java. |
| public void | write(final int
the i)byte.Overrides org. |
| public void | writeFully(final byte[]
data to write b, final int offset of the start of data in param b off, final int the length of data to write len, final long position in the stream atPosition)Implements abstract org. |
| private void | writeToSegment(final Path segment, final long position, final byte[] b, final int off, final int len)
|
| private void | writeZipSplitSignature()
Writes the ZIP split signature (0x08074B50) to the head of the first ZIP split segment |
| currentChannel | back to summary |
|---|---|
| private FileChannel currentChannel | |
| currentSplitSegmentBytesWritten | back to summary |
|---|---|
| private long currentSplitSegmentBytesWritten | |
| currentSplitSegmentIndex | back to summary |
|---|---|
| private int currentSplitSegmentIndex | |
| diskToPosition | back to summary |
|---|---|
| private final List<Long> diskToPosition | |
| finished | back to summary |
|---|---|
| private boolean finished | |
| outputStream | back to summary |
|---|---|
| private FileRandomAccessOutputStream outputStream | |
| positionToFiles | back to summary |
|---|---|
| private final TreeMap<Long, Path> positionToFiles | |
| singleByte | back to summary |
|---|---|
| private final byte[] singleByte | |
| splitSize | back to summary |
|---|---|
| private final long splitSize | |
| totalPosition | back to summary |
|---|---|
| private long totalPosition | |
| ZIP_SEGMENT_MAX_SIZE | back to summary |
|---|---|
| private static final long ZIP_SEGMENT_MAX_SIZE | |
| ZIP_SEGMENT_MIN_SIZE | back to summary |
|---|---|
| private static final long ZIP_SEGMENT_MIN_SIZE 8.5.1 Capacities for split archives are as follows: Maximum number of segments = 4,294,967,295 - 1 Maximum .ZIP segment size = 4,294,967,295 bytes (refer to section 8.5.6) Minimum segment size = 64K Maximum PKSFX segment size = 2,147,483,647 bytes | |
| zipFile | back to summary |
|---|---|
| private Path zipFile | |
| ZipSplitOutputStream | back to summary |
|---|---|
| pack-priv ZipSplitOutputStream(final File zipFile, final long splitSize) throws IllegalArgumentException, IOException Creates a split ZIP. If the ZIP file is smaller than the split size, then there will only be one split ZIP, and its suffix is .zip, otherwise the split segments should be like .z01, .z02, ... .z(N-1), .zip
| |
| ZipSplitOutputStream | back to summary |
|---|---|
| pack-priv ZipSplitOutputStream(final Path zipFile, final long splitSize) throws IllegalArgumentException, IOException Creates a split ZIP. If the ZIP file is smaller than the split size, then there will only be one split ZIP, and its suffix is .zip, otherwise the split segments should be like .z01, .z02, ... .z(N-1), .zip
| |
| calculateDiskPosition | back to summary |
|---|---|
| public long calculateDiskPosition(final long disk, final long localOffset) throws IOException | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this output stream and releases any system resources
associated with this stream. The general contract of
| |
| createNewSplitSegmentFile | back to summary |
|---|---|
| private Path createNewSplitSegmentFile(final Integer zipSplitSegmentSuffixIndex) throws IOException Creates the new ZIP split segment, the last ZIP segment should be .zip, and the ZIP split segments' suffix should be like .z01, .z02, .z03, ... .z99, .z100, ..., .z(N-1), .zip 8.3.3 Split ZIP files are typically written to the same location and are subject to name collisions if the spanned name format is used since each segment will reside on the same drive. To avoid name collisions, split archives are named as follows. Segment 1 = filename.z01 Segment n-1 = filename.z(n-1) Segment n = filename.zip Note The ZIP split segment begin from 1,2,3,... , and we're creating a new segment, so the new segment suffix should be (currentSplitSegmentIndex + 2) | |
| finish | back to summary |
|---|---|
| private void finish() throws IOException The last ZIP split segment's suffix should be .zip | |
| getCurrentSplitSegmentBytesWritten | back to summary |
|---|---|
| public long getCurrentSplitSegmentBytesWritten() | |
| getCurrentSplitSegmentIndex | back to summary |
|---|---|
| public int getCurrentSplitSegmentIndex() | |
| getSplitSegmentFileName | back to summary |
|---|---|
| private Path getSplitSegmentFileName(final Integer zipSplitSegmentSuffixIndex) | |
| openNewSplitSegment | back to summary |
|---|---|
| private void openNewSplitSegment() throws IOException Creates a new ZIP split segment and prepare to write to the new segment | |
| position | back to summary |
|---|---|
| public long position() Implements abstract org. Doc from org. Provides current position in output.
| |
| prepareToWriteUnsplittableContent | back to summary |
|---|---|
| public void prepareToWriteUnsplittableContent(final long unsplittableContentSize) throws IllegalArgumentException, IOException Some data can not be written to different split segments, for example: 4.4.1.5 The end of central directory record and the Zip64 end of central directory locator record MUST reside on the same disk when splitting or spanning an archive. | |
| write | back to summary |
|---|---|
| public void write(final byte[] b) throws IOException Overrides java. Doc from java. Writes
| |
| write | back to summary |
|---|---|
| public void write(final byte[] b, final int off, final int len) throws IOException Overrides java. Writes the data to ZIP split segments, if the remaining space of current split segment is not enough, then a new split segment should be created
| |
| write | back to summary |
|---|---|
| public void write(final int i) throws IOException Overrides org. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| writeFully | back to summary |
|---|---|
| public void writeFully(final byte[] b, final int off, final int len, final long atPosition) throws IOException Implements abstract org. Doc from org. Writes given data to specific position.
| |
| writeToSegment | back to summary |
|---|---|
| private void writeToSegment(final Path segment, final long position, final byte[] b, final int off, final int len) throws IOException | |
| writeZipSplitSignature | back to summary |
|---|---|
| private void writeZipSplitSignature() throws IOException Writes the ZIP split signature (0x08074B50) to the head of the first ZIP split segment | |