use of org.codehaus.jackson.util.ByteArrayBuilder in project stargate-core by tuplejump.
the class Group method toByteBuffer.
public ByteBuffer toByteBuffer() throws IOException {
BufferRecycler bufferRecycler = bufferThreadLocal.get();
ByteArrayBuilder bytes = new ByteArrayBuilder(bufferRecycler);
IOContext ioContext = new IOContext(bufferRecycler, bytes, false);
JsonGenerator gen = new Utf8Generator(ioContext, 0, null, bytes);
gen.enable(JsonGenerator.Feature.QUOTE_FIELD_NAMES);
gen.enable(JsonGenerator.Feature.QUOTE_NON_NUMERIC_NUMBERS);
gen.enable(JsonGenerator.Feature.ESCAPE_NON_ASCII);
writeJson(gen);
gen.flush();
bytes.flush();
bytes.close();
return ByteBuffer.wrap(bytes.toByteArray());
}
Aggregations