Class Pipe.RefByteChannel

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.ByteChannel, java.nio.channels.Channel, java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel
    Enclosing class:
    Pipe

    private class Pipe.RefByteChannel
    extends java.lang.Object
    implements java.nio.channels.ByteChannel
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.channels.Channel channel  
      private java.util.concurrent.atomic.AtomicBoolean closed  
      private java.util.concurrent.atomic.AtomicInteger references  
    • Constructor Summary

      Constructors 
      Constructor Description
      RefByteChannel​(java.nio.channels.Channel channel, java.util.concurrent.atomic.AtomicInteger references)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      private void ensureOpen()  
      boolean isOpen()  
      int read​(java.nio.ByteBuffer dst)  
      int write​(java.nio.ByteBuffer src)  
      • Methods inherited from class java.lang.Object

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

      • channel

        private final java.nio.channels.Channel channel
      • references

        private final java.util.concurrent.atomic.AtomicInteger references
      • closed

        private final java.util.concurrent.atomic.AtomicBoolean closed
    • Constructor Detail

      • RefByteChannel

        public RefByteChannel​(java.nio.channels.Channel channel,
                              java.util.concurrent.atomic.AtomicInteger references)
    • Method Detail

      • read

        public int read​(java.nio.ByteBuffer dst)
                 throws java.io.IOException
        Specified by:
        read in interface java.nio.channels.ReadableByteChannel
        Throws:
        java.io.IOException
      • write

        public int write​(java.nio.ByteBuffer src)
                  throws java.io.IOException
        Specified by:
        write in interface java.nio.channels.WritableByteChannel
        Throws:
        java.io.IOException
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
      • ensureOpen

        private void ensureOpen()
                         throws java.nio.channels.ClosedChannelException
        Throws:
        java.nio.channels.ClosedChannelException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException