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

org.mk300.marshal.common.TheUnsafe Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package org.mk300.marshal.common;

import java.lang.reflect.Field;

import sun.misc.Unsafe;

@SuppressWarnings({"restriction"})
public class TheUnsafe {
	public final static Unsafe unsafe;
	public final static long byteArrayBaseOffset;
	
	static {
		try {
			Field field = Unsafe.class.getDeclaredField("theUnsafe");
			field.setAccessible(true);
			unsafe = (Unsafe) field.get(null);
			
			byteArrayBaseOffset = unsafe.arrayBaseOffset(byte[].class);
			
		} catch (Exception e) {
			throw new Error("NG unsafe", e);
		}
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy