Methods Summary |
---|
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;
}
}
}
|
public boolean | hasNext()
if (this.currentElement == null) {
parseNextElement();
}
return this.currentElement != null;
|
public final java.lang.Object | next()
return nextElement();
|
public org.apache.http.HeaderElement | nextElement()
if (this.currentElement == null) {
parseNextElement();
}
if (this.currentElement == null) {
throw new NoSuchElementException("No more header elements available");
}
HeaderElement element = this.currentElement;
this.currentElement = null;
return element;
|
private void | parseNextElement()
// loop while there are headers left to parse
while (this.headerIt.hasNext() || this.cursor != null) {
if (this.cursor == null || this.cursor.atEnd()) {
// get next header value
bufferHeaderValue();
}
// Anything buffered?
if (this.cursor != null) {
// loop while there is data in the buffer
while (!this.cursor.atEnd()) {
HeaderElement e = this.parser.parseHeaderElement(this.buffer, this.cursor);
if (!(e.getName().length() == 0 && e.getValue() == null)) {
// Found something
this.currentElement = e;
return;
}
}
// if at the end of the buffer
if (this.cursor.atEnd()) {
// discard it
this.cursor = null;
this.buffer = null;
}
}
}
|
public void | remove()
throw new UnsupportedOperationException("Remove not supported");
|