public class UnzipFileIO extends Object implements FileIO
FileIO that allows to work with ZIP compressed file.
Doesn't allow random access and setting FileIO.position() backwards.
Allows sequential reads including setting FileIO.position() forward.| Constructor and Description |
|---|
UnzipFileIO(File zip) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Truncates current file to zero length
and resets current file position to zero.
|
void |
close()
Closes current file.
|
void |
force()
Forces any updates of this file to be written to the storage
device that contains it.
|
MappedByteBuffer |
map(int maxWalSegmentSize) |
long |
position()
Returns current file position.
|
void |
position(long newPosition)
Sets new current file position.
|
int |
read(byte[] buf,
int off,
int len)
Reads a up to
length bytes from this file into the buffer. |
int |
read(ByteBuffer dstBuf)
Reads a sequence of bytes from this file into the
destinationBuffer. |
int |
read(ByteBuffer dstBuf,
long position)
Reads a sequence of bytes from this file into the
destinationBuffer
starting from specified file position. |
long |
size()
Returns current file size in bytes.
|
void |
write(byte[] buf,
int off,
int len)
Writes
length bytes from the buffer
starting at offset off to this file. |
int |
write(ByteBuffer srcBuf)
Writes a sequence of bytes to this file from the
sourceBuffer. |
int |
write(ByteBuffer srcBuf,
long position)
Writes a sequence of bytes to this file from the
sourceBuffer
starting from specified file position |
public UnzipFileIO(File zip) throws IOException
zip - Compressed file.IOExceptionpublic long position()
throws IOException
position in interface FileIOIOException - If some I/O error occurs.public void position(long newPosition)
throws IOException
position in interface FileIOnewPosition - The new position, a non-negative integer counting
the number of bytes from the beginning of the file.IOException - If some I/O error occurs.public int read(ByteBuffer dstBuf) throws IOException
destinationBuffer.read in interface FileIOdstBuf - Destination byte buffer.IOException - If some I/O error occurs.public int read(ByteBuffer dstBuf, long position) throws IOException
destinationBuffer
starting from specified file position.read in interface FileIOdstBuf - Destination byte buffer.position - Starting position of file.IOException - If some I/O error occurs.public int read(byte[] buf,
int off,
int len)
throws IOException
length bytes from this file into the buffer.read in interface FileIObuf - Destination byte array.off - The start offset in array b
at which the data is written.len - Maximum number of bytes read.IOException - If some I/O error occurs.public int write(ByteBuffer srcBuf) throws IOException
sourceBuffer.write in interface FileIOsrcBuf - Source buffer.IOException - If some I/O error occurs.public int write(ByteBuffer srcBuf, long position) throws IOException
sourceBuffer
starting from specified file positionwrite in interface FileIOsrcBuf - Source buffer.position - Starting file position.IOException - If some I/O error occurs.public void write(byte[] buf,
int off,
int len)
throws IOException
length bytes from the buffer
starting at offset off to this file.write in interface FileIObuf - Source byte array.off - Start offset in the buffer.len - Number of bytes to write.IOException - If some I/O error occurs.public void force()
throws IOException
force in interface FileIOIOException - If some I/O error occurs.public long size()
throws IOException
size in interface FileIOIOException - If some I/O error occurs.public void clear()
throws IOException
clear in interface FileIOIOException - If some I/O error occurs.public MappedByteBuffer map(int maxWalSegmentSize) throws IOException
map in interface FileIOIOExceptionpublic void close()
throws IOException
close in interface AutoCloseableclose in interface FileIOIOException - If some I/O error occurs.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.6.0 Release Date : July 10 2018