use of org.apache.thrift.transport.TMemoryInputTransport in project jena by apache.
the class ThriftConverter method fromBytes.
public static void fromBytes(byte[] buffer, RDF_Quad quad) throws TException {
TMemoryInputTransport transport = getInputTransport();
transport.reset(buffer);
TProtocol protocol = getInputProtocol();
quad.read(protocol);
}
use of org.apache.thrift.transport.TMemoryInputTransport in project jena by apache.
the class ThriftConverter method fromBytes.
public static void fromBytes(byte[] buffer, RDF_Triple triple) throws TException {
TMemoryInputTransport transport = getInputTransport();
transport.reset(buffer);
TProtocol protocol = getInputProtocol();
triple.read(protocol);
}
use of org.apache.thrift.transport.TMemoryInputTransport in project distributedlog by twitter.
the class BKDLConfig method deserialize.
@Override
public void deserialize(byte[] data) throws IOException {
BKDLConfigFormat configFormat = new BKDLConfigFormat();
TMemoryInputTransport transport = new TMemoryInputTransport(data);
TJSONProtocol protocol = new TJSONProtocol(transport);
try {
configFormat.read(protocol);
} catch (TException e) {
throw new IOException("Failed to deserialize data '" + new String(data, UTF_8) + "' : ", e);
}
// bookkeeper cluster settings
if (configFormat.isSetBkZkServers()) {
bkZkServersForWriter = configFormat.getBkZkServers();
}
if (configFormat.isSetBkZkServersForReader()) {
bkZkServersForReader = configFormat.getBkZkServersForReader();
} else {
bkZkServersForReader = bkZkServersForWriter;
}
if (configFormat.isSetBkLedgersPath()) {
bkLedgersPath = configFormat.getBkLedgersPath();
}
// dl zookeeper cluster settings
if (configFormat.isSetDlZkServersForWriter()) {
dlZkServersForWriter = configFormat.getDlZkServersForWriter();
}
if (configFormat.isSetDlZkServersForReader()) {
dlZkServersForReader = configFormat.getDlZkServersForReader();
} else {
dlZkServersForReader = dlZkServersForWriter;
}
// dl settings
sanityCheckTxnID = !configFormat.isSetSanityCheckTxnID() || configFormat.isSanityCheckTxnID();
encodeRegionID = configFormat.isSetEncodeRegionID() && configFormat.isEncodeRegionID();
if (configFormat.isSetAclRootPath()) {
aclRootPath = configFormat.getAclRootPath();
}
if (configFormat.isSetFirstLogSegmentSeqNo()) {
firstLogSegmentSeqNo = configFormat.getFirstLogSegmentSeqNo();
}
isFederatedNamespace = configFormat.isSetFederatedNamespace() && configFormat.isFederatedNamespace();
// Validate the settings
if (null == bkZkServersForWriter || null == bkZkServersForReader || null == bkLedgersPath || null == dlZkServersForWriter || null == dlZkServersForReader) {
throw new IOException("Missing zk/bk settings in BKDL Config : " + new String(data, UTF_8));
}
}
use of org.apache.thrift.transport.TMemoryInputTransport in project distributedlog by twitter.
the class ZKAccessControl method deserialize.
static AccessControlEntry deserialize(String zkPath, byte[] data) throws IOException {
if (data.length == 0) {
return DEFAULT_ACCESS_CONTROL_ENTRY;
}
AccessControlEntry ace = new AccessControlEntry();
TMemoryInputTransport transport = new TMemoryInputTransport(data);
TJSONProtocol protocol = new TJSONProtocol(transport);
try {
ace.read(protocol);
} catch (TException e) {
throw new CorruptedAccessControlException(zkPath, e);
}
return ace;
}
use of org.apache.thrift.transport.TMemoryInputTransport in project distributedlog by twitter.
the class Utils method parseMessage.
public static Message parseMessage(byte[] data) throws TException {
Message msg = new Message();
TMemoryInputTransport transport = new TMemoryInputTransport(data);
TBinaryProtocol protocol = new TBinaryProtocol(transport);
msg.read(protocol);
return msg;
}
Aggregations