Package org.jline.nativ
Class JLineNativeLoader
java.lang.Object
org.jline.nativ.JLineNativeLoader
Set the system properties, library.jline.path, library.jline.name,
appropriately so that jline can find *.dll, *.jnilib and
*.so files, according to the current OS (win, linux, mac).
The library files are automatically extracted from this project's package (JAR).
usage: call initialize() before using jline.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidcleanup()Deleted old native libraries e.g.private static StringcontentsEquals(InputStream in1, InputStream in2) private static voidcopy(InputStream in, OutputStream out) private static booleanextractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder) Extracts and loads the specified library file to the target folderstatic intstatic intstatic Stringstatic Stringprivate static Filestatic Stringprivate static booleanhasResource(String path) static booleanLoads jline native library.private static Stringprivate static voidLoads jline library using given path and name of the library.private static booleanloadNativeLibrary(File libPath) Loads native library using the given path and name of the library.private static Stringprivate static intreadNBytes(InputStream in, byte[] b)
-
Field Details
-
loaded
private static boolean loaded -
nativeLibraryPath
-
nativeLibrarySourceUrl
-
-
Constructor Details
-
JLineNativeLoader
public JLineNativeLoader()
-
-
Method Details
-
initialize
public static boolean initialize()Loads jline native library.- Returns:
- True if jline native library is successfully loaded; false otherwise.
-
getNativeLibraryPath
-
getNativeLibrarySourceUrl
-
getTempDir
-
cleanup
static void cleanup()Deleted old native libraries e.g. on Windows the DLL file is not removed on VM-Exit (bug #80) -
readNBytes
- Throws:
IOException
-
contentsEquals
- Throws:
IOException
-
extractAndLoadLibraryFile
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder) Extracts and loads the specified library file to the target folder- Parameters:
libFolderForCurrentOS- Library path.libraryFileName- Library name.targetFolder- Target folder.- Returns:
-
randomUUID
-
copy
- Throws:
IOException
-
loadNativeLibrary
Loads native library using the given path and name of the library.- Parameters:
libPath- Path of the native library.- Returns:
- True for successfully loading; false otherwise.
-
loadJLineNativeLibrary
Loads jline library using given path and name of the library.- Throws:
Exception
-
hasResource
-
getMajorVersion
public static int getMajorVersion()- Returns:
- The major version of the jline library.
-
getMinorVersion
public static int getMinorVersion()- Returns:
- The minor version of the jline library.
-
getVersion
- Returns:
- The version of the jline library.
-
join
-