美文网首页jersey
2019-12-19 jersey upload (input

2019-12-19 jersey upload (input

作者: 黑窗口 | 来源:发表于2019-12-19 14:19 被阅读0次

inputStream,FormDataContentDisposition

问题描述:使用jersey框架上传,通过inputstream 不能获取到输入流的字节大小

解决:将输入流写入到输出流中读取

byte[] buffer =new byte[1024];

ByteArrayOutputStream outSteam =new ByteArrayOutputStream();

int ls = -1;

try {

while ((ls = inputStream.read(buffer)) != -1) {

outSteam.write(buffer,0, ls);

}

outSteam.close();

inputStream.close();

}catch (IOException e) {

e.printStackTrace();

}

int size = outSteam.size();

相关文章

网友评论

    本文标题:2019-12-19 jersey upload (input

    本文链接:https://www.haomeiwen.com/subject/nxvmnctx.html