use of cn.hutool.core.io.FastByteArrayOutputStream in project hutool by looly.
the class MultipartRequestInputStream method readString.
// ---------------------------------------------------------------- copy
/**
* 读取字节流,直到下一个boundary
*
* @param charset 编码,null表示系统默认编码
* @return 读取的字符串
* @throws IOException 读取异常
*/
public String readString(Charset charset) throws IOException {
final FastByteArrayOutputStream out = new FastByteArrayOutputStream();
copy(out);
return out.toString(charset);
}
use of cn.hutool.core.io.FastByteArrayOutputStream in project hutool by looly.
the class HttpResponse method readBody.
/**
* 读取主体,忽略EOFException异常
*
* @param in 输入流
* @throws IORuntimeException IO异常
*/
private void readBody(InputStream in) throws IORuntimeException {
if (ignoreBody) {
return;
}
final long contentLength = contentLength();
final FastByteArrayOutputStream out = new FastByteArrayOutputStream((int) contentLength);
copyBody(in, out, contentLength, null);
this.bodyBytes = out.toByteArray();
}
Aggregations