| org.netbeans.installer.infra.utils.comment.handlers.FileHandler
All known Subclasses: org.netbeans.installer.infra.utils.comment.handlers.LineFileHandler, org.netbeans.installer.infra.utils.comment.handlers.BlockFileHandler,
FileHandler | public interface FileHandler (Code) | | The interface that all file handlers, i.e. classes handling comment correction
for concrete file types, should implement.
It requires the implementing classes to provide functionality of loading/saving a
file, extracting the current initial comment, iserting a new one and updating
(replacing) the current.
author: Kirill Sorokin |
Method Summary | |
boolean | accept(File file) Checks whether the given ile can be processed by this file handler.
Parameters: file - The file for which to run the compatibility check. | String | getCorrectComment(String text, int lineLength) Constructs the correct initial comment.
Parameters: text - The text of the initial comment. Parameters: lineLength - The desired line length for the comment. | String | getCurrentComment() Extracts the current initial comment from the cached file contents. | void | insertComment(String text, int lineLength) Inserts the initial comment to the cached file contents. | void | load(File file) Loads the file into file handler's cache. | void | save(File file) Saves the cached file contents to the given file on disk. | void | updateComment(String text, int lineLength) Updates the current initial comment in the cached file contents. |
accept | boolean accept(File file)(Code) | | Checks whether the given ile can be processed by this file handler.
Parameters: file - The file for which to run the compatibility check. true if the current file handler is capable of handling the file, false otherwise. |
getCorrectComment | String getCorrectComment(String text, int lineLength)(Code) | | Constructs the correct initial comment.
Parameters: text - The text of the initial comment. Parameters: lineLength - The desired line length for the comment. The correct, formatted, initial comment for this type of file. |
getCurrentComment | String getCurrentComment()(Code) | | Extracts the current initial comment from the cached file contents.
Teh current initial comment or null if the initial comment does not exist. throws: java.lang.IllegalStateException - if the file handler does not have anything loaded. |
insertComment | void insertComment(String text, int lineLength)(Code) | | Inserts the initial comment to the cached file contents. If an intiial
comment already exists in the file it is prepended by the new one.
Parameters: text - The text of the new initial comment. Parameters: lineLength - The desired line length for the comment. throws: java.lang.IllegalArgumentException - if the parameters validation fails. throws: java.lang.IllegalStateException - if the file handler does not have anything loaded. |
|
|