MCPcopy Create free account
hub / github.com/apache/tomcat / SocketInputBuffer

Class SocketInputBuffer

java/org/apache/coyote/ajp/AjpProcessor.java:1255–1289  ·  view source on GitHub ↗

This class is an input buffer which will read its data from an input stream.

Source from the content-addressed store, hash-verified

1253 * This class is an input buffer which will read its data from an input stream.
1254 */
1255 protected class SocketInputBuffer implements InputBuffer {
1256
1257 /**
1258 * Constructs a new SocketInputBuffer.
1259 */
1260 SocketInputBuffer() {
1261 // No-op
1262 }
1263
1264 @Override
1265 public int doRead(ApplicationBufferHandler handler) throws IOException {
1266
1267 if (endOfStream) {
1268 return -1;
1269 }
1270 if (empty) {
1271 if (!refillReadBuffer(true)) {
1272 return -1;
1273 }
1274 }
1275 ByteChunk bc = bodyBytes.getByteChunk();
1276 handler.setByteBuffer(ByteBuffer.wrap(bc.getBuffer(), bc.getStart(), bc.getLength()));
1277 empty = true;
1278 return handler.getByteBuffer().remaining();
1279 }
1280
1281 @Override
1282 public int available() {
1283 if (empty) {
1284 return 0;
1285 } else {
1286 return bodyBytes.getByteChunk().getLength();
1287 }
1288 }
1289 }
1290
1291
1292 // ----------------------------------- OutputStreamOutputBuffer Inner Class

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected