Package io.roastedroot.zerofs
Class ZeroFsAsynchronousFileChannel
java.lang.Object
java.nio.channels.AsynchronousFileChannel
io.roastedroot.zerofs.ZeroFsAsynchronousFileChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,AsynchronousChannel,Channel
AsynchronousFileChannel implementation that delegates to a ZeroFsFileChannel.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionZeroFsAsynchronousFileChannel(ZeroFsFileChannel channel, ExecutorService executor) -
Method Summary
Modifier and TypeMethodDescriptionprivate <R,A> void addCallback(CompletableFuture<R> future, CompletionHandler<R, ? super A> handler, A attachment) voidclose()private static <V> CompletableFuture<V> Immediate future indicating that the channel is closed.voidforce(boolean metaData) booleanisOpen()lock(long position, long size, boolean shared) <A> voidlock(long position, long size, boolean shared, A attachment, CompletionHandler<FileLock, ? super A> handler) read(ByteBuffer dst, long position) <A> voidread(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer, ? super A> handler) longsize()truncate(long size) tryLock(long position, long size, boolean shared) write(ByteBuffer src, long position) <A> voidwrite(ByteBuffer src, long position, A attachment, CompletionHandler<Integer, ? super A> handler)
-
Field Details
-
channel
-
executor
-
-
Constructor Details
-
ZeroFsAsynchronousFileChannel
-
-
Method Details
-
size
- Specified by:
sizein classAsynchronousFileChannel- Throws:
IOException
-
addCallback
private <R,A> void addCallback(CompletableFuture<R> future, CompletionHandler<R, ? super A> handler, 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, A attachment, CompletionHandler<FileLock, ? super A> handler) - Specified by:
lockin classAsynchronousFileChannel
-
lock
- Specified by:
lockin classAsynchronousFileChannel
-
tryLock
- Specified by:
tryLockin classAsynchronousFileChannel- Throws:
IOException
-
read
public <A> void read(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer, ? super A> handler) - Specified by:
readin classAsynchronousFileChannel
-
read
- Specified by:
readin classAsynchronousFileChannel
-
write
public <A> void write(ByteBuffer src, long position, A attachment, CompletionHandler<Integer, ? super A> handler) - Specified by:
writein classAsynchronousFileChannel
-
write
- Specified by:
writein classAsynchronousFileChannel
-
isOpen
public boolean isOpen() -
close
- Throws:
IOException
-
closedChannelFuture
Immediate future indicating that the channel is closed.
-