Class LowCopyProtobufOutput
java.lang.Object
io.protostuff.LowCopyProtobufOutput
- All Implemented Interfaces:
Output
Output that differs from the standard by attempting to avoid extra copies of large ByteBuffer fields. When used with
ByteBuffer=true compiler option, we can splice in ByteBuffer objects without copying them. Most of the magic lives in
LinkBuffer, so this class exists just to serialize to a LinkBuffer.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidwriteBool(int fieldNumber, boolean value, boolean repeated) Writes a boolean field.voidwriteByteArray(int fieldNumber, byte[] bytes, boolean repeated) Writes a byte array field.voidwriteByteRange(boolean utf8String, int fieldNumber, byte[] value, int offset, int length, boolean repeated) Writes a binary or a pre-encoded utf8 string.voidwriteBytes(int fieldNumber, ByteString value, boolean repeated) Writes a ByteString(wraps byte array) field.voidwriteBytes(int fieldNumber, ByteBuffer value, boolean repeated) voidwriteDouble(int fieldNumber, double value, boolean repeated) Writes a double field.voidwriteEnum(int fieldNumber, int number, boolean repeated) Writes a enum(its number) field.voidwriteFixed32(int fieldNumber, int value, boolean repeated) Writes a fixed int(4 bytes) field.voidwriteFixed64(int fieldNumber, long value, boolean repeated) Writes a fixed long(8 bytes) field.voidwriteFloat(int fieldNumber, float value, boolean repeated) Writes a float field.voidwriteInt32(int fieldNumber, int value, boolean repeated) Writes a variable int field.voidwriteInt64(int fieldNumber, long value, boolean repeated) Writes a variable long field.<T> voidwriteObject(int fieldNumber, T value, Schema<T> schema, boolean repeated) Writes an object(using its schema) field.voidwriteSFixed32(int fieldNumber, int value, boolean repeated) Writes a signed+fixed int(4 bytes) field.voidwriteSFixed64(int fieldNumber, long value, boolean repeated) Writes a signed+fixed long(8 bytes) field.voidwriteSInt32(int fieldNumber, int value, boolean repeated) Writes a signed int field.voidwriteSInt64(int fieldNumber, long value, boolean repeated) Writes a signed long field.voidwriteString(int fieldNumber, CharSequence value, boolean repeated) Writes a String field.voidwriteUInt32(int fieldNumber, int value, boolean repeated) Writes an unsigned int field.voidwriteUInt64(int fieldNumber, long value, boolean repeated) Writes an unsigned long field.
-
Field Details
-
buffer
-
-
Constructor Details
-
LowCopyProtobufOutput
public LowCopyProtobufOutput() -
LowCopyProtobufOutput
-
-
Method Details
-
writeInt32
Description copied from interface:OutputWrites a variable int field.- Specified by:
writeInt32in interfaceOutput- Throws:
IOException
-
writeUInt32
Description copied from interface:OutputWrites an unsigned int field.- Specified by:
writeUInt32in interfaceOutput- Throws:
IOException
-
writeSInt32
Description copied from interface:OutputWrites a signed int field.- Specified by:
writeSInt32in interfaceOutput- Throws:
IOException
-
writeFixed32
Description copied from interface:OutputWrites a fixed int(4 bytes) field.- Specified by:
writeFixed32in interfaceOutput- Throws:
IOException
-
writeSFixed32
Description copied from interface:OutputWrites a signed+fixed int(4 bytes) field.- Specified by:
writeSFixed32in interfaceOutput- Throws:
IOException
-
writeInt64
Description copied from interface:OutputWrites a variable long field.- Specified by:
writeInt64in interfaceOutput- Throws:
IOException
-
writeUInt64
Description copied from interface:OutputWrites an unsigned long field.- Specified by:
writeUInt64in interfaceOutput- Throws:
IOException
-
writeSInt64
Description copied from interface:OutputWrites a signed long field.- Specified by:
writeSInt64in interfaceOutput- Throws:
IOException
-
writeFixed64
Description copied from interface:OutputWrites a fixed long(8 bytes) field.- Specified by:
writeFixed64in interfaceOutput- Throws:
IOException
-
writeSFixed64
Description copied from interface:OutputWrites a signed+fixed long(8 bytes) field.- Specified by:
writeSFixed64in interfaceOutput- Throws:
IOException
-
writeFloat
Description copied from interface:OutputWrites a float field.- Specified by:
writeFloatin interfaceOutput- Throws:
IOException
-
writeDouble
Description copied from interface:OutputWrites a double field.- Specified by:
writeDoublein interfaceOutput- Throws:
IOException
-
writeBool
Description copied from interface:OutputWrites a boolean field.- Specified by:
writeBoolin interfaceOutput- Throws:
IOException
-
writeEnum
Description copied from interface:OutputWrites a enum(its number) field.- Specified by:
writeEnumin interfaceOutput- Throws:
IOException
-
writeString
Description copied from interface:OutputWrites a String field.- Specified by:
writeStringin interfaceOutput- Throws:
IOException
-
writeBytes
Description copied from interface:OutputWrites a ByteString(wraps byte array) field.- Specified by:
writeBytesin interfaceOutput- Throws:
IOException
-
writeByteArray
Description copied from interface:OutputWrites a byte array field.- Specified by:
writeByteArrayin interfaceOutput- Throws:
IOException
-
writeByteRange
public void writeByteRange(boolean utf8String, int fieldNumber, byte[] value, int offset, int length, boolean repeated) throws IOException Description copied from interface:OutputWrites a binary or a pre-encoded utf8 string.- Specified by:
writeByteRangein interfaceOutput- Throws:
IOException
-
writeObject
public <T> void writeObject(int fieldNumber, T value, Schema<T> schema, boolean repeated) throws IOException Description copied from interface:OutputWrites an object(using its schema) field.- Specified by:
writeObjectin interfaceOutput- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin interfaceOutput- Throws:
IOException
-