Package io.airlift.slice
Class UnsafeSliceFactory
- java.lang.Object
-
- io.airlift.slice.UnsafeSliceFactory
-
public class UnsafeSliceFactory extends Object
A slice factory for creating unsafe slices
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UnsafeSliceFactorygetInstance()Get a factory for creating "unsafe" slices that can reference arbitrary memory addresses.SlicenewSlice(long address, int size)Creates a slice for directly a raw memory address.SlicenewSlice(long address, int size, Object reference)Creates a slice for directly a raw memory address.SlicenewSlice(Object base, long address, int size)
-
-
-
Method Detail
-
getInstance
public static UnsafeSliceFactory getInstance()
Get a factory for creating "unsafe" slices that can reference arbitrary memory addresses. If there is a security manager, itscheckPermissionmethod is called with aReflectPermission("suppressAccessChecks")permission.- Returns:
- an unsafe slice factory
-
newSlice
public Slice newSlice(long address, int size)
Creates a slice for directly a raw memory address. This is inherently unsafe as it may be used to access arbitrary memory.- Parameters:
address- the raw memory address basesize- the size of the slice- Returns:
- the unsafe slice
-
newSlice
public Slice newSlice(long address, int size, Object reference)
Creates a slice for directly a raw memory address. This is inherently unsafe as it may be used to access arbitrary memory. The slice will hold the specified object reference to prevent the garbage collector from freeing it while it is in use by the slice.- Parameters:
address- the raw memory address basesize- the size of the slicereference- the object reference- Returns:
- the unsafe slice
-
-