Class BinSearch


  • public class BinSearch
    extends Object
    Performs a binary search through .cdx files for a given prefix string. Currently only handles a single .cdx file.
    • Constructor Detail

      • BinSearch

        public BinSearch()
    • Method Detail

      • getLinesInFile

        public static Iterable<String> getLinesInFile​(File file,
                                                      String prefix)
        Given a file in sorted order and a prefix to search for, return a an iterable that will return the lines in the files that start with the prefix, in order. They will be read lazily from the file.

        If no matches are found, it will still return an iterable with no entries.

        Parameters:
        file - A CDX file to search in.
        prefix - The line prefix to search for.
        Returns:
        An Iterable object that will return the lines matching the prefix in the file.