public int readFrom(InputStream stream) throws IOException {
        int bytesRead = stream.read(buffer);
        if (bytesRead < 0) {
            bytesInBuffer = 0;
        } else {
            bytesInBuffer = bytesRead;
        }
        return bytesRead;
    }
Reads from the input stream.
@param stream the input stream to read from
@throws IOException I/O error when reading from buffer
@return bytes read from buffer
gateway/engine/core/src/main/java/io/apiman/gateway/engine/io/ByteBuffer.java