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 long
private int
private RandomAccessFile
private RawIO
private long
private File
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkBufferSizeAndStartNextSplitFile
(int bufferSize) Checks if the buffer size is sufficient for the current split file.void
close()
int
long
long
private boolean
isBufferSizeFitForCurrSplitFile
(int bufferSize) Checks if the given buffer size will be fit in the current split file.private boolean
isHeaderData
(byte[] buff) boolean
void
seek
(long pos) int
skipBytes
(int n) private void
void
write
(byte[] b) void
write
(byte[] b, int off, int len) void
write
(int b) Methods inherited from class java.io.OutputStream
flush
-
Field Details
-
raf
-
splitLength
private long splitLength -
zipFile
-
currSplitFileCounter
private int currSplitFileCounter -
bytesWrittenForThisPart
private long bytesWrittenForThisPart -
rawIO
-
-
Constructor Details
-
SplitOutputStream
- Throws:
FileNotFoundException
ZipException
-
SplitOutputStream
- Throws:
FileNotFoundException
ZipException
-
-
Method Details
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
getFilePointer
- Specified by:
getFilePointer
in interfaceOutputStreamWithSplitZipSupport
- Throws:
IOException
-
isSplitZipFile
public boolean isSplitZipFile() -
getSplitLength
public long getSplitLength() -
getCurrentSplitFileCounter
public int getCurrentSplitFileCounter()- Specified by:
getCurrentSplitFileCounter
in interfaceOutputStreamWithSplitZipSupport
-