Class Slices


  • public final class Slices
    extends Object
    • Field Detail

      • EMPTY_SLICE

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

      • ensureSize

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

        public static Slice allocate​(int capacity)
      • allocateDirect

        public static Slice allocateDirect​(int capacity)
      • copyOf

        public static Slice copyOf​(Slice slice)
      • copyOf

        public static Slice copyOf​(Slice slice,
                                   int offset,
                                   int length)
      • 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
      • wrappedBooleanArray

        public static Slice wrappedBooleanArray​(boolean... array)
        Creates a slice over the specified array.
      • wrappedBooleanArray

        public static Slice wrappedBooleanArray​(boolean[] 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
      • wrappedShortArray

        public static Slice wrappedShortArray​(short... array)
        Creates a slice over the specified array.
      • wrappedShortArray

        public static Slice wrappedShortArray​(short[] 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
      • wrappedIntArray

        public static Slice wrappedIntArray​(int... array)
        Creates a slice over the specified array.
      • wrappedIntArray

        public static Slice wrappedIntArray​(int[] 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
      • wrappedLongArray

        public static Slice wrappedLongArray​(long... array)
        Creates a slice over the specified array.
      • wrappedLongArray

        public static Slice wrappedLongArray​(long[] 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
      • wrappedFloatArray

        public static Slice wrappedFloatArray​(float... array)
        Creates a slice over the specified array.
      • wrappedFloatArray

        public static Slice wrappedFloatArray​(float[] 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
      • wrappedDoubleArray

        public static Slice wrappedDoubleArray​(double... array)
        Creates a slice over the specified array.
      • wrappedDoubleArray

        public static Slice wrappedDoubleArray​(double[] 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
      • utf8Slice

        public static Slice utf8Slice​(String string)