Class FileUtil

java.lang.Object
org.locationtech.jtstest.util.FileUtil

public class FileUtil extends Object
Useful file utilities.
Version:
1.7
  • Field Details

  • Constructor Details

    • FileUtil

      public FileUtil()
  • Method Details

    • name

      public static String name(String path)
    • extension

      public static String extension(String path)
    • deleteFiles

      public static void deleteFiles(String directoryName)
      Deletes the files in the directory, but does not remove the directory.
    • directoryExists

      public static boolean directoryExists(String directoryName)
      Returns true if the given directory exists.
    • getContents

      public static List getContents(String textFileName) throws FileNotFoundException, IOException
      Returns a List of the String's in the text file, one per line.
      Throws:
      FileNotFoundException
      IOException
    • readText

      public static String readText(String filename) throws IOException
      Throws:
      IOException
    • readText

      public static String readText(File file) throws IOException
      Gets the contents of a text file as a single String
      Parameters:
      file -
      Returns:
      text file contents
      Throws:
      IOException
    • setContents

      public static void setContents(String textFileName, String contents) throws IOException
      Saves the String with the given filename
      Throws:
      IOException
    • copyFile

      public static void copyFile(File source, File destination) throws IOException
      Copies the source file to the destination filename. Posted by Mark Thornton invalid input: '<'mthorn@cix.compulink.co.uk> on Usenet.
      Throws:
      IOException