publicstaticvoidmain(String[] args) { try { //The Pipe is created Pipepipe= Pipe.open(); //For accessing the pipe sink channel Pipe.SinkChannelskChannel= pipe.sink(); Stringtd="Data is successfully sent for checking the java NIO Channel Pipe."; ByteBufferbb= ByteBuffer.allocate(512); bb.clear(); bb.put(td.getBytes()); bb.flip(); //write the data into a sink channel. while (bb.hasRemaining()) { skChannel.write(bb); } //For accessing the pipe source channel Pipe.SourceChannelsourceChannel= pipe.source(); bb = ByteBuffer.allocate(512); //The data is write to the console while (sourceChannel.read(bb) > 0) { bb.flip(); while (bb.hasRemaining()) { charTestData= (char) bb.get(); System.out.print(TestData); } bb.clear(); } } catch (IOException e) { e.printStackTrace(); } } }