public class KafkaBufferUtils extends Object
| 构造器和说明 |
|---|
KafkaBufferUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static long |
crc32(byte[] bytes)
Compute the CRC32 of the byte array
|
static long |
crc32(byte[] bytes,
int offset,
int size)
Compute the CRC32 of the segment of the byte array given by the specificed size and offset
|
static Thread |
newThread(String name,
Runnable runnable,
Boolean daemon)
Create a new thread
|
static byte[] |
readBytes(ByteBuffer buffer) |
static byte[] |
readCompactBytes(io.netty.buffer.ByteBuf buffer) |
static String |
readCompactString(io.netty.buffer.ByteBuf buffer) |
static List<RawTaggedField> |
readRawTaggedFields(io.netty.buffer.ByteBuf buffer) |
static String |
readString(ByteBuffer buffer)
read string
|
static long |
readUnsignedInt(ByteBuffer buffer,
int index)
Read an unsigned integer from the given position without modifying the buffers
position
|
static int |
readUnsignedIntLE(byte[] buffer,
int offset)
Read an unsigned integer stored in little-endian format from a byte array
at a given offset.
|
static int |
readUnsignedIntLE(InputStream in)
Read an unsigned integer stored in little-endian format from the
InputStream. |
static long |
readUnsignedLongLE(byte[] buffer,
int offset) |
static int |
readUnsignedVarint(io.netty.buffer.ByteBuf buffer) |
static int |
readUnsignedVarint(ByteBuffer buffer)
Read an integer stored in variable-length format using unsigned decoding from
Google Protocol Buffers.
|
static byte[] |
readVarBytes(ByteBuffer buffer) |
static int |
readVarint(io.netty.buffer.ByteBuf buffer) |
static int |
readVarint(ByteBuffer buffer) |
static long |
readVarlong(ByteBuffer buffer) |
static byte[] |
toArray(ByteBuffer buffer)
Read the given byte buffer into a byte array
|
static byte[] |
toArray(ByteBuffer buffer,
int offset,
int size)
Read a byte array from the given offset and size in the buffer
|
static void |
writeBytes(byte[] value,
io.netty.buffer.ByteBuf buffer) |
static void |
writeUnsignedInt(ByteBuffer buffer,
int index,
long value)
Write the given long value as a 4 byte unsigned integer.
|
static void |
writeUnsignedIntLE(byte[] buffer,
int offset,
int value)
Write an unsigned integer in little-endian format to a byte array
at a given offset.
|
static void |
writeUnsignedIntLE(OutputStream out,
int value)
Write an unsigned integer in little-endian format to the
OutputStream. |
static void |
writeUnsignedLongLE(byte[] buffer,
int offset,
long value) |
static void |
writeVarBytes(byte[] value,
io.netty.buffer.ByteBuf buffer) |
static void |
writeVarint(int value,
io.netty.buffer.ByteBuf buffer) |
static void |
writeVarint(int value,
ByteBuffer buffer) |
static void |
writeVarlong(long value,
io.netty.buffer.ByteBuf buffer) |
static void |
writeVarlong(long value,
ByteBuffer buffer) |
public static void writeUnsignedInt(ByteBuffer buffer, int index, long value)
buffer - The buffer to write toindex - The position in the buffer at which to begin writingvalue - The value to writepublic static long readUnsignedInt(ByteBuffer buffer, int index)
buffer - the buffer to read fromindex - the index from which to read the integerpublic static int readUnsignedVarint(ByteBuffer buffer)
buffer - The buffer to read fromIllegalArgumentException - if variable-length value does not terminate after 5 bytes have been readpublic static int readUnsignedVarint(io.netty.buffer.ByteBuf buffer)
public static long crc32(byte[] bytes)
bytes - The array to compute the checksum forpublic static long crc32(byte[] bytes,
int offset,
int size)
bytes - The bytes to checksumoffset - the offset at which to begin checksummingsize - the number of bytes to checksumpublic static String readString(ByteBuffer buffer)
buffer - public static void writeUnsignedIntLE(byte[] buffer,
int offset,
int value)
buffer - The byte array to write tooffset - The position in buffer to write tovalue - The value to writepublic static void writeUnsignedIntLE(OutputStream out, int value) throws IOException
OutputStream.out - The stream to write tovalue - The value to writeIOExceptionpublic static int readUnsignedIntLE(InputStream in) throws IOException
InputStream.in - The stream to read fromIOExceptionpublic static int readUnsignedIntLE(byte[] buffer,
int offset)
buffer - The byte array to read fromoffset - The position in buffer to read frompublic static void writeUnsignedLongLE(byte[] buffer,
int offset,
long value)
public static long readUnsignedLongLE(byte[] buffer,
int offset)
public static Thread newThread(String name, Runnable runnable, Boolean daemon)
name - The name of the threadrunnable - The work for the thread to dodaemon - Should the thread block JVM shutdown?public static byte[] toArray(ByteBuffer buffer)
public static byte[] toArray(ByteBuffer buffer, int offset, int size)
public static byte[] readBytes(ByteBuffer buffer)
public static byte[] readVarBytes(ByteBuffer buffer)
public static byte[] readCompactBytes(io.netty.buffer.ByteBuf buffer)
public static String readCompactString(io.netty.buffer.ByteBuf buffer)
public static void writeVarlong(long value,
io.netty.buffer.ByteBuf buffer)
public static void writeVarlong(long value,
ByteBuffer buffer)
public static long readVarlong(ByteBuffer buffer)
public static void writeVarint(int value,
io.netty.buffer.ByteBuf buffer)
public static void writeVarint(int value,
ByteBuffer buffer)
public static int readVarint(ByteBuffer buffer)
public static int readVarint(io.netty.buffer.ByteBuf buffer)
public static void writeBytes(byte[] value,
io.netty.buffer.ByteBuf buffer)
public static void writeVarBytes(byte[] value,
io.netty.buffer.ByteBuf buffer)
public static List<RawTaggedField> readRawTaggedFields(io.netty.buffer.ByteBuf buffer)
Copyright © 2020 Joyqueue Community. All rights reserved.