Class FilterFileReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    @ThreadSafety(level=COMPLETELY_THREADSAFE)
    public final class FilterFileReader
    extends java.lang.Object
    implements java.io.Closeable
    This class provides a mechanism for reading LDAP search filters from a file. The file is expected to have one filter per line. Blank lines and lines beginning with the octothorpe (#) character will be ignored.
    • Constructor Summary

      Constructors 
      Constructor Description
      FilterFileReader​(java.io.File filterFile)
      Creates a new filter file reader that will read from the specified file.
      FilterFileReader​(java.lang.String path)
      Creates a new filter file reader that will read from the file with the specified path.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes this filter file reader.
      Filter readFilter()
      Reads the next filter from the file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FilterFileReader

        public FilterFileReader​(@NotNull
                                java.lang.String path)
                         throws java.io.IOException
        Creates a new filter file reader that will read from the file with the specified path.
        Parameters:
        path - The path to the file to be read. It must not be null and the file must exist.
        Throws:
        java.io.IOException - If a problem is encountered while opening the file for reading.
      • FilterFileReader

        public FilterFileReader​(@NotNull
                                java.io.File filterFile)
                         throws java.io.IOException
        Creates a new filter file reader that will read from the specified file.
        Parameters:
        filterFile - The file to be read. It must not be null and the file must exist.
        Throws:
        java.io.IOException - If a problem is encountered while opening the file for reading.
    • Method Detail

      • readFilter

        @Nullable
        public Filter readFilter()
                          throws java.io.IOException,
                                 LDAPException
        Reads the next filter from the file.
        Returns:
        The filter read from the file, or null if there are no more filters to be read.
        Throws:
        java.io.IOException - If a problem is encountered while trying to read from the file.
        LDAPException - If data read from the file can't be parsed as an LDAP search filter.
      • close

        public void close()
                   throws java.io.IOException
        Closes this filter file reader.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException - If a problem is encountered while closing the reader.