Class CDXReader


  • public class CDXReader
    extends Object
    This class handles reading CDX files and finding entries in them. Furthermore it implements the possibility to do filtering of searchresults
    • Constructor Detail

      • CDXReader

        public CDXReader​(File cdxFile)
        Create a new CDXReader that reads the given file.
        Parameters:
        cdxFile - A CDX file to read.
        Throws:
        IOFailure - If the file cannot be found.
      • CDXReader

        public CDXReader()
        Create a new CDXReader with no file.
    • Method Detail

      • addCDXFile

        public void addCDXFile​(File cdxFile)
        Add another CDX file to those being searched.
        Parameters:
        cdxFile - A CDX file to search.
        Throws:
        IOFailure - If the file cannot be found or read
      • clearCDXFiles

        public void clearCDXFiles()
        Forget about all CDX files.
      • addCDXRecordFilter

        public void addCDXRecordFilter​(CDXRecordFilter cdxrecfilter)
                                throws ArgumentNotValid
        Add another CDXRecordFilter to the list of filters to use when searching.
        Parameters:
        cdxrecfilter - A CDXRecordFilter to use when searching.
        Throws:
        ArgumentNotValid - If the filter is invalid or another filter exists with the same name.
      • removeAllCDXRecordFilters

        public void removeAllCDXRecordFilters()
        Remove all CDXRecordFilters.
      • getFilters

        public Map<String,​CDXRecordFilter> getFilters()
        Get a table of all filters.
        Returns:
        a Hashtable with all the filters.
      • getCDXRecordFilter

        public CDXRecordFilter getCDXRecordFilter​(String filtername)
        Get a specific filter by the name of the filter - if not found return null.
        Parameters:
        filtername - The given filtername.
        Returns:
        the CDXRecordFilter
      • removeCDXRecordFilter

        public void removeCDXRecordFilter​(String filtername)
        Remove a specific filter by the name of the filter.
        Parameters:
        filtername - The given filtername.
        Throws:
        UnknownID - if there is no filter of that name.
      • getKey

        public ARCKey getKey​(String uri)
        Look up an entry in CDX files. Notice that only full match search is allowed, not prefix search.
        Parameters:
        uri - A URI to find in the CDX files.
        Returns:
        A key indicating the place where the entry can be found, or null if no such entry was found;