本文整理了Java中com.google.protobuf.ByteString.toStringUtf8()
方法的一些代码示例,展示了ByteString.toStringUtf8()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteString.toStringUtf8()
方法的具体详情如下:
包路径:com.google.protobuf.ByteString
类名称:ByteString
方法名:toStringUtf8
[英]Constructs a new String by decoding the bytes as UTF-8.
[中]通过将字节解码为UTF-8来构造新字符串。
代码示例来源:origin: bazelbuild/bazel
/**
* <code>optional string default_string = 5;</code>
*/
public java.lang.String getDefaultString() {
java.lang.Object ref = defaultString_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
defaultString_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
代码示例来源:origin: bazelbuild/bazel
/**
* <code>optional string default_string = 5;</code>
*/
public java.lang.String getDefaultString() {
java.lang.Object ref = defaultString_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
defaultString_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string key = 1;</code>
*/
public String getKey() {
Object ref = key_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
key_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string value = 2;</code>
*/
public String getValue() {
Object ref = value_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
value_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string value = 2;</code>
*/
public String getValue() {
Object ref = value_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
value_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string key = 1;</code>
*/
public String getKey() {
Object ref = key_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
key_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string serverenCode = 5;</code>
*
* <pre>
** 变更数据的编码 *
* </pre>
*/
public String getServerenCode() {
Object ref = serverenCode_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
serverenCode_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string tableName = 9;</code>
*
* <pre>
**变更数据的tablename*
* </pre>
*/
public String getTableName() {
Object ref = tableName_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
tableName_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string gtid = 13;</code>
*
* <pre>
**当前事务的gitd*
* </pre>
*/
public String getGtid() {
Object ref = gtid_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
gtid_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string ddlSchemaName = 14;</code>
*
* <pre>
** ddl/query的schemaName,会存在跨库ddl,需要保留执行ddl的当前schemaName *
* </pre>
*/
public String getDdlSchemaName() {
Object ref = ddlSchemaName_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
ddlSchemaName_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string transactionId = 2;</code>
*
* <pre>
**已废弃,Begin里不提供事务id*
* </pre>
*/
public String getTransactionId() {
Object ref = transactionId_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
transactionId_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string serverenCode = 5;</code>
*
* <pre>
** 变更数据的编码 *
* </pre>
*/
public String getServerenCode() {
Object ref = serverenCode_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
serverenCode_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string name = 3;</code>
*
* <pre>
**字段名称(忽略大小写),在mysql中是没有的*
* </pre>
*/
public String getName() {
Object ref = name_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string mysqlType = 10;</code>
*
* <pre>
**字段mysql类型*
* </pre>
*/
public String getMysqlType() {
Object ref = mysqlType_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
mysqlType_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string name = 3;</code>
*
* <pre>
**字段名称(忽略大小写),在mysql中是没有的*
* </pre>
*/
public String getName() {
Object ref = name_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string mysqlType = 10;</code>
*
* <pre>
**字段mysql类型*
* </pre>
*/
public String getMysqlType() {
Object ref = mysqlType_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
mysqlType_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string sql = 11;</code>
*
* <pre>
** ddl/query的sql语句 *
* </pre>
*/
public String getSql() {
Object ref = sql_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
sql_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string transactionId = 2;</code>
*
* <pre>
**事务号*
* </pre>
*/
public String getTransactionId() {
Object ref = transactionId_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
transactionId_ = s;
}
return s;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string gtid = 13;</code>
*
* <pre>
**当前事务的gitd*
* </pre>
*/
public String getGtid() {
Object ref = gtid_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
gtid_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
代码示例来源:origin: alibaba/canal
/**
* <code>optional string ddlSchemaName = 14;</code>
*
* <pre>
** ddl/query的schemaName,会存在跨库ddl,需要保留执行ddl的当前schemaName *
* </pre>
*/
public String getDdlSchemaName() {
Object ref = ddlSchemaName_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
ddlSchemaName_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
内容来源于网络,如有侵权,请联系作者删除!