public class ProcessesUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
executeCommand(String... command) |
static int |
executeCommandAndGetCode(String... command) |
static String |
getCustomDateFormat() |
static Locale |
getCustomLocale() |
static String |
parseUnixLongTimeToFullDate(String longFormatDate)
Parse Unix long date format(ex: Fri Jun 10 04:35:36 2016) to format
MM/dd/yyyy HH:mm:ss
|
static String |
parseWindowsDateTimeToFullDate(String dateTime)
Parse Window DateTime format to time format (MM/dd/yyyy hh:mm:ss)
|
static String |
parseWindowsDateTimeToSimpleTime(String dateTime)
Parse Window DateTime format to time format (hh:mm:ss).
|
static void |
setCustomDateFormat(String dateFormat)
Custom date format to be used when parsing date string in "ps" output
NOTE: We assume 5 space separated fields for date, where we pass the last 4 to the parser, e.g. |
static void |
setCustomLocale(Locale customLocale)
Sets a custom locale if the defaults won't parse your ps output
|
public static int executeCommandAndGetCode(String... command)
public static String parseWindowsDateTimeToSimpleTime(String dateTime)
dateTime - original datetime formatpublic static String parseWindowsDateTimeToFullDate(String dateTime)
dateTime - original datetime formatpublic static String parseUnixLongTimeToFullDate(String longFormatDate) throws ParseException
longFormatDate - original datetime formatParseExceptionpublic static String getCustomDateFormat()
public static void setCustomDateFormat(String dateFormat)
søn 23 okt 08:30:00 2016 we would send 23 okt 08:30:00 2016
to the parser, so a pattern dd MMM HH:mm:ss yyyy would work.dateFormat - the custom date format string to usepublic static Locale getCustomLocale()
public static void setCustomLocale(Locale customLocale)
customLocale - the Locale object to useCopyright © 2017. All rights reserved.