Stream转Gson字符串
来源:互联网 发布:知乎用户政治倾向 编辑:程序博客网 时间:2024/06/14 05:23
package com.example.myapplication;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
/**
* Created by HP on 2017/11/29.
*/
public class ToStream {
public static String getToString(InputStream stream){
String data = "";
try {
ByteArrayOutputStream bao;
int len;
byte[] arr = new byte[1024];
bao = new ByteArrayOutputStream();
while((len = stream.read(arr))!=-1){
bao.write(arr,0,len);
}
data = bao.toString();
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
}
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
/**
* Created by HP on 2017/11/29.
*/
public class ToStream {
public static String getToString(InputStream stream){
String data = "";
try {
ByteArrayOutputStream bao;
int len;
byte[] arr = new byte[1024];
bao = new ByteArrayOutputStream();
while((len = stream.read(arr))!=-1){
bao.write(arr,0,len);
}
data = bao.toString();
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
}
阅读全文
0 0
- Stream转Gson字符串
- com.google.gson.stream.MalformedJsonException
- Gson 字符串 对象 List 对象互转
- Gson把json字符串转对象
- 使用GSON抛出com.google.gson.stream.MalformedJsonException异常
- com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException:
- com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException:解决办法
- com.google.gson.stream.MalformedJsonException的解决办法
- com.google.gson.stream.MalformedJsonException的解决办法
- com.google.gson.stream.MalformedJsonException的解决办法
- 字符串与Stream转换
- gson json字符串转换
- gson解析字符串toBean
- 使用Gson解析字符串
- Gson解析字符串
- Gson转JSON字符串时候, 将时间转成Long型
- google 的 gson json字符串转map 或 list
- java Gson java代码转字符串、对象使用
- 数据结构 希尔排序
- centos虚拟机搭建
- Linux centos7下安裝配置redis及Redis desktop Manager工具連接註意事項
- 1248
- three.js 05-04 之 BoxGeometry 几何体
- Stream转Gson字符串
- Linux文件权限
- 产品经理内功修炼——用户场景你真的考虑了吗?
- Jquery表单提交
- 【直观梳理深度学习关键概念】优化算法、调参基本思路、正则化方式等
- 基于UDP的P2P聊天工具 0.4——线程的和平退出
- BootStrapTable结合SpringMvc 异步删除刷新页面
- Android在Fragment中不调用onActivityResult()的解决办法
- Application工具类