Class StringSerializer
java.lang.Object
io.protostuff.StringSerializer
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic intcomputeUTF8Size(CharSequence str, int index, int len) Computes the size of the utf8 string beginning at the specifiedindexwith the specifiedlength.static charhighSurrogate(int codePoint) static charlowSurrogate(int codePoint) static LinkedBufferwriteAscii(CharSequence str, WriteSession session, LinkedBuffer lb) Writes the ascii bytes from the string into theLinkedBuffer.static LinkedBufferwriteDouble(double value, WriteSession session, LinkedBuffer lb) Writes the stringified double into theLinkedBuffer.static LinkedBufferwriteFloat(float value, WriteSession session, LinkedBuffer lb) Writes the stringified float into theLinkedBuffer.static LinkedBufferwriteInt(int value, WriteSession session, LinkedBuffer lb) Writes the stringified int into theLinkedBuffer.static LinkedBufferwriteLong(long value, WriteSession session, LinkedBuffer lb) Writes the stringified long into theLinkedBuffer.static LinkedBufferwriteUTF8(CharSequence str, WriteSession session, LinkedBuffer lb) Writes the utf8-encoded bytes from the string into theLinkedBuffer.static LinkedBufferwriteUTF8FixedDelimited(CharSequence str, boolean littleEndian, WriteSession session, LinkedBuffer lb) The length of the utf8 bytes is written first before the string - which is fixed 2-bytes.static LinkedBufferwriteUTF8FixedDelimited(CharSequence str, WriteSession session, LinkedBuffer lb) The length of the utf8 bytes is written first (big endian) before the string - which is fixed 2-bytes.static LinkedBufferwriteUTF8VarDelimited(CharSequence str, WriteSession session, LinkedBuffer lb) The length of the utf8 bytes is written first before the string - which is a variable int (1 to 5 bytes).
-
Method Details
-
writeInt
Writes the stringified int into theLinkedBuffer. -
writeLong
Writes the stringified long into theLinkedBuffer. -
writeFloat
Writes the stringified float into theLinkedBuffer. TODO - skip string conversion and write directly to buffer -
writeDouble
Writes the stringified double into theLinkedBuffer. TODO - skip string conversion and write directly to buffer -
computeUTF8Size
Computes the size of the utf8 string beginning at the specifiedindexwith the specifiedlength. -
writeUTF8
Writes the utf8-encoded bytes from the string into theLinkedBuffer. -
writeAscii
Writes the ascii bytes from the string into theLinkedBuffer. It is the responsibility of the caller to know in advance that the string is 100% ascii. E.g if you convert a double/float to a string, you are sure it only contains ascii chars. -
writeUTF8FixedDelimited
public static LinkedBuffer writeUTF8FixedDelimited(CharSequence str, WriteSession session, LinkedBuffer lb) The length of the utf8 bytes is written first (big endian) before the string - which is fixed 2-bytes. Same behavior asDataOutputStream.writeUTF(String). -
writeUTF8FixedDelimited
public static LinkedBuffer writeUTF8FixedDelimited(CharSequence str, boolean littleEndian, WriteSession session, LinkedBuffer lb) The length of the utf8 bytes is written first before the string - which is fixed 2-bytes. -
writeUTF8VarDelimited
public static LinkedBuffer writeUTF8VarDelimited(CharSequence str, WriteSession session, LinkedBuffer lb) The length of the utf8 bytes is written first before the string - which is a variable int (1 to 5 bytes). -
highSurrogate
public static char highSurrogate(int codePoint) -
lowSurrogate
public static char lowSurrogate(int codePoint)
-