Package net.lingala.zip4j.io
Class SplitOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- net.lingala.zip4j.io.SplitOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class SplitOutputStream extends OutputStream
-
-
Constructor Summary
Constructors Constructor Description SplitOutputStream(File file)SplitOutputStream(File file, long splitLength)SplitOutputStream(String name)SplitOutputStream(String name, long splitLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckBuffSizeAndStartNextSplitFile(int bufferSize)Checks if the buffer size is sufficient for the current split file.voidclose()voidflush()intgetCurrSplitFileCounter()longgetFilePointer()longgetSplitLength()booleanisBuffSizeFitForCurrSplitFile(int bufferSize)Checks if the given buffer size will be fit in the current split file.booleanisSplitZipFile()voidseek(long pos)voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
SplitOutputStream
public SplitOutputStream(String name) throws FileNotFoundException, ZipException
- Throws:
FileNotFoundExceptionZipException
-
SplitOutputStream
public SplitOutputStream(File file) throws FileNotFoundException, ZipException
- Throws:
FileNotFoundExceptionZipException
-
SplitOutputStream
public SplitOutputStream(String name, long splitLength) throws FileNotFoundException, ZipException
- Throws:
FileNotFoundExceptionZipException
-
SplitOutputStream
public SplitOutputStream(File file, long splitLength) throws FileNotFoundException, ZipException
- Throws:
FileNotFoundExceptionZipException
-
-
Method Detail
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
checkBuffSizeAndStartNextSplitFile
public boolean checkBuffSizeAndStartNextSplitFile(int bufferSize) throws ZipExceptionChecks 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
-
isBuffSizeFitForCurrSplitFile
public boolean isBuffSizeFitForCurrSplitFile(int bufferSize) throws ZipExceptionChecks 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.
- Throws:
ZipException
-
seek
public void seek(long pos) throws IOException- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
getFilePointer
public long getFilePointer() throws IOException- Throws:
IOException
-
isSplitZipFile
public boolean isSplitZipFile()
-
getSplitLength
public long getSplitLength()
-
getCurrSplitFileCounter
public int getCurrSplitFileCounter()
-
-