Package com.google.common.jimfs
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 class
Runnable callback that wraps aCompletionHandler
and an attachment. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JimfsFileChannel
private 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) void
close()
private static <V> com.google.common.util.concurrent.ListenableFuture
<V> Immediate future indicating that the channel is closed.void
force
(boolean metaData) boolean
isOpen()
com.google.common.util.concurrent.ListenableFuture
<FileLock> lock
(long position, long size, boolean shared) <A> void
lock
(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> void
read
(ByteBuffer dst, long position, @Nullable A attachment, CompletionHandler<Integer, ? super A> handler) long
size()
truncate
(long size) tryLock
(long position, long size, boolean shared) com.google.common.util.concurrent.ListenableFuture
<Integer> write
(ByteBuffer src, long position) <A> void
write
(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:
size
in 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:
truncate
in classAsynchronousFileChannel
- Throws:
IOException
-
force
- Specified by:
force
in classAsynchronousFileChannel
- Throws:
IOException
-
lock
public <A> void lock(long position, long size, boolean shared, @Nullable A attachment, CompletionHandler<FileLock, ? super A> handler) - Specified by:
lock
in classAsynchronousFileChannel
-
lock
public com.google.common.util.concurrent.ListenableFuture<FileLock> lock(long position, long size, boolean shared) - Specified by:
lock
in classAsynchronousFileChannel
-
tryLock
- Specified by:
tryLock
in classAsynchronousFileChannel
- Throws:
IOException
-
read
public <A> void read(ByteBuffer dst, long position, @Nullable A attachment, CompletionHandler<Integer, ? super A> handler) - Specified by:
read
in classAsynchronousFileChannel
-
read
public com.google.common.util.concurrent.ListenableFuture<Integer> read(ByteBuffer dst, long position) - Specified by:
read
in classAsynchronousFileChannel
-
write
public <A> void write(ByteBuffer src, long position, @Nullable A attachment, CompletionHandler<Integer, ? super A> handler) - Specified by:
write
in classAsynchronousFileChannel
-
write
public com.google.common.util.concurrent.ListenableFuture<Integer> write(ByteBuffer src, long position) - Specified by:
write
in 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.
-