Modifier and Type | Class and Description |
---|---|
private static class |
Modifier and Type | Field and Description |
---|---|
private static final FileDispatcher | |
private final String | |
private final NativeThreadSet |
Access | Constructor and Description |
---|---|
pack-priv | SimpleAsynchronousFileChannelImpl(FileDescriptor fdObj, String path, boolean reading, boolean writing, ExecutorService executor)
|
Modifier and Type | Method and Description |
---|---|
public void | |
public void | force(boolean
If metaData)true then this method is required to force changes
to both the file's content and metadata to be written to
storage; otherwise, it need only force content changes to be
writtenImplements abstract java. Forces any updates to this channel's file to be written to the storage device that contains it. |
private void | |
pack-priv <A> Future | implLock(final long position, final long size, final boolean shared, final A attachment, final CompletionHandler<FileLock, ? super A> handler)
Implements abstract sun.
|
pack-priv <A> Future | implRead(final ByteBuffer dst, final long position, final A attachment, final CompletionHandler<Integer, ? super A> handler)
Implements abstract sun.
|
protected void | implRelease(FileLockImpl fli)
Implements abstract sun. Releases the given file lock. |
pack-priv <A> Future | implWrite(final ByteBuffer src, final long position, final A attachment, final CompletionHandler<Integer, ? super A> handler)
Implements abstract sun.
|
public static AsynchronousFileChannel | |
public long | size()
Implements abstract java. Returns the current size of this channel's file. |
public AsynchronousFileChannel | truncate(long
The new size, a non-negative byte count size)Implements abstract java. Truncates this channel's file to the given size. |
public FileLock | tryLock(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,
false to request an exclusive lockImplements abstract java. Attempts to acquire a lock on the given region of this channel's file. |
nd | back to summary |
---|---|
private static final FileDispatcher nd |
path | back to summary |
---|---|
private final String path |
threads | back to summary |
---|---|
private final NativeThreadSet threads |
SimpleAsynchronousFileChannelImpl | back to summary |
---|---|
pack-priv SimpleAsynchronousFileChannelImpl(FileDescriptor fdObj, String path, boolean reading, boolean writing, ExecutorService executor) |
close | back to summary |
---|---|
public void close() throws IOException Implements java. Doc from java. Closes this channel. Any outstanding asynchronous operations upon this channel will
complete with the exception This method otherwise behaves exactly as specified by the
|
force | back to summary |
---|---|
public void force(boolean metaData) throws IOException Implements abstract java. Doc from java. Forces any updates to this channel's file to be written to the storage device that contains it. If this channel's file resides on a local storage device then when this method returns it is guaranteed that all changes made to the file since this channel was created, or since this method was last invoked, will have been written to that device. This is useful for ensuring that critical information is not lost in the event of a system crash. If the file does not reside on a local device then no such guarantee is made. The Invoking this method may cause an I/O operation to occur even if the channel was only opened for reading. Some operating systems, for example, maintain a last-access time as part of a file's metadata, and this time is updated whenever the file is read. Whether or not this is actually done is system-dependent and is therefore unspecified. This method is only guaranteed to force changes that were made to this channel's file via the methods defined in this class.
|
implForce | back to summary |
---|---|
private void implForce(boolean metaData) throws IOException |
implLock | back to summary |
---|---|
pack-priv <A> Future Implements abstract sun.
|
implRead | back to summary |
---|---|
pack-priv <A> Future Implements abstract sun.
|
implRelease | back to summary |
---|---|
protected void implRelease(FileLockImpl fli) throws IOException Implements abstract sun. Doc from sun. Releases the given file lock.
|
implWrite | back to summary |
---|---|
pack-priv <A> Future Implements abstract sun.
|
open | back to summary |
---|---|
public static AsynchronousFileChannel open(FileDescriptor fdo, String path, boolean reading, boolean writing, ThreadPool pool) |
size | back to summary |
---|---|
public long size() throws IOException Implements abstract java. Doc from java. Returns the current size of this channel's file.
|
truncate | back to summary |
---|---|
public AsynchronousFileChannel truncate(long size) throws IOException Implements abstract 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.
|
tryLock | back to summary |
---|---|
public FileLock tryLock(long position, long size, boolean shared) throws IOException Implements abstract java. Doc from java. Attempts to acquire a lock on the given region of this channel's file. This method does not block. An invocation always returns immediately,
either having acquired a lock on the requested region or having failed to
do so. If it fails to acquire a lock because an overlapping lock is held
by another program then it returns
|
Modifier and Type | Field and Description |
---|---|
pack-priv static final ExecutorService |
Access | Constructor and Description |
---|---|
private |
defaultExecutor | back to summary |
---|---|
pack-priv static final ExecutorService defaultExecutor |
DefaultExecutorHolder | back to summary |
---|---|
private DefaultExecutorHolder() |