use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class RFC2109Spec method doFormatOneHeader.
private List<Header> doFormatOneHeader(final List<Cookie> cookies) {
int version = Integer.MAX_VALUE;
// Pick the lowest common denominator
for (Cookie cookie : cookies) {
if (cookie.getVersion() < version) {
version = cookie.getVersion();
}
}
CharArrayBuffer buffer = new CharArrayBuffer(40 * cookies.size());
buffer.append(SM.COOKIE);
buffer.append(": ");
buffer.append("$Version=");
buffer.append(Integer.toString(version));
for (Cookie cooky : cookies) {
buffer.append("; ");
Cookie cookie = cooky;
formatCookieAsVer(buffer, cookie, version);
}
List<Header> headers = new ArrayList<Header>(1);
headers.add(new BufferedHeader(buffer));
return headers;
}
use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class RFC2109Spec method doFormatManyHeaders.
private List<Header> doFormatManyHeaders(final List<Cookie> cookies) {
List<Header> headers = new ArrayList<Header>(cookies.size());
for (Cookie cookie : cookies) {
int version = cookie.getVersion();
CharArrayBuffer buffer = new CharArrayBuffer(40);
buffer.append("Cookie: ");
buffer.append("$Version=");
buffer.append(Integer.toString(version));
buffer.append("; ");
formatCookieAsVer(buffer, cookie, version);
headers.add(new BufferedHeader(buffer));
}
return headers;
}
use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class HttpRequestWriter method writeHeadLine.
protected void writeHeadLine(final HttpMessage message) throws IOException {
final CharArrayBuffer buffer = lineFormatter.formatRequestLine(this.lineBuf, ((HttpRequest) message).getRequestLine());
this.sessionBuffer.writeLine(buffer);
}
use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class HttpResponseWriter method writeHeadLine.
protected void writeHeadLine(final HttpMessage message) throws IOException {
final CharArrayBuffer buffer = lineFormatter.formatStatusLine(this.lineBuf, ((HttpResponse) message).getStatusLine());
this.sessionBuffer.writeLine(buffer);
}
use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class BasicHeaderElement method toString.
public String toString() {
CharArrayBuffer buffer = new CharArrayBuffer(64);
buffer.append(this.name);
if (this.value != null) {
buffer.append("=");
buffer.append(this.value);
}
for (int i = 0; i < this.parameters.length; i++) {
buffer.append("; ");
buffer.append(this.parameters[i]);
}
return buffer.toString();
}
Aggregations