org.apache.wicket.util.io
Class Streams

java.lang.Object
  extended by org.apache.wicket.util.io.Streams

public final class Streams
extends java.lang.Object

Utilities methods for working with input and output streams.

Author:
Jonathan Locke

Method Summary
static int copy(java.io.InputStream in, java.io.OutputStream out)
          Writes the input stream to the output stream.
static void loadFromXml(java.util.Properties properties, java.io.InputStream inputStream)
          Loads properties from an XML input stream into the provided properties object.
static java.lang.String readString(java.io.InputStream in)
          Reads a stream as a string.
static java.lang.String readString(java.io.InputStream in, java.lang.CharSequence encoding)
          Reads a string using a character encoding.
static java.lang.String readString(java.io.Reader in)
          Reads all input from a reader into a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copy

public static int copy(java.io.InputStream in,
                       java.io.OutputStream out)
                throws java.io.IOException
Writes the input stream to the output stream. Input is done without a Reader object, meaning that the input is copied in its raw form.

Parameters:
in - The input stream
out - The output stream
Returns:
Number of bytes copied from one stream to the other
Throws:
java.io.IOException

loadFromXml

public static void loadFromXml(java.util.Properties properties,
                               java.io.InputStream inputStream)
                        throws java.io.IOException
Loads properties from an XML input stream into the provided properties object.

Parameters:
properties - The object to load the properties into
inputStream -
Throws:
java.io.IOException - When the input stream could not be read from

readString

public static java.lang.String readString(java.io.InputStream in)
                                   throws java.io.IOException
Reads a stream as a string.

Parameters:
in - The input stream
Returns:
The string
Throws:
java.io.IOException

readString

public static java.lang.String readString(java.io.InputStream in,
                                          java.lang.CharSequence encoding)
                                   throws java.io.IOException
Reads a string using a character encoding.

Parameters:
in - The input
encoding - The character encoding of the input data
Returns:
The string
Throws:
java.io.IOException

readString

public static java.lang.String readString(java.io.Reader in)
                                   throws java.io.IOException
Reads all input from a reader into a string.

Parameters:
in - The input
Returns:
The string
Throws:
java.io.IOException


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.