public Optional<String> getNextOperationId(InputStream requestInputStream) throws IOException {
        StringBuilder idBuf = new StringBuilder(100);
        int c;
        while ((c = requestInputStream.read()) != -1) {
            if (c == 32) {
                break;
            }
            idBuf.append((char) c);  // it's ASCII
        }
        if (idBuf.length() == 0) {
            return Optional.empty();
        }
        return Optional.of(Encoder.decode(idBuf.toString(), new StringBuilder(idBuf.length())).toString());
    }
This code is based on v2 code, but restructured so stream reading code is in one dedicated class.

@author Haakon Dybdahl
vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/StreamReaderV3.java