Class JimfsAsynchronousFileChannel
java.lang.Object
java.nio.channels.AsynchronousFileChannel
com.google.common.jimfs.JimfsAsynchronousFileChannel
- All Implemented Interfaces:
Closeable, AutoCloseable, AsynchronousChannel, Channel
AsynchronousFileChannel implementation that delegates to a JimfsFileChannel.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classRunnable callback that wraps aCompletionHandlerand an attachment. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JimfsFileChannelprivate final com.google.common.util.concurrent.ListeningExecutorService -
Constructor Summary
ConstructorsConstructorDescriptionJimfsAsynchronousFileChannel(JimfsFileChannel channel, ExecutorService executor) -
Method Summary
Modifier and TypeMethodDescriptionprivate <R,A> void addCallback(com.google.common.util.concurrent.ListenableFuture<R> future, CompletionHandler<R, ? super A> handler, @Nullable A attachment) voidclose()private static <V> com.google.common.util.concurrent.ListenableFuture<V> Immediate future indicating that the channel is closed.voidforce(boolean metaData) booleanisOpen()com.google.common.util.concurrent.ListenableFuture<FileLock> lock(long position, long size, boolean shared) <A> voidlock(long position, long size, boolean shared, @Nullable A attachment, CompletionHandler<FileLock, ? super A> handler) com.google.common.util.concurrent.ListenableFuture<Integer> read(ByteBuffer dst, long position) <A> voidread(ByteBuffer dst, long position, @Nullable A attachment, CompletionHandler<Integer, ? super A> handler) longsize()truncate(long size) tryLock(long position, long size, boolean shared) com.google.common.util.concurrent.ListenableFuture<Integer> write(ByteBuffer src, long position) <A> voidwrite(ByteBuffer src, long position, @Nullable A attachment, CompletionHandler<Integer, ? super A> handler)
-
Field Details
-
channel
-
executor
private final com.google.common.util.concurrent.ListeningExecutorService executor
-
-
Constructor Details
-
JimfsAsynchronousFileChannel
-
-
Method Details
-
size
- Specified by:
sizein classAsynchronousFileChannel- Throws:
IOException
-
addCallback
private <R,A> void addCallback(com.google.common.util.concurrent.ListenableFuture<R> future, CompletionHandler<R, ? super A> handler, @Nullable A attachment) -
truncate
- Specified by:
truncatein classAsynchronousFileChannel- Throws:
IOException
-
force
- Specified by:
forcein classAsynchronousFileChannel- Throws:
IOException
-
lock
public <A> void lock(long position, long size, boolean shared, @Nullable A attachment, CompletionHandler<FileLock, ? super A> handler) - Specified by:
lockin classAsynchronousFileChannel
-
lock
public com.google.common.util.concurrent.ListenableFuture<FileLock> lock(long position, long size, boolean shared) - Specified by:
lockin classAsynchronousFileChannel
-
tryLock
- Specified by:
tryLockin classAsynchronousFileChannel- Throws:
IOException
-
read
public <A> void read(ByteBuffer dst, long position, @Nullable A attachment, CompletionHandler<Integer, ? super A> handler) - Specified by:
readin classAsynchronousFileChannel
-
read
public com.google.common.util.concurrent.ListenableFuture<Integer> read(ByteBuffer dst, long position) - Specified by:
readin classAsynchronousFileChannel
-
write
public <A> void write(ByteBuffer src, long position, @Nullable A attachment, CompletionHandler<Integer, ? super A> handler) - Specified by:
writein classAsynchronousFileChannel
-
write
public com.google.common.util.concurrent.ListenableFuture<Integer> write(ByteBuffer src, long position) - Specified by:
writein classAsynchronousFileChannel
-
isOpen
public boolean isOpen() -
close
- Throws:
IOException
-
closedChannelFuture
private static <V> com.google.common.util.concurrent.ListenableFuture<V> closedChannelFuture()Immediate future indicating that the channel is closed.
-