src/main/java/com/aws/iot/edgeconnectorforkvs/videouploader/mkv/MkvFilesInputStream.java [63:117]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @Override
    public int available() {
        if (isClosed) {
            return -1;
        } else {
            wantMoreData();
            if (byteArrayInputStream == null) {
                return -1;
            } else {
                return byteArrayInputStream.available();
            }
        }
    }

    @Override
    public void close() {
        closeMkvInputStream();
        try {
            // FIXME: The data flushed here are not able to read out.
            mergeFragmentVisitor.flush();
        } catch (IOException exception) {
            log.debug("Failed to do flush");
        }
        isClosed = true;
    }

    @Override
    public boolean markSupported() {
        return false;
    }

    @Override
    public int read() {
        if (available() >= 0) {
            return byteArrayInputStream.read();
        } else {
            return -1;
        }
    }

    @Override
    public int read(byte[] b, int off, int len) {
        if (available() >= 0) {
            return byteArrayInputStream.read(b, off, len);
        } else {
            return -1;
        }
    }

    private void wantMoreData() {
        if (byteArrayInputStream != null) {
            if (byteArrayInputStream.available() > 0) {
                return;
            } else {
                closeMkvInputStream();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/com/aws/iot/edgeconnectorforkvs/videouploader/mkv/MkvInputStream.java [56:110]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @Override
    public int available() {
        if (isClosed) {
            return -1;
        } else {
            wantMoreData();
            if (byteArrayInputStream == null) {
                return -1;
            } else {
                return byteArrayInputStream.available();
            }
        }
    }

    @Override
    public void close() {
        closeMkvInputStream();
        try {
            // FIXME: The data flushed here are not able to read out.
            mergeFragmentVisitor.flush();
        } catch (IOException exception) {
            log.debug("Failed to do flush");
        }
        isClosed = true;
    }

    @Override
    public boolean markSupported() {
        return false;
    }

    @Override
    public int read() {
        if (available() >= 0) {
            return byteArrayInputStream.read();
        } else {
            return -1;
        }
    }

    @Override
    public int read(byte[] b, int off, int len) {
        if (available() >= 0) {
            return byteArrayInputStream.read(b, off, len);
        } else {
            return -1;
        }
    }

    private void wantMoreData() {
        if (byteArrayInputStream != null) {
            if (byteArrayInputStream.available() > 0) {
                return;
            } else {
                closeMkvInputStream();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



