public class IoUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE
The size to use when instantiating buffered items such as instances of
the
BufferedReader class. |
static int |
TIMEOUT_MS
The number of milliseconds after which IO operation will time out.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static final int BUFFER_SIZE
BufferedReader
class. It looks for the System property
"org.restlet.client.engine.io.bufferSize" and if not defined, uses the "8192"
default value.public static final int TIMEOUT_MS
public static long getAvailableSize(Representation representation)
Representation.getSize()
if no
range is defined, otherwise it
returns the size of the range using Range.getSize()
.representation
- The representation to evaluate.public static java.io.Reader getReader(java.io.InputStream stream, CharacterSet characterSet) throws java.io.UnsupportedEncodingException
stream
- The input stream.characterSet
- The character set. May be null.java.io.UnsupportedEncodingException
- if a character set is given, but not supportedpublic static java.lang.String toString(java.io.InputStream inputStream)
inputStream
- The input stream.InputStreamReader
,
toString(InputStream, CharacterSet)
public static java.lang.String toString(java.io.InputStream inputStream, CharacterSet characterSet)
inputStream
- The input stream.characterSet
- The character setInputStreamReader
public static java.lang.String toString(java.io.Reader reader)
reader
- The characters reader.InputStreamReader
Copyright © 2005-2020 Restlet.