Package org.xerial.snappy
Class SnappyLoader
java.lang.Object
org.xerial.snappy.SnappyLoader
Internal only - Do not use this class. This class loads a native
library of snappy-java (snappyjava.dll, libsnappy.so, etc.) according to the
user platform (os.name and os.arch). The natively compiled
libraries bundled to snappy-java contain the codes of the original snappy and
JNI programs to access Snappy.
In default, no configuration is required to use snappy-java, but you can load
your own native library created by 'make native' command.
This SnappyLoader searches for native libraries (snappyjava.dll,
libsnappy.so, etc.) in the following order:
- If system property org.xerial.snappy.use.systemlib is set to true, lookup folders specified by java.lib.path system property (This is the default path that JVM searches for native libraries)
- (System property: org.xerial.snappy.lib.path)/(System property: org.xerial.lib.name)
- One of the libraries embedded in snappy-java-(version).jar extracted into (System property: java.io.tmpdir). If org.xerial.snappy.tempdir is set, use this folder instead of java.io.tmpdir.
If you do not want to use folder java.io.tmpdir, set the System property org.xerial.snappy.tempdir. For example, to use /tmp/leo as a temporary folder to copy native libraries, use -D option of JVM:
java -Dorg.xerial.snappy.tempdir="/tmp/leo" ...
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
private static boolean
contentsEquals
(InputStream in1, InputStream in2) private static File
extractLibraryFile
(String libFolderForCurrentOS, String libraryFileName, String targetFolder) Extract the specified library file to the target folder(package private) static File
private static InputStream
getResourceAsInputStream
(String resourcePath) static String
Get the snappy-java version by reading pom.properties embedded in jar.private static boolean
hasResource
(String path) (package private) static BitShuffleNative
private static void
Load a native library of snappy-java(package private) static SnappyApi
private static void
load system properties when configuration file of the nameSNAPPY_SYSTEM_PROPERTIES_FILE
is found(package private) static void
setSnappyApi
(SnappyApi apiImpl) Set the `snappyApi` instance.
-
Field Details
-
SNAPPY_SYSTEM_PROPERTIES_FILE
- See Also:
-
KEY_SNAPPY_LIB_PATH
- See Also:
-
KEY_SNAPPY_LIB_NAME
- See Also:
-
KEY_SNAPPY_PUREJAVA
- See Also:
-
KEY_SNAPPY_TEMPDIR
- See Also:
-
KEY_SNAPPY_USE_SYSTEMLIB
- See Also:
-
KEY_SNAPPY_DISABLE_BUNDLED_LIBS
- See Also:
-
isLoaded
private static boolean isLoaded -
snappyApi
-
bitshuffleApi
-
nativeLibFile
-
-
Constructor Details
-
SnappyLoader
public SnappyLoader()
-
-
Method Details
-
cleanUpExtractedNativeLib
static void cleanUpExtractedNativeLib() -
setSnappyApi
Set the `snappyApi` instance.- Parameters:
apiImpl
-
-
loadSnappySystemProperties
private static void loadSnappySystemProperties()load system properties when configuration file of the nameSNAPPY_SYSTEM_PROPERTIES_FILE
is found -
loadSnappyApi
-
loadBitShuffleApi
-
loadNativeLibrary
private static void loadNativeLibrary()Load a native library of snappy-java -
contentsEquals
- Throws:
IOException
-
extractLibraryFile
private static File extractLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder) Extract the specified library file to the target folder- Parameters:
libFolderForCurrentOS
-libraryFileName
-targetFolder
-- Returns:
-
findNativeLibrary
-
hasResource
-
getVersion
Get the snappy-java version by reading pom.properties embedded in jar. This version data is used as a suffix of a dll file extracted from the jar.- Returns:
- the version string
-
getResourceAsInputStream
- Throws:
IOException
-