// Path: src/main/java/io/openio/sds/common/OioConstants.java
// public static final Charset OIO_CHARSET = Charset.forName("UTF-8");
// 
// Path: src/main/java/io/openio/sds/common/Strings.java
// public static boolean nullOrEmpty(String string) {
//     return null == string || 0 == string.length();
// }


import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;
import static io.openio.sds.common.OioConstants.OIO_CHARSET;
import static io.openio.sds.common.Strings.nullOrEmpty;
import static java.lang.String.format;
package io.openio.sds.http;



public class OioHttpRequest {

	private static final int R = 1;
	private static final int RN = 2;
	private static final int RNR = 3;
	private static final int RNRN = 3;

	private static byte BS_R = '\r';
	private static byte BS_N = '\n';

	private RequestHead head;
	private InputStream is;

	public OioHttpRequest(InputStream is) {
		this.is = is;
	}

	public static OioHttpRequest build(InputStream is) throws IOException {
		OioHttpRequest r = new OioHttpRequest(is);
		r.parseHead();
		return r;
	}

	private void parseHead() throws IOException {
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		int state = 0;
		while (state < RNRN) {
			state = next(bos, state);
		}
		read();
// Path: src/main/java/io/openio/sds/common/OioConstants.java
// public static final Charset OIO_CHARSET = Charset.forName("UTF-8");
// 
// Path: src/main/java/io/openio/sds/common/Strings.java
// public static boolean nullOrEmpty(String string) {
//     return null == string || 0 == string.length();
// }


// Path: src/main/java/io/openio/sds/http/OioHttpRequest.java
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;
import static io.openio.sds.common.OioConstants.OIO_CHARSET;
import static io.openio.sds.common.Strings.nullOrEmpty;
import static java.lang.String.format;

package io.openio.sds.http;



public class OioHttpRequest {

	private static final int R = 1;
	private static final int RN = 2;
	private static final int RNR = 3;
	private static final int RNRN = 3;

	private static byte BS_R = '\r';
	private static byte BS_N = '\n';

	private RequestHead head;
	private InputStream is;

	public OioHttpRequest(InputStream is) {
		this.is = is;
	}

	public static OioHttpRequest build(InputStream is) throws IOException {
		OioHttpRequest r = new OioHttpRequest(is);
		r.parseHead();
		return r;
	}

	private void parseHead() throws IOException {
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		int state = 0;
		while (state < RNRN) {
			state = next(bos, state);
		}
		read();
		head = RequestHead.parse(new String(bos.toByteArray(), OIO_CHARSET));