Class DecoratorDbReader<T extends DecoratorInformation>

  • Direct Known Subclasses:
    MaxmindVpnDecoratorDbReader

    public abstract class DecoratorDbReader<T extends DecoratorInformation>
    extends Object
    Reads one line at a time from the provided DB. Only hold one line in memory and stop reading when an IP is reached, that is outside of the requested one

    T lastFetched holds the last line that was read from the DB The reader will keep reading until it reaches the end of the file or the end of the requested ip range;

    • Constructor Detail

      • DecoratorDbReader

        public DecoratorDbReader()
    • Method Detail

      • getLastFetched

        protected Optional<T> getLastFetched()
      • setLastFetched

        protected void setLastFetched​(T lastFetched)
        The last successfully parsed line read from the provided decorating DB
        Parameters:
        lastFetched - set the last fetched line to the passed argument
      • fetchForRange

        public final List<T> fetchForRange​(IP rangeBoundStart,
                                           IP rangeBoundEnd)
      • readNextLine

        protected abstract Optional<T> readNextLine()
      • parseDbLine

        protected abstract Optional<T> parseDbLine​(String line)