I have a strange issue:
My dropwizard API processes the uploaded file and saves it as a JPEG image
the uploaded file is read as an InputStream.
FormDataBodyPart fileBody is read using @FormDataParam("file")
InputStream imageStream = fileBody.getValueAs(InputStream.class);
final int maxSize = 102400;
final byte[] bytes = new byte[maxSize + 1];
int totalBytes = this.imageStream.read(bytes);
System.out.println("totalBytes:"+totalBytes);
the totalBytes value returned is never greater than 8181 irrespective of the original size of the uploaded file. I tried with 800KB and 1.3MB files
the HttpServletRequest.getContentLength() shows the correct number of bytes as uploaded
what am I missing here?
8181has some possible explanation:8181*8=65 448 ~ 65 536 = 2^16->16 bits = 2 bytes. I might be wrong.