Package jnr.posix
Interface POSIXHandler
-
- All Known Implementing Classes:
DefaultPOSIXHandler
public interface POSIXHandler
The POSIXHandler class allows you do implement the runtime-specific behavior you need in such a way that it is insulated from the implementation of the POSIX library. Implementing each of the methods in this interface should give you are working POSIX implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
POSIXHandler.WARNING_ID
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
error(jnr.constants.platform.Errno error, java.lang.String extraData)
void
error(jnr.constants.platform.Errno error, java.lang.String methodName, java.lang.String extraData)
java.io.File
getCurrentWorkingDirectory()
java.lang.String[]
getEnv()
java.io.PrintStream
getErrorStream()
Get your runtime's current ErrorStreamjava.io.InputStream
getInputStream()
java.io.PrintStream
getOutputStream()
int
getPID()
Get your runtime's process ID.boolean
isVerbose()
void
unimplementedError(java.lang.String methodName)
Specify that posix method is unimplemented.void
warn(POSIXHandler.WARNING_ID id, java.lang.String message, java.lang.Object... data)
-
-
-
Method Detail
-
error
void error(jnr.constants.platform.Errno error, java.lang.String extraData)
-
error
void error(jnr.constants.platform.Errno error, java.lang.String methodName, java.lang.String extraData)
-
unimplementedError
void unimplementedError(java.lang.String methodName)
Specify that posix method is unimplemented. In JRuby we generate an exception with this.- Parameters:
methodName
- the POSIX method that failed
-
warn
void warn(POSIXHandler.WARNING_ID id, java.lang.String message, java.lang.Object... data)
-
isVerbose
boolean isVerbose()
- Returns:
- should we provide verbose output about POSIX activities
-
getCurrentWorkingDirectory
java.io.File getCurrentWorkingDirectory()
- Returns:
- current working directory of your runtime.
-
getEnv
java.lang.String[] getEnv()
- Returns:
- current set of environment variables of your runtime.
-
getInputStream
java.io.InputStream getInputStream()
- Returns:
- your runtime's current input stream
-
getOutputStream
java.io.PrintStream getOutputStream()
- Returns:
- your runtime's current output stream
-
getPID
int getPID()
Get 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 callunimplementedError(String)
.- Returns:
- your runtime's process ID
-
getErrorStream
java.io.PrintStream getErrorStream()
Get your runtime's current ErrorStream- Returns:
- your runtime's current error stream
-
-