Class ZeroFsAsynchronousFileChannel

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.AsynchronousChannel, java.nio.channels.Channel

    final class ZeroFsAsynchronousFileChannel
    extends java.nio.channels.AsynchronousFileChannel
    AsynchronousFileChannel implementation that delegates to a ZeroFsFileChannel.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private <R,​A>
      void
      addCallback​(java.util.concurrent.CompletableFuture<R> future, java.nio.channels.CompletionHandler<R,​? super A> handler, A attachment)  
      void close()  
      private static <V> java.util.concurrent.CompletableFuture<V> closedChannelFuture()
      Immediate future indicating that the channel is closed.
      void force​(boolean metaData)  
      boolean isOpen()  
      java.util.concurrent.CompletableFuture<java.nio.channels.FileLock> lock​(long position, long size, boolean shared)  
      <A> void lock​(long position, long size, boolean shared, A attachment, java.nio.channels.CompletionHandler<java.nio.channels.FileLock,​? super A> handler)  
      java.util.concurrent.CompletableFuture<java.lang.Integer> read​(java.nio.ByteBuffer dst, long position)  
      <A> void read​(java.nio.ByteBuffer dst, long position, A attachment, java.nio.channels.CompletionHandler<java.lang.Integer,​? super A> handler)  
      long size()  
      java.nio.channels.AsynchronousFileChannel truncate​(long size)  
      java.nio.channels.FileLock tryLock​(long position, long size, boolean shared)  
      java.util.concurrent.CompletableFuture<java.lang.Integer> write​(java.nio.ByteBuffer src, long position)  
      <A> void write​(java.nio.ByteBuffer src, long position, A attachment, java.nio.channels.CompletionHandler<java.lang.Integer,​? super A> handler)  
      • Methods inherited from class java.nio.channels.AsynchronousFileChannel

        lock, lock, open, open, tryLock
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ZeroFsAsynchronousFileChannel

        public ZeroFsAsynchronousFileChannel​(ZeroFsFileChannel channel,
                                             java.util.concurrent.ExecutorService executor)
    • Method Detail

      • size

        public long size()
                  throws java.io.IOException
        Specified by:
        size in class java.nio.channels.AsynchronousFileChannel
        Throws:
        java.io.IOException
      • addCallback

        private <R,​A> void addCallback​(java.util.concurrent.CompletableFuture<R> future,
                                             java.nio.channels.CompletionHandler<R,​? super A> handler,
                                             A attachment)
      • truncate

        public java.nio.channels.AsynchronousFileChannel truncate​(long size)
                                                           throws java.io.IOException
        Specified by:
        truncate in class java.nio.channels.AsynchronousFileChannel
        Throws:
        java.io.IOException
      • force

        public void force​(boolean metaData)
                   throws java.io.IOException
        Specified by:
        force in class java.nio.channels.AsynchronousFileChannel
        Throws:
        java.io.IOException
      • lock

        public <A> void lock​(long position,
                             long size,
                             boolean shared,
                             A attachment,
                             java.nio.channels.CompletionHandler<java.nio.channels.FileLock,​? super A> handler)
        Specified by:
        lock in class java.nio.channels.AsynchronousFileChannel
      • lock

        public java.util.concurrent.CompletableFuture<java.nio.channels.FileLock> lock​(long position,
                                                                                       long size,
                                                                                       boolean shared)
        Specified by:
        lock in class java.nio.channels.AsynchronousFileChannel
      • tryLock

        public java.nio.channels.FileLock tryLock​(long position,
                                                  long size,
                                                  boolean shared)
                                           throws java.io.IOException
        Specified by:
        tryLock in class java.nio.channels.AsynchronousFileChannel
        Throws:
        java.io.IOException
      • read

        public <A> void read​(java.nio.ByteBuffer dst,
                             long position,
                             A attachment,
                             java.nio.channels.CompletionHandler<java.lang.Integer,​? super A> handler)
        Specified by:
        read in class java.nio.channels.AsynchronousFileChannel
      • read

        public java.util.concurrent.CompletableFuture<java.lang.Integer> read​(java.nio.ByteBuffer dst,
                                                                              long position)
        Specified by:
        read in class java.nio.channels.AsynchronousFileChannel
      • write

        public <A> void write​(java.nio.ByteBuffer src,
                              long position,
                              A attachment,
                              java.nio.channels.CompletionHandler<java.lang.Integer,​? super A> handler)
        Specified by:
        write in class java.nio.channels.AsynchronousFileChannel
      • write

        public java.util.concurrent.CompletableFuture<java.lang.Integer> write​(java.nio.ByteBuffer src,
                                                                               long position)
        Specified by:
        write in class java.nio.channels.AsynchronousFileChannel
      • isOpen

        public boolean isOpen()
      • close

        public void close()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • closedChannelFuture

        private static <V> java.util.concurrent.CompletableFuture<V> closedChannelFuture()
        Immediate future indicating that the channel is closed.