Code example for SocketChannel

Methods: read, socket

0
 
    public byte[] read() throws IOException, ReadNotCompleteException 
    {           
        return doRead(buffer_);
    } 
 
    public void morphState() throws IOException 
    {         
        StartState nextState = stream_.getSocketState(TcpReader.TcpReaderState.DONE);
        if ( nextState == null )
        { 
            nextState = new DoneState(stream_, toBytes());
            stream_.putSocketState( TcpReader.TcpReaderState.DONE, nextState );
        } 
        else 
        {             
            nextState.setContextData(toBytes());
        } 
        stream_.morphState( nextState );               
    }