/***//**
* Convert a string to an input stream
*/
Public static inputstream getstringstream (string sinputstring)
...{
If (sinputstring! = NULL &&! Sinputstring. Trim (). Equals (""))
...{
Try
...{
Bytearrayinputstream tinputstringstream = new bytearrayinputstream (sinputstring. getbytes ());
Return tinputstringstream;
}
Catch (exception ex)
...{
Ex. printstacktrace ();
}
}
Return NULL;
}
/***//**
* Convert an input stream to a string
*/
Public static string getstreamstring (inputstream tinputstream)
...{
If (tinputstream! = NULL)
...{
Try
...{
Bufferedreader tbufferedreader = new bufferedreader (New inputstreamreader (tinputstream ));
Stringbuffer tstringbuffer = new stringbuffer ();
String stemponeline = new string ("");
While (stemponeline = tbufferedreader. Readline ())! = NULL)
...{
Tstringbuffer. append (stemponeline );
}
Return tstringbuffer. tostring ();
}
Catch (exception ex)
...{
Ex. printstacktrace ();
}
}
Return NULL;
}