javanpst.utils
Class Files
- java.lang.Object
-
- javanpst.utils.Files
-
public class Files extends java.lang.ObjectA simple class for managing files. Basic functionality for reading, writing and adding contents to text files is provided.
-
-
Constructor Summary
Constructors Constructor and Description Files()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidaddToFile(java.lang.String fileName, java.lang.String content)Adds data to a file.static java.lang.StringfindSeparator(java.lang.String text)In CSV-based contents, checks whether "," or ";" was used as separatorstatic java.lang.StringreadFile(java.lang.String fileName)Reads a file and returns the contents on a single string.static voidwriteFile(java.lang.String fileName, java.lang.String content)Writes a String in a new file.
-
-
-
Method Detail
-
readFile
public static java.lang.String readFile(java.lang.String fileName)
Reads a file and returns the contents on a single string.- Parameters:
fileName- name of the file- Returns:
- A string with the contents of the file
-
writeFile
public static void writeFile(java.lang.String fileName, java.lang.String content)Writes a String in a new file. Note that this method will overwrite contents of the file if it was created previously.- Parameters:
fileName- name of the filecontent- text to be written
-
addToFile
public static void addToFile(java.lang.String fileName, java.lang.String content)Adds data to a file. New contents will be added to the end of the file, without overwriting previous contents- Parameters:
fileName- name of the filecontent- content to be added
-
findSeparator
public static java.lang.String findSeparator(java.lang.String text)
In CSV-based contents, checks whether "," or ";" was used as separator- Parameters:
text- text to scan- Returns:
- a string containing the separator used
-
-
DMelt 3.0 © DataMelt by jWork.ORG