docs: public int readFrom(InputStream stream) throws IOException {
          int bytesRead = stream.read(buffer);
          if (bytesRead < 0) {
              bytesInBuffer = 0;
          } else {
              bytesInBuffer = bytesRead;
          }
          return bytesRead;
      }