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();
网友评论