All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.coley.llzip.util.UnsafeUtil Maven / Gradle / Ivy

package software.coley.llzip.util;

import sun.misc.Unsafe;

import java.lang.reflect.Field;

/**
 * Unsafe accessor.
 *
 * @author XDark
 */
class UnsafeUtil {
	private static final Unsafe UNSAFE;

	/**
	 * @return Unsafe instance.
	 */
	public static Unsafe get() {
		return UNSAFE;
	}

	static {
		try {
			Field f = Unsafe.class.getDeclaredField("theUnsafe");
			f.setAccessible(true);
			UNSAFE = (Unsafe) f.get(null);
		} catch (NoSuchFieldException | IllegalAccessException ex) {
			throw new ExceptionInInitializerError(ex);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy