- java.lang.Object
-
- jnr.posix.util.DefaultPOSIXHandler
-
- All Implemented Interfaces:
POSIXHandler
public class DefaultPOSIXHandler extends Object implements POSIXHandler
A POSIXHandler with reasonable default behavior.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jnr.posix.POSIXHandler
POSIXHandler.WARNING_ID
-
-
Constructor Summary
Constructors Constructor Description DefaultPOSIXHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiderror(jnr.constants.platform.Errno error, String extraData)voiderror(jnr.constants.platform.Errno error, String methodName, String extraData)FilegetCurrentWorkingDirectory()String[]getEnv()PrintStreamgetErrorStream()Get your runtime's current ErrorStreamInputStreamgetInputStream()PrintStreamgetOutputStream()intgetPID()Get your runtime's process ID.booleanisVerbose()voidunimplementedError(String methodName)Specify that posix method is unimplemented.voidwarn(POSIXHandler.WARNING_ID id, String message, Object... data)
-
-
-
Method Detail
-
error
public void error(jnr.constants.platform.Errno error, String extraData)- Specified by:
errorin interfacePOSIXHandler
-
error
public void error(jnr.constants.platform.Errno error, String methodName, String extraData)- Specified by:
errorin interfacePOSIXHandler
-
unimplementedError
public void unimplementedError(String methodName)
Description copied from interface:POSIXHandlerSpecify that posix method is unimplemented. In JRuby we generate an exception with this.- Specified by:
unimplementedErrorin interfacePOSIXHandler- Parameters:
methodName- the POSIX method that failed
-
warn
public void warn(POSIXHandler.WARNING_ID id, String message, Object... data)
- Specified by:
warnin interfacePOSIXHandler
-
isVerbose
public boolean isVerbose()
- Specified by:
isVerbosein interfacePOSIXHandler- Returns:
- should we provide verbose output about POSIX activities
-
getCurrentWorkingDirectory
public File getCurrentWorkingDirectory()
- Specified by:
getCurrentWorkingDirectoryin interfacePOSIXHandler- Returns:
- current working directory of your runtime.
-
getEnv
public String[] getEnv()
- Specified by:
getEnvin interfacePOSIXHandler- Returns:
- current set of environment variables of your runtime.
-
getInputStream
public InputStream getInputStream()
- Specified by:
getInputStreamin interfacePOSIXHandler- Returns:
- your runtime's current input stream
-
getOutputStream
public PrintStream getOutputStream()
- Specified by:
getOutputStreamin interfacePOSIXHandler- Returns:
- your runtime's current output stream
-
getPID
public int getPID()
Description copied from interface:POSIXHandlerGet your runtime's process ID. This is only intended for non-native POSIX support (e.g. environments where JNA cannot load or security restricted environments). In JRuby we found a number of packages which would rather have some identity for the runtime than nothing. Note: If you do not want this to work you impl can just callPOSIXHandler.unimplementedError(String).- Specified by:
getPIDin interfacePOSIXHandler- Returns:
- your runtime's process ID
-
getErrorStream
public PrintStream getErrorStream()
Description copied from interface:POSIXHandlerGet your runtime's current ErrorStream- Specified by:
getErrorStreamin interfacePOSIXHandler- Returns:
- your runtime's current error stream
-
-