public int read()

in src/main/java/com/microsoft/azure/spark/tools/processes/SparkJobLogInputStream.java [35:57]


    public int read() throws IOException {
        if (isClosed) {
            return -1;
        }

        if (bufferPos >= buffer.length) {
            try {
                final String logSlice = sparkLogFetcher.observable()
                        .first()
                        .flatMap(fetcher -> fetcher.fetch(getLogType(), offset, -1))
                        .toBlocking()
                        .first();

                buffer = logSlice.getBytes();
                bufferPos = 0;
                offset += logSlice.length();
            } catch (NoSuchElementException ignored) {
                return -1;
            }
        }

        return buffer[bufferPos++];
    }