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 boolean
checkBuffSizeAndStartNextSplitFile(int bufferSize)
Checks if the buffer size is sufficient for the current split file.void
close()
void
flush()
int
getCurrSplitFileCounter()
long
getFilePointer()
long
getSplitLength()
boolean
isBuffSizeFitForCurrSplitFile(int bufferSize)
Checks if the given buffer size will be fit in the current split file.boolean
isSplitZipFile()
void
seek(long pos)
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
SplitOutputStream
public SplitOutputStream(String name) throws FileNotFoundException, ZipException
- Throws:
FileNotFoundException
ZipException
-
SplitOutputStream
public SplitOutputStream(File file) throws FileNotFoundException, ZipException
- Throws:
FileNotFoundException
ZipException
-
SplitOutputStream
public SplitOutputStream(String name, long splitLength) throws FileNotFoundException, ZipException
- Throws:
FileNotFoundException
ZipException
-
SplitOutputStream
public SplitOutputStream(File file, long splitLength) throws FileNotFoundException, ZipException
- Throws:
FileNotFoundException
ZipException
-
-
Method Detail
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
checkBuffSizeAndStartNextSplitFile
public boolean checkBuffSizeAndStartNextSplitFile(int bufferSize) throws ZipException
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
-
isBuffSizeFitForCurrSplitFile
public boolean isBuffSizeFitForCurrSplitFile(int bufferSize) throws ZipException
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.
- Throws:
ZipException
-
seek
public void seek(long pos) throws IOException
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
getFilePointer
public long getFilePointer() throws IOException
- Throws:
IOException
-
isSplitZipFile
public boolean isSplitZipFile()
-
getSplitLength
public long getSplitLength()
-
getCurrSplitFileCounter
public int getCurrSplitFileCounter()
-
-