public class IOLib
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getExtension(java.io.File f)
Returns the extension for a file or null if there is none
|
static java.lang.String |
getExtension(java.lang.String filename)
Returns the extension for a file or null if there is none
|
static Graph |
getGraphFile(java.awt.Component c)
Present a file chooser dialog for loading a Graph or Tree data set.
|
static Table |
getTableFile(java.awt.Component c)
Present a file chooser dialog for loading a Table data set.
|
static boolean |
isGZipFile(java.lang.String file)
Indicates if the given file ends with a file extension of
".gz" or ".Z", indicating a GZip file.
|
static boolean |
isUrlString(java.lang.String s)
Indicates if a given String is a URL string.
|
static boolean |
isZipFile(java.lang.String file)
Indicates if the given file ends with a file extension of
".zip", indicating a Zip file.
|
static ByteArrayList |
readAsBytes(java.io.InputStream is)
Reads an input stream into a list of byte values.
|
static java.lang.String |
readAsString(java.io.InputStream is)
Reads an input stream into a single String result.
|
static java.lang.String |
readAsString(java.lang.String location)
Reads data pulled from the given location string into a single String
result.
|
static java.io.InputStream |
streamFromString(java.lang.String location)
Get an input string corresponding to the given location string.
|
static java.net.URL |
urlFromString(java.lang.String location)
From a string description, attempt to generate a URL object.
|
static java.net.URL |
urlFromString(java.lang.String location,
java.lang.Class referrer,
boolean includeFileSystem)
From a string description, attempt to generate a URL object.
|
public static boolean isUrlString(java.lang.String s)
s - the string to checkpublic static java.net.URL urlFromString(java.lang.String location)
location - the location string for which to get a URL objectpublic static java.net.URL urlFromString(java.lang.String location,
java.lang.Class referrer,
boolean includeFileSystem)
includeFileSystem
flag is true, a file on the local filesystem
(resulting in a file:// URL). The String will be checked in that order
in an attempt to resolve it to a valid URL.location - the location string for which to get a URL objectreferrer - the class to check for classpath resource items, the
location string will be resolved against the package/folder containing
this classincludeFileSystem - indicates if the file system should be
included in the search to resolve the location Stringpublic static java.io.InputStream streamFromString(java.lang.String location)
throws java.io.IOException
location - the location stringjava.io.IOException - if an input/ouput error occurspublic static java.lang.String getExtension(java.io.File f)
f - the input filepublic static boolean isGZipFile(java.lang.String file)
file - a String of the filename or URL of the filepublic static boolean isZipFile(java.lang.String file)
file - a String of the filename or URL of the filepublic static java.lang.String getExtension(java.lang.String filename)
filename - the input filenamepublic static ByteArrayList readAsBytes(java.io.InputStream is) throws java.io.IOException
is - the input stream to readjava.io.IOException - if an input/ouput error occurspublic static java.lang.String readAsString(java.io.InputStream is)
throws java.io.IOException
is - the input stream to readjava.io.IOException - if an input/ouput error occurspublic static java.lang.String readAsString(java.lang.String location)
throws java.io.IOException
streamFromString(String) method, then read the input stream
into a String result.location - the location Stringjava.io.IOException - if an input/ouput error occursstreamFromString(String)public static Table getTableFile(java.awt.Component c)
c - user interface component from which the request is being madepublic static Graph getGraphFile(java.awt.Component c)
c - user interface component from which the request is being made