Home All Groups
lz4-java / net / jpountz / xxhash / XXHashFactory.html /
net.jpountz.xxhash

Class XXHashFactory

  • java.lang.Object
    • net.jpountz.xxhash.XXHashFactory
    • Method Detail

      • nativeInstance

        public static XXHashFactory nativeInstance()
        Returns a XXHashFactory that returns XXHash32 instances that are native bindings to the original C API.

        Please note that this instance has some traps you should be aware of:

        1. Upon loading this instance, files will be written to the temporary directory of the system. Although these files are supposed to be deleted when the JVM exits, they might remain on systems that don't support removal of files being used such as Windows.
        2. The instance can only be loaded once per JVM. This can be a problem if your application uses multiple class loaders (such as most servlet containers): this instance will only be available to the children of the class loader which has loaded it. As a consequence, it is advised to either not use this instance in webapps or to put this library in the lib directory of your servlet container so that it is loaded by the system class loader.
        Returns:
        a XXHashFactory that returns XXHash32 instances that are native bindings to the original C API.
      • fastestJavaInstance

        public static XXHashFactory fastestJavaInstance()
        Returns the fastest available XXHashFactory instance which does not rely on JNI bindings. It first tries to load the unsafe instance, and then the safe Java instance if the JVM doesn't have a working Unsafe.
        Returns:
        the fastest available XXHashFactory instance which does not rely on JNI bindings.
      • main

        public static void main(java.lang.String[] args)
        Prints the fastest instance.
        Parameters:
        args - no argument required
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class  java.lang.Object