本文整理了Java中org.apache.ratis.thirdparty.com.google.protobuf.ByteString.toStringUtf8()
方法的一些代码示例,展示了ByteString.toStringUtf8()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteString.toStringUtf8()
方法的具体详情如下:
包路径:org.apache.ratis.thirdparty.com.google.protobuf.ByteString
类名称:ByteString
方法名:toStringUtf8
暂无
代码示例来源:origin: apache/incubator-ratis
/**
* <code>string value_serde_class = 6;</code>
*/
public java.lang.String getValueSerdeClass() {
java.lang.Object ref = valueSerdeClass_;
if (!(ref instanceof java.lang.String)) {
org.apache.ratis.thirdparty.com.google.protobuf.ByteString bs =
(org.apache.ratis.thirdparty.com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
valueSerdeClass_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
代码示例来源:origin: hortonworks/ratis
/**
* <code>string exceptionClassName = 1;</code>
*/
public java.lang.String getExceptionClassName() {
java.lang.Object ref = exceptionClassName_;
if (!(ref instanceof java.lang.String)) {
org.apache.ratis.thirdparty.com.google.protobuf.ByteString bs =
(org.apache.ratis.thirdparty.com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
exceptionClassName_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
代码示例来源:origin: apache/incubator-ratis
/**
* <code>string value_class = 4;</code>
*/
public java.lang.String getValueClass() {
java.lang.Object ref = valueClass_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
org.apache.ratis.thirdparty.com.google.protobuf.ByteString bs =
(org.apache.ratis.thirdparty.com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
valueClass_ = s;
return s;
}
}
/**
代码示例来源:origin: apache/incubator-ratis
/**
* <code>string errorMsg = 2;</code>
*/
public java.lang.String getErrorMsg() {
java.lang.Object ref = errorMsg_;
if (!(ref instanceof java.lang.String)) {
org.apache.ratis.thirdparty.com.google.protobuf.ByteString bs =
(org.apache.ratis.thirdparty.com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
errorMsg_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
代码示例来源:origin: apache/incubator-ratis
/**
* <code>string exceptionClassName = 1;</code>
*/
public java.lang.String getExceptionClassName() {
java.lang.Object ref = exceptionClassName_;
if (!(ref instanceof java.lang.String)) {
org.apache.ratis.thirdparty.com.google.protobuf.ByteString bs =
(org.apache.ratis.thirdparty.com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
exceptionClassName_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
代码示例来源:origin: apache/incubator-ratis
static String toString(RaftRpcReplyProto reply) {
return reply.getRequestorId().toStringUtf8() + "->"
+ reply.getReplyId().toStringUtf8() + "," + reply.getSuccess();
}
代码示例来源:origin: apache/incubator-ratis
static String toString(RaftRpcRequestProto proto) {
return proto.getRequestorId().toStringUtf8() + "->" + proto.getReplyId().toStringUtf8()
+ "#" + proto.getCallId();
}
代码示例来源:origin: apache/incubator-ratis
static String toString(RaftRpcReplyProto proto) {
return proto.getRequestorId().toStringUtf8() + "<-" + proto.getReplyId().toStringUtf8()
+ "#" + proto.getCallId() + ":"
+ (proto.getSuccess()? "OK": "FAIL");
}
static String toString(RequestVoteReplyProto proto) {
代码示例来源:origin: apache/incubator-ratis
public CompletableFuture<String> deleteAsync(String path) {
return deleteImpl(this::sendAsync, path
).thenApply(reply -> JavaUtils.supplyAndWrapAsCompletionException(
() -> DeleteReplyProto.parseFrom(reply).getResolvedPath().toStringUtf8()));
}
}
代码示例来源:origin: apache/incubator-ratis
public String delete(String path) throws IOException {
final ByteString reply = deleteImpl(this::send, path);
return DeleteReplyProto.parseFrom(reply).getResolvedPath().toStringUtf8();
}
代码示例来源:origin: apache/incubator-ratis
private CompletableFuture<Message> writeCommit(
long index, WriteRequestHeaderProto header, int size) {
final String path = header.getPath().toStringUtf8();
return files.submitCommit(index, path, header.getClose(), header.getOffset(), size)
.thenApply(reply -> Message.valueOf(reply.toByteString()));
}
代码示例来源:origin: apache/incubator-ratis
static String toString(RaftClientReplyProto proto) {
final RaftRpcReplyProto rpc = proto.getRpcReply();
return ClientId.valueOf(rpc.getRequestorId()) + "<-" + rpc.getReplyId().toStringUtf8()
+ "#" + rpc.getCallId();
}
代码示例来源:origin: apache/incubator-ratis
private CompletableFuture<Message> delete(long index, DeleteRequestProto request) {
final String path = request.getPath().toStringUtf8();
return files.delete(index, path).thenApply(resolved ->
Message.valueOf(DeleteReplyProto.newBuilder().setResolvedPath(
FileStoreCommon.toByteString(resolved)).build().toByteString(),
() -> "Message:" + resolved));
}
}
代码示例来源:origin: apache/incubator-ratis
static String toString(RaftClientRequestProto proto) {
final RaftRpcRequestProto rpc = proto.getRpcRequest();
return ClientId.valueOf(rpc.getRequestorId()) + "->" + rpc.getReplyId().toStringUtf8()
+ "#" + rpc.getCallId() + "-" + rpc.getSeqNum();
}
代码示例来源:origin: apache/incubator-ratis
private void put(LogEntryProto entry) {
final LogEntryProto previous = indexMap.put(entry.getIndex(), entry);
Preconditions.assertNull(previous, "previous");
final String s = entry.getStateMachineLogEntry().getLogData().toStringUtf8();
dataMap.put(s, entry);
LOG.info("{}: put {}, {} -> {}", getId(), entry.getIndex(),
s.length() <= 10? s: s.substring(0, 10) + "...",
ServerProtoUtils.toLogEntryString(entry));
}
代码示例来源:origin: apache/incubator-ratis
@Override
public CompletableFuture<Message> query(Message request) {
final ReadRequestProto proto;
try {
proto = ReadRequestProto.parseFrom(request.getContent());
} catch (InvalidProtocolBufferException e) {
return FileStoreCommon.completeExceptionally("Failed to parse " + request, e);
}
final String path = proto.getPath().toStringUtf8();
return files.read(path, proto.getOffset(), proto.getLength())
.thenApply(reply -> Message.valueOf(reply.toByteString()));
}
代码示例来源:origin: apache/incubator-ratis
@Override
public String getRequestorId() {
if (isAppendEntries()) {
return appendEntries.getServerRequest().getRequestorId().toStringUtf8();
} else if (isRequestVote()) {
return requestVote.getServerRequest().getRequestorId().toStringUtf8();
} else {
return installSnapshot.getServerRequest().getRequestorId().toStringUtf8();
}
}
代码示例来源:origin: apache/incubator-ratis
@Override
public String getReplierId() {
if (isAppendEntries()) {
return appendEntries.getServerRequest().getReplyId().toStringUtf8();
} else if (isRequestVote()) {
return requestVote.getServerRequest().getReplyId().toStringUtf8();
} else {
return installSnapshot.getServerRequest().getReplyId().toStringUtf8();
}
}
代码示例来源:origin: apache/incubator-ratis
@Override
public String getRequestorId() {
if (isAppendEntries()) {
return appendEntries.getServerReply().getRequestorId().toStringUtf8();
} else if (isRequestVote()) {
return requestVote.getServerReply().getRequestorId().toStringUtf8();
} else {
return installSnapshot.getServerReply().getRequestorId().toStringUtf8();
}
}
代码示例来源:origin: apache/incubator-ratis
@Override
public String getReplierId() {
if (isAppendEntries()) {
return appendEntries.getServerReply().getReplyId().toStringUtf8();
} else if (isRequestVote()) {
return requestVote.getServerReply().getReplyId().toStringUtf8();
} else {
return installSnapshot.getServerReply().getReplyId().toStringUtf8();
}
}
内容来源于网络,如有侵权,请联系作者删除!