Package org.locationtech.jtstest.util
Class FileUtil
- java.lang.Object
-
- org.locationtech.jtstest.util.FileUtil
-
public class FileUtil extends Object
Useful file utilities.- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXTENSION_SEPARATOR
-
Constructor Summary
Constructors Constructor Description FileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopyFile(File source, File destination)Copies the source file to the destination filename.static voiddeleteFiles(String directoryName)Deletes the files in the directory, but does not remove the directory.static booleandirectoryExists(String directoryName)Returns true if the given directory exists.static Stringextension(String path)static ListgetContents(String textFileName)Returns a List of the String's in the text file, one per line.static Stringname(String path)static StringreadText(File file)Gets the contents of a text file as a single Stringstatic StringreadText(String filename)static voidsetContents(String textFileName, String contents)Saves the String with the given filename
-
-
-
Field Detail
-
EXTENSION_SEPARATOR
public static final String EXTENSION_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
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:
FileNotFoundExceptionIOException
-
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 Thorntonon Usenet. - Throws:
IOException
-
-