com.esri.aims.mtier.model.util
Class InputStreamToString

java.lang.Object
  extended by com.esri.aims.mtier.model.util.InputStreamToString

public class InputStreamToString
extends Object

Converts an InputStream Object to a String object.


Constructor Summary
InputStreamToString()
           
 
Method Summary
static String writeString(InputStream inputStream)
          Creates a String object from an InputStream object.
static String writeString(InputStream inputStream, String enc)
          Creates a String object from an InputStream object using the encoding specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputStreamToString

public InputStreamToString()
Method Detail

writeString

public static String writeString(InputStream inputStream)
Creates a String object from an InputStream object.

Example:

  String streamString = InputStreamToString.writeString(inputStreamObject);
 

Parameters:
inputStream - the InputStream object to convert.
Returns:
String- constructed from all the read bytes from the InputStream using JVM default encoding. It returns an empty string if there is an exception in the function.

writeString

public static String writeString(InputStream inputStream,
                                 String enc)
Creates a String object from an InputStream object using the encoding specified.

Parameters:
inputStream - the InputStream object to convert.
enc - is character-encoding that is used to construct InputStreamReader. If it is null, JVM's default encoding is used.
Returns:
String- constructed from all the read bytes from the InputStream using the specified character-encoding. It returns an empty string if there is an exception in the function.