Java tutorial
package org.apache.http.impl.io; import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; import java.io.IOException; import org.apache.http.ConnectionClosedException; import org.apache.http.HttpException; import org.apache.http.HttpMessage; import org.apache.http.HttpRequestFactory; import org.apache.http.ParseException; import org.apache.http.annotation.NotThreadSafe; import org.apache.http.io.SessionInputBuffer; import org.apache.http.message.LineParser; import org.apache.http.message.ParserCursor; import org.apache.http.params.HttpParams; import org.apache.http.util.Args; import org.apache.http.util.CharArrayBuffer; @NotThreadSafe @Deprecated public class HttpRequestParser extends AbstractMessageParser<HttpMessage> { private final CharArrayBuffer lineBuf; private final HttpRequestFactory requestFactory; public HttpRequestParser(SessionInputBuffer sessionInputBuffer, LineParser lineParser, HttpRequestFactory httpRequestFactory, HttpParams httpParams) { super(sessionInputBuffer, lineParser, httpParams); this.requestFactory = (HttpRequestFactory) Args.notNull(httpRequestFactory, "Request factory"); this.lineBuf = new CharArrayBuffer(AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } protected HttpMessage parseHead(SessionInputBuffer sessionInputBuffer) throws IOException, HttpException, ParseException { this.lineBuf.clear(); if (sessionInputBuffer.readLine(this.lineBuf) == -1) { throw new ConnectionClosedException("Client closed connection"); } return this.requestFactory.newHttpRequest( this.lineParser.parseRequestLine(this.lineBuf, new ParserCursor(0, this.lineBuf.length()))); } }