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.RandomAccessFile
A 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[]
allSortedSplitFiles
private int
currentOpenSplitFileCounter
private java.io.RandomAccessFile
randomAccessFile
private java.lang.String
rwMode
private byte[]
singleByteBuffer
private long
splitLength
-
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 void
assertAllSplitFilesExist(java.io.File[] allSortedSplitFiles)
void
close()
long
getFilePointer()
long
length()
void
openLastSplitFileForReading()
private void
openRandomAccessFileForIndex(int splitCounter)
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
void
seek(long pos)
void
seekInCurrentPart(long pos)
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(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:
read
in classjava.io.RandomAccessFile
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.RandomAccessFile
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.RandomAccessFile
- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Overrides:
write
in classjava.io.RandomAccessFile
- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Overrides:
write
in classjava.io.RandomAccessFile
- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Overrides:
write
in classjava.io.RandomAccessFile
- Throws:
java.io.IOException
-
seek
public void seek(long pos) throws java.io.IOException
- Overrides:
seek
in classjava.io.RandomAccessFile
- Throws:
java.io.IOException
-
getFilePointer
public long getFilePointer() throws java.io.IOException
- Overrides:
getFilePointer
in classjava.io.RandomAccessFile
- Throws:
java.io.IOException
-
length
public long length() throws java.io.IOException
- Overrides:
length
in classjava.io.RandomAccessFile
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in 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
-
-