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

io.protostuff.compiler.parser.CompositeFileReader Maven / Gradle / Ivy

There is a newer version: 3.1.40
Show newest version
package io.protostuff.compiler.parser;

import org.antlr.v4.runtime.CharStream;

import java.util.Arrays;
import java.util.List;

import javax.annotation.Nullable;

/**
 * @author Kostiantyn Shchepanovskyi
 */
public class CompositeFileReader implements FileReader {

    private final List delegateList;

    public CompositeFileReader(List delegateList) {
        this.delegateList = delegateList;
    }

    public CompositeFileReader(FileReader... delegates) {
        this.delegateList = Arrays.asList(delegates);
    }

    @Nullable
    @Override
    public CharStream read(String name) {
        for (FileReader delegate : delegateList) {
            CharStream result = delegate.read(name);
            if (result != null) {
                return result;
            }
        }
        return null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy