|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectapollo.util.IOUtil
public class IOUtil
I can't believe these basic IO utilities didn't already exist somewhere, but I didn't see them. Methods to read a text file, write a text file, and copy a text file. readFile and writeFile throw IOExceptions. copyFile returns true or false depending on whether it succeeded in copying the file. 4/2006: Moved getStreamFromUrl here (from GAMEAdapter) so that ChadoXMLAdapter can use it too.
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
logger
|
| Constructor Summary | |
|---|---|
IOUtil()
|
|
| Method Summary | |
|---|---|
static boolean |
canWriteToDirectory(java.lang.String path)
Check whether specified directory is writeable |
static boolean |
copyFile(java.lang.String from,
java.lang.String to)
|
static void |
errorDialog(java.lang.String msg)
Put up a dialog box if we're not running in batch mode or in headless mode. |
static java.lang.String |
expandSquiggle(java.lang.String name)
|
static java.lang.String |
findFile(java.lang.String name)
Look in various sensible places for the file with a given name (which may be a full path, a relative path, or just a filename). |
static java.lang.String |
findFile(java.lang.String name,
boolean canCreate)
|
static java.lang.String |
getRootDir()
Apollo root directory is defined by system property APOLLO_ROOT; if that's not defined, try . |
static java.io.InputStream |
getStreamFromUrl(java.net.URL url,
java.lang.String badUrlMessage)
|
static java.io.InputStream |
getStreamFromUrl(java.net.URL url,
java.lang.String badUrlMessage,
java.lang.String notFoundMessage)
Makes InputStream from URL - throws DataAdapterException with badUrlMessage if URL is not found, or with notFoundMessage if stream is empty (i.e., requested region is not found). |
static void |
informationDialog(java.lang.String msg)
Display an information dialog box (if not running in headless mode or command line mode and outputs information to logger). |
static boolean |
isMac()
|
static boolean |
isUnix()
|
static boolean |
isWebStart()
Try to determine whether we're running as a webstart application |
static boolean |
isWindows()
|
static java.lang.String |
readFile(java.lang.String fileName)
Any IO errors will be thrown back to the caller to catch |
static java.lang.String |
stripControlChars(java.lang.String s)
|
static void |
writeFile(java.lang.String fileName,
java.lang.String text)
Any IO errors will be thrown back to the caller to catch |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger logger
| Constructor Detail |
|---|
public IOUtil()
| Method Detail |
|---|
public static java.lang.String getRootDir()
public static java.lang.String readFile(java.lang.String fileName)
throws java.io.IOException
java.io.IOException
public static void writeFile(java.lang.String fileName,
java.lang.String text)
throws java.io.IOException
java.io.IOException
public static boolean copyFile(java.lang.String from,
java.lang.String to)
public static java.lang.String stripControlChars(java.lang.String s)
public static java.lang.String findFile(java.lang.String name)
public static java.lang.String findFile(java.lang.String name,
boolean canCreate)
public static java.lang.String expandSquiggle(java.lang.String name)
public static boolean canWriteToDirectory(java.lang.String path)
public static boolean isWindows()
public static boolean isMac()
public static boolean isUnix()
public static boolean isWebStart()
public static void errorDialog(java.lang.String msg)
public static void informationDialog(java.lang.String msg)
msg - - Message to be displayed
public static java.io.InputStream getStreamFromUrl(java.net.URL url,
java.lang.String badUrlMessage,
java.lang.String notFoundMessage)
throws ApolloAdapterException
ApolloAdapterException
public static java.io.InputStream getStreamFromUrl(java.net.URL url,
java.lang.String badUrlMessage)
throws ApolloAdapterException
ApolloAdapterException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||