public class SystemUtil extends Object
| Constructor and Description | 
|---|
| SystemUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static <T> T[] | concatenate(T[] array1,
           T... array2)Concatenates two arrays. | 
| static boolean | getBooleanSystemProperty(String key)Return true if the system property is set to "true". | 
| static boolean | getBooleanSystemProperty(String key,
                        boolean defaultValue)Return its boolean value if the system property is set. | 
| static int | getJreVersion()Returns the major JRE version. | 
| static @Nullable String | getReleaseValue(ProcessingEnvironment env)Returns the release value passed to the compiler or null if release was not passed. | 
| static @Nullable String | getToolsJar()Returns the pathname to the tools.jar file, or null if it does not exist. | 
| static String | join(CharSequence delimiter,
    @Nullable Iterable<?> values)Returns a new String composed of the string representations of the elements joined together
 with a copy of the specified delimiter. | 
| static <T> String | join(CharSequence delimiter,
    T[] objs)Returns a new String composed of the string representations of the elements joined together
 with a copy of the specified delimiter. | 
| static String | joinLines(@Nullable Iterable<? extends Object> v)Concatenate the string representations of the objects, placing the system-specific line
 separator between them. | 
| static <T> String | joinLines(T... a)Concatenate the string representations of the objects, placing the system-specific line
 separator between them. | 
| static List<String> | readFile(File argFile)Return a list of Strings, one per line of the file. | 
| static void | sleep(long millis)Like Thread.sleep, but does not throw any exceptions, so it is easier for clients to use. | 
public static List<String> readFile(File argFile) throws IOException
argFile - argument fileIOException - when reading the argFilepublic static <T> String join(CharSequence delimiter, T[] objs)
T - the type of array elementsdelimiter - the delimiter that separates each elementobjs - the values whose string representations to join togetherpublic static String join(CharSequence delimiter, @Nullable Iterable<?> values)
delimiter - the delimiter that separates each elementvalues - the values whose string representations to join together@SafeVarargs public static <T> String joinLines(T... a)
T - the type of array elementsa - array of values to concatenatepublic static String joinLines(@Nullable Iterable<? extends Object> v)
v - list of values to concatenatepublic static boolean getBooleanSystemProperty(String key)
key - system property to checkpublic static boolean getBooleanSystemProperty(String key, boolean defaultValue)
key - system property to checkdefaultValue - value to use if the property is not setkey or defaultValue if key is not setpublic static int getJreVersion()
This is different from the version passed to the compiler via --release; use getReleaseValue(ProcessingEnvironment) to get that version.
 
Extract the major version number from the "java.version" system property. Two possible formats are considered. Up to Java 8, from a version string like `1.8.whatever`, this method extracts 8. Since Java 9, from a version string like `11.0.1`, this method extracts 11.
public static @Nullable String getReleaseValue(ProcessingEnvironment env)
env - the ProcessingEnvironmentpublic static @Nullable String getToolsJar()
public static <T> T[] concatenate(T[] array1,
                                  T... array2)
T - the type of the array elementsarray1 - the first arrayarray2 - the second arraypublic static void sleep(long millis)
millis - the length of time to sleep in milliseconds