jersey

2019-12-19 jersey upload (input

2019-12-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();

上一篇 下一篇

猜你喜欢

热点阅读