public enum Platform extends java.lang.Enum<Platform>
Currently McIDAS-V distinguishes between "Unix-like" and
"Windows"; these can be accessed using Platform.UNIXLIKE
or Platform.WINDOWS
.
Enum Constant and Description |
---|
UNIXLIKE
Instance of unix-specific platform information.
|
WINDOWS
Instance of windows-specific platform information.
|
Modifier and Type | Field and Description |
---|---|
private int |
availableMemory
Total amount of memory avilable in megabytes
|
private java.lang.String |
defaultPrefs
Path to the preference file that ships with McIDAS-V.
|
private java.lang.String |
newLine
Holds the platform's representation of a new line.
|
private java.lang.String |
userBundles
Path to the bundles subdirectory within
userDirectory . |
private java.lang.String |
userDirectory
Path to the user's "userpath" directory.
|
private java.lang.String |
userPrefs
The path to the user's copy of the startup preferences.
|
Modifier and Type | Method and Description |
---|---|
int |
getAvailableMemory()
Returns the amount of available memory in megabytes.
|
java.lang.String |
getDefaultPrefs()
Returns the path of the startup preferences included in the McIDAS-V
distribution.
|
java.lang.String |
getNewLine()
Returns the platform's notion of a new line.
|
java.lang.String |
getUserBundles()
Returns the path to the user's bundles directory.
|
java.lang.String |
getUserDirectory()
Returns the path to the user's "userpath" directory.
|
java.lang.String |
getUserFile(java.lang.String filename)
Returns the path to a file in the user's "userpath" directory.
|
java.lang.String |
getUserPrefs()
Returns the path of user's copy of the startup preferences.
|
void |
setAvailableMemory(java.lang.String megabytes)
Deprecated.
There's not really a need for this method; the JVM can
tell us the amount of memory.
|
void |
setUserDirectory(java.lang.String path)
Sets the path to the user's "userpath" directory explicitly.
|
java.lang.String |
toString()
Returns a brief summary of the platform specific file locations.
|
static Platform |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Platform[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
private java.lang.String userDirectory
private java.lang.String userPrefs
private final java.lang.String defaultPrefs
private final java.lang.String newLine
private final java.lang.String userBundles
userDirectory
.private int availableMemory
public static Platform[] values()
for (Platform c : Platform.values()) System.out.println(c);
public static Platform valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic void setUserDirectory(java.lang.String path) throws java.lang.IllegalArgumentException
path
- New path. Cannot be null
, but does not have to exist
prior to running this method. Be aware that this method will attempt to
create path
if it does not already exist.java.lang.IllegalArgumentException
- if path
is not a
directory, or if it not both readable and writable.public void setAvailableMemory(java.lang.String megabytes)
megabytes
must be
greater than or equal to zero.megabytes
- Memory in megabytes.java.lang.NullPointerException
- if megabytes
is null
.java.lang.IllegalArgumentException
- if megabytes
is less than
zero or does not represent an integer.StartupManager.getArgs(boolean, boolean, java.lang.String[], java.util.Properties)
public java.lang.String getUserDirectory()
public java.lang.String getUserFile(java.lang.String filename)
filename
- Filename within the userpath
. Cannot be
null
, but does not need to be a filename that already exists
within the userpath
.public java.lang.String getUserBundles()
getUserDirectory()
.public int getAvailableMemory()
public java.lang.String getUserPrefs()
public java.lang.String getDefaultPrefs()
OptionMaster.normalizeUserDirectory()
public java.lang.String getNewLine()
public java.lang.String toString()
toString
in class java.lang.Enum<Platform>
[Platform@HASHCODE: defaultPrefs=..., userDirectory=...,
userPrefs=...]