org.jasig.cas.client.util
Class IOUtils

java.lang.Object
  extended by org.jasig.cas.client.util.IOUtils

public final class IOUtils
extends Object

IO utility class.

Since:
3.4
Author:
Marvin S. Addison

Field Summary
static Charset UTF8
          UTF-8 character set.
 
Method Summary
static void closeQuietly(Closeable resource)
          Unconditionally close a Closeable resource.
static String readString(InputStream in)
          Reads all data from the given stream as UTF-8 character data and closes it on completion or errors.
static String readString(InputStream in, Charset charset)
          Reads all data from the given stream as character data in the given character set and closes it on completion or errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTF8

public static final Charset UTF8
UTF-8 character set.

Method Detail

readString

public static String readString(InputStream in)
                         throws IOException
Reads all data from the given stream as UTF-8 character data and closes it on completion or errors.

Parameters:
in - Input stream containing character data.
Returns:
String of all data in stream.
Throws:
IOException - On IO errors.

readString

public static String readString(InputStream in,
                                Charset charset)
                         throws IOException
Reads all data from the given stream as character data in the given character set and closes it on completion or errors.

Parameters:
in - Input stream containing character data.
charset - Character set of data in stream.
Returns:
String of all data in stream.
Throws:
IOException - On IO errors.

closeQuietly

public static void closeQuietly(Closeable resource)
Unconditionally close a Closeable resource. Errors on close are ignored.

Parameters:
resource - Resource to close.


Copyright © 2006-2015 Jasig. All Rights Reserved.