public class NoChecksumFileIO extends CheckedFileIO
| Modifier and Type | Field and Description |
|---|---|
static short |
NO_CHECKSUM_SUPER_BLOCK_LENGTH_DEFAULT
The super block length for NO_CHECKSUM should always be 0.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the file channel
|
void |
flush()
Flush method is used to flush the file onto storage.
|
long |
position()
Returns this channel's file relative position.
|
void |
position(long newPosition)
Sets this channel's file position from the input relative position.
|
void |
read(ByteBuffer dst,
long position)
Read data from the channel to the given byte buffer from the input relative position until there are no bytes
remaining in the buffer or the end of the file has been reached.
|
long |
size()
Size of file channel based on relative position.
|
String |
toString() |
void |
truncate(long size)
Truncate file channel to given size based on relative position.
|
boolean |
validate()
Validate compares with the value stored in header of the file with the checksum computed of the entire file.
|
void |
write(ByteBuffer src)
Write the given buffer into the file channel at the relative file channel position
NOTE: File position is updated with the number of bytes written
|
void |
write(ByteBuffer src,
long position)
Write the given buffer into the file channel at the input relative position in file channel.
|
checksum, create, isValidPath, migrateFile, open, open, openOrCreate, openOrCreate, transferFrom, transferTo, validPath, verifyOnlyValidFileExistspublic static final short NO_CHECKSUM_SUPER_BLOCK_LENGTH_DEFAULT
public boolean validate()
throws IOException,
InstantiationException,
IllegalAccessException
CheckedFileIOvalidate in class CheckedFileIOIOException - If any I/O error occursInstantiationExceptionIllegalAccessExceptionpublic void read(ByteBuffer dst, long position) throws IOException
CheckedFileIOread in class CheckedFileIOdst - The byte buffer to which bytes are to be transferredposition - The file position at which the transfer is to beginIOException - If any I/O error occurspublic void write(ByteBuffer src) throws IOException
CheckedFileIOwrite in class CheckedFileIOsrc - The buffer from which bytes are to be transferredIOException - If any I/O error occurspublic void write(ByteBuffer src, long position) throws IOException
CheckedFileIOwrite in class CheckedFileIOsrc - The buffer from which bytes are to be transferredposition - The file position at which the transfer is to beginIOException - If any I/O error occurspublic long position()
throws IOException
CheckedFileIOposition in class CheckedFileIOIOException - If any I/O error occurspublic void position(long newPosition)
throws IOException
CheckedFileIOposition in class CheckedFileIOnewPosition - The new positionIOException - If any I/O error occurspublic long size()
throws IOException
CheckedFileIOsize in class CheckedFileIOIOException - If any I/O error occurspublic void truncate(long size)
throws IOException
CheckedFileIOtruncate in class CheckedFileIOsize - The new size of file channelIOException - If any I/O error occurspublic void flush()
throws IOException
CheckedFileIOflush in class CheckedFileIOIOException - If any I/O error occurspublic void close()
throws IOException
CheckedFileIOclose in interface AutoCloseableclose in class CheckedFileIOIOException - If any I/O error occurs