IT. Expert System.

Android Reference

Channels


java.nio.channels

Class Channels



  • public final class Channels
    extends Object
    This class provides several utilities to get I/O streams from channels.
    • Method Detail

      • newInputStream

        public static InputStream newInputStream(ReadableByteChannel channel)
        Returns an input stream on the given channel. The resulting stream has the following properties:
        • If the stream is closed, then the underlying channel is closed as well.
        • It is thread safe.
        • It throws an IllegalBlockingModeException if the channel is in non-blocking mode and read is called.
        • Neither mark nor reset is supported.
        • It is not buffered.
        Parameters:
        channel - the channel to be wrapped by an InputStream.
        Returns:
        an InputStream that takes bytes from the given byte channel.
      • newOutputStream

        public static OutputStream newOutputStream(WritableByteChannel channel)
        Returns an output stream on the given channel. The resulting stream has the following properties:
        • If the stream is closed, then the underlying channel is closed as well.
        • It is thread safe.
        • It throws an IllegalBlockingModeException if the channel is in non-blocking mode and write is called.
        • It is not buffered.
        Parameters:
        channel - the channel to be wrapped by an OutputStream.
        Returns:
        an OutputStream that puts bytes onto the given byte channel.
      • newChannel

        public static ReadableByteChannel newChannel(InputStream inputStream)
        Returns a readable channel on the given input stream. The resulting channel has the following properties:
        • If the channel is closed, then the underlying stream is closed as well.
        • It is not buffered.
        Parameters:
        inputStream - the stream to be wrapped by a byte channel.
        Returns:
        a byte channel that reads bytes from the input stream.
      • newChannel

        public static WritableByteChannel newChannel(OutputStream outputStream)
        Returns a writable channel on the given output stream. The resulting channel has following properties:
        • If the channel is closed, then the underlying stream is closed as well.
        • It is not buffered.
        Parameters:
        outputStream - the stream to be wrapped by a byte channel.
        Returns:
        a byte channel that writes bytes to the output stream.
      • newReader

        public static Reader newReader(ReadableByteChannel channel,
                       CharsetDecoder decoder,
                       int minBufferCapacity)
        Returns a reader that decodes bytes from a channel.
        Parameters:
        channel - the Channel to be read.
        decoder - the Charset decoder to be used.
        minBufferCapacity - The minimum size of the byte buffer, -1 means to use the default size.
        Returns:
        the reader.
      • newReader

        public static Reader newReader(ReadableByteChannel channel,
                       String charsetName)
        Returns a reader that decodes bytes from a channel. This method creates a reader with a buffer of default size.
        Parameters:
        channel - the Channel to be read.
        charsetName - the name of the charset.
        Returns:
        the reader.
        Throws:
        UnsupportedCharsetException - if the given charset name is not supported.
      • newWriter

        public static Writer newWriter(WritableByteChannel channel,
                       CharsetEncoder encoder,
                       int minBufferCapacity)
        Returns a writer that encodes characters with the specified encoder and sends the bytes to the specified channel.
        Parameters:
        channel - the Channel to write to.
        encoder - the CharsetEncoder to be used.
        minBufferCapacity - the minimum size of the byte buffer, -1 means to use the default size.
        Returns:
        the writer.
      • newWriter

        public static Writer newWriter(WritableByteChannel channel,
                       String charsetName)
        Returns a writer that encodes characters with the specified encoder and sends the bytes to the specified channel. This method creates a writer with a buffer of default size.
        Parameters:
        channel - the Channel to be written to.
        charsetName - the name of the charset.
        Returns:
        the writer.
        Throws:
        UnsupportedCharsetException - if the given charset name is not supported.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1125 / . Delta: 0.02876 с