|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ach.file.ParamUtil
ParamUtil.java
Copyright (c) 1997-2005 Helge Hackbarth, All Rights Reserved.
Static utilities to retrieve commandline parameters, paths/codebase.
THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY
DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
Field Summary | |
static java.net.URL |
codeBase
codebase of an applet determined at runtime using retrieveCodeBase |
static java.net.URL |
documentBase
|
static java.lang.String |
progPath
path to main class file (if run as standalone application) determined at runtime using retrieveProgramPath |
Constructor Summary | |
ParamUtil()
|
Method Summary | |
static java.lang.String |
getFilename(java.awt.Frame parent,
java.io.FilenameFilter filenameFilter,
java.lang.String nameMasks,
java.lang.String initialPath,
int mode)
Get filename using standard FileDialog filenameFilter, masks for filenames and mode (open/save) can be controlled |
static byte[] |
getResourceAsByteArray(java.lang.String resName,
java.lang.Class relativeToClass)
Try to open a resource as stream using Java 1.1 and 1.0 methods path is determined from path of related class if running as applet, ParamUtil.retrieveCodeBase should be run before |
static java.util.Hashtable |
loadProps(java.lang.Object parent)
|
static int |
netFileToLocalFile(java.net.URL context,
java.lang.String name,
boolean useGauge)
Copies a file specified by URL to a local file |
static byte[] |
netFileToRam(java.net.URL context,
boolean useGauge)
Copies a file specified by URL to a byte array |
static void |
retrieveCodeBase(java.applet.Applet parent)
Retrieve the codebase of an applet (not running standalone). |
static java.lang.String[] |
retrieveParameters(java.lang.String paramStr)
Separate a parameter string into an array containing single parameters. |
static java.lang.String[] |
retrieveParameters(java.lang.String paramStr,
char separator)
Separate a parameter string into an array containing single parameters. |
static void |
retrieveProgramPath(java.lang.Object mainClass,
java.lang.String overridePath)
For standalone applications we may be interested in the programīs path as the current dir may be changed by file dialogs later. |
static void |
saveProps(java.util.Hashtable props,
java.lang.Object parent)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.lang.String progPath
retrieveProgramPath(java.lang.Object, java.lang.String)
public static java.net.URL codeBase
retrieveCodeBase(java.applet.Applet)
public static java.net.URL documentBase
Constructor Detail |
public ParamUtil()
Method Detail |
public static java.lang.String[] retrieveParameters(java.lang.String paramStr, char separator)
paramStr
- String containing parametersseparator
- Character used as separatorpublic static java.lang.String[] retrieveParameters(java.lang.String paramStr)
paramStr
- String containing parameters (seperatet by blanks)public static void retrieveProgramPath(java.lang.Object mainClass, java.lang.String overridePath)
public static void retrieveCodeBase(java.applet.Applet parent)
parent
- the main applet that is running (not standalone)public static byte[] getResourceAsByteArray(java.lang.String resName, java.lang.Class relativeToClass) throws java.io.IOException
public static java.lang.String getFilename(java.awt.Frame parent, java.io.FilenameFilter filenameFilter, java.lang.String nameMasks, java.lang.String initialPath, int mode) throws java.io.IOException
filenameFilter
- to filter filenames (see java.io.FilenameFilter) or nullnameMasks
- used to mask filenames (e.g. "*.gif, *.jpg")initialPath
- used to set initial pathmode
- FileDialog.OPEN or FileDialog.SAVEpublic static int netFileToLocalFile(java.net.URL context, java.lang.String name, boolean useGauge) throws java.net.MalformedURLException, java.io.IOException
context
- contains the URL of the file to readcontext
- contains the URL of the file to readuseGauge
- to enable or disable a gaugepublic static byte[] netFileToRam(java.net.URL context, boolean useGauge) throws java.net.MalformedURLException, java.io.IOException
context
- contains the URL of the file to readuseGauge
- to enable or disable a gaugepublic static java.util.Hashtable loadProps(java.lang.Object parent)
public static void saveProps(java.util.Hashtable props, java.lang.Object parent)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |