All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aconex.scrutineer.elasticsearch.IdAndVersionInputStreamIterator Maven / Gradle / Ivy

package com.aconex.scrutineer.elasticsearch;

import com.aconex.scrutineer.IdAndVersion;

import java.io.IOException;
import java.util.Iterator;

public class IdAndVersionInputStreamIterator implements Iterator {

    private final IdAndVersionDataReader idAndVersionDataReader;
    private IdAndVersion currentValue;

    public IdAndVersionInputStreamIterator(IdAndVersionDataReader idAndVersionDataReader) {
        try {
            this.idAndVersionDataReader = idAndVersionDataReader;
            this.currentValue = idAndVersionDataReader.readNext();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public boolean hasNext() {
        return currentValue != null;
    }

    @Override
    public IdAndVersion next() {
        try {
            IdAndVersion result = currentValue;
            currentValue = idAndVersionDataReader.readNext();
            return result;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy