Package edu.wpi.first.util
Class ClassPreloader
java.lang.Object
edu.wpi.first.util.ClassPreloader
public final class ClassPreloader extends Object
Loads classes by name. Can be used at any time, but is most commonly used to preload classes at
the start of the program to avoid unpredictable delays due to lazy classloading later in program
execution.
-
Method Summary
Modifier and Type Method Description static int
preload(BufferedReader reader)
Loads classes from a buffered reader.static int
preload(InputStream stream)
Loads classes from an input stream.static int
preload(Iterable<String> classNames)
Loads classes from an iterable.static int
preload(String... classNames)
Loads classes.static int
preloadFile(String filename)
Loads classes from a file.
-
Method Details
-
preload
Loads classes from an iterable.- Parameters:
classNames
- iterable of class names- Returns:
- Number of classes loaded.
-
preload
Loads classes.- Parameters:
classNames
- array of class names- Returns:
- Number of classes loaded.
-
preload
Loads classes from a buffered reader. The input is expected to be one class name per line. Blank lines and lines starting with a semicolon are ignored.- Parameters:
reader
- Reader- Returns:
- Number of classes loaded.
-
preload
Loads classes from an input stream. The input is expected to be one class name per line. Blank lines and lines starting with a semicolon are ignored.- Parameters:
stream
- input stream- Returns:
- Number of classes loaded.
-
preloadFile
Loads classes from a file. The input is expected to be one class name per line. Blank lines and lines starting with a semicolon are ignored.- Parameters:
filename
- filename- Returns:
- Number of classes loaded.
-