Class Pipe.MultiChannel

  • 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.MultiChannel
    extends java.lang.Object
    implements java.nio.channels.ByteChannel
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.List<java.nio.channels.Channel> channels  
      (package private) int index  
      protected java.util.concurrent.atomic.AtomicBoolean opened  
      protected java.util.List<java.nio.channels.Channel> toClose  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MultiChannel()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChannel​(java.nio.channels.Channel channel, boolean toclose)  
      private void checkSuspend​(java.nio.channels.Channel ch)  
      void close()  
      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

      • channels

        protected final java.util.List<java.nio.channels.Channel> channels
      • toClose

        protected final java.util.List<java.nio.channels.Channel> toClose
      • opened

        protected final java.util.concurrent.atomic.AtomicBoolean opened
      • index

        int index
    • Constructor Detail

      • MultiChannel

        private MultiChannel()
    • Method Detail

      • addChannel

        public void addChannel​(java.nio.channels.Channel channel,
                               boolean toclose)
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
      • 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
      • 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
      • checkSuspend

        private void checkSuspend​(java.nio.channels.Channel ch)
                           throws java.io.IOException
        Throws:
        java.io.IOException