本文整理汇总了Java中org.apache.hadoop.hbase.security.SaslStatus类的典型用法代码示例。如果您正苦于以下问题:Java SaslStatus类的具体用法?Java SaslStatus怎么用?Java SaslStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SaslStatus类属于org.apache.hadoop.hbase.security包,在下文中一共展示了SaslStatus类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRawSaslReply
import org.apache.hadoop.hbase.security.SaslStatus; //导入依赖的package包/类
/**
* No protobuf encoding of raw sasl messages
*/
protected final void doRawSaslReply(SaslStatus status, Writable rv,
String errorClass, String error) throws IOException {
BufferChain bc;
// In my testing, have noticed that sasl messages are usually
// in the ballpark of 100-200. That's why the initial capacity is 256.
try (ByteBufferOutputStream saslResponse = new ByteBufferOutputStream(256);
DataOutputStream out = new DataOutputStream(saslResponse)) {
out.writeInt(status.state); // write status
if (status == SaslStatus.SUCCESS) {
rv.write(out);
} else {
WritableUtils.writeString(out, errorClass);
WritableUtils.writeString(out, error);
}
bc = new BufferChain(saslResponse.getByteBuffer());
}
doRespond(() -> bc);
}