Top Description Fields Constructors Methods
org.fusesource.jansi.internal

public Class JansiLoader

extends Object
Class Inheritance
Imports
java.io.File, .FileInputStream, .FileOutputStream, .FilenameFilter, .IOException, .InputStream, java.net.URL, java.nio.file.Files, .StandardCopyOption, java.util.Arrays, .LinkedList, .List, .Properties, .Random, org.fusesource.jansi.AnsiConsole

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

Modifier and TypeField and Description
private static boolean
private static String
private static String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
cleanup()

Deleted old native libraries e.g. on Windows the DLL file is not removed on VM-Exit (bug #80)

private static String
private static boolean
extractAndLoadLibraryFile(String
Library path.
libFolderForCurrentOS
,
String
Library name.
libraryFileName
,
String
Target folder.
targetFolder
)

Extracts and loads the specified library file to the target folder

public static int

Returns:

The major version of the jansi library.
getMajorVersion
()

public static int

Returns:

The minor version of the jansi library.
getMinorVersion
()

public static String
public static String
private static File
public static String

Returns:

The version of the jansi library.
getVersion
()

private static boolean
public static synchronized boolean

Returns:

True if jansi native library is successfully loaded; false otherwise.
initialize
()

Loads Jansi native library.

private static void
loadJansiNativeLibrary()

Loads jansi library using given path and name of the library.

private static boolean

Returns:

True for successfully loading; false otherwise.
loadNativeLibrary
(File
Path of the native library.
libPath
)

Loads native library using the given path and name of the library.

private static String
private static int
readNBytes(InputStream in, byte[] b)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loadedback to summary
private static boolean loaded
nativeLibraryPathback to summary
private static String nativeLibraryPath
nativeLibrarySourceUrlback to summary
private static String nativeLibrarySourceUrl

Constructor Detail

JansiLoaderback to summary
public JansiLoader()

Method Detail

cleanupback to summary
pack-priv static void cleanup()

Deleted old native libraries e.g. on Windows the DLL file is not removed on VM-Exit (bug #80)

contentsEqualsback to summary
private static String contentsEquals(InputStream in1, InputStream in2) throws IOException
extractAndLoadLibraryFileback to summary
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder)

Extracts and loads the specified library file to the target folder

Parameters
libFolderForCurrentOS:String

Library path.

libraryFileName:String

Library name.

targetFolder:String

Target folder.

getMajorVersionback to summary
public static int getMajorVersion()
Returns:int

The major version of the jansi library.

getMinorVersionback to summary
public static int getMinorVersion()
Returns:int

The minor version of the jansi library.

getNativeLibraryPathback to summary
public static String getNativeLibraryPath()
getNativeLibrarySourceUrlback to summary
public static String getNativeLibrarySourceUrl()
getTempDirback to summary
private static File getTempDir()
getVersionback to summary
public static String getVersion()
Returns:String

The version of the jansi library.

hasResourceback to summary
private static boolean hasResource(String path)
initializeback to summary
public static synchronized boolean initialize()

Loads Jansi native library.

Returns:boolean

True if jansi native library is successfully loaded; false otherwise.

loadJansiNativeLibraryback to summary
private static void loadJansiNativeLibrary() throws Exception

Loads jansi library using given path and name of the library.

loadNativeLibraryback to summary
private static boolean loadNativeLibrary(File libPath)

Loads native library using the given path and name of the library.

Parameters
libPath:File

Path of the native library.

Returns:boolean

True for successfully loading; false otherwise.

randomUUIDback to summary
private static String randomUUID()
readNBytesback to summary
private static int readNBytes(InputStream in, byte[] b) throws IOException