Package oshi.driver.unix
Class Who
- java.lang.Object
-
- oshi.driver.unix.Who
-
@ThreadSafe public final class Who extends java.lang.Object
Utility to query logged in users.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.time.format.DateTimeFormatterWHO_DATE_FORMAT_LINUXprivate static java.time.format.DateTimeFormatterWHO_DATE_FORMAT_UNIXprivate static java.util.regex.PatternWHO_FORMAT_LINUXprivate static java.util.regex.PatternWHO_FORMAT_UNIX
-
Constructor Summary
Constructors Modifier Constructor Description privateWho()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static booleanmatchLinux(java.util.List<OSSession> whoList, java.lang.String s)Attempt to match Linux WHO format and add to the listprivate static booleanmatchUnix(java.util.List<OSSession> whoList, java.lang.String s)Attempt to match Unix WHO format and add to the liststatic java.util.List<OSSession>queryWho()Querywhoto get logged in users
-
-
-
Field Detail
-
WHO_FORMAT_LINUX
private static final java.util.regex.Pattern WHO_FORMAT_LINUX
-
WHO_DATE_FORMAT_LINUX
private static final java.time.format.DateTimeFormatter WHO_DATE_FORMAT_LINUX
-
WHO_FORMAT_UNIX
private static final java.util.regex.Pattern WHO_FORMAT_UNIX
-
WHO_DATE_FORMAT_UNIX
private static final java.time.format.DateTimeFormatter WHO_DATE_FORMAT_UNIX
-
-
Method Detail
-
queryWho
public static java.util.List<OSSession> queryWho()
Querywhoto get logged in users- Returns:
- A list of logged in user sessions
-
matchLinux
private static boolean matchLinux(java.util.List<OSSession> whoList, java.lang.String s)
Attempt to match Linux WHO format and add to the list- Parameters:
whoList- the list to add tos- the string to match- Returns:
- true if successful, false otherwise
-
matchUnix
private static boolean matchUnix(java.util.List<OSSession> whoList, java.lang.String s)
Attempt to match Unix WHO format and add to the list- Parameters:
whoList- the list to add tos- the string to match- Returns:
- true if successful, false otherwise
-
-