public final class Header extends Object
Header
class wraps the license template file, the one which have to be outputted inside the other
files.Constructor and Description |
---|
Header(URL location,
String encoding,
HeaderSection[] sections)
Constructs a
Header object pointing to a license template file. |
Modifier and Type | Method and Description |
---|---|
String |
applyDefinitionAndSections(HeaderDefinition headerDefinition,
boolean unix) |
String |
asOneLineString() |
String |
asString() |
String |
buildForDefinition(HeaderDefinition type,
boolean unix) |
String |
eol(boolean unix) |
int |
getLineCount() |
String[] |
getLines() |
URL |
getLocation()
Returns the location of license template file.
|
int |
getMaxLineLength() |
boolean |
isMatchForText(Document d,
HeaderDefinition headerDefinition,
boolean unix,
String encoding) |
boolean |
isMatchForText(String potentialFileHeader,
HeaderDefinition headerDefinition,
boolean unix)
Determines if a potential file header (typically, the start of the file
plus some buffer space) matches this header, as rendered with the
specified
HeaderDefinition and line-ending. |
boolean |
isMatchForText(String expected,
String potentialFileHeader,
HeaderDefinition headerDefinition,
boolean unix) |
String |
toString() |
public Header(URL location, String encoding, HeaderSection[] sections)
Header
object pointing to a license template file. In case of the template contains
replaceable values (declared as ${valuename}), you can set the map of this values.location
- The license template file location.sections
- Any applicable header sections for this headerIllegalArgumentException
- If the header file location is null or if an error occurred while reading the
file content.public String asString()
public String asOneLineString()
public int getLineCount()
public int getMaxLineLength()
public URL getLocation()
public String eol(boolean unix)
public String buildForDefinition(HeaderDefinition type, boolean unix)
public String[] getLines()
public boolean isMatchForText(String potentialFileHeader, HeaderDefinition headerDefinition, boolean unix)
HeaderDefinition
and line-ending.potentialFileHeader
- the potential file header, usually with some extra buffer
linesheaderDefinition
- the header definition to render the header withunix
- if true, unix line-endings will be usedpublic boolean isMatchForText(String expected, String potentialFileHeader, HeaderDefinition headerDefinition, boolean unix)
public boolean isMatchForText(Document d, HeaderDefinition headerDefinition, boolean unix, String encoding) throws IOException
IOException
public String applyDefinitionAndSections(HeaderDefinition headerDefinition, boolean unix)
Copyright © 2008–2016 Mycila. All rights reserved.