Package net.lingala.zip4j.io.inputstream
Class NumberedSplitRandomAccessFile
- java.lang.Object
-
- java.io.RandomAccessFile
-
- net.lingala.zip4j.io.inputstream.NumberedSplitRandomAccessFile
-
- All Implemented Interfaces:
java.io.Closeable,java.io.DataInput,java.io.DataOutput,java.lang.AutoCloseable
public class NumberedSplitRandomAccessFile extends java.io.RandomAccessFileA RandomAccessFile which reads files split with 7-zip format (.z001, .z002, etc) as a single file making it easier for calling methods to deal with opening appropriate split file to read
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File[]allSortedSplitFilesprivate intcurrentOpenSplitFileCounterprivate java.io.RandomAccessFilerandomAccessFileprivate java.lang.StringrwModeprivate byte[]singleByteBufferprivate longsplitLength
-
Constructor Summary
Constructors Constructor Description NumberedSplitRandomAccessFile(java.io.File file, java.lang.String mode)NumberedSplitRandomAccessFile(java.io.File file, java.lang.String mode, java.io.File[] allSortedSplitFiles)NumberedSplitRandomAccessFile(java.lang.String name, java.lang.String mode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidassertAllSplitFilesExist(java.io.File[] allSortedSplitFiles)voidclose()longgetFilePointer()longlength()voidopenLastSplitFileForReading()private voidopenRandomAccessFileForIndex(int splitCounter)intread()intread(byte[] b)intread(byte[] b, int off, int len)voidseek(long pos)voidseekInCurrentPart(long pos)voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.RandomAccessFile
getChannel, getFD, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
-
-
-
Field Detail
-
splitLength
private long splitLength
-
allSortedSplitFiles
private java.io.File[] allSortedSplitFiles
-
randomAccessFile
private java.io.RandomAccessFile randomAccessFile
-
singleByteBuffer
private byte[] singleByteBuffer
-
currentOpenSplitFileCounter
private int currentOpenSplitFileCounter
-
rwMode
private java.lang.String rwMode
-
-
Constructor Detail
-
NumberedSplitRandomAccessFile
public NumberedSplitRandomAccessFile(java.lang.String name, java.lang.String mode) throws java.io.IOException- Throws:
java.io.IOException
-
NumberedSplitRandomAccessFile
public NumberedSplitRandomAccessFile(java.io.File file, java.lang.String mode) throws java.io.IOException- Throws:
java.io.IOException
-
NumberedSplitRandomAccessFile
public NumberedSplitRandomAccessFile(java.io.File file, java.lang.String mode, java.io.File[] allSortedSplitFiles) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Overrides:
readin classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException- Overrides:
readin classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein interfacejava.io.DataOutput- Overrides:
writein classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException- Specified by:
writein interfacejava.io.DataOutput- Overrides:
writein classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Specified by:
writein interfacejava.io.DataOutput- Overrides:
writein classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
seek
public void seek(long pos) throws java.io.IOException- Overrides:
seekin classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
getFilePointer
public long getFilePointer() throws java.io.IOException- Overrides:
getFilePointerin classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
length
public long length() throws java.io.IOException- Overrides:
lengthin classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.RandomAccessFile- Throws:
java.io.IOException
-
seekInCurrentPart
public void seekInCurrentPart(long pos) throws java.io.IOException- Throws:
java.io.IOException
-
openLastSplitFileForReading
public void openLastSplitFileForReading() throws java.io.IOException- Throws:
java.io.IOException
-
openRandomAccessFileForIndex
private void openRandomAccessFileForIndex(int splitCounter) throws java.io.IOException- Throws:
java.io.IOException
-
assertAllSplitFilesExist
private void assertAllSplitFilesExist(java.io.File[] allSortedSplitFiles) throws java.io.IOException- Throws:
java.io.IOException
-
-