Package org.apache.rat.analysis
Class HeaderCheckWorker
java.lang.Object
org.apache.rat.analysis.HeaderCheckWorker
Reads from a stream to check license.
Note that this class is not thread safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intThe default number of header lines to read while looking for the license information. -
Constructor Summary
ConstructorsConstructorDescriptionHeaderCheckWorker(IHeaderMatcher generatedMatcher, Reader reader, int numberOfRetainedHeaderLine, Collection<ILicense> licenses, Document document)Constructs a check worker for the license against the specified document.HeaderCheckWorker(IHeaderMatcher generatedMatcher, Reader reader, Collection<ILicense> licenses, Document name)Convenience constructor wraps givenReaderin aBufferedReader. -
Method Summary
Modifier and TypeMethodDescriptionvoidread()Read the input and perform the header check.static IHeadersreadHeader(BufferedReader reader, int numberOfLines)Read the input and perform the header check.
-
Field Details
-
DEFAULT_NUMBER_OF_RETAINED_HEADER_LINES
public static final int DEFAULT_NUMBER_OF_RETAINED_HEADER_LINESThe default number of header lines to read while looking for the license information.- See Also:
- Constant Field Values
-
-
Constructor Details
-
HeaderCheckWorker
public HeaderCheckWorker(IHeaderMatcher generatedMatcher, Reader reader, Collection<ILicense> licenses, Document name)Convenience constructor wraps givenReaderin aBufferedReader.- 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
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
Read the input and perform the header check.- Throws:
RatHeaderAnalysisException- on IO exception.
-