public static int computeMessageSize(int tag, MessageBuffer message) { return CodedOutputStream.computeTagSize(tag) + message.serializedSizeFramed(); }
public static void writeMessage(CodedOutputStream output, int tag, MessageBuffer message) throws IOException { output.writeTag(tag, WIRETYPE_LENGTH_DELIMITED); message.writeFramed(output); }
static public Buffer toUnframedBuffer(MessageBuffer message) { try { int size = message.serializedSizeUnframed(); BufferOutputStream baos = new BufferOutputStream(size); CodedOutputStream output = new CodedOutputStream(baos); message.writeUnframed(output); Buffer rc = baos.toBuffer(); assert rc.length == size : "Did not write as much data as expected."; return rc; } catch (IOException e) { throw new RuntimeException("Serializing to a byte array threw an IOException " + "(should never happen).", e); } }
static public Buffer toFramedBuffer(MessageBuffer message) { try { int size = message.serializedSizeFramed(); BufferOutputStream baos = new BufferOutputStream(size); CodedOutputStream output = new CodedOutputStream(baos); message.writeFramed(output); Buffer rc = baos.toBuffer(); assert rc.length==size : "Did not write as much data as expected."; return rc; } catch (IOException e) { throw new RuntimeException("Serializing to a byte array threw an IOException " + "(should never happen).", e); } }
static public Buffer toUnframedBuffer(MessageBuffer message) { try { int size = message.serializedSizeUnframed(); BufferOutputStream baos = new BufferOutputStream(size); CodedOutputStream output = new CodedOutputStream(baos); message.writeUnframed(output); Buffer rc = baos.toBuffer(); assert rc.length == size : "Did not write as much data as expected."; return rc; } catch (IOException e) { throw new RuntimeException("Serializing to a byte array threw an IOException " + "(should never happen).", e); } }
static public Buffer toFramedBuffer(MessageBuffer message) { try { int size = message.serializedSizeFramed(); BufferOutputStream baos = new BufferOutputStream(size); CodedOutputStream output = new CodedOutputStream(baos); message.writeFramed(output); Buffer rc = baos.toBuffer(); assert rc.length==size : "Did not write as much data as expected."; return rc; } catch (IOException e) { throw new RuntimeException("Serializing to a byte array threw an IOException " + "(should never happen).", e); } }
static public Buffer toUnframedBuffer(MessageBuffer message) { try { int size = message.serializedSizeUnframed(); BufferOutputStream baos = new BufferOutputStream(size); CodedOutputStream output = new CodedOutputStream(baos); message.writeUnframed(output); Buffer rc = baos.toBuffer(); assert rc.length == size : "Did not write as much data as expected."; return rc; } catch (IOException e) { throw new RuntimeException("Serializing to a byte array threw an IOException " + "(should never happen).", e); } }
static public Buffer toFramedBuffer(MessageBuffer message) { try { int size = message.serializedSizeFramed(); BufferOutputStream baos = new BufferOutputStream(size); CodedOutputStream output = new CodedOutputStream(baos); message.writeFramed(output); Buffer rc = baos.toBuffer(); assert rc.length==size : "Did not write as much data as expected."; return rc; } catch (IOException e) { throw new RuntimeException("Serializing to a byte array threw an IOException " + "(should never happen).", e); } }
public static void writeMessage(CodedOutputStream output, int tag, MessageBuffer message) throws IOException { output.writeTag(tag, WIRETYPE_LENGTH_DELIMITED); message.writeFramed(output); }
public static int computeMessageSize(int tag, MessageBuffer message) { return CodedOutputStream.computeTagSize(tag) + message.serializedSizeFramed(); }
public static void writeMessage(CodedOutputStream output, int tag, MessageBuffer message) throws IOException { output.writeTag(tag, WIRETYPE_LENGTH_DELIMITED); message.writeFramed(output); }
public static int computeMessageSize(int tag, MessageBuffer message) { return CodedOutputStream.computeTagSize(tag) + message.serializedSizeFramed(); }