Package org.fusesource.jansi.internal
Class JansiLoader
java.lang.Object
org.fusesource.jansi.internal.JansiLoader
Set the system properties, org.jansi.lib.path, org.jansi.lib.name,
appropriately so that jansi 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 Jansi.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
cleanup()
Deleted old native libraries e.g.private static String
contentsEquals
(InputStream in1, InputStream in2) private static boolean
extractAndLoadLibraryFile
(String libFolderForCurrentOS, String libraryFileName, String targetFolder) Extracts and loads the specified library file to the target folderstatic int
static int
static String
static String
private static File
static String
private static boolean
hasResource
(String path) static boolean
Loads Jansi native library.private static void
Loads jansi library using given path and name of the library.private static boolean
loadNativeLibrary
(File libPath) Loads native library using the given path and name of the library.private static String
private static int
readNBytes
(InputStream in, byte[] b)
-
Field Details
-
loaded
private static boolean loaded -
nativeLibraryPath
-
nativeLibrarySourceUrl
-
-
Constructor Details
-
JansiLoader
public JansiLoader()
-
-
Method Details
-
initialize
public static boolean initialize()Loads Jansi native library.- Returns:
- True if jansi 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
-
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.
-
loadJansiNativeLibrary
Loads jansi library using given path and name of the library.- Throws:
Exception
-
hasResource
-
getMajorVersion
public static int getMajorVersion()- Returns:
- The major version of the jansi library.
-
getMinorVersion
public static int getMinorVersion()- Returns:
- The minor version of the jansi library.
-
getVersion
- Returns:
- The version of the jansi library.
-