MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / encodeResponse

Method encodeResponse

test/PBufResponses.java:232–242  ·  view source on GitHub ↗

Encodes a response WITHOUT the frame length or header. Useful for individual parsing calls @param response The response to serialize @return A channel buffer to parse

(final GeneratedMessageLite response)

Source from the content-addressed store, hash-verified

230 * @return A channel buffer to parse
231 */
232 static ChannelBuffer encodeResponse(final GeneratedMessageLite response)
233 throws Exception {
234 final int pblen = response.getSerializedSize();
235 final int vlen = CodedOutputStream.computeRawVarint32Size(pblen);
236 final byte[] buf = new byte[vlen + pblen];
237 final CodedOutputStream out = CodedOutputStream.newInstance(buf, 0,
238 vlen + pblen);
239
240 out.writeMessageNoTag(response);
241 return ChannelBuffers.wrappedBuffer(buf);
242 }
243
244 /**
245 * Encodes a response with associated cells, WITHOUT the frame length or header. It should be

Calls

no outgoing calls

Tested by

no test coverage detected