use of org.apache.thrift.transport.TMemoryBuffer in project pinpoint by naver.
the class BytesUtilsTest method compactProtocolVint.
@Test
public void compactProtocolVint() throws TException {
TMemoryBuffer tMemoryBuffer = writeVInt32(BytesUtils.zigzagToInt(64));
logger.trace("length:{}", tMemoryBuffer.length());
TMemoryBuffer tMemoryBuffer2 = writeVInt32(64);
logger.trace("length:{}", tMemoryBuffer2.length());
}
use of org.apache.thrift.transport.TMemoryBuffer in project distributedlog by twitter.
the class ZKAccessControl method serialize.
static byte[] serialize(AccessControlEntry ace) throws IOException {
TMemoryBuffer transport = new TMemoryBuffer(BUFFER_SIZE);
TJSONProtocol protocol = new TJSONProtocol(transport);
try {
ace.write(protocol);
transport.flush();
return transport.toString(UTF_8.name()).getBytes(UTF_8);
} catch (TException e) {
throw new IOException("Failed to serialize access control entry : ", e);
} catch (UnsupportedEncodingException uee) {
throw new IOException("Failed to serialize acesss control entry : ", uee);
}
}
Aggregations