Package net.sf.gridarta.utils
Class IOUtils
- java.lang.Object
-
- net.sf.gridarta.utils.IOUtils
-
public class IOUtils extends java.lang.ObjectUtility-class for Gridarta's I/O.
-
-
Field Summary
Fields Modifier and Type Field Description static @NotNull java.lang.StringMAP_ENCODINGEncoding to use for maps and other data.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @NotNull java.io.FilefindPathFile(@NotNull java.lang.String name)Searches forfileon all paths specified by the environment variable "PATH".static @NotNull java.io.FilegetCanonicalFile(@NotNull java.io.File file)CallsFile.getCanonicalFile().static @NotNull java.lang.StringgetCanonicalPath(@NotNull java.io.File file)CallsFile.getCanonicalPath().static @NotNull java.io.FilegetFile(@NotNull java.io.File dir, @NotNull java.lang.String fileName)Returns aFileinstance for a resource that is a regular file on the file system.static @NotNull java.net.URLgetResource(@NotNull java.io.File dir, @NotNull java.lang.String fileName)Get theURLof a resource.
-
-
-
Field Detail
-
MAP_ENCODING
@NotNull public static final @NotNull java.lang.String MAP_ENCODING
Encoding to use for maps and other data. The encoding given here is used for reading and writing maps. You shouldn't change this only because you use an UTF-8 system or so, since the encoding used here MUST be compatible with the server and the client and the maps. The paragraph sign § is the critical character.- See Also:
- Constant Field Values
- Todo:
- once the mailing list decided on the § character, eventually replace by "us-ascii".
-
-
Method Detail
-
getResource
@NotNull public static @NotNull java.net.URL getResource(@NotNull @NotNull java.io.File dir, @NotNull @NotNull java.lang.String fileName) throws java.io.FileNotFoundExceptionGet theURLof a resource.- Parameters:
dir- the directory to read fromfileName- the file name of the file to read- Returns:
- the URL for reading from
fileName - Throws:
java.io.FileNotFoundException- in case all tries getting a URL to the file failed
-
getFile
@NotNull public static @NotNull java.io.File getFile(@NotNull @NotNull java.io.File dir, @NotNull @NotNull java.lang.String fileName) throws java.io.IOExceptionReturns aFileinstance for a resource that is a regular file on the file system. Returns the passed file if it is a regular file. Otherwise copies the passed file into a temporary regular file and returns the copy.- Parameters:
dir- directory to read fromfileName- file name of file to read- Returns:
- the file
- Throws:
java.io.IOException- if the file does not exist or cannot be copied to the file system
-
findPathFile
@NotNull public static @NotNull java.io.File findPathFile(@NotNull @NotNull java.lang.String name) throws java.io.IOExceptionSearches forfileon all paths specified by the environment variable "PATH".- Parameters:
name- the file to search for- Returns:
- the matching file
- Throws:
java.io.IOException- if the file was not found
-
getCanonicalPath
@NotNull public static @NotNull java.lang.String getCanonicalPath(@NotNull @NotNull java.io.File file)CallsFile.getCanonicalPath(). If this fails, returnsFile.getAbsolutePath().- Parameters:
file- the file- Returns:
- the absolute path
-
getCanonicalFile
@NotNull public static @NotNull java.io.File getCanonicalFile(@NotNull @NotNull java.io.File file)CallsFile.getCanonicalFile(). If this fails, returnsFile.getAbsoluteFile().- Parameters:
file- the file- Returns:
- the absolute path
-
-