code: public void read()
    {
      StateInPipe stateOld;
      StateInPipe stateNew;
      
      do {
        stateOld = _stateInRef.get();
        stateNew = stateOld.toActive();
      } while (! _stateInRef.compareAndSet(stateOld, stateNew));
      
      while (stateNew.isActive()) {
        readPipe();
        
        wakeOut();
        
        do {
          stateOld = _stateInRef.get();
          stateNew = stateOld.toIdle();
        } while (! _stateInRef.compareAndSet(stateOld, stateNew));
      }
      
      if (_stateInRef.get().isClosed()) {
        StateOutPipe outStateOld = _stateOutRef.getAndSet(StateOutPipe.CLOSE);
        
        if (! outStateOld.isClosed()) {
          _outFlow.cancel();
        }
      }
    }
docs: Reads data from the pipe.