use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class BasicLineParser method parseStatusLine.
public static final StatusLine parseStatusLine(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.parseStatusLine(buffer, cursor);
}
use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class BasicNameValuePair method toString.
/**
* Get a string representation of this pair.
*
* @return A string representation.
*/
public String toString() {
// don't call complex default formatting for a simple toString
int len = this.name.length();
if (this.value != null)
len += 1 + this.value.length();
CharArrayBuffer buffer = new CharArrayBuffer(len);
buffer.append(this.name);
if (this.value != null) {
buffer.append("=");
buffer.append(this.value);
}
return buffer.toString();
}
use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class AbstractSessionInputBuffer method readLine.
public String readLine() throws IOException {
CharArrayBuffer charbuffer = new CharArrayBuffer(64);
int l = readLine(charbuffer);
if (l != -1) {
return charbuffer.toString();
} else {
return null;
}
}
use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class BasicHeaderElementIterator method bufferHeaderValue.
private void bufferHeaderValue() {
this.cursor = null;
this.buffer = null;
while (this.headerIt.hasNext()) {
Header h = this.headerIt.nextHeader();
if (h instanceof FormattedHeader) {
this.buffer = ((FormattedHeader) h).getBuffer();
this.cursor = new ParserCursor(0, this.buffer.length());
this.cursor.updatePos(((FormattedHeader) h).getValuePos());
break;
} else {
String value = h.getValue();
if (value != null) {
this.buffer = new CharArrayBuffer(value.length());
this.buffer.append(value);
this.cursor = new ParserCursor(0, this.buffer.length());
break;
}
}
}
}
use of org.apache.http.util.CharArrayBuffer in project XobotOS by xamarin.
the class BasicHeaderValueParser method parseNameValuePair.
/**
* Parses a name-value-pair with the given parser.
*
* @param value the NVP to parse
* @param parser the parser to use, or <code>null</code> for default
*
* @return the parsed name-value pair
*/
public static final NameValuePair parseNameValuePair(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.parseNameValuePair(buffer, cursor);
}
Aggregations