Modifier and Type | Field and Description |
---|---|
protected volatile boolean | |
protected final ReadWriteLock | |
protected final ExecutorService | |
protected final FileDescriptor | |
private volatile FileLockTable | |
protected final boolean | |
protected final boolean |
Access | Constructor and Description |
---|---|
protected | AsynchronousFileChannelImpl(FileDescriptor fdObj, boolean reading, boolean writing, ExecutorService executor)
|
Modifier and Type | Method and Description |
---|---|
protected final FileLockImpl | |
protected final void | |
protected final void | |
protected final void | |
pack-priv final void | |
pack-priv final ExecutorService | |
pack-priv abstract <A> Future | implLock(long position, long size, boolean shared, A attachment, CompletionHandler<FileLock, ? super A> handler)
|
pack-priv abstract <A> Future | implRead(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer, ? super A> handler)
|
protected abstract void | |
pack-priv abstract <A> Future | implWrite(ByteBuffer src, long position, A attachment, CompletionHandler<Integer, ? super A> handler)
|
pack-priv final void | |
public final boolean | |
public final Future | lock(long
The position at which the locked region is to start; must be
non-negative position, long The size of the locked region; must be non-negative, and the sum
size, boolean position + size must be non-negative.
A value of zero means to lock all bytes from the specified
starting position to the end of the file, regardless of whether
the file is subsequently extended or truncatedtrue to request a shared lock, in which case this
channel must be open for reading (and possibly writing);
false to request an exclusive lock, in which case this
channel must be open for writing (and possibly reading)Implements abstract java. Acquires a lock on the given region of this channel's file. |
public final <A> void | lock(long
The position at which the locked region is to start; must be
non-negative position, long The size of the locked region; must be non-negative, and the sum
size, boolean position + size must be non-negative.
A value of zero means to lock all bytes from the specified
starting position to the end of the file, regardless of whether
the file is subsequently extended or truncatedtrue to request a shared lock, in which case this
channel must be open for reading (and possibly writing);
false to request an exclusive lock, in which case this
channel must be open for writing (and possibly reading)The object to attach to the I/O operation; can be attachment, CompletionHandler<FileLock, ? super A> null The handler for consuming the result handler)Implements abstract java. Acquires a lock on the given region of this channel's file. |
public final Future | read(ByteBuffer
The buffer into which bytes are to be transferred dst, long The file position at which the transfer is to begin;
must be non-negative position)Implements abstract java. Reads a sequence of bytes from this channel into the given buffer, starting at the given file position. |
public final <A> void | read(ByteBuffer
The buffer into which bytes are to be transferred dst, long The file position at which the transfer is to begin;
must be non-negative position, A The object to attach to the I/O operation; can be attachment, CompletionHandler<Integer, ? super A> null The handler for consuming the result handler)Implements abstract java. Reads a sequence of bytes from this channel into the given buffer, starting at the given file position. |
pack-priv final void | release(FileLockImpl fli)
Invoked by FileLockImpl to release the given file lock and remove it from the lock table. |
protected final void | |
public final Future | write(ByteBuffer
The buffer from which bytes are to be transferred src, long The file position at which the transfer is to begin;
must be non-negative position)Implements abstract java. Writes a sequence of bytes to this channel from the given buffer, starting at the given file position. |
public final <A> void | write(ByteBuffer
The buffer from which bytes are to be transferred src, long The file position at which the transfer is to begin;
must be non-negative position, A The object to attach to the I/O operation; can be attachment, CompletionHandler<Integer, ? super A> null The handler for consuming the result handler)Implements abstract java. Writes a sequence of bytes to this channel from the given buffer, starting at the given file position. |
closed | back to summary |
---|---|
protected volatile boolean closed |
closeLock | back to summary |
---|---|
protected final ReadWriteLock closeLock |
executor | back to summary |
---|---|
protected final ExecutorService executor |
fdObj | back to summary |
---|---|
protected final FileDescriptor fdObj |
fileLockTable | back to summary |
---|---|
private volatile FileLockTable fileLockTable |
reading | back to summary |
---|---|
protected final boolean reading |
writing | back to summary |
---|---|
protected final boolean writing |
AsynchronousFileChannelImpl | back to summary |
---|---|
protected AsynchronousFileChannelImpl(FileDescriptor fdObj, boolean reading, boolean writing, ExecutorService executor) |
addToFileLockTable | back to summary |
---|---|
protected final FileLockImpl addToFileLockTable(long position, long size, boolean shared) Adds region to lock table |
begin | back to summary |
---|---|
protected final void begin() throws IOException Marks the beginning of an I/O operation.
|
end | back to summary |
---|---|
protected final void end() Marks the end of an I/O operation. |
end | back to summary |
---|---|
protected final void end(boolean completed) throws IOException Marks end of I/O operation |
ensureFileLockTableInitialized | back to summary |
---|---|
pack-priv final void ensureFileLockTableInitialized() throws IOException |
executor | back to summary |
---|---|
pack-priv final ExecutorService executor() |
implLock | back to summary |
---|---|
pack-priv abstract <A> Future |
implRead | back to summary |
---|---|
pack-priv abstract <A> Future |
implRelease | back to summary |
---|---|
protected abstract void implRelease(FileLockImpl fli) throws IOException Releases the given file lock. |
implWrite | back to summary |
---|---|
pack-priv abstract <A> Future |
invalidateAllLocks | back to summary |
---|---|
pack-priv final void invalidateAllLocks() throws IOException |
isOpen | back to summary |
---|---|
public final boolean isOpen() Implements java. Doc from java. Tells whether or not this channel is open.
|
lock | back to summary |
---|---|
public final Future Implements abstract java. Doc from java. Acquires a lock on the given region of this channel's file. This method initiates an operation to acquire a lock on the given
region of this channel's file. The method behaves in exactly the same
manner as the
|
lock | back to summary |
---|---|
public final <A> void lock(long position, long size, boolean shared, A attachment, CompletionHandler<FileLock, ? super A> handler) Implements abstract java. Doc from java. Acquires a lock on the given region of this channel's file. This method initiates an operation to acquire a lock on the given
region of this channel's file. The The region specified by the Some operating systems do not support a mechanism to acquire a file lock in an asynchronous manner. Consequently an implementation may acquire the file lock in a background thread or from a task executed by a thread in the associated thread pool. If there are many lock operations outstanding then it may consume threads in the Java virtual machine for indefinite periods. Some operating systems do not support shared locks, in which case a
request for a shared lock is automatically converted into a request for
an exclusive lock. Whether the newly-acquired lock is shared or
exclusive may be tested by invoking the resulting lock object's File locks are held on behalf of the entire Java virtual machine. They are not suitable for controlling access to a file by multiple threads within the same virtual machine.
|
read | back to summary |
---|---|
public final Future Implements abstract java. Doc from java. Reads a sequence of bytes from this channel into the given buffer, starting at the given file position. This method initiates the reading of a sequence of bytes from this
channel into the given buffer, starting at the given file position. This
method returns a This method works in the same manner as the
|
read | back to summary |
---|---|
public final <A> void read(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer, ? super A> handler) Implements abstract java. Doc from java. Reads a sequence of bytes from this channel into the given buffer, starting at the given file position. This method initiates the reading of a sequence of bytes from this
channel into the given buffer, starting at the given file position. The
result of the read is the number of bytes read or This method works in the same manner as the
|
release | back to summary |
---|---|
pack-priv final void release(FileLockImpl fli) throws IOException Invoked by FileLockImpl to release the given file lock and remove it from the lock table. |
removeFromFileLockTable | back to summary |
---|---|
protected final void removeFromFileLockTable(FileLockImpl fli) |
write | back to summary |
---|---|
public final Future Implements abstract java. Doc from java. Writes a sequence of bytes to this channel from the given buffer, starting at the given file position. This method initiates the writing of a sequence of bytes to this
channel from the given buffer, starting at the given file position. The
method returns a This method works in the same manner as the
|
write | back to summary |
---|---|
public final <A> void write(ByteBuffer src, long position, A attachment, CompletionHandler<Integer, ? super A> handler) Implements abstract java. Doc from java. Writes a sequence of bytes to this channel from the given buffer, starting at the given file position. This method works in the same manner as the
|