Class HeaderWriter
java.lang.Object
net.lingala.zip4j.headers.HeaderWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final shortprivate final byte[]private final byte[]private final RawIOprivate static final shortprivate static final short -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Zip64EndOfCentralDirectoryRecordbuildZip64EndOfCentralDirectoryRecord(ZipModel zipModel, int sizeOfCentralDir, long offsetCentralDir) private intcalculateExtraDataRecordsSize(FileHeader fileHeader, boolean writeZip64ExtendedInfo) private longcountNumberOfFileHeaderEntriesOnDisk(List<FileHeader> fileHeaders, int numOfDisk) voidfinalizeZipFile(ZipModel zipModel, OutputStream outputStream, Charset charset) voidfinalizeZipFileWithoutValidations(ZipModel zipModel, OutputStream outputStream, Charset charset) private intgetCurrentSplitFileCounter(OutputStream outputStream) private longgetOffsetOfCentralDirectory(ZipModel zipModel) private booleanisSplitZipFile(OutputStream outputStream) private booleanisZip64Entry(FileHeader fileHeader) private voidprocessHeaderData(ZipModel zipModel, OutputStream outputStream) private voidupdateFileSizesInLocalFileHeader(SplitOutputStream outputStream, FileHeader fileHeader) voidupdateLocalFileHeader(FileHeader fileHeader, ZipModel zipModel, SplitOutputStream outputStream) private voidwriteCentralDirectory(ZipModel zipModel, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO, Charset charset) private voidwriteEndOfCentralDirectoryRecord(ZipModel zipModel, int sizeOfCentralDir, long offsetCentralDir, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO, Charset charset) voidwriteExtendedLocalHeader(LocalFileHeader localFileHeader, OutputStream outputStream) private voidwriteFileHeader(ZipModel zipModel, FileHeader fileHeader, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO, Charset charset) voidwriteLocalFileHeader(ZipModel zipModel, LocalFileHeader localFileHeader, OutputStream outputStream, Charset charset) private voidwriteRemainingExtraDataRecordsIfPresent(FileHeader fileHeader, OutputStream outputStream) private voidwriteZip64EndOfCentralDirectoryLocator(Zip64EndOfCentralDirectoryLocator zip64EndOfCentralDirectoryLocator, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO) private voidwriteZip64EndOfCentralDirectoryRecord(Zip64EndOfCentralDirectoryRecord zip64EndOfCentralDirectoryRecord, ByteArrayOutputStream byteArrayOutputStream, RawIO rawIO) private voidwriteZipHeaderBytes(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
-