Code example for ReadableByteChannel

Methods: closeisOpen

0
    } 
 
    public void disconnect() { 
        super.disconnect(); 
        try { 
            if (readChannel.isOpen()) {
                readChannel.close();
            } 
            if (writeChannel.isOpen()) {
                writeChannel.close();
            } 
        } catch (IOException ex) {
            log.error("Error closing transport", ex);
        } 
    } 
 
    public void writeln(String line) throws IOException {
        writeChannel.write(ByteBuffer.wrap(line.concat(PerfMonMetricGetter.NEWLINE).getBytes()));
    } 
 
    public String readln() {