FileChannel (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Closeable, AutoCloseable, ByteChannel, Channel, GatheringByteChannel, InterruptibleChannel, ReadableByteChannel, ScatteringByteChannel, SeekableByteChannel, WritableByteChannel
-
Nested Class Summary
Nested Classes
-
Constructor Summary
Constructors
protectedInitializes a new instance of this class.
-
Method Summary
abstract voidforce(boolean metaData) Forces any updates to this channel's file to be written to the storage device that contains it.
lock()Acquires an exclusive lock on this channel's file.
lock(long position, long size, boolean shared) Acquires a lock on the given region of this channel's file.
Maps a region of this channel's file directly into memory.
Maps a region of this channel's file into a new mapped memory segment, with the given offset, size and arena.
Opens or creates a file, returning a file channel to access the file.
Opens or creates a file, returning a file channel to access the file.
abstract longposition()Returns this channel's file position.
position(long newPosition) Sets this channel's file position.
abstract intReads a sequence of bytes from this channel into the given buffer.
final longReads a sequence of bytes from this channel into the given buffers.
abstract longread(ByteBuffer[] dsts, int offset, int length) Reads a sequence of bytes from this channel into a subsequence of the given buffers.
abstract intReads a sequence of bytes from this channel into the given buffer, starting at the given file position.
abstract longsize()Returns the current size of this channel's file.
abstract longTransfers bytes into this channel's file from the given readable byte channel.
abstract longTransfers bytes from this channel's file to the given writable byte channel.
truncate(long size) Truncates this channel's file to the given size.
tryLock()Attempts to acquire an exclusive lock on this channel's file.
tryLock(long position, long size, boolean shared) Attempts to acquire a lock on the given region of this channel's file.
abstract intWrites a sequence of bytes to this channel from the given buffer.
final longWrites a sequence of bytes to this channel from the given buffers.
abstract longwrite(ByteBuffer[] srcs, int offset, int length) Writes a sequence of bytes to this channel from a subsequence of the given buffers.
abstract intWrites a sequence of bytes to this channel from the given buffer, starting at the given file position.
Methods declared in class AbstractInterruptibleChannel
begin, close, end, implCloseChannel, isOpenprotected final voidMarks the beginning of an I/O operation that might block indefinitely.
final voidprotected final voidend(boolean completed) Marks the end of an I/O operation that might block indefinitely.
protected abstract voidfinal booleanTells whether or not this channel is open.
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitCreates and returns a copy of this object.
booleanIndicates whether some other object is "equal to" this one.
protected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.intReturns a hash code value for this object.
final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
Returns a string representation of the object.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
FileChannel
-
-
Method Details
-
open
-
open
-
read
-
read
-
read
-
write
-
write
-
write
-
position
-
position
-
size
-
truncate
-
force
-
transferTo
-
transferFrom
-
read
-
write
-
map
-
map
-
lock
-
lock
-
tryLock
-
tryLock
-