diff options
Diffstat (limited to 'libjava/java/nio/channels/Pipe.java')
| -rw-r--r-- | libjava/java/nio/channels/Pipe.java | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/libjava/java/nio/channels/Pipe.java b/libjava/java/nio/channels/Pipe.java index 9c3c6cdc2de..22f3d156f68 100644 --- a/libjava/java/nio/channels/Pipe.java +++ b/libjava/java/nio/channels/Pipe.java @@ -40,40 +40,82 @@ package java.nio.channels; import java.nio.channels.spi.AbstractSelectableChannel; import java.nio.channels.spi.SelectorProvider; +/** + * @author Michael Koch + * @since 1.4 + */ public abstract class Pipe { public abstract static class SinkChannel extends AbstractSelectableChannel implements WritableByteChannel, GatheringByteChannel { - protected SinkChannel(SelectorProvider provider) + /** + * Initializes the channel. + */ + protected SinkChannel (SelectorProvider provider) { super (provider); } + + /** + * Returns an operation set that is valid on this channel. + * + * The only valid operation on this channel is @see SelectionKey.OP_WRITE. + */ + public final int validOps () + { + return SelectionKey.OP_WRITE; + } } public abstract static class SourceChannel extends AbstractSelectableChannel implements ReadableByteChannel, ScatteringByteChannel { - protected SourceChannel(SelectorProvider provider) + /** + * Initializes the channel. + */ + protected SourceChannel (SelectorProvider provider) { super (provider); } + + /** + * Returns an operation set that is valid on this channel. + * + * The only valid operation on this channel is @see SelectionKey.OP_READ. + */ + public final int validOps () + { + return SelectionKey.OP_READ; + } } - + + /** + * Initializes the pipe. + */ protected Pipe() { } /** + * Opens a pipe. + * * @exception IOException If an error occurs */ public static Pipe open() { - return null; + return SelectorProvider.provider ().openPipe(); } - + + /** + * Returns a pipe's sink channel. + */ public abstract Pipe.SinkChannel sink(); + + /** + * Returns a pipe's source channel + */ public abstract Pipe.SourceChannel source(); } |
