inputstream与其他格式的转换

1、InputStream 转换成InputSource 。

InputStream inputStream = request.getInputStream();
InputSource input = new InputSource(inputStream);

2、InputStream 输出转换成字符串输出。

InputStream inputStream = request.getInputStream();

        StringBuffer   out   =   new   StringBuffer(); 
        byte[]   b   =   new   byte[4096]; 
        for   (int   n;   (n   =   inputStream .read(b))   !=   -1;)  

        { 
                out.append(new   String(b,   0,   n)); 
        } 
        String value = out.toString();

原文地址:https://www.cnblogs.com/liun1994/p/3834462.html