Package io.airlift.slice
Class Slices
- java.lang.Object
-
- io.airlift.slice.Slices
-
public final class Slices extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static SliceEMPTY_SLICEA slice with size0.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Sliceallocate(int capacity)static SliceallocateDirect(int capacity)static SlicecopiedBuffer(String string, Charset charset)static SlicecopyOf(Slice slice)static SlicecopyOf(Slice slice, int offset, int length)static SliceensureSize(Slice existingSlice, int minWritableBytes)static SlicemapFileReadOnly(File file)static Sliceutf8Slice(String string)static SlicewrappedBooleanArray(boolean... array)Creates a slice over the specified array.static SlicewrappedBooleanArray(boolean[] array, int offset, int length)Creates a slice over the specified array range.static SlicewrappedBuffer(byte... array)Creates a slice over the specified array.static SlicewrappedBuffer(byte[] array, int offset, int length)Creates a slice over the specified array range.static SlicewrappedBuffer(ByteBuffer buffer)Wrap the visible portion of aByteBuffer.static SlicewrappedDoubleArray(double... array)Creates a slice over the specified array.static SlicewrappedDoubleArray(double[] array, int offset, int length)Creates a slice over the specified array range.static SlicewrappedFloatArray(float... array)Creates a slice over the specified array.static SlicewrappedFloatArray(float[] array, int offset, int length)Creates a slice over the specified array range.static SlicewrappedIntArray(int... array)Creates a slice over the specified array.static SlicewrappedIntArray(int[] array, int offset, int length)Creates a slice over the specified array range.static SlicewrappedLongArray(long... array)Creates a slice over the specified array.static SlicewrappedLongArray(long[] array, int offset, int length)Creates a slice over the specified array range.static SlicewrappedShortArray(short... array)Creates a slice over the specified array.static SlicewrappedShortArray(short[] array, int offset, int length)Creates a slice over the specified array range.
-
-
-
Field Detail
-
EMPTY_SLICE
public static final Slice EMPTY_SLICE
A slice with size0.
-
-
Method Detail
-
allocate
public static Slice allocate(int capacity)
-
allocateDirect
public static Slice allocateDirect(int capacity)
-
wrappedBuffer
public static Slice wrappedBuffer(ByteBuffer buffer)
Wrap the visible portion of aByteBuffer.
-
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 beginslength- 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 beginslength- 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 beginslength- 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 beginslength- 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 beginslength- 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 beginslength- 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 beginslength- the number of array positions to include in the slice
-
mapFileReadOnly
public static Slice mapFileReadOnly(File file) throws IOException
- Throws:
IOException
-
-