Package org.locationtech.jtstest.util
Class FileUtil
- java.lang.Object
-
- org.locationtech.jtstest.util.FileUtil
-
public class FileUtil extends java.lang.ObjectUseful file utilities.- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXTENSION_SEPARATOR
-
Constructor Summary
Constructors Constructor Description FileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopyFile(java.io.File source, java.io.File destination)Copies the source file to the destination filename.static voiddeleteFiles(java.lang.String directoryName)Deletes the files in the directory, but does not remove the directory.static booleandirectoryExists(java.lang.String directoryName)Returns true if the given directory exists.static java.lang.Stringextension(java.lang.String path)static java.util.ListgetContents(java.lang.String textFileName)Returns a List of the String's in the text file, one per line.static java.lang.Stringname(java.lang.String path)static java.lang.StringreadText(java.io.File file)Gets the contents of a text file as a single Stringstatic java.lang.StringreadText(java.lang.String filename)static voidsetContents(java.lang.String textFileName, java.lang.String contents)Saves the String with the given filename
-
-
-
Field Detail
-
EXTENSION_SEPARATOR
public static final java.lang.String EXTENSION_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
name
public static java.lang.String name(java.lang.String path)
-
extension
public static java.lang.String extension(java.lang.String path)
-
deleteFiles
public static void deleteFiles(java.lang.String directoryName)
Deletes the files in the directory, but does not remove the directory.
-
directoryExists
public static boolean directoryExists(java.lang.String directoryName)
Returns true if the given directory exists.
-
getContents
public static java.util.List getContents(java.lang.String textFileName) throws java.io.FileNotFoundException, java.io.IOExceptionReturns a List of the String's in the text file, one per line.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
readText
public static java.lang.String readText(java.lang.String filename) throws java.io.IOException- Throws:
java.io.IOException
-
readText
public static java.lang.String readText(java.io.File file) throws java.io.IOExceptionGets the contents of a text file as a single String- Parameters:
file-- Returns:
- text file contents
- Throws:
java.io.IOException
-
setContents
public static void setContents(java.lang.String textFileName, java.lang.String contents) throws java.io.IOExceptionSaves the String with the given filename- Throws:
java.io.IOException
-
copyFile
public static void copyFile(java.io.File source, java.io.File destination) throws java.io.IOExceptionCopies the source file to the destination filename. Posted by Mark Thorntonon Usenet. - Throws:
java.io.IOException
-
-