JsonXOutput writeEndObject() throws IOException { tail = sink.writeByte(END_OBJECT, this, tail); return this; }
private void writeB64(String name, byte[] value, int offset, int length, boolean repeated) throws IOException { tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeByteArrayB64(value, offset, length, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
@Override public void writeBool(int fieldNumber, boolean value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeByteArray(value ? TRUE : FALSE, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
static LinkedBuffer writeTag(final String name, final boolean repeated, final WriteSink sink, final WriteSession session, LinkedBuffer lb) throws IOException { lb = sink.writeStrAscii(name, session, sink.writeByte( EXCLAMATION, session, lb)); if (repeated) return sink.writeByteArray(EMPTY_ARRAY, session, lb); return lb; }
JsonXOutput writeStartArray() throws IOException { tail = sink.writeByte(START_ARRAY, this, tail); return this; }
@Override public void writeInt32(int fieldNumber, int value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrFromInt(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
@Override public void writeInt64(int fieldNumber, long value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrFromLong(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
public LinkedBuffer packBoolean(boolean b, WriteSession session, LinkedBuffer lb) throws IOException { return sink.writeByte(b ? TRUE : FALSE, session, lb); }
@Override public void writeDouble(int fieldNumber, double value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrFromDouble(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
JsonXOutput writeStartObject() throws IOException { tail = sink.writeByte(START_OBJECT, this, tail); return this; }
@Override public void writeString(int fieldNumber, CharSequence value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrUTF8(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
JsonXOutput writeEndArray() throws IOException { tail = sink.writeByte(END_ARRAY, this, tail); return this; }
@Override public void writeFloat(int fieldNumber, float value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrFromFloat(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
private LinkedBuffer writeByteAndShort(byte b, short v, WriteSession session, LinkedBuffer lb) throws IOException { return sink.writeInt16(v, session, sink.writeByte(b, session, lb)); }
@Override public <T> void writeObject(int fieldNumber, T value, Schema<T> schema, boolean repeated) throws IOException { final Schema<?> lastSchema = this.schema; this.schema = schema; final String name = lastSchema.getFieldName(fieldNumber); // start tag tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))); schema.writeTo(this, value); // end tag tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, tail))); // restore state this.schema = lastSchema; }
private LinkedBuffer writeByteAndInt(byte b, int v, WriteSession session, LinkedBuffer lb) throws IOException { return sink.writeInt32(v, session, sink.writeByte(b, session, lb)); }
private LinkedBuffer writeByteAndLong(byte b, long v, WriteSession session, LinkedBuffer lb) throws IOException { return sink.writeInt64(v, session, sink.writeByte(b, session, lb)); }
@Override public void writeBool(int fieldNumber, boolean value, boolean repeated) throws IOException { tail = sink.writeByte( (byte) (value ? 0x31 : 0x30), this, writeField( fieldNumber, 1, tail)); }
@Override public void writeBool(int fieldNumber, boolean value, boolean repeated) throws IOException { tail = sink.writeByte( value ? (byte) 0x01 : 0x00, this, sink.writeVarInt32( makeTag(fieldNumber, WIRETYPE_VARINT), this, tail)); /* * tail = writeTagAndRawVarInt32( makeTag(fieldNumber, WIRETYPE_VARINT), value ? 1 : 0, this, tail); */ }