Example usage for Java java.nio.channels FileChannel fields, constructors, methods, implement or subclass
The text is from its open source code.
void | close() Closes this channel. |
void | force(boolean metaData) Forces any updates to this channel's file to be written to the storage device that contains it. |
boolean | isOpen() |
FileLock | lock() Acquires an exclusive lock on this channel's file. |
FileLock | lock(long position, long size, boolean shared) Acquires a lock on the given region of this channel's file. |
MappedByteBuffer | map(MapMode mode, long position, long size) Maps a region of this channel's file directly into memory. |
FileChannel | open(Path path, Set extends OpenOption> options, FileAttribute>... attrs) Opens or creates a file, returning a file channel to access the file. |
FileChannel | open(Path path, OpenOption... options) Opens or creates a file, returning a file channel to access the file. |
FileChannel | position(long newPosition) Sets this channel's file position. |
long | position() Returns this channel's file position. |
int | read(ByteBuffer dst) Reads a sequence of bytes from this channel into the given buffer. |
long | read(ByteBuffer[] dsts) Reads a sequence of bytes from this channel into the given buffers. |
int | read(ByteBuffer dst, long position) Reads a sequence of bytes from this channel into the given buffer, starting at the given file position. |
long | size() Returns the current size of this channel's file. |
String | toString() Returns a string representation of the object. |
long | transferFrom(ReadableByteChannel src, long position, long count) Transfers bytes into this channel's file from the given readable byte channel. |
long | transferTo(long position, long count, WritableByteChannel target) Transfers bytes from this channel's file to the given writable byte channel. |
FileChannel | truncate(long size) Truncates this channel's file to the given size. |
FileLock | tryLock() Attempts to acquire an exclusive lock on this channel's file. |
FileLock | tryLock(long position, long size, boolean shared) Attempts to acquire a lock on the given region of this channel's file. |
int | write(ByteBuffer src) Writes a sequence of bytes to this channel from the given buffer. |
long | write(ByteBuffer[] srcs) Writes a sequence of bytes to this channel from the given buffers. |
int | write(ByteBuffer src, long position) Writes a sequence of bytes to this channel from the given buffer, starting at the given file position. |