NIO2 API

org.classpath.icedtea.java.nio.channels
Class Channels

java.lang.Object
  extended by org.classpath.icedtea.java.nio.channels.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.

Since:
1.4

Method Summary
static InputStream newInputStream(AsynchronousByteChannel ch)
           Constructs a stream that reads bytes from the given channel.
static OutputStream newOutputStream(AsynchronousByteChannel ch)
           Constructs a stream that writes bytes to the given channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInputStream

public static InputStream newInputStream(AsynchronousByteChannel ch)
Constructs a stream that reads bytes from the given channel.

The stream will not be buffered, and it will not support the mark or reset methods. The stream will be safe for access by multiple concurrent threads. Closing the stream will in turn cause the channel to be closed.

Parameters:
ch - The channel from which bytes will be read
Returns:
A new input stream
Since:
1.7

newOutputStream

public static OutputStream newOutputStream(AsynchronousByteChannel ch)
Constructs a stream that writes bytes to the given channel.

The stream will not be buffered. The stream will be safe for access by multiple concurrent threads. Closing the stream will in turn cause the channel to be closed.

Parameters:
ch - The channel to which bytes will be written
Returns:
A new output stream
Since:
1.7

NIO2 API

Copyright © 2007, 2011, Oracle and/or its affiliates. All rights reserved.