public final class JsonXOutput extends WriteSession implements Output, StatefulOutput
This is the appropriate output sink to use when writing from binary (protostuff,protobuf,etc) pipes.
WriteSession.FlushHandlerflushHandler, head, nextBufferSize, out, sink, size, tail| Constructor and Description |
|---|
JsonXOutput(LinkedBuffer head,
boolean numeric,
Schema<?> schema) |
JsonXOutput(LinkedBuffer head,
OutputStream out,
boolean numeric,
Schema<?> schema) |
JsonXOutput(LinkedBuffer head,
OutputStream out,
WriteSession.FlushHandler flushHandler,
int nextBufferSize,
boolean numeric,
Schema<?> schema) |
| Modifier and Type | Method and Description |
|---|---|
JsonXOutput |
clear() |
int |
getLastNumber()
Gets the last field number written.
|
boolean |
isLastRepeated()
Returns true if the last written field was a repeated field.
|
boolean |
isNumeric()
Returns whether the incoming messages' field names are numeric.
|
void |
reset()
Resets this output for re-use.
|
void |
updateLast(Schema<?> schema,
Schema<?> lastSchema) |
JsonXOutput |
use(Schema<?> schema)
Before serializing a message/object tied to a schema, this should be called.
|
void |
writeBool(int fieldNumber,
boolean value,
boolean repeated) |
void |
writeByteArray(int fieldNumber,
byte[] value,
boolean repeated) |
void |
writeByteRange(boolean utf8String,
int fieldNumber,
byte[] value,
int offset,
int length,
boolean repeated) |
void |
writeBytes(int fieldNumber,
ByteBuffer value,
boolean repeated)
Writes a ByteBuffer field.
|
void |
writeBytes(int fieldNumber,
ByteString value,
boolean repeated) |
void |
writeDouble(int fieldNumber,
double value,
boolean repeated) |
void |
writeEnum(int fieldNumber,
int value,
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) |
<T> void |
writeObject(int fieldNumber,
T value,
Schema<T> schema,
boolean repeated) |
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,
CharSequence value,
boolean repeated) |
void |
writeUInt32(int fieldNumber,
int value,
boolean repeated) |
void |
writeUInt64(int fieldNumber,
long value,
boolean repeated) |
flush, flush, flush, getSize, toByteArraypublic JsonXOutput(LinkedBuffer head, boolean numeric, Schema<?> schema)
public JsonXOutput(LinkedBuffer head, OutputStream out, WriteSession.FlushHandler flushHandler, int nextBufferSize, boolean numeric, Schema<?> schema)
public JsonXOutput(LinkedBuffer head, OutputStream out, boolean numeric, Schema<?> schema)
public void reset()
reset in class WriteSessionpublic JsonXOutput clear()
clear in class WriteSessionpublic JsonXOutput use(Schema<?> schema)
public boolean isNumeric()
public int getLastNumber()
public boolean isLastRepeated()
public void updateLast(Schema<?> schema, Schema<?> lastSchema)
updateLast in interface StatefulOutputpublic void writeBool(int fieldNumber,
boolean value,
boolean repeated)
throws IOException
writeBool in interface OutputIOExceptionpublic void writeByteArray(int fieldNumber,
byte[] value,
boolean repeated)
throws IOException
writeByteArray in interface OutputIOExceptionpublic void writeByteRange(boolean utf8String,
int fieldNumber,
byte[] value,
int offset,
int length,
boolean repeated)
throws IOException
writeByteRange in interface OutputIOExceptionpublic void writeBytes(int fieldNumber,
ByteString value,
boolean repeated)
throws IOException
writeBytes in interface OutputIOExceptionpublic void writeDouble(int fieldNumber,
double value,
boolean repeated)
throws IOException
writeDouble in interface OutputIOExceptionpublic void writeEnum(int fieldNumber,
int value,
boolean repeated)
throws IOException
writeEnum in interface OutputIOExceptionpublic void writeFixed32(int fieldNumber,
int value,
boolean repeated)
throws IOException
writeFixed32 in interface OutputIOExceptionpublic void writeFixed64(int fieldNumber,
long value,
boolean repeated)
throws IOException
writeFixed64 in interface OutputIOExceptionpublic void writeFloat(int fieldNumber,
float value,
boolean repeated)
throws IOException
writeFloat in interface OutputIOExceptionpublic void writeInt32(int fieldNumber,
int value,
boolean repeated)
throws IOException
writeInt32 in interface OutputIOExceptionpublic void writeInt64(int fieldNumber,
long value,
boolean repeated)
throws IOException
writeInt64 in interface OutputIOExceptionpublic void writeSFixed32(int fieldNumber,
int value,
boolean repeated)
throws IOException
writeSFixed32 in interface OutputIOExceptionpublic void writeSFixed64(int fieldNumber,
long value,
boolean repeated)
throws IOException
writeSFixed64 in interface OutputIOExceptionpublic void writeSInt32(int fieldNumber,
int value,
boolean repeated)
throws IOException
writeSInt32 in interface OutputIOExceptionpublic void writeSInt64(int fieldNumber,
long value,
boolean repeated)
throws IOException
writeSInt64 in interface OutputIOExceptionpublic void writeString(int fieldNumber,
CharSequence value,
boolean repeated)
throws IOException
writeString in interface OutputIOExceptionpublic void writeUInt32(int fieldNumber,
int value,
boolean repeated)
throws IOException
writeUInt32 in interface OutputIOExceptionpublic void writeUInt64(int fieldNumber,
long value,
boolean repeated)
throws IOException
writeUInt64 in interface OutputIOExceptionpublic <T> void writeObject(int fieldNumber,
T value,
Schema<T> schema,
boolean repeated)
throws IOException
writeObject in interface OutputIOExceptionpublic void writeBytes(int fieldNumber,
ByteBuffer value,
boolean repeated)
throws IOException
writeBytes in interface OutputIOExceptionCopyright © 2009–2020. All rights reserved.