Class HeaderCheckWorker

java.lang.Object
org.apache.rat.analysis.HeaderCheckWorker

public class HeaderCheckWorker extends Object
Reads from a stream to check license.

Note that this class is not thread safe.

  • Field Details

    • DEFAULT_NUMBER_OF_RETAINED_HEADER_LINES

      public static final int DEFAULT_NUMBER_OF_RETAINED_HEADER_LINES
      The default number of header lines to read while looking for the license information.
      See Also:
  • Constructor Details

    • HeaderCheckWorker

      public HeaderCheckWorker(IHeaderMatcher generatedMatcher, Reader reader, Collection<ILicense> licenses, Document name)
      Convenience constructor wraps given Reader in a BufferedReader.
      Parameters:
      generatedMatcher - The matcher for generated headers.
      reader - The reader on the document. Not null.
      licenses - The licenses to check against. Not null.
      name - The document that is being checked. Possibly null.
    • HeaderCheckWorker

      public HeaderCheckWorker(IHeaderMatcher generatedMatcher, Reader reader, int numberOfRetainedHeaderLine, Collection<ILicense> licenses, Document document)
      Constructs a check worker for the license against the specified document.
      Parameters:
      generatedMatcher - The matcher for generated headers.
      reader - The reader on the document. Not null.
      numberOfRetainedHeaderLine - the maximum number of lines to read to find the license information.
      licenses - The licenses to check against. Not null.
      document - The document that is being checked. Possibly null.
  • Method Details

    • readHeader

      public static IHeaders readHeader(BufferedReader reader, int numberOfLines) throws IOException
      Read the input and perform the header check.

      The number of lines indicates how many lines from the top of the file will be read for processing

      Parameters:
      reader - The reader for the document.
      numberOfLines - the number of lines to read from the header.
      Returns:
      The IHeaders instance for the header.
      Throws:
      IOException - on input failure
    • read

      public void read() throws RatHeaderAnalysisException
      Read the input and perform the header check.
      Throws:
      RatHeaderAnalysisException - on IO exception.