| java.lang.Object org.netbeans.installer.infra.utils.comment.handlers.LineFileHandler
All known Subclasses: org.netbeans.installer.infra.utils.comment.handlers.ShellFileHandler, org.netbeans.installer.infra.utils.comment.handlers.MakefileFileHandler, org.netbeans.installer.infra.utils.comment.handlers.PropertiesFileHandler,
LineFileHandler | abstract public class LineFileHandler implements FileHandler(Code) | | The base class for handling file types in which line-based comments are used,
such as java-style properties files or shell scripts.
author: Kirill Sorokin |
Field Summary | |
final protected Pattern | commentPattern The regular expression pattern which matches the line which is a comment. | final protected String | commentPrefix The prefix which should be used for each line in the comment. | protected String | contents The cached file contents. | final protected Pattern | ignorePattern The regular expression pattern which matches the line which should be
ignored. |
Constructor Summary | |
protected | LineFileHandler(Pattern commentPattern, Pattern ignorePattern, String commentPrefix) The constructor which should be called by the extending classes. |
commentPattern | final protected Pattern commentPattern(Code) | | The regular expression pattern which matches the line which is a comment.
|
commentPrefix | final protected String commentPrefix(Code) | | The prefix which should be used for each line in the comment. If there should
be no prefix - an empty line should be used (which is very unlikely in this
case).
|
contents | protected String contents(Code) | | The cached file contents.
|
ignorePattern | final protected Pattern ignorePattern(Code) | | The regular expression pattern which matches the line which should be
ignored. This is used to skip the non-whitespace lines that can preceed the
initial comment such as #!/bin/sh in shell scripts.
|
LineFileHandler | protected LineFileHandler(Pattern commentPattern, Pattern ignorePattern, String commentPrefix)(Code) | | The constructor which should be called by the extending classes. It merely
sets the class fields, performnig some basic validation.
Parameters: commentPattern - The regular expression pattern which matches the linewhich is a comment. Parameters: ignorePattern - The regular expression pattern which matches the linewhich should be ignored. Parameters: commentPrefix - The prefix which should be used for each line in thecomment. throws: java.lang.IllegalArgumentException - if the parameters validationfails. |
getCurrentComment | final public String getCurrentComment()(Code) | | |
insertComment | final public void insertComment(String text, int lineLength)(Code) | | |
updateComment | final public void updateComment(String text, int lineLength)(Code) | | |
|
|