public class UnzipFileIO extends AbstractFileIO
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.
|
void |
force(boolean withMetadata)
Forces any updates of this file to be written to the storage
device that contains it.
|
int |
getFileSystemBlockSize() |
long |
getSparseSize() |
MappedByteBuffer |
map(int sizeBytes)
Allocates memory mapped buffer for this file with given size.
|
long |
position()
Returns current file position.
|
void |
position(long newPosition)
Sets new current file position.
|
int |
punchHole(long position,
int len) |
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.
|
int |
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 |
readFully, readFully, readFully, writeFully, writeFully, writeFullyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittransferFrom, transferTopublic UnzipFileIO(File zip) throws IOException
zip - Compressed file.IOExceptionpublic int getFileSystemBlockSize()
public long getSparseSize()
FileIO.punchHole(long, int)public int punchHole(long position,
int len)
position - Starting file position.len - Number of bytes to free.public long position()
throws IOException
IOException - If some I/O error occurs.public void position(long newPosition)
throws IOException
newPosition - 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.dstBuf - 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.dstBuf - 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.buf - 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.srcBuf - Source buffer.IOException - If some I/O error occurs.public int write(ByteBuffer srcBuf, long position) throws IOException
sourceBuffer
starting from specified file positionsrcBuf - Source buffer.position - Starting file position.IOException - If some I/O error occurs.public int write(byte[] buf,
int off,
int len)
throws IOException
length bytes from the buffer
starting at offset off to this file.buf - 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
IOException - If some I/O error occurs.public void force(boolean withMetadata)
throws IOException
withMetadata - If true force also file metadata.IOException - If some I/O error occurs.public long size()
throws IOException
IOException - If some I/O error occurs.public void clear()
throws IOException
IOException - If some I/O error occurs.public MappedByteBuffer map(int sizeBytes) throws IOException
sizeBytes - Size of buffer.IOException - If some I/O error occurs.public void close()
throws IOException
IOException - If some I/O error occurs.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.9.0 Release Date : October 15 2020