Java 8 Channel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Channel class.

This code example shows how to use the following methods: isOpen, read
    public boolean isEndOfInput() throws Exception {
        if (byteBuffer.position() > 0) {
            // A previous read was not over, so there is a next chunk in the buffer at least 
            return false; 
        } 
        if (in.isOpen()) {
            // Try to read a new part, and keep this part (no rewind) 
            int b = in.read(byteBuffer);
            if (b < 0) {
                return true; 
            } else { 
                offset += b;
                return false; 
            } 
        } 
        return true; 
    } 
 
    @Override 
    public void close() throws Exception {
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isOpen, write
   } 
 
   @Override 
   public int write(ByteBuffer src) throws IOException {
      checkOpen(); 
      return delegate.write(src);
   } 
 
   public void flush() throws IOException {
      gridOutputStream.flush();
   } 
 
   @Override 
   public boolean isOpen() { 
      return delegate.isOpen();
   } 
 
   @Override 
   public void close() throws IOException {
      delegate.close();
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, isOpen
    public void shutdownOutput() 
    { 
        if (LOG.isDebugEnabled()) 
            LOG.debug("oshut {}", this);
        _oshut = true;
        if (_channel.isOpen())
        { 
            try 
            { 
                if (!_socket.isOutputShutdown())
                    _socket.shutdownOutput();
            } 
            catch (IOException e)
            { 
                LOG.debug(e);
            } 
            finally 
            { 
                if (_ishut)
                { 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, isOpen
	public void sessionClosed(NextFilter next, IoSession session)
			throws Exception { 
		if (headers.isOpen()) {
			headers.close();
		} 
		if (raw.isOpen()) {
			raw.close();
		} 
		next.sessionClosed(session);
	} 
 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close
 
    public void shutdown() { 
      keepRunning = false;
      this.interrupt();
      try { 
        out.close();
      } catch (IOException e) {
        e.printStackTrace();
      } 
    } 
 
    public void run() { 
      byte[] bytes = new byte[4096];
      ByteBuffer buffer = ByteBuffer.wrap(bytes);
      try { 
        while (keepRunning) {
          int count = in.read(bytes);
          // 0 = nothing read 
          // -1 = EOF 
          if (count <= 0) {
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 Channel Questions & Answers:

See Code Examples for Java 8 Channel Methods: