| Modifier and Type | Field and Description |
|---|---|
| private long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract void | |
| public final synchronized long | position()
Implements abstract java. Implements java. Returns this channel's file position. |
| public final synchronized FileChannel | position(long
The new position, a non-negative integer counting
the number of bytes from the beginning of the file newPosition)Implements abstract java. Implements java. Sets this channel's file position. |
| public final synchronized int | read(ByteBuffer
The buffer into which bytes are to be transferred dst)Implements abstract java. Implements java. Reads a sequence of bytes from this channel into the given buffer. |
| public final synchronized FileChannel | truncate(long
The new size, a non-negative byte count newLength)Implements abstract java. Implements java. Truncates this channel's file to the given size. |
| public final synchronized int | write(ByteBuffer
The buffer from which bytes are to be retrieved src)Implements abstract java. Implements java. Writes a sequence of bytes to this channel from the given buffer. |
| position | back to summary |
|---|---|
| private long position | |
| FileBaseDefault | back to summary |
|---|---|
| public FileBaseDefault() | |
| implTruncate | back to summary |
|---|---|
| protected abstract void implTruncate(long size) throws IOException The truncate implementation.
| |
| position | back to summary |
|---|---|
| public final synchronized long position() throws IOException Implements abstract java. Implements java. Doc from java. Returns this channel's file position.
| |
| position | back to summary |
|---|---|
| public final synchronized FileChannel position(long newPosition) throws IOException Implements abstract java. Implements java. Doc from java. 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.
| |
| read | back to summary |
|---|---|
| public final synchronized int read(ByteBuffer dst) throws IOException Implements abstract java. Implements java. Doc from java. 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
| |
| truncate | back to summary |
|---|---|
| public final synchronized FileChannel truncate(long newLength) throws IOException Implements abstract java. Implements java. Doc from java. 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.
| |
| write | back to summary |
|---|---|
| public final synchronized int write(ByteBuffer src) throws IOException Implements abstract java. Implements java. Doc from java. 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
| |