public final class Slices extends Object
Modifier and Type | Field and Description |
---|---|
static Slice |
EMPTY_SLICE
A buffer whose capacity is
0 . |
Modifier and Type | Method and Description |
---|---|
static Slice |
allocate(int capacity) |
static Slice |
copiedBuffer(ByteBuffer source) |
static Slice |
copiedBuffer(ByteBuffer source,
int sourceOffset,
int length) |
static Slice |
copiedBuffer(String string,
Charset charset) |
static String |
decodeString(ByteBuffer src,
Charset charset) |
static ByteBuffer |
encodeString(CharBuffer src,
Charset charset) |
static Slice |
ensureSize(Slice existingSlice,
int minWritableBytes) |
static Slice |
readLengthPrefixedBytes(SliceInput sliceInput) |
static int |
swapInt(int value)
Toggles the endianness of the specified 32-bit integer.
|
static long |
swapLong(long value)
Toggles the endianness of the specified 64-bit long integer.
|
static short |
swapShort(short value)
Toggles the endianness of the specified 16-bit short integer.
|
static Slice |
wrappedBuffer(byte[] array) |
static void |
writeLengthPrefixedBytes(SliceOutput sliceOutput,
Slice value) |
public static final Slice EMPTY_SLICE
0
.public static Slice readLengthPrefixedBytes(SliceInput sliceInput)
public static void writeLengthPrefixedBytes(SliceOutput sliceOutput, Slice value)
public static Slice allocate(int capacity)
public static Slice wrappedBuffer(byte[] array)
public static Slice copiedBuffer(ByteBuffer source, int sourceOffset, int length)
public static Slice copiedBuffer(ByteBuffer source)
public static ByteBuffer encodeString(CharBuffer src, Charset charset)
public static String decodeString(ByteBuffer src, Charset charset)
public static short swapShort(short value)
public static int swapInt(int value)
public static long swapLong(long value)
Copyright © 2011–2022. All rights reserved.