public class IOUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static @NotNull java.lang.String |
MAP_ENCODING
Encoding to use for maps and other data.
|
Modifier and Type | Method and Description |
---|---|
static @NotNull java.io.File |
findPathFile(@NotNull java.lang.String name)
Searches for
file on all paths specified by the environment
variable "PATH". |
static @NotNull java.io.File |
getCanonicalFile(@NotNull java.io.File file)
Calls
File.getCanonicalFile() . |
static @NotNull java.lang.String |
getCanonicalPath(@NotNull java.io.File file)
Calls
File.getCanonicalPath() . |
static @NotNull java.io.File |
getFile(@NotNull java.io.File dir,
@NotNull java.lang.String fileName)
Returns a
File instance for a resource that is a regular file on
the file system. |
static @NotNull java.net.URL |
getResource(@NotNull java.io.File dir,
@NotNull java.lang.String fileName)
Get the
URL of a resource. |
@NotNull public static final @NotNull java.lang.String MAP_ENCODING
@NotNull public static @NotNull java.net.URL getResource(@NotNull @NotNull java.io.File dir, @NotNull @NotNull java.lang.String fileName) throws java.io.FileNotFoundException
URL
of a resource.dir
- the directory to read fromfileName
- the file name of the file to readfileName
java.io.FileNotFoundException
- in case all tries getting a URL to the file
failed@NotNull public static @NotNull java.io.File getFile(@NotNull @NotNull java.io.File dir, @NotNull @NotNull java.lang.String fileName) throws java.io.IOException
File
instance 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.dir
- directory to read fromfileName
- file name of file to readjava.io.IOException
- if the file does not exist or cannot be copied to the
file system@NotNull public static @NotNull java.io.File findPathFile(@NotNull @NotNull java.lang.String name) throws java.io.IOException
file
on all paths specified by the environment
variable "PATH".name
- the file to search forjava.io.IOException
- if the file was not found@NotNull public static @NotNull java.lang.String getCanonicalPath(@NotNull @NotNull java.io.File file)
File.getCanonicalPath()
. If this fails, returns File.getAbsolutePath()
.file
- the file@NotNull public static @NotNull java.io.File getCanonicalFile(@NotNull @NotNull java.io.File file)
File.getCanonicalFile()
. If this fails, returns File.getAbsoluteFile()
.file
- the file