Documentation of 'javanpst.utils.Files' Java class
Files
javanpst.utils

Class Files



  • public class Files
    extends java.lang.Object
    A 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 void addToFile(java.lang.String fileName, java.lang.String content)
      Adds data to a file.
      static java.lang.String findSeparator(java.lang.String text)
      In CSV-based contents, checks whether "," or ";" was used as separator
      static java.lang.String readFile(java.lang.String fileName)
      Reads a file and returns the contents on a single string.
      static void writeFile(java.lang.String fileName, java.lang.String content)
      Writes a String in a new file.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Files

        public Files()
    • 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 file
        content - 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 file
        content - 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

You see the box below because you did not login.