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 String
EXTENSION_SEPARATOR
-
Constructor Summary
Constructors Constructor Description FileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
copyFile(File source, File destination)
Copies the source file to the destination filename.static void
deleteFiles(String directoryName)
Deletes the files in the directory, but does not remove the directory.static boolean
directoryExists(String directoryName)
Returns true if the given directory exists.static String
extension(String path)
static List
getContents(String textFileName)
Returns a List of the String's in the text file, one per line.static String
name(String path)
static String
readText(File file)
Gets the contents of a text file as a single Stringstatic String
readText(String filename)
static void
setContents(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:
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 Thorntonon Usenet. - Throws:
IOException
-
-