Class SplitOutputStream
java.lang.Object
java.io.OutputStream
net.lingala.zip4j.io.outputstream.SplitOutputStream
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, OutputStreamWithSplitZipSupport
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate intprivate RandomAccessFileprivate RawIOprivate longprivate File -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckBufferSizeAndStartNextSplitFile(int bufferSize) Checks if the buffer size is sufficient for the current split file.voidclose()intlonglongprivate booleanisBufferSizeFitForCurrSplitFile(int bufferSize) Checks if the given buffer size will be fit in the current split file.private booleanisHeaderData(byte[] buff) booleanvoidseek(long pos) intskipBytes(int n) private voidvoidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) Methods inherited from class OutputStream
flush
-
Field Details
-
raf
-
splitLength
private long splitLength -
zipFile
-
currSplitFileCounter
private int currSplitFileCounter -
bytesWrittenForThisPart
private long bytesWrittenForThisPart -
rawIO
-
-
Constructor Details
-
SplitOutputStream
- Throws:
FileNotFoundExceptionZipException
-
SplitOutputStream
- Throws:
FileNotFoundExceptionZipException
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
startNextSplitFile
- Throws:
IOException
-
isHeaderData
private boolean isHeaderData(byte[] buff) -
checkBufferSizeAndStartNextSplitFile
Checks if the buffer size is sufficient for the current split file. If not a new split file will be started.- Parameters:
bufferSize-- Returns:
- true if a new split file was started else false
- Throws:
ZipException
-
isBufferSizeFitForCurrSplitFile
private boolean isBufferSizeFitForCurrSplitFile(int bufferSize) Checks if the given buffer size will be fit in the current split file. If this output stream is a non-split file, then this method always returns true- Parameters:
bufferSize-- Returns:
- true if the buffer size is fit in the current split file or else false.
-
seek
- Throws:
IOException
-
skipBytes
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
getFilePointer
- Specified by:
getFilePointerin interfaceOutputStreamWithSplitZipSupport- Throws:
IOException
-
isSplitZipFile
public boolean isSplitZipFile() -
getSplitLength
public long getSplitLength() -
getCurrentSplitFileCounter
public int getCurrentSplitFileCounter()- Specified by:
getCurrentSplitFileCounterin interfaceOutputStreamWithSplitZipSupport
-