src/main/java/js/http/encoder/MultipartFormArgumentsReader.java
@Override
	public Object[] read(HttpServletRequest httpRequest, Type[] formalParameters) throws IOException, IllegalArgumentException {
		if (formalParameters.length != 1) {
			throw new IllegalArgumentException("Bad parameters count. Should be exactly one but is |%d|.", formalParameters.length);
		}
		if (formalParameters[0] instanceof ParameterizedType) {
			throw new IllegalArgumentException("Parameterized type |%s| is not supported.", formalParameters[0]);
		}

		Class<?> type = (Class<?>) formalParameters[0];
		Object[] arguments = new Object[1];

		if (type.equals(Form.class)) {
			arguments[0] = new FormImpl(httpRequest);
		}

		else if (type.equals(FormIterator.class)) {
			arguments[0] = new FormIteratorImpl(httpRequest);
		}

		else if (type.equals(UploadedFile.class)) {
			Form form = new FormImpl(httpRequest);
			// Form#getUploadedFile() throws IlegalArgumentException if form has not a single file upload part
			arguments[0] = form.getUploadedFile();
		}

		else if (type.equals(UploadStream.class)) {
			threadLocal.set((Closeable) (arguments[0] = getUploadStream(httpRequest, formalParameters)));
		}

		else if (type.equals(InputStream.class)) {
			threadLocal.set((Closeable) (arguments[0] = getUploadStream(httpRequest, formalParameters).openStream()));
		}

		else {
			arguments[0] = new FormObject(httpRequest, type).getValue();
		}

		return arguments;
	}
@Override
	public Object[] read(HttpServletRequest httpRequest, Type[] formalParameters) throws IOException, IllegalArgumentException {
		if (formalParameters.length != 1) {
			throw new IllegalArgumentException("Bad parameters count. Should be exactly one but is |%d|.", formalParameters.length);
		}
		if (formalParameters[0] instanceof ParameterizedType) {
			throw new IllegalArgumentException("Parameterized type |%s| is not supported.", formalParameters[0]);
		}

		Class<?> type = (Class<?>) formalParameters[0];
		Object[] arguments = new Object[1];

		if (type.equals(Form.class)) {
			arguments[0] = new FormImpl(httpRequest);
		}

		else if (type.equals(FormIterator.class)) {
			arguments[0] = new FormIteratorImpl(httpRequest);
		}

		else if (type.equals(UploadedFile.class)) {
			Form form = new FormImpl(httpRequest);
			// Form#getUploadedFile() throws IlegalArgumentException if form has not a single file upload part
			arguments[0] = form.getUploadedFile();
		}

		else if (type.equals(UploadStream.class)) {
			threadLocal.set((Closeable) (arguments[0] = getUploadStream(httpRequest, formalParameters)));
		}

		else if (type.equals(InputStream.class)) {
			threadLocal.set((Closeable) (arguments[0] = getUploadStream(httpRequest, formalParameters).openStream()));
		}

		else {
			arguments[0] = new FormObject(httpRequest, type).getValue();
		}

		return arguments;
	}
Parse multipart form from HTTP request, create object instance of requested type and fill it with form field value(s). If
formal type is a stream store it to local thread so that to be able to close it after arguments processed by application
code.

@param httpRequest HTTP request,
@param formalParameters formal parameter types.
@return single item arguments array.
@throws IOException if reading from HTTP request input stream fails.
@throws IllegalArgumentException if formal parameters does not contain exactly one type.
@throws IllegalArgumentException if formal parameter type is parameterized.
@throws IllegalArgumentException if HTTP request does not contain a valid multipart form.