Package org.sqlite
Class SQLiteJDBCLoader
java.lang.Object
org.sqlite.SQLiteJDBCLoader
@AndroidSignatureIgnore(explanation="The loader is not used on Android")
public class SQLiteJDBCLoader
extends Object
Set the system properties, org.sqlite.lib.path, org.sqlite.lib.name, appropriately so that the
SQLite JDBC driver can find *.dll, *.dylib 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 SQLite JDBC driver.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThis class will load the version from resources during. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidcleanup()Deleted old native libraries e.g.private static booleancontentsEquals(InputStream in1, InputStream in2) private static booleanextractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder) Extracts and loads the specified library file to the target folderstatic intstatic intprivate static voidprivate static InputStreamgetResourceAsStream(String name) private static Filestatic Stringstatic booleanLoads SQLite native JDBC library.static booleanChecks if the SQLite JDBC driver is set to native mode.private static booleanloadNativeLibrary(String path, String name) Loads native library using the given path and name of the library.private static booleanprivate static voidLoads SQLite native library using given path and name of the library.(package private) static Stringmd5sum(InputStream input) Computes the MD5 value of the input stream.
-
Field Details
-
logger
-
LOCK_EXT
- See Also:
-
extracted
private static boolean extracted
-
-
Constructor Details
-
SQLiteJDBCLoader
public SQLiteJDBCLoader()
-
-
Method Details
-
initialize
Loads SQLite native JDBC library.- Returns:
- True if SQLite native library is successfully loaded; false otherwise.
- Throws:
Exception
-
getTempDir
-
cleanup
static void cleanup()Deleted old native libraries e.g. on Windows the DLL file is not removed on VM-Exit (bug #80) -
isNativeMode
Checks if the SQLite JDBC driver is set to native mode.- Returns:
- True if the SQLite JDBC driver is set to native Java mode; false otherwise.
- Throws:
Exception
-
md5sum
Computes the MD5 value of the input stream.- Parameters:
input- InputStream.- Returns:
- Encrypted string for the InputStream.
- Throws:
IOExceptionNoSuchAlgorithmException
-
contentsEquals
- Throws:
IOException
-
extractAndLoadLibraryFile
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder) throws FileException Extracts and loads the specified library file to the target folder- Parameters:
libFolderForCurrentOS- Library path.libraryFileName- Library name.targetFolder- Target folder.- Returns:
- Throws:
FileException
-
getResourceAsStream
-
loadNativeLibrary
Loads native library using the given path and name of the library.- Parameters:
path- Path of the native library.name- Name of the native library.- Returns:
- True for successfully loading; false otherwise.
-
loadNativeLibraryJdk
private static boolean loadNativeLibraryJdk() -
loadSQLiteNativeLibrary
Loads SQLite native library using given path and name of the library.- Throws:
Exception
-
getNativeLibraryFolderForTheCurrentOS
private static void getNativeLibraryFolderForTheCurrentOS() -
getMajorVersion
public static int getMajorVersion()- Returns:
- The major version of the SQLite JDBC driver.
-
getMinorVersion
public static int getMinorVersion()- Returns:
- The minor version of the SQLite JDBC driver.
-
getVersion
- Returns:
- The version of the SQLite JDBC driver.
-