Package io.protostuff
Class StreamedStringSerializer
- java.lang.Object
-
- io.protostuff.StreamedStringSerializer
-
public final class StreamedStringSerializer extends java.lang.ObjectUTF-8 String serialization
-
-
Constructor Summary
Constructors Modifier Constructor Description privateStreamedStringSerializer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidflushAndReset(LinkedBuffer node, WriteSession session)static LinkedBufferwriteAscii(java.lang.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(java.lang.CharSequence str, WriteSession session, LinkedBuffer lb)Writes the utf8-encoded bytes from the string into theLinkedBuffer.static LinkedBufferwriteUTF8FixedDelimited(java.lang.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(java.lang.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.private static LinkedBufferwriteUTF8OneByteDelimited(java.lang.CharSequence str, int index, int len, WriteSession session, LinkedBuffer lb)private static LinkedBufferwriteUTF8VarDelimited(java.lang.CharSequence str, int index, int len, int lowerLimit, int expectedSize, WriteSession session, LinkedBuffer lb)static LinkedBufferwriteUTF8VarDelimited(java.lang.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 Detail
-
writeInt
public static LinkedBuffer writeInt(int value, WriteSession session, LinkedBuffer lb) throws java.io.IOException
Writes the stringified int into theLinkedBuffer.- Throws:
java.io.IOException
-
writeLong
public static LinkedBuffer writeLong(long value, WriteSession session, LinkedBuffer lb) throws java.io.IOException
Writes the stringified long into theLinkedBuffer.- Throws:
java.io.IOException
-
writeFloat
public static LinkedBuffer writeFloat(float value, WriteSession session, LinkedBuffer lb) throws java.io.IOException
Writes the stringified float into theLinkedBuffer. TODO - skip string conversion and write directly to buffer- Throws:
java.io.IOException
-
writeDouble
public static LinkedBuffer writeDouble(double value, WriteSession session, LinkedBuffer lb) throws java.io.IOException
Writes the stringified double into theLinkedBuffer. TODO - skip string conversion and write directly to buffer- Throws:
java.io.IOException
-
writeUTF8
public static LinkedBuffer writeUTF8(java.lang.CharSequence str, WriteSession session, LinkedBuffer lb) throws java.io.IOException
Writes the utf8-encoded bytes from the string into theLinkedBuffer.- Throws:
java.io.IOException
-
writeAscii
public static LinkedBuffer writeAscii(java.lang.CharSequence str, WriteSession session, LinkedBuffer lb) throws java.io.IOException
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.- Throws:
java.io.IOException
-
flushAndReset
private static void flushAndReset(LinkedBuffer node, WriteSession session) throws java.io.IOException
- Throws:
java.io.IOException
-
writeUTF8FixedDelimited
public static LinkedBuffer writeUTF8FixedDelimited(java.lang.CharSequence str, WriteSession session, LinkedBuffer lb) throws java.io.IOException
The length of the utf8 bytes is written first (big endian) before the string - which is fixed 2-bytes. Same behavior asDataOutputStream.writeUTF(String).- Throws:
java.io.IOException
-
writeUTF8FixedDelimited
public static LinkedBuffer writeUTF8FixedDelimited(java.lang.CharSequence str, boolean littleEndian, WriteSession session, LinkedBuffer lb) throws java.io.IOException
The length of the utf8 bytes is written first before the string - which is fixed 2-bytes.- Throws:
java.io.IOException
-
writeUTF8OneByteDelimited
private static LinkedBuffer writeUTF8OneByteDelimited(java.lang.CharSequence str, int index, int len, WriteSession session, LinkedBuffer lb) throws java.io.IOException
- Throws:
java.io.IOException
-
writeUTF8VarDelimited
private static LinkedBuffer writeUTF8VarDelimited(java.lang.CharSequence str, int index, int len, int lowerLimit, int expectedSize, WriteSession session, LinkedBuffer lb) throws java.io.IOException
- Throws:
java.io.IOException
-
writeUTF8VarDelimited
public static LinkedBuffer writeUTF8VarDelimited(java.lang.CharSequence str, WriteSession session, LinkedBuffer lb) throws java.io.IOException
The length of the utf8 bytes is written first before the string - which is a variable int (1 to 5 bytes).- Throws:
java.io.IOException
-
-