Channels

public final class Channels extends Object

Utility methods for channels and streams.

This class defines static methods that support the interoperation of the stream classes of the java.io package with the channel classes of this package.

Public Method Summary

static ReadableByteChannel
newChannel(InputStream in)
Constructs a channel that reads bytes from the given stream.
static WritableByteChannel
newChannel(OutputStream out)
Constructs a channel that writes bytes to the given stream.
static InputStream
newInputStream(ReadableByteChannel ch)
Constructs a stream that reads bytes from the given channel.
static OutputStream
newOutputStream(WritableByteChannel ch)
Constructs a stream that writes bytes to the given channel.
static Reader
newReader(ReadableByteChannel ch, CharsetDecoder dec, int minBufferCap)
Constructs a reader that decodes bytes from the given channel using the given decoder.
static Reader
newReader(ReadableByteChannel ch, String csName)
Constructs a reader that decodes bytes from the given channel according to the named charset.
static Writer
newWriter(WritableByteChannel ch, CharsetEncoder enc, int minBufferCap)
Constructs a writer that encodes characters using the given encoder and writes the resulting bytes to the given channel.