Top Fields Constructors Methods
io.rsocket.util

public Class CharByteBufUtil

extends Object
Class Inheritance
Static Imports
io.netty.util.internal.StringUtil.isSurrogate

Field Summary

Modifier and TypeField and Description
private static final byte

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static char[]
checkCharSequenceBounds(char[] seq, int start, int end)

public static char[]
readUtf8(ByteBuf byteBuf, int length)

private static char[]
safeTrim(char[] ca, int len)

private static int
utf8ByteCount(final char[] seq, int start, int end)

public static int
utf8Bytes(final char[] seq)

Returns the exact bytes length of UTF8 character sequence.

public static int
utf8Bytes(final char[] seq, int start, int end)

This method is producing the exact length according to writeUtf8(ByteBuf, char[], int, int).

private static int
utf8BytesNonAscii(final char[] seq, final int start, final int end)

public static int
writeUtf8(ByteBuf buf, char[] seq)

Encode a char[] in UTF-8 and write it into ByteBuf.

public static int

Returns:

actual number of bytes written
writeUtf8
(ByteBuf buf, char[] seq, int start, int end)

Equivalent to writeUtf8(buf, seq.subSequence(start, end), reserveBytes) but avoids subsequence object allocation if possible.

pack-priv static int
writeUtf8(ByteBuf buffer, int writerIndex, char[] seq, int start, int end)

private static int
writeUtf8Surrogate(ByteBuf buffer, int writerIndex, char c, char c2)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

WRITE_UTF_UNKNOWNback to summary
private static final byte WRITE_UTF_UNKNOWN

Constructor Detail

CharByteBufUtilback to summary
private CharByteBufUtil()

Method Detail

checkCharSequenceBoundsback to summary
private static char[] checkCharSequenceBounds(char[] seq, int start, int end)
readUtf8back to summary
public static char[] readUtf8(ByteBuf byteBuf, int length)
safeTrimback to summary
private static char[] safeTrim(char[] ca, int len)
utf8ByteCountback to summary
private static int utf8ByteCount(final char[] seq, int start, int end)
utf8Bytesback to summary
public static int utf8Bytes(final char[] seq)

Returns the exact bytes length of UTF8 character sequence.

This method is producing the exact length according to writeUtf8(ByteBuf, char[]).

utf8Bytesback to summary
public static int utf8Bytes(final char[] seq, int start, int end)

This method is producing the exact length according to writeUtf8(ByteBuf, char[], int, int).

utf8BytesNonAsciiback to summary
private static int utf8BytesNonAscii(final char[] seq, final int start, final int end)
writeUtf8back to summary
public static int writeUtf8(ByteBuf buf, char[] seq)

Encode a char[] in UTF-8 and write it into ByteBuf.

This method returns the actual number of bytes written.

writeUtf8back to summary
public static int writeUtf8(ByteBuf buf, char[] seq, int start, int end)

Equivalent to writeUtf8(buf, seq.subSequence(start, end), reserveBytes) but avoids subsequence object allocation if possible.

Returns:int

actual number of bytes written

writeUtf8back to summary
pack-priv static int writeUtf8(ByteBuf buffer, int writerIndex, char[] seq, int start, int end)
writeUtf8Surrogateback to summary
private static int writeUtf8Surrogate(ByteBuf buffer, int writerIndex, char c, char c2)