Android
java.nio.channels
public final class

java.nio.channels.Channels

java.lang.Object
java.nio.channels.Channels

This class provides several utilities to get I/O streams from channels.

Summary

Public Methods

      static    ReadableByteChannel  newChannel(InputStream inputStream)
Returns a channel on the given input stream
      static    WritableByteChannel  newChannel(OutputStream outputStream)
Returns a channel on the given output stream
      static    InputStream  newInputStream(ReadableByteChannel channel)
Returns an input stream on the given channel
      static    OutputStream  newOutputStream(WritableByteChannel channel)
Returns an output stream on the given channel
      static    Reader  newReader(ReadableByteChannel channel, CharsetDecoder decoder, int minBufferCapacity)
Returns a reader that decodes bytes from a channel.
      static    Reader  newReader(ReadableByteChannel channel, String charsetName)
Returns a reader that decodes bytes from a channel.
      static    Writer  newWriter(WritableByteChannel channel, String charsetName)
Returns a writer that encodes characters by encoder and output bytes to a channel.
      static    Writer  newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity)
Returns a writer that encodes characters by encoder and output bytes to a channel.
Methods inherited from class java.lang.Object

Details

Public Methods

public static ReadableByteChannel newChannel(InputStream inputStream)

Returns a channel on the given input stream

Parameters

inputStream the stream to be wrapped in a byte channel.

Returns

  • a byte channel that reads bytes from the input stream.

public static WritableByteChannel newChannel(OutputStream outputStream)

Returns a channel on the given output stream

Parameters

outputStream the stream to be wrapped in a byte channel.

Returns

  • a byte channel that writes bytes to the output stream.

public static InputStream newInputStream(ReadableByteChannel channel)

Returns an input stream on the given channel

Parameters

channel The channel to be wrapped in an InputStream.

Returns

  • an InputStream that takes bytes from the given byte channel.

public static OutputStream newOutputStream(WritableByteChannel channel)

Returns an output stream on the given channel

Parameters

channel the channel to be wrapped in an OutputStream.

Returns

  • an OutputStream that puts bytes onto the given byte channel.

public static Reader newReader(ReadableByteChannel channel, CharsetDecoder decoder, int minBufferCapacity)

Returns a reader that decodes bytes from a channel.

Parameters

channel Channel to be read.
decoder Charset decoder to be used.
minBufferCapacity The minimum size of byte buffer, -1 means to use default size.

Returns

  • The reader.

public static Reader newReader(ReadableByteChannel channel, String charsetName)

Returns a reader that decodes bytes from a channel.

Parameters

channel Channel to be read.
charsetName Name of charset.

Returns

  • The reader.

public static Writer newWriter(WritableByteChannel channel, String charsetName)

Returns a writer that encodes characters by encoder and output bytes to a channel.

Parameters

channel Channel to be written.
charsetName Name of charset.

Returns

  • The writer.

public static Writer newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity)

Returns a writer that encodes characters by encoder and output bytes to a channel.

Parameters

channel Channel to be written.
encoder Charset decoder to be used.
minBufferCapacity The minimum size of byte buffer, -1 means to use default size.

Returns

  • The writer.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56