public enum Platform extends 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 String |
defaultPrefs
Path to the preference file that ships with McIDAS-V.
|
private String |
newLine
Holds the platform's representation of a new line.
|
private String |
userBundles
Path to the bundles subdirectory within
userDirectory . |
private String |
userDirectory
Path to the user's "userpath" directory.
|
private 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.
|
String |
getDefaultPrefs()
Returns the path of the startup preferences included in the McIDAS-V
distribution.
|
String |
getNewLine()
Returns the platform's notion of a new line.
|
String |
getUserBundles()
Returns the path to the user's bundles directory.
|
String |
getUserDirectory()
Returns the path to the user's "userpath" directory.
|
String |
getUserFile(String filename)
Returns the path to a file in the user's "userpath" directory.
|
String |
getUserPrefs()
Returns the path of user's copy of the startup preferences.
|
void |
setAvailableMemory(String megabytes)
Deprecated.
There's not really a need for this method; the JVM can
tell us the amount of memory.
|
void |
setUserDirectory(String path)
Sets the path to the user's "userpath" directory explicitly.
|
String |
toString()
Returns a brief summary of the platform specific file locations.
|
static Platform |
valueOf(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 String userDirectory
private final String defaultPrefs
private final String userBundles
userDirectory
.private int availableMemory
public static Platform[] values()
for (Platform c : Platform.values()) System.out.println(c);
public static Platform valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic void setUserDirectory(String path) throws 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.IllegalArgumentException
- if path
is not a
directory, or if it not both readable and writable.public void setAvailableMemory(String megabytes)
megabytes
must be
greater than or equal to zero.megabytes
- Memory in megabytes.NullPointerException
- if megabytes
is null
.IllegalArgumentException
- if megabytes
is less than
zero or does not represent an integer.StartupManager.getArgs(boolean, boolean, java.lang.String[], java.util.Properties)
public String getUserDirectory()
public String getUserFile(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 String getUserBundles()
getUserDirectory()
.public int getAvailableMemory()
public String getUserPrefs()
public String getDefaultPrefs()
OptionMaster.normalizeUserDirectory()
public String getNewLine()