Package org.astrogrid.samp
Class Platform
- java.lang.Object
-
- org.astrogrid.samp.Platform
-
public abstract class Platform extends java.lang.ObjectPlatform-dependent features required by the SAMP implementation.- Since:
- 14 Jul 2008
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPlatform(java.lang.String name)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetEnv(java.lang.String varname)Returns the value of an environment variable.protected abstract java.lang.String[]getGetenvArgs(java.lang.String varname)Returns an array of words to pass toRuntime.exec(java.lang.String[])in order to read an environment variable name.abstract java.io.FilegetHomeDirectory()Returns SAMP's definition of the "home" directory.static PlatformgetPlatform()Returns aPlatforminstance for the current system.protected abstract java.lang.String[]getPrivateReadArgs(java.io.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.voidsetPrivateRead(java.io.File file)Sets file permissions on a given file so that it cannot be read by anyone other than its owner.
-
-
-
Method Detail
-
getHomeDirectory
public abstract java.io.File getHomeDirectory()
Returns SAMP's definition of the "home" directory.- Returns:
- directory containing SAMP lockfile
-
getEnv
public java.lang.String getEnv(java.lang.String varname)
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
public void setPrivateRead(java.io.File file) throws java.io.IOExceptionSets 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:
java.io.IOException- if permissions cannot be changed
-
getGetenvArgs
protected abstract java.lang.String[] getGetenvArgs(java.lang.String varname)
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
protected abstract java.lang.String[] getPrivateReadArgs(java.io.File file) throws java.io.IOExceptionReturns 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:
java.io.IOException
-
getPlatform
public static Platform getPlatform()
Returns aPlatforminstance for the current system.- Returns:
- platform instance
-
-