java流解析

来源:互联网 发布:手机壳定制软件 编辑:程序博客网 时间:2024/04/30 03:48
/**
 * 
 * parser deal
 * 
 * @author mickey_hou
 *
 */
public class Parser
{

/**

* parser inputStream

* @param inputStream
* @return
*/
public static String Reader(InputStream inputStream) 
{
String sCurrentLine = null;
String sTotalString = null;
try 
{
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
StringBuffer stemp = new StringBuffer();
while ((sCurrentLine = bufferedReader.readLine()) != null) 
{
stemp.append(sCurrentLine);
}
sTotalString = stemp.toString();

catch (IOException e) 
{
e.printStackTrace();

finally 
{
if (null != inputStream) 
{
try
{
inputStream.close();

catch (IOException e) 
{
e.printStackTrace();
}
}
}
return sTotalString;
}
}
原创粉丝点击