use of com.helger.servlet.io.AbstractServletInputStream in project ph-web by phax.
the class StreamingFuncTest method _parseUploadToList.
@Nonnull
@ReturnsMutableCopy
private ICommonsList<IFileItem> _parseUploadToList(final InputStream pStream, final int pLength) throws FileUploadException {
final String contentType = "multipart/form-data; boundary=---1234";
final AbstractFileUploadBase upload = new ServletFileUpload(new DiskFileItemFactory(10240));
final MockHttpServletRequest request = new MockHttpServletRequest() {
@Override
public int getContentLength() {
return pLength;
}
@Override
public ServletInputStream getInputStream() {
return new AbstractServletInputStream() {
@Override
public int read() throws IOException {
return pStream.read();
}
};
}
};
request.setContentType(contentType);
return upload.parseRequest(new ServletRequestContext(request));
}
Aggregations