Returns this channel's file position.
Sets this channel's file position.
Setting the position to a value that is greater than the file's current size is legal but does not change the size of the file. A later attempt to read bytes at such a position will immediately return an end-of-file indication. A later attempt to write bytes at such a position will cause the file to be grown to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.
Reads a sequence of bytes from this channel into the given buffer.
Bytes are read starting at this channel's current file position, and
then the file position is updated with the number of bytes actually
read. Otherwise this method behaves exactly as specified in the ReadableByteChannel
interface.
-1
if the
channel has reached end-of-stream
Reads a sequence of bytes from this channel into the given buffers.
Bytes are read starting at this channel's current file position, and
then the file position is updated with the number of bytes actually
read. Otherwise this method behaves exactly as specified in the ScatteringByteChannel
interface.
-1
if the channel has reached end-of-stream
Reads a sequence of bytes from this channel into a subsequence of the given buffers.
Bytes are read starting at this channel's current file position, and
then the file position is updated with the number of bytes actually
read. Otherwise this method behaves exactly as specified in the ScatteringByteChannel
interface.
-1
if the channel has reached end-of-stream
Returns the current size of this channel's file.
Truncates this channel's file to the given size.
If the given size is less than the file's current size then the file is truncated, discarding any bytes beyond the new end of the file. If the given size is greater than or equal to the file's current size then the file is not modified. In either case, if this channel's file position is greater than the given size then it is set to that size.
Writes a sequence of bytes to this channel from the given buffer.
Bytes are written starting at this channel's current file position
unless the channel is in append mode, in which case the position is
first advanced to the end of the file. The file is grown, if necessary,
to accommodate the written bytes, and then the file position is updated
with the number of bytes actually written. Otherwise this method
behaves exactly as specified by the WritableByteChannel
interface.
Writes a sequence of bytes to this channel from the given buffers.
Bytes are written starting at this channel's current file position
unless the channel is in append mode, in which case the position is
first advanced to the end of the file. The file is grown, if necessary,
to accommodate the written bytes, and then the file position is updated
with the number of bytes actually written. Otherwise this method
behaves exactly as specified in the GatheringByteChannel
interface.
Writes a sequence of bytes to this channel from a subsequence of the given buffers.
Bytes are written starting at this channel's current file position
unless the channel is in append mode, in which case the position is
first advanced to the end of the file. The file is grown, if necessary,
to accommodate the written bytes, and then the file position is updated
with the number of bytes actually written. Otherwise this method
behaves exactly as specified in the GatheringByteChannel
interface.
Diagram: FileChannel