|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.dyuproject.protostuff.WriteSession
com.dyuproject.protostuff.ProtobufOutput
public final class ProtobufOutput
Protobuf serialization where the messages must be fully buffered on memory before
it can be written to the socket (OutputStream).
| Field Summary | |
|---|---|
static int |
LITTLE_ENDIAN_32_SIZE
|
static int |
LITTLE_ENDIAN_64_SIZE
|
| Fields inherited from class com.dyuproject.protostuff.WriteSession |
|---|
head, nextBufferSize, out, sink, size, tail |
| Constructor Summary | |
|---|---|
ProtobufOutput(LinkedBuffer buffer)
|
|
ProtobufOutput(LinkedBuffer buffer,
int nextBufferSize)
|
|
| Method Summary | ||
|---|---|---|
ProtobufOutput |
clear()
Resets this output for re-use. |
|
static int |
computeRawVarint32Size(int value)
Compute the number of bytes that would be needed to encode a varint. |
|
static int |
computeRawVarint64Size(long value)
Compute the number of bytes that would be needed to encode a varint. |
|
static int |
encodeZigZag32(int n)
Encode a ZigZag-encoded 32-bit value. |
|
static long |
encodeZigZag64(long n)
Encode a ZigZag-encoded 64-bit value. |
|
static byte[] |
getRawVarInt32Bytes(int value)
Returns the byte array computed from the var int 32 size |
|
static byte[] |
getTagAndRawLittleEndian32Bytes(int tag,
int value)
Returns a byte array encoded with the tag and little endian 32 |
|
static byte[] |
getTagAndRawLittleEndian64Bytes(int tag,
long value)
Returns a byte array encoded with the tag and little endian 64 |
|
static byte[] |
getTagAndRawVarInt32Bytes(int tag,
int value)
Returns a byte array encoded with the tag and var int 32 |
|
static byte[] |
getTagAndRawVarInt64Bytes(int tag,
long value)
Returns a byte array encoded with the tag and var int 64 |
|
void |
writeBool(int fieldNumber,
boolean value,
boolean repeated)
|
|
void |
writeByteArray(int fieldNumber,
byte[] bytes,
boolean repeated)
|
|
void |
writeByteRange(boolean utf8String,
int fieldNumber,
byte[] value,
int offset,
int length,
boolean repeated)
|
|
void |
writeBytes(int fieldNumber,
ByteString value,
boolean repeated)
|
|
void |
writeDouble(int fieldNumber,
double value,
boolean repeated)
|
|
void |
writeEnum(int fieldNumber,
int number,
boolean repeated)
|
|
void |
writeFixed32(int fieldNumber,
int value,
boolean repeated)
|
|
void |
writeFixed64(int fieldNumber,
long value,
boolean repeated)
|
|
void |
writeFloat(int fieldNumber,
float value,
boolean repeated)
|
|
void |
writeInt32(int fieldNumber,
int value,
boolean repeated)
|
|
void |
writeInt64(int fieldNumber,
long value,
boolean repeated)
|
|
|
writeObject(int fieldNumber,
T value,
Schema<T> schema,
boolean repeated)
|
|
static int |
writeRawLittleEndian32(int value,
byte[] buffer,
int offset)
Writes the encoded little endian 32 and returns the bytes written |
|
static int |
writeRawLittleEndian64(long value,
byte[] buffer,
int offset)
Writes the encoded little endian 64 and returns the bytes written |
|
static void |
writeRawVarInt32(int value,
byte[] buf,
int offset)
Encode and write a varint to the byte array |
|
static LinkedBuffer |
writeRawVarInt32(int value,
WriteSession session,
LinkedBuffer lb)
Returns the buffer encoded with the variable int 32. |
|
static void |
writeRawVarInt32Bytes(java.io.DataOutput out,
int value)
Encode and write a varint to the DataOutput |
|
static void |
writeRawVarInt32Bytes(java.io.OutputStream out,
int value)
Encode and write a varint to the OutputStream |
|
void |
writeSFixed32(int fieldNumber,
int value,
boolean repeated)
|
|
void |
writeSFixed64(int fieldNumber,
long value,
boolean repeated)
|
|
void |
writeSInt32(int fieldNumber,
int value,
boolean repeated)
|
|
void |
writeSInt64(int fieldNumber,
long value,
boolean repeated)
|
|
void |
writeString(int fieldNumber,
java.lang.String value,
boolean repeated)
|
|
static LinkedBuffer |
writeTagAndByteArray(int tag,
byte[] value,
int offset,
int valueLen,
WriteSession session,
LinkedBuffer lb)
Returns the buffer encoded with the tag and byte array |
|
static LinkedBuffer |
writeTagAndLinkedBuffer(int tag,
LinkedBuffer buffer,
WriteSession session,
LinkedBuffer lb)
Returns the buffer encoded with the tag and LinkedBuffer (zero-copy) |
|
static LinkedBuffer |
writeTagAndRawLittleEndian32(int tag,
int value,
WriteSession session,
LinkedBuffer lb)
Returns the buffer encoded with the tag and little endian 32 |
|
static LinkedBuffer |
writeTagAndRawLittleEndian64(int tag,
long value,
WriteSession session,
LinkedBuffer lb)
Returns the buffer encoded with the tag and little endian 64 |
|
static LinkedBuffer |
writeTagAndRawVarInt32(int tag,
int value,
WriteSession session,
LinkedBuffer lb)
Returns the buffer encoded with the tag and var int 32 |
|
static LinkedBuffer |
writeTagAndRawVarInt64(int tag,
long value,
WriteSession session,
LinkedBuffer lb)
Returns the buffer encoded with the tag and var int 64 |
|
void |
writeUInt32(int fieldNumber,
int value,
boolean repeated)
|
|
void |
writeUInt64(int fieldNumber,
long value,
boolean repeated)
|
|
| Methods inherited from class com.dyuproject.protostuff.WriteSession |
|---|
getSize, toByteArray |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LITTLE_ENDIAN_32_SIZE
public static final int LITTLE_ENDIAN_64_SIZE
| Constructor Detail |
|---|
public ProtobufOutput(LinkedBuffer buffer)
public ProtobufOutput(LinkedBuffer buffer,
int nextBufferSize)
| Method Detail |
|---|
public ProtobufOutput clear()
clear in class WriteSession
public void writeInt32(int fieldNumber,
int value,
boolean repeated)
throws java.io.IOException
writeInt32 in interface Outputjava.io.IOException
public void writeUInt32(int fieldNumber,
int value,
boolean repeated)
throws java.io.IOException
writeUInt32 in interface Outputjava.io.IOException
public void writeSInt32(int fieldNumber,
int value,
boolean repeated)
throws java.io.IOException
writeSInt32 in interface Outputjava.io.IOException
public void writeFixed32(int fieldNumber,
int value,
boolean repeated)
throws java.io.IOException
writeFixed32 in interface Outputjava.io.IOException
public void writeSFixed32(int fieldNumber,
int value,
boolean repeated)
throws java.io.IOException
writeSFixed32 in interface Outputjava.io.IOException
public void writeInt64(int fieldNumber,
long value,
boolean repeated)
throws java.io.IOException
writeInt64 in interface Outputjava.io.IOException
public void writeUInt64(int fieldNumber,
long value,
boolean repeated)
throws java.io.IOException
writeUInt64 in interface Outputjava.io.IOException
public void writeSInt64(int fieldNumber,
long value,
boolean repeated)
throws java.io.IOException
writeSInt64 in interface Outputjava.io.IOException
public void writeFixed64(int fieldNumber,
long value,
boolean repeated)
throws java.io.IOException
writeFixed64 in interface Outputjava.io.IOException
public void writeSFixed64(int fieldNumber,
long value,
boolean repeated)
throws java.io.IOException
writeSFixed64 in interface Outputjava.io.IOException
public void writeFloat(int fieldNumber,
float value,
boolean repeated)
throws java.io.IOException
writeFloat in interface Outputjava.io.IOException
public void writeDouble(int fieldNumber,
double value,
boolean repeated)
throws java.io.IOException
writeDouble in interface Outputjava.io.IOException
public void writeBool(int fieldNumber,
boolean value,
boolean repeated)
throws java.io.IOException
writeBool in interface Outputjava.io.IOException
public void writeEnum(int fieldNumber,
int number,
boolean repeated)
throws java.io.IOException
writeEnum in interface Outputjava.io.IOException
public void writeString(int fieldNumber,
java.lang.String value,
boolean repeated)
throws java.io.IOException
writeString in interface Outputjava.io.IOException
public void writeBytes(int fieldNumber,
ByteString value,
boolean repeated)
throws java.io.IOException
writeBytes in interface Outputjava.io.IOException
public void writeByteArray(int fieldNumber,
byte[] bytes,
boolean repeated)
throws java.io.IOException
writeByteArray in interface Outputjava.io.IOException
public void writeByteRange(boolean utf8String,
int fieldNumber,
byte[] value,
int offset,
int length,
boolean repeated)
throws java.io.IOException
writeByteRange in interface Outputjava.io.IOException
public <T> void writeObject(int fieldNumber,
T value,
Schema<T> schema,
boolean repeated)
throws java.io.IOException
writeObject in interface Outputjava.io.IOException
public static LinkedBuffer writeRawVarInt32(int value,
WriteSession session,
LinkedBuffer lb)
public static LinkedBuffer writeTagAndLinkedBuffer(int tag,
LinkedBuffer buffer,
WriteSession session,
LinkedBuffer lb)
public static LinkedBuffer writeTagAndByteArray(int tag,
byte[] value,
int offset,
int valueLen,
WriteSession session,
LinkedBuffer lb)
public static LinkedBuffer writeTagAndRawVarInt32(int tag,
int value,
WriteSession session,
LinkedBuffer lb)
public static LinkedBuffer writeTagAndRawVarInt64(int tag,
long value,
WriteSession session,
LinkedBuffer lb)
public static LinkedBuffer writeTagAndRawLittleEndian32(int tag,
int value,
WriteSession session,
LinkedBuffer lb)
public static LinkedBuffer writeTagAndRawLittleEndian64(int tag,
long value,
WriteSession session,
LinkedBuffer lb)
public static void writeRawVarInt32(int value,
byte[] buf,
int offset)
throws java.io.IOException
java.io.IOException
public static void writeRawVarInt32Bytes(java.io.OutputStream out,
int value)
throws java.io.IOException
OutputStream
java.io.IOException
public static void writeRawVarInt32Bytes(java.io.DataOutput out,
int value)
throws java.io.IOException
DataOutput
java.io.IOException
public static byte[] getTagAndRawVarInt32Bytes(int tag,
int value)
public static byte[] getTagAndRawVarInt64Bytes(int tag,
long value)
public static byte[] getTagAndRawLittleEndian32Bytes(int tag,
int value)
public static byte[] getTagAndRawLittleEndian64Bytes(int tag,
long value)
public static int writeRawLittleEndian32(int value,
byte[] buffer,
int offset)
public static int writeRawLittleEndian64(long value,
byte[] buffer,
int offset)
public static byte[] getRawVarInt32Bytes(int value)
public static int computeRawVarint32Size(int value)
value is treated as unsigned, so it won't be sign-extended if
negative.
public static int computeRawVarint64Size(long value)
public static int encodeZigZag32(int n)
n - A signed 32-bit integer.
public static long encodeZigZag64(long n)
n - A signed 64-bit integer.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||