InputStream转换使用说明

1、返回结果字符串String转换成InputStream

Response r = client.getObject(container, object);

InputStream stream =new ByteArrayInputStream(r.getBody().getBytes());

//其中r.getBody()为String类型

2、InputStream转换成string

 Response r = client.getObject(container, object);
 int length=r.getStreamBody().available();
 byte[] buf = new byte[length];
 r.getStreamBody().read(buf,0,length);
 stream = new ByteArrayInputStream(buf);

你可能感兴趣的:(Inputstream,String转换)