public <T> void writeObject(final int fieldNumber, final T value, final Schema<T> schema, final boolean repeated) throws IOException { final boolean lastEntityField = entityField; entityField = false; schema.writeTo(this, value); entityField = lastEntityField; }
public <T> void writeObject(final int fieldNumber, final T value, final Schema<T> schema, final boolean repeated) throws IOException { final boolean lastEntityField = entityField; entityField = false; schema.writeTo(this, value); entityField = lastEntityField; }
public <T> void writeObject(final int fieldNumber, final T value, final Schema<T> schema, final boolean repeated) throws IOException { final boolean lastEntityField = entityField; entityField = false; schema.writeTo(this, value); entityField = lastEntityField; }
public <T> boolean fail(RpcError error, T message, Schema<T> fSchema) throws IOException { protocol.updateError(error, worker, po); fSchema.writeTo(po, message); return false; }
/** * Serializes the {@code message} into an {@link XMLStreamWriter} * using the given {@code schema}. */ public static <T> void writeTo(XMLStreamWriter writer, T message, Schema<T> schema) throws IOException, XMLStreamException, XmlOutputException { writer.writeStartElement(schema.messageName()); schema.writeTo(new XmlOutput(writer, schema), message); writer.writeEndElement(); }
/** * Serializes the {@code message} into an {@link OutputStream} using the given schema. * * @return the size of the message */ public static <T> int writeTo(OutputStream out, T message, Schema<T> schema, LinkedBuffer buffer) throws IOException { if(buffer.start != buffer.offset) throw new IllegalArgumentException("Buffer previously used and had not been reset."); final ProtobufOutput output = new ProtobufOutput(buffer); schema.writeTo(output, message); return LinkedBuffer.writeTo(out, buffer); }
/** * Serializes the {@code message} into an {@link OutputStream} using the given schema. * * @return the size of the message */ public static <T> int writeTo(final OutputStream out, final T message, final Schema<T> schema, final LinkedBuffer buffer) throws IOException { if(buffer.start != buffer.offset) throw new IllegalArgumentException("Buffer previously used and had not been reset."); final ProtostuffOutput output = new ProtostuffOutput(buffer, out); schema.writeTo(output, message); LinkedBuffer.writeTo(out, buffer); return output.size; }
public <T> boolean fail(RpcError error, T message, Schema<T> fSchema) throws IOException { protocol.updateError(error, worker, jo); fSchema.writeTo(jo.use(fSchema), message); return false; }
public <T> boolean fail(RpcError error, T message, Schema<T> fSchema) throws IOException { protocol.updateError(error, worker, yo); fSchema.writeTo(yo.use(fSchema), message); return false; }
public <T> RpcError writeError(RpcError error, T message, Schema<T> schema, RpcHeader header, RpcProtocol protocol, RpcWorker worker, WriteSession session) throws IOException { final ProtostuffOutput output = this.output; response.worker.currentOutput = output; output.size = session.size; protocol.writeHeader(error, header, this, worker, output); schema.writeTo(output, message); output.tail = output.sink.writeByte( (byte)WIRETYPE_TAIL_DELIMITER, output, output.tail); return error; }
/** * Serializes the {@code message} into an {@link OutputStream} using the given schema. * * @return the size of the message */ public static <T> int writeTo(final OutputStream out, final T message, final Schema<T> schema, final LinkedBuffer buffer) throws IOException { if(buffer.start != buffer.offset) throw new IllegalArgumentException("Buffer previously used and had not been reset."); final ProtostuffOutput output = new ProtostuffOutput(buffer, out); final GraphProtostuffOutput graphOutput = new GraphProtostuffOutput(output); schema.writeTo(graphOutput, message); LinkedBuffer.writeTo(out, buffer); return output.size; }
/** * Serializes the {@code message}, prefixed with its length, into an * {@link OutputStream}. * * @return the size of the message */ public static <T> int writeDelimitedTo(final OutputStream out, final T message, final Schema<T> schema, final LinkedBuffer buffer) throws IOException { if(buffer.start != buffer.offset) throw new IllegalArgumentException("Buffer previously used and had not been reset."); final ProtostuffOutput output = new ProtostuffOutput(buffer); schema.writeTo(output, message); ProtobufOutput.writeRawVarInt32Bytes(out, output.size); LinkedBuffer.writeTo(out, buffer); return output.size; }
public <T> void writeObject(final int fieldNumber, final T value, final Schema<T> schema, final boolean repeated) throws IOException { tail = sink.writeVarInt32( makeTag(fieldNumber, WIRETYPE_START_GROUP), this, tail); schema.writeTo(this, value); tail = sink.writeVarInt32( makeTag(fieldNumber, WIRETYPE_END_GROUP), this, tail); }
/** * Used by the code generated messages that implement {@link java.io.Externalizable}. * Writes to the {@link DataOutput}. * * @return the size of the message. */ public static <T> int writeDelimitedTo(DataOutput out, T message, Schema<T> schema) throws IOException { final LinkedBuffer buffer = new LinkedBuffer(LinkedBuffer.MIN_BUFFER_SIZE); final ProtostuffOutput output = new ProtostuffOutput(buffer); schema.writeTo(output, message); ProtobufOutput.writeRawVarInt32Bytes(out, output.size); LinkedBuffer.writeTo(out, buffer); return output.size; }
/** * Serializes the {@code message} into an {@link OutputStream} via {@link JsonXOutput} * using the given {@code schema}. */ public static <T> void writeTo(OutputStream out, T message, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException { if(buffer.start != buffer.offset) throw new IllegalArgumentException("Buffer previously used and had not been reset."); final JsonXOutput output = new JsonXOutput(buffer, out, numeric, schema); output.writeStartObject(); schema.writeTo(output, message); if(output.isLastRepeated()) output.writeEndArray(); output.writeEndObject(); LinkedBuffer.writeTo(out, buffer); }
/** * Serializes the {@code message} into a JsonGenerator * using the given {@code schema}. */ public static <T> void writeTo(JsonGenerator generator, T message, Schema<T> schema, boolean numeric) throws IOException { generator.writeStartObject(); final JsonOutput output = new JsonOutput(generator, numeric, schema); schema.writeTo(output, message); if(output.isLastRepeated()) generator.writeEndArray(); generator.writeEndObject(); }
/** * Used by the code generated messages that implement {@link java.io.Externalizable}. * Writes to the {@link DataOutput}. * * @return the size of the message. */ public static <T> int writeDelimitedTo(DataOutput out, T message, Schema<T> schema) throws IOException { final LinkedBuffer buffer = new LinkedBuffer(LinkedBuffer.MIN_BUFFER_SIZE); final ProtostuffOutput output = new ProtostuffOutput(buffer); final GraphProtostuffOutput graphOutput = new GraphProtostuffOutput(output); schema.writeTo(graphOutput, message); ProtobufOutput.writeRawVarInt32Bytes(out, output.size); LinkedBuffer.writeTo(out, buffer); return output.size; }
/** * Used by the code generated messages that implement {@link java.io.Externalizable}. * Writes to the {@link DataOutput}. * * @return the size of the message. */ public static <T> int writeDelimitedTo(DataOutput out, T message, Schema<T> schema) throws IOException { final LinkedBuffer buffer = new LinkedBuffer(LinkedBuffer.MIN_BUFFER_SIZE); final ProtobufOutput output = new ProtobufOutput(buffer); schema.writeTo(output, message); final int size = output.getSize(); ProtobufOutput.writeRawVarInt32Bytes(out, size); final int msgSize = LinkedBuffer.writeTo(out, buffer); assert size == msgSize; return size; }
public <T> void writeObject(int fieldNumber, T value, Schema<T> schema, boolean repeated) throws IOException { final ProtostuffOutput output = this.output; if(references.shouldIncrement(refCount, value, output, fieldNumber)) { refCount++; output.tail = output.sink.writeVarInt32( makeTag(fieldNumber, WIRETYPE_START_GROUP), output, output.tail); schema.writeTo(this, value); output.tail = output.sink.writeVarInt32( makeTag(fieldNumber, WIRETYPE_END_GROUP), output, output.tail); } }
public <T> RpcError writeError(RpcError error, T message, Schema<T> schema, RpcHeader header, RpcProtocol protocol, RpcWorker worker, WriteSession session) throws IOException { final JsonXOutput output = this.output; response.worker.currentOutput = output; output.use(schema).reset(); output.size = session.size; protocol.writeHeader(error, header, this, worker, output); output.writeStartObject(); schema.writeTo(output, message); if (output.isLastRepeated()) output.writeEndArray(); output.writeEndObject(); return error; }