org.restlet.client.engine.io
Class BioUtils

java.lang.Object
  extended by org.restlet.client.engine.io.BioUtils

public final class BioUtils
extends java.lang.Object

Basic IO manipulation utilities.

Author:
Jerome Louvel

Method Summary
static long getAvailableSize(Representation representation)
          Returns the size effectively available.
static java.io.Reader getReader(java.io.InputStream stream, CharacterSet characterSet)
          Returns a reader from an input stream and a character set.
static java.lang.String toString(java.io.InputStream inputStream)
          Converts an input stream to a string.
As this method uses the InputstreamReader class, the default character set is used for decoding the input stream.
static java.lang.String toString(java.io.InputStream inputStream, CharacterSet characterSet)
          Converts an input stream to a string using the specified character set for decoding the input stream.
static java.lang.String toString(java.io.Reader reader)
          Converts a reader to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAvailableSize

public static long getAvailableSize(Representation representation)
Returns the size effectively available. This returns the same value as Representation.getSize() if no range is defined, otherwise it returns the size of the range using Range.getSize().

Parameters:
representation - The representation to evaluate.
Returns:
The available size.

getReader

public static java.io.Reader getReader(java.io.InputStream stream,
                                       CharacterSet characterSet)
                                throws java.io.UnsupportedEncodingException
Returns a reader from an input stream and a character set.

Parameters:
stream - The input stream.
characterSet - The character set. May be null.
Returns:
The equivalent reader.
Throws:
java.io.UnsupportedEncodingException - if a character set is given, but not supported

toString

public static java.lang.String toString(java.io.InputStream inputStream)
Converts an input stream to a string.
As this method uses the InputstreamReader class, the default character set is used for decoding the input stream.

Parameters:
inputStream - The input stream.
Returns:
The converted string.
See Also:
InputStreamReader class, toString(InputStream, CharacterSet)

toString

public static java.lang.String toString(java.io.InputStream inputStream,
                                        CharacterSet characterSet)
Converts an input stream to a string using the specified character set for decoding the input stream. Once read, the input stream is closed.

Parameters:
inputStream - The input stream.
characterSet - The character set
Returns:
The converted string.
See Also:
InputStreamReader class

toString

public static java.lang.String toString(java.io.Reader reader)
Converts a reader to a string.

Parameters:
reader - The characters reader.
Returns:
The converted string.
See Also:
InputStreamReader class


Copyright © 2005-2011 Noelios Technologies.