/**
* 将一个字符串转化为输入流
*/
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
;
}
/**
* 将一个输入流转化为字符串
*/
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
;
}