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; }
tail = sink.writeByte( QUOTE, this, sink.writeByteArrayB64( value, 0, value.length, this, sink.writeByteArray( COMMA_AND_QUOTE, this, tail = sink.writeByte( QUOTE, this, sink.writeByteArrayB64( value, 0, value.length, 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))))))); }
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))))))); }
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 { final WriteSink sink = this.sink; if (lastNumber == fieldNumber) { // repeated field tail = sink.writeByteArray( value ? TRUE : FALSE, this, sink.writeByte( COMMA, this, tail)); return; } tail = sink.writeByteArray( value ? TRUE : FALSE, this, writeKey( fieldNumber, sink, repeated ? KEY_SUFFIX_ARRAY : KEY_SUFFIX)); lastNumber = fieldNumber; lastRepeated = repeated; }
@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))))))); }
@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))))))); }
@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))))))); }
@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))))))); }
JsonXOutput writeCommaAndStartObject() throws IOException { tail = sink.writeByteArray(COMMA_AND_START_OBJECT, this, tail); return this; }
JsonXOutput writeEndObject() throws IOException { tail = sink.writeByte(END_OBJECT, this, tail); return this; }
numBuf[1] = (byte) ((len >>> 8) & 0xFF); lb = sink.writeStrFromInt( number, this, sink.writeByteArray( numBuf, 0, 2, this, numBuf[1] = (byte) ((valueLen >>> 8) & 0xFF); return sink.writeByteArray(numBuf, 0, 2, this, lb); numBuf[1] = (byte) ((valueLen >>> 8) & 0xFF); return sink.writeByteArray( numBuf, 0, 2, this, sink.writeStrUTF8FixedDelimited( schema.getFieldName(number), true,
tail = sink.writeByteArrayB64( value, this, sink.writeByteArray( DASH_AND_SPACE, this, tail = sink.writeByteArrayB64( value, this,
@Override public void writeInt64(int fieldNumber, long value, boolean repeated) throws IOException { final WriteSink sink = this.sink; if (lastNumber == fieldNumber) { // repeated field tail = sink.writeStrFromLong( value, this, sink.writeByte( COMMA, this, tail)); return; } tail = sink.writeStrFromLong( value, this, writeKey( fieldNumber, sink, repeated ? KEY_SUFFIX_ARRAY : KEY_SUFFIX)); lastNumber = fieldNumber; lastRepeated = repeated; }
@Override public void writeInt32(int fieldNumber, int value, boolean repeated) throws IOException { final WriteSink sink = this.sink; if (lastNumber == fieldNumber) { // repeated field tail = sink.writeStrFromInt( value, this, sink.writeByte( COMMA, this, tail)); return; } tail = sink.writeStrFromInt( value, this, writeKey( fieldNumber, sink, repeated ? KEY_SUFFIX_ARRAY : KEY_SUFFIX)); lastNumber = fieldNumber; lastRepeated = repeated; }
private static LinkedBuffer writeKey(final String name, final int indent, final boolean repeated, final WriteSink sink, final WriteSession session, LinkedBuffer lb) throws IOException { lb = sink.writeByteArray( COLON_AND_SPACE, session, sink.writeStrAscii( name, session, newLine( indent, sink, session, lb))); if (repeated) { return sink.writeByteArray( DASH_AND_SPACE, session, newLine( inc(indent, 2), sink, session, lb)); } return lb; }
@Override public void writeDouble(int fieldNumber, double value, boolean repeated) throws IOException { final WriteSink sink = this.sink; if (lastNumber == fieldNumber) { // repeated field tail = sink.writeStrFromDouble( value, this, sink.writeByte( COMMA, this, tail)); return; } tail = sink.writeStrFromDouble( value, this, writeKey( fieldNumber, sink, repeated ? KEY_SUFFIX_ARRAY : KEY_SUFFIX)); lastNumber = fieldNumber; lastRepeated = repeated; }
@Override public void writeFloat(int fieldNumber, float value, boolean repeated) throws IOException { final WriteSink sink = this.sink; if (lastNumber == fieldNumber) { // repeated field tail = sink.writeStrFromFloat( value, this, sink.writeByte( COMMA, this, tail)); return; } tail = sink.writeStrFromFloat( value, this, writeKey( fieldNumber, sink, repeated ? KEY_SUFFIX_ARRAY : KEY_SUFFIX)); lastNumber = fieldNumber; lastRepeated = repeated; }