public class FindFile
extends java.lang.Object
Constructor and Description |
---|
FindFile(java.lang.String pathname)
Constructor for finding a file.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the InputStream.
|
static void |
copy(FindFile src,
java.io.File dest)
Copies the src file to the dest file.
|
static void |
copy(java.io.InputStream is,
java.io.File src,
java.io.File dest) |
void |
finalize() |
static FindFile |
find(java.util.ArrayList<java.lang.String> pathnames)
Provided an array of names, this returns the first one found.
|
static java.lang.String |
getAppData()
Returns the path to the App Data folder, and makes sure it exists.
|
java.io.InputStream |
getBufferedInputStream()
Returns the BufferedInputStream of the file.
|
java.io.File |
getFile()
Returns the java.io.File object for the file that was found.
|
java.lang.String |
getFileFound()
Returns the name of the file that was found including the path to where it was found.
|
java.io.InputStream |
getInputStream()
Returns the InputStream of the file.
|
java.util.Map<java.lang.String,java.lang.Object> |
getJSON()
Returns the contents of the file parsed as a JSON file as a Map<String,Object> type.
|
java.net.URL |
getURL()
Returns a URL to the found file.
|
static java.lang.String |
getUserDocumentsPath()
Returns the path to the users Documents location.
|
static java.lang.String[] |
getUserPath()
Returns an array of the user's paths.
|
static void |
setUserPath(java.lang.String path)
Sets the user's paths by parsing the "path" argument for semicolon as a separator.
|
java.lang.String |
toString() |
public FindFile(java.lang.String pathname) throws java.io.FileNotFoundException
pathname
- The path to the file found.java.io.FileNotFoundException
- When the file cannot be found.public static FindFile find(java.util.ArrayList<java.lang.String> pathnames) throws java.io.FileNotFoundException
pathnames
- An array of files to find.java.io.FileNotFoundException
- When none of the files are found.public java.io.File getFile()
public static java.lang.String getUserDocumentsPath()
public static java.lang.String getAppData()
public static java.lang.String[] getUserPath()
public static void setUserPath(java.lang.String path)
path
- A semicolon separated list of directories to use as the user's path.public java.lang.String getFileFound()
public java.io.InputStream getInputStream()
public java.io.InputStream getBufferedInputStream()
public java.net.URL getURL()
public static void copy(FindFile src, java.io.File dest)
src
- The source FindFile instancedest
- The dest filenamepublic static void copy(java.io.InputStream is, java.io.File src, java.io.File dest)
public void close()
public void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.util.Map<java.lang.String,java.lang.Object> getJSON()
public java.lang.String toString()
toString
in class java.lang.Object