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

Method available

java/org/apache/coyote/ajp/AjpProcessor.java:1044–1066  ·  view source on GitHub ↗
(boolean doRead)

Source from the content-addressed store, hash-verified

1042
1043
1044 @Override
1045 protected final int available(boolean doRead) {
1046 if (endOfStream) {
1047 return 0;
1048 }
1049 if (empty && doRead) {
1050 try {
1051 refillReadBuffer(false);
1052 } catch (IOException ioe) {
1053 /*
1054 * Probably a timeout. This approach isn't ideal but it works. Returning 1 will indicate that data is
1055 * available which should trigger a read which in turn will trigger another IOException and that one can
1056 * be thrown.
1057 */
1058 return 1;
1059 }
1060 }
1061 if (empty) {
1062 return 0;
1063 } else {
1064 return request.getInputBuffer().available();
1065 }
1066 }
1067
1068
1069 @Override

Callers 1

Calls 3

refillReadBufferMethod · 0.95
availableMethod · 0.65
getInputBufferMethod · 0.45

Tested by

no test coverage detected