net.sf.sasl.common.io
Class ResourceReader

java.lang.Object
  extended by net.sf.sasl.common.io.ResourceReader

public class ResourceReader
extends Object

Helper class for resource reading operations.

Since:
0.0.1 (sasl-common-aspect-library)
Author:
Philipp Förmer

Constructor Summary
ResourceReader()
           
 
Method Summary
 String readStringResource(InputStream stream, String charset)
          Reads all bytes from the given input stream encoded by the given charset and returns the readed string.
 String readStringResource(String location)
          Wrapper method for readStringResource(String, String) that uses UTF-8 as the default character set.
 String readStringResource(String location, String charset)
          Reads the resource that has got the given character set encoding and is defined by the location into a string object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceReader

public ResourceReader()
Method Detail

readStringResource

public String readStringResource(String location)
                          throws IOException,
                                 IllegalArgumentException
Wrapper method for readStringResource(String, String) that uses UTF-8 as the default character set.

Parameters:
location - non null
Returns:
non null
Throws:
IOException - if any io exception occurs.
IllegalArgumentException - if location is null.
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
readStringResource(String, String)

readStringResource

public String readStringResource(String location,
                                 String charset)
                          throws IOException,
                                 IllegalArgumentException
Reads the resource that has got the given character set encoding and is defined by the location into a string object. The location can start with "classpath:" for local classpath resources or "file:" for file access.

Parameters:
location - non null
charset - non null
Returns:
non null
Throws:
IOException - if any io exception occurs.
IllegalArgumentException - if location or charset is null.
Since:
0.0.1 (sasl-common-aspect-library)

readStringResource

public String readStringResource(InputStream stream,
                                 String charset)
                          throws IOException,
                                 IllegalArgumentException
Reads all bytes from the given input stream encoded by the given charset and returns the readed string.

Parameters:
stream - non null
charset - non null
Returns:
non null readed string from the input stream.
Throws:
IOException - if any io exception occurs.
IllegalArgumentException - if stream or charset is null.
Since:
0.0.1 (sasl-common-aspect-library)


Copyright © 2010. All Rights Reserved.