java.lang.Object
de.zocher_regel.util.UtilFiles
Static routines for file processing.
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final intByte order mark. printWriter.write(BOM)(Package privat) static final FilenameFilterA filename filter that matches files like "... -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic FileChange the extension of a file.static StringChange the extension of a file.static voidcleanUp(File directory, FilenameFilter filenameFilter) Delete backups recursively.static voidcreateIfNecessary(File file) Create the file if it does not exist.static voiddeleteDuplicates(ListIterator listIter) Delete multiple occurrences from a List.static CharsetdetermineCharset(File file) Try to determine the charset by inspecting the BOM.static voidCall the external editor.static voidCall the external editor.static booleanCheck the existence of a file and log if it is missingstatic voidList the file in the logging pane.static StringoverreadBOM(String line) A file may beginn with Byte Order Marker FEFF.static PathsaveWithTimestamp(Path path) Save the file as a backup copy with an suffix.static StringstripExtension(String fileName) Strip the extension from filename
-
Felddetails
-
BOM
public static final int BOMByte order mark. printWriter.write(BOM)- Siehe auch:
-
saveFilter
A filename filter that matches files like "..._original"
-
-
Methodendetails
-
exists
Check the existence of a file and log if it is missing- Parameter:
file- to be checked- Gibt zurück:
- if the file exists
-
deleteDuplicates
Delete multiple occurrences from a List.- Parameter:
listIter- for iteration, must be able to delete a list element
-
changeExt
Change the extension of a file.- Parameter:
file- with (optional) extensionnewExt- new extension string, starting "*\." is ignored- Gibt zurück:
- file with new extension
-
changeExt
Change the extension of a file.- Parameter:
fileName- with (optional) extensionnewExt- new extension string, starting "*\." is ignored- Gibt zurück:
- file with new extension
-
cleanUp
Delete backups recursively.- Parameter:
directory- in which the backup files are to be deleted.filenameFilter- e.g. saveFilter
-
createIfNecessary
Create the file if it does not exist.- Parameter:
file- which may not exist- Löst aus:
UtilException- if the file could not be created
-
determineCharset
Try to determine the charset by inspecting the BOM.- Parameter:
file- whose starting characters are read- Gibt zurück:
- the Charset (default is ISO_8859_1)
- Löst aus:
IOException- when the file could not be read
-
edit
Call the external editor.- Parameter:
absolutePath- of the file to be edited- Löst aus:
UtilException- in case of any error.
-
edit
Call the external editor.- Parameter:
absolutePath- of the file to be editedtitle- in editor panel, not supported by all editors- Löst aus:
UtilException- if the runtime could not excecute the editor
-
list
List the file in the logging pane. Its charset is determined automatically.- Parameter:
file- to be listed
-
overreadBOM
A file may beginn with Byte Order Marker FEFF.- Parameter:
line- , null is allowed- Gibt zurück:
- line without BOM
-
saveWithTimestamp
Save the file as a backup copy with an suffix.- Parameter:
path- of the file to be saved- Gibt zurück:
- path of the saved file
- Löst aus:
IOException- if the file could not be saved.
-
stripExtension
Strip the extension from filename- Parameter:
fileName- (e.g. "xyz.abc")- Gibt zurück:
- fileName without extension ("abc")
-