Class Slices

java.lang.Object
io.airlift.slice.Slices

public final class Slices extends Object
  • Field Details

    • EMPTY_SLICE

      public static final Slice EMPTY_SLICE
      A slice with size 0.
  • Method Details

    • ensureSize

      public static Slice ensureSize(Slice existingSlice, int minWritableBytes)
    • allocate

      public static Slice allocate(int capacity)
    • random

      public static Slice random(int capacity)
      Allocates a new slice containing random bytes from ThreadLocalRandom.
    • random

      public static Slice random(int capacity, Random random)
      Allocates a new slice containing random bytes.
    • wrappedHeapBuffer

      public static Slice wrappedHeapBuffer(ByteBuffer buffer)
    • wrappedBuffer

      public static Slice wrappedBuffer(byte... array)
      Creates a slice over the specified array.
    • wrappedBuffer

      public static Slice wrappedBuffer(byte[] array, int offset, int length)
      Creates a slice over the specified array range.
      Parameters:
      offset - the array position at which the slice begins
      length - the number of array positions to include in the slice
    • copiedBuffer

      public static Slice copiedBuffer(String string, Charset charset)
    • utf8Slice

      public static Slice utf8Slice(String string)