interface.
This class is not thread safe.
| Method from org.apache.http.nio.util.SimpleInputBuffer Detail: |
public int consumeContent(ContentDecoder decoder) throws IOException {
setInputMode();
int totalRead = 0;
int bytesRead;
while ((bytesRead = decoder.read(this.buffer)) != -1) {
if (bytesRead == 0) {
if (!this.buffer.hasRemaining()) {
expand();
} else {
break;
}
} else {
totalRead += bytesRead;
}
}
if (bytesRead == -1 || decoder.isCompleted()) {
this.endOfStream = true;
}
return totalRead;
}
|
public boolean isEndOfStream() {
return !hasData() && this.endOfStream;
}
|
public int read() throws IOException {
if (isEndOfStream()) {
return -1;
}
return this.buffer.get() & 0xff;
}
|
public int read(byte[] b) throws IOException {
if (isEndOfStream()) {
return -1;
}
if (b == null) {
return 0;
}
return read(b, 0, b.length);
}
|
public int read(byte[] b,
int off,
int len) throws IOException {
if (isEndOfStream()) {
return -1;
}
if (b == null) {
return 0;
}
setOutputMode();
int chunk = len;
if (chunk > this.buffer.remaining()) {
chunk = this.buffer.remaining();
}
this.buffer.get(b, off, chunk);
return chunk;
}
|
public void reset() {
this.endOfStream = false;
super.clear();
}
|
public void shutdown() {
}
|