从给定的流中读取所有的数据转成字符串

public static String readStream(InputStream is){
        try {
            byte[] bs = new byte[1024] ;
            int b = 0 ;
            ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
            while((b=is.read(bs))!=-1){
                baos.write(bs, 0, b) ;
            }
            baos.close() ;
            return new String(bs) ;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null ;
    }