Package org.astrogrid.samp
Class Platform
java.lang.Object
org.astrogrid.samp.Platform
Platform-dependent features required by the SAMP implementation.
- Since:
- 14 Jul 2008
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of an environment variable.protected abstract String[]
getGetenvArgs
(String varname) Returns an array of words to pass toRuntime.exec(java.lang.String[])
in order to read an environment variable name.abstract File
Returns SAMP's definition of the "home" directory.static Platform
Returns aPlatform
instance for the current system.protected abstract String[]
getPrivateReadArgs
(File file) Returns an array of words to pass toRuntime.exec(java.lang.String[])
in order to set permissions on a given file so that it cannot be read by anyone other than its owner.void
setPrivateRead
(File file) Sets file permissions on a given file so that it cannot be read by anyone other than its owner.
-
Constructor Details
-
Platform
Constructor.- Parameters:
name
- platform name
-
-
Method Details
-
getHomeDirectory
Returns SAMP's definition of the "home" directory.- Returns:
- directory containing SAMP lockfile
-
getEnv
Returns the value of an environment variable. If it can't be done, null is returned.- Parameters:
varname
- name of environment variable- Returns:
- value of environment variable
-
setPrivateRead
Sets file permissions on a given file so that it cannot be read by anyone other than its owner.- Parameters:
file
- file whose permissions are to be altered- Throws:
IOException
- if permissions cannot be changed
-
getGetenvArgs
Returns an array of words to pass toRuntime.exec(java.lang.String[])
in order to read an environment variable name. If null is returned, no way is known to do this with a system command.- Parameters:
varname
- environment variable name to read- Returns:
- exec args
-
getPrivateReadArgs
Returns an array of words to pass toRuntime.exec(java.lang.String[])
in order to set permissions on a given file so that it cannot be read by anyone other than its owner. If null is returned, no way is known to do this with a system command.- Parameters:
file
- file to alter- Returns:
- exec args
- Throws:
IOException
-
getPlatform
Returns aPlatform
instance for the current system.- Returns:
- platform instance
-