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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
String[]
getEnv()
Get your runtime's current ErrorStreamint
getPID()
Get your runtime's process ID.boolean
void
unimplementedError
(String methodName) Specify that posix method is unimplemented.void
warn
(POSIXHandler.WARNING_ID id, String message, Object... data)
-
Method Details
-
error
-
error
-
unimplementedError
Specify that posix method is unimplemented. In JRuby we generate an exception with this.- Parameters:
methodName
- the POSIX method that failed
-
warn
-
isVerbose
boolean isVerbose()- Returns:
- should we provide verbose output about POSIX activities
-
getCurrentWorkingDirectory
File getCurrentWorkingDirectory()- Returns:
- current working directory of your runtime.
-
getEnv
String[] getEnv()- Returns:
- current set of environment variables of your runtime.
-
getInputStream
InputStream getInputStream()- Returns:
- your runtime's current input stream
-
getOutputStream
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
PrintStream getErrorStream()Get your runtime's current ErrorStream- Returns:
- your runtime's current error stream
-