1 7 8 package java.nio.channels; 9 10 import java.io.IOException ; 11 import java.nio.channels.spi.*; 12 13 14 35 36 public abstract class Pipe { 37 38 43 public static abstract class SourceChannel 44 extends AbstractSelectableChannel 45 implements ReadableByteChannel , ScatteringByteChannel 46 { 47 50 protected SourceChannel(SelectorProvider provider) { 51 super(provider); 52 } 53 54 63 public final int validOps() { 64 return SelectionKey.OP_READ; 65 } 66 67 } 68 69 74 public static abstract class SinkChannel 75 extends AbstractSelectableChannel 76 implements WritableByteChannel , GatheringByteChannel 77 { 78 81 protected SinkChannel(SelectorProvider provider) { 82 super(provider); 83 } 84 85 94 public final int validOps() { 95 return SelectionKey.OP_WRITE; 96 } 97 98 } 99 100 103 protected Pipe() { } 104 105 110 public abstract SourceChannel source(); 111 112 117 public abstract SinkChannel sink(); 118 119 132 public static Pipe open() throws IOException { 133 return SelectorProvider.provider().openPipe(); 134 } 135 136 } 137 | Popular Tags |