public class IoUtils extends 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 Reader |
getReader(InputStream stream,
CharacterSet characterSet)
Returns a reader from an input stream and a character set.
|
static String |
toString(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 String |
toString(InputStream inputStream,
CharacterSet characterSet)
Converts an input stream to a string using the specified character set
for decoding the input stream.
|
static String |
toString(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 Reader getReader(InputStream stream, CharacterSet characterSet) throws UnsupportedEncodingException
stream
- The input stream.characterSet
- The character set. May be null.UnsupportedEncodingException
- if a character set is given, but not supportedpublic static String toString(InputStream inputStream)
inputStream
- The input stream.InputStreamReader
,
toString(InputStream, CharacterSet)
public static String toString(InputStream inputStream, CharacterSet characterSet)
inputStream
- The input stream.characterSet
- The character setInputStreamReader
public static String toString(Reader reader)
reader
- The characters reader.InputStreamReader
Copyright © 2005-2015 Restlet.