Class UnsafeSliceFactory

java.lang.Object
io.airlift.slice.UnsafeSliceFactory

public class UnsafeSliceFactory extends Object
A slice factory for creating unsafe slices
  • Method Details

    • getInstance

      public static UnsafeSliceFactory getInstance()
      Get a factory for creating "unsafe" slices that can reference arbitrary memory addresses. If there is a security manager, its checkPermission method is called with a ReflectPermission("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 base
      size - 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 base
      size - the size of the slice
      reference - the object reference
      Returns:
      the unsafe slice
    • newSlice

      public Slice newSlice(Object base, long address, int size)