Search in sources :

Example 66 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

the class BasicLineParser method parseRequestLine.

public static final RequestLine parseRequestLine(final String value, LineParser parser) throws ParseException {
    if (value == null) {
        throw new IllegalArgumentException("Value to parse may not be null.");
    }
    if (parser == null)
        parser = BasicLineParser.DEFAULT;
    CharArrayBuffer buffer = new CharArrayBuffer(value.length());
    buffer.append(value);
    ParserCursor cursor = new ParserCursor(0, value.length());
    return parser.parseRequestLine(buffer, cursor);
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Example 67 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

the class ParserCursor method toString.

public String toString() {
    CharArrayBuffer buffer = new CharArrayBuffer(16);
    buffer.append('[');
    buffer.append(Integer.toString(this.lowerBound));
    buffer.append('>');
    buffer.append(Integer.toString(this.pos));
    buffer.append('>');
    buffer.append(Integer.toString(this.upperBound));
    buffer.append(']');
    return buffer.toString();
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Example 68 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

the class BasicHeaderValueFormatter method formatHeaderElement.

// non-javadoc, see interface HeaderValueFormatter
public CharArrayBuffer formatHeaderElement(CharArrayBuffer buffer, final HeaderElement elem, final boolean quote) {
    if (elem == null) {
        throw new IllegalArgumentException("Header element must not be null.");
    }
    int len = estimateHeaderElementLen(elem);
    if (buffer == null) {
        buffer = new CharArrayBuffer(len);
    } else {
        buffer.ensureCapacity(len);
    }
    buffer.append(elem.getName());
    final String value = elem.getValue();
    if (value != null) {
        buffer.append('=');
        doFormatValue(buffer, value, quote);
    }
    final int parcnt = elem.getParameterCount();
    if (parcnt > 0) {
        for (int i = 0; i < parcnt; i++) {
            buffer.append("; ");
            formatNameValuePair(buffer, elem.getParameter(i), quote);
        }
    }
    return buffer;
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Example 69 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

the class BasicHeaderValueFormatter method formatNameValuePair.

// non-javadoc, see interface HeaderValueFormatter
public CharArrayBuffer formatNameValuePair(CharArrayBuffer buffer, final NameValuePair nvp, final boolean quote) {
    if (nvp == null) {
        throw new IllegalArgumentException("NameValuePair must not be null.");
    }
    int len = estimateNameValuePairLen(nvp);
    if (buffer == null) {
        buffer = new CharArrayBuffer(len);
    } else {
        buffer.ensureCapacity(len);
    }
    buffer.append(nvp.getName());
    final String value = nvp.getValue();
    if (value != null) {
        buffer.append('=');
        doFormatValue(buffer, value, quote);
    }
    return buffer;
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Example 70 with CharArrayBuffer

use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.

the class BasicHeaderValueParser method parseHeaderElement.

/**
     * Parses an element with the given parser.
     *
     * @param value     the header element to parse
     * @param parser    the parser to use, or <code>null</code> for default
     *
     * @return  the parsed header element
     */
public static final HeaderElement parseHeaderElement(final String value, HeaderValueParser parser) throws ParseException {
    if (value == null) {
        throw new IllegalArgumentException("Value to parse may not be null");
    }
    if (parser == null)
        parser = BasicHeaderValueParser.DEFAULT;
    CharArrayBuffer buffer = new CharArrayBuffer(value.length());
    buffer.append(value);
    ParserCursor cursor = new ParserCursor(0, value.length());
    return parser.parseHeaderElement(buffer, cursor);
}
Also used : CharArrayBuffer(org.apache.http.util.CharArrayBuffer)

Aggregations

CharArrayBuffer (org.apache.http.util.CharArrayBuffer)126 BufferedHeader (org.apache.http.message.BufferedHeader)27 FormattedHeader (org.apache.http.FormattedHeader)24 Header (org.apache.http.Header)21 ArrayList (java.util.ArrayList)19 ClientCookie (org.apache.http.cookie.ClientCookie)12 Cookie (org.apache.http.cookie.Cookie)12 ParserCursor (org.apache.http.message.ParserCursor)11 Headers (android.net.http.Headers)6 IOException (java.io.IOException)6 MalformedChallengeException (org.apache.http.auth.MalformedChallengeException)6 MalformedCookieException (org.apache.http.cookie.MalformedCookieException)6 AuthenticationException (org.apache.http.auth.AuthenticationException)5 InvalidCredentialsException (org.apache.http.auth.InvalidCredentialsException)5 BasicNameValuePair (org.apache.http.message.BasicNameValuePair)5 NTCredentials (org.apache.http.auth.NTCredentials)4 HashMap (java.util.HashMap)3 HeaderElement (org.apache.http.HeaderElement)3 NoHttpResponseException (org.apache.http.NoHttpResponseException)3 ParseException (org.apache.http.ParseException)3