public final class HeaderParser extends Object
HeaderParser
class is used to get header information about the current header defined in the given
file.HeaderDefinition
associated to the type of the given file.
Important: is considered a license header a header which contains the word copyright (case insensitive)
within a section of the file which match the given HeaderDefinition
associated to this
HeaderParser
.HeaderDefinition
Constructor and Description |
---|
HeaderParser(FileContent fileContent,
HeaderDefinition headerDefinition,
String[] keywords)
Creates a
HeaderParser object linked to the given file content and the associated header definition
based on the file type. |
Modifier and Type | Method and Description |
---|---|
int |
getBeginPosition()
Returns the index position in the content where the header effectively starts.
|
int |
getEndPosition()
Returns the index position in the content where the header effectively ends.
|
FileContent |
getFileContent()
Returns the file content.
|
HeaderDefinition |
getHeaderDefinition()
Returns the header definition associated to this header parser (itself bounded to a file).
|
boolean |
gotAnyHeader()
Tells if the given file already contains a license header.
|
public HeaderParser(FileContent fileContent, HeaderDefinition headerDefinition, String[] keywords)
HeaderParser
object linked to the given file content and the associated header definition
based on the file type.fileContent
- The file content.headerDefinition
- The associated header definition to use.IllegalArgumentException
- If the file content is null or if the header definition is null.public int getBeginPosition()
public int getEndPosition()
public boolean gotAnyHeader()
public FileContent getFileContent()
public HeaderDefinition getHeaderDefinition()
Copyright © 2008-2012 Mathieu Carbou. All Rights Reserved.