Package net.lingala.zip4j.headers
Class HeaderWriter
java.lang.Object
net.lingala.zip4j.headers.HeaderWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final short
private final byte[]
private final byte[]
private final RawIO
private static final short
private static final short
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Zip64EndOfCentralDirectoryRecord
buildZip64EndOfCentralDirectoryRecord
(ZipModel zipModel, int sizeOfCentralDir, long offsetCentralDir) private int
calculateExtraDataRecordsSize
(FileHeader fileHeader, boolean writeZip64ExtendedInfo) private long
countNumberOfFileHeaderEntriesOnDisk
(List<FileHeader> fileHeaders, int numOfDisk) void
finalizeZipFile
(ZipModel zipModel, OutputStream outputStream, Charset charset) void
finalizeZipFileWithoutValidations
(ZipModel zipModel, OutputStream outputStream, Charset charset) private int
getCurrentSplitFileCounter
(OutputStream outputStream) private long
getOffsetOfCentralDirectory
(ZipModel zipModel) private boolean
isSplitZipFile
(OutputStream outputStream) private boolean
isZip64Entry
(FileHeader fileHeader) private void
processHeaderData
(ZipModel zipModel, OutputStream outputStream) private void
updateFileSizesInLocalFileHeader
(SplitOutputStream outputStream, FileHeader fileHeader) void
updateLocalFileHeader
(FileHeader fileHeader, ZipModel zipModel, SplitOutputStream outputStream) private void
writeCentralDirectory
(ZipModel zipModel, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO, Charset charset) private void
writeEndOfCentralDirectoryRecord
(ZipModel zipModel, int sizeOfCentralDir, long offsetCentralDir, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO, Charset charset) void
writeExtendedLocalHeader
(LocalFileHeader localFileHeader, OutputStream outputStream) private void
writeFileHeader
(ZipModel zipModel, FileHeader fileHeader, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO, Charset charset) void
writeLocalFileHeader
(ZipModel zipModel, LocalFileHeader localFileHeader, OutputStream outputStream, Charset charset) private void
writeRemainingExtraDataRecordsIfPresent
(FileHeader fileHeader, OutputStream outputStream) private void
writeZip64EndOfCentralDirectoryLocator
(Zip64EndOfCentralDirectoryLocator zip64EndOfCentralDirectoryLocator, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO) private void
writeZip64EndOfCentralDirectoryRecord
(Zip64EndOfCentralDirectoryRecord zip64EndOfCentralDirectoryRecord, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO) private void
writeZipHeaderBytes
(ZipModel zipModel, OutputStream outputStream, byte[] buff, Charset charset)
-
Field Details
-
ZIP64_EXTRA_DATA_RECORD_SIZE_LFH
private static final short ZIP64_EXTRA_DATA_RECORD_SIZE_LFH- See Also:
-
ZIP64_EXTRA_DATA_RECORD_SIZE_FH
private static final short ZIP64_EXTRA_DATA_RECORD_SIZE_FH- See Also:
-
AES_EXTRA_DATA_RECORD_SIZE
private static final short AES_EXTRA_DATA_RECORD_SIZE- See Also:
-
rawIO
-
longBuff
private final byte[] longBuff -
intBuff
private final byte[] intBuff
-
-
Constructor Details
-
HeaderWriter
public HeaderWriter()
-
-
Method Details
-
writeLocalFileHeader
public void writeLocalFileHeader(ZipModel zipModel, LocalFileHeader localFileHeader, OutputStream outputStream, Charset charset) throws IOException - Throws:
IOException
-
writeExtendedLocalHeader
public void writeExtendedLocalHeader(LocalFileHeader localFileHeader, OutputStream outputStream) throws IOException - Throws:
IOException
-
finalizeZipFile
public void finalizeZipFile(ZipModel zipModel, OutputStream outputStream, Charset charset) throws IOException - Throws:
IOException
-
finalizeZipFileWithoutValidations
public void finalizeZipFileWithoutValidations(ZipModel zipModel, OutputStream outputStream, Charset charset) throws IOException - Throws:
IOException
-
updateLocalFileHeader
public void updateLocalFileHeader(FileHeader fileHeader, ZipModel zipModel, SplitOutputStream outputStream) throws IOException - Throws:
IOException
-
updateFileSizesInLocalFileHeader
private void updateFileSizesInLocalFileHeader(SplitOutputStream outputStream, FileHeader fileHeader) throws IOException - Throws:
IOException
-
isSplitZipFile
-
getCurrentSplitFileCounter
-
writeZipHeaderBytes
private void writeZipHeaderBytes(ZipModel zipModel, OutputStream outputStream, byte[] buff, Charset charset) throws IOException - Throws:
IOException
-
processHeaderData
- Throws:
IOException
-
writeCentralDirectory
private void writeCentralDirectory(ZipModel zipModel, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO, Charset charset) throws ZipException - Throws:
ZipException
-
writeFileHeader
private void writeFileHeader(ZipModel zipModel, FileHeader fileHeader, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO, Charset charset) throws ZipException - Throws:
ZipException
-
calculateExtraDataRecordsSize
-
writeRemainingExtraDataRecordsIfPresent
private void writeRemainingExtraDataRecordsIfPresent(FileHeader fileHeader, OutputStream outputStream) throws IOException - Throws:
IOException
-
writeZip64EndOfCentralDirectoryRecord
private void writeZip64EndOfCentralDirectoryRecord(Zip64EndOfCentralDirectoryRecord zip64EndOfCentralDirectoryRecord, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO) throws IOException - Throws:
IOException
-
writeZip64EndOfCentralDirectoryLocator
private void writeZip64EndOfCentralDirectoryLocator(Zip64EndOfCentralDirectoryLocator zip64EndOfCentralDirectoryLocator, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO) throws IOException - Throws:
IOException
-
writeEndOfCentralDirectoryRecord
private void writeEndOfCentralDirectoryRecord(ZipModel zipModel, int sizeOfCentralDir, long offsetCentralDir, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO, Charset charset) throws IOException - Throws:
IOException
-
countNumberOfFileHeaderEntriesOnDisk
private long countNumberOfFileHeaderEntriesOnDisk(List<FileHeader> fileHeaders, int numOfDisk) throws ZipException - Throws:
ZipException
-
isZip64Entry
-
getOffsetOfCentralDirectory
-
buildZip64EndOfCentralDirectoryRecord
private Zip64EndOfCentralDirectoryRecord buildZip64EndOfCentralDirectoryRecord(ZipModel zipModel, int sizeOfCentralDir, long offsetCentralDir) throws ZipException - Throws:
ZipException
-