本文整理了Java中com.google.protobuf.Internal.toStringUtf8()
方法的一些代码示例,展示了Internal.toStringUtf8()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Internal.toStringUtf8()
方法的具体详情如下:
包路径:com.google.protobuf.Internal
类名称:Internal
方法名:toStringUtf8
[英]Helper method to convert a byte array to a string using UTF-8 encoding.
[中]使用UTF-8编码将字节数组转换为字符串的帮助器方法。
代码示例来源:origin: com.google.protobuf/protobuf-java
private static String asString(Object o) {
if (o instanceof String) {
return (String) o;
} else if (o instanceof ByteString) {
return ((ByteString) o).toStringUtf8();
} else {
return Internal.toStringUtf8((byte[]) o);
}
}
代码示例来源:origin: com.google.protobuf/protobuf-java
@Override
public String get(int index) {
Object o = list.get(index);
if (o instanceof String) {
return (String) o;
} else if (o instanceof ByteString) {
ByteString bs = (ByteString) o;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
list.set(index, s);
}
return s;
} else {
byte[] ba = (byte[]) o;
String s = Internal.toStringUtf8(ba);
if (Internal.isValidUtf8(ba)) {
list.set(index, s);
}
return s;
}
}
代码示例来源:origin: WeAreFairphone/FP2-Launcher
private static String asString(Object o) {
if (o instanceof String) {
return (String) o;
} else if (o instanceof ByteString) {
return ((ByteString) o).toStringUtf8();
} else {
return Internal.toStringUtf8((byte[]) o);
}
}
代码示例来源:origin: com.google.protobuf/protobuf-lite
private static String asString(Object o) {
if (o instanceof String) {
return (String) o;
} else if (o instanceof ByteString) {
return ((ByteString) o).toStringUtf8();
} else {
return Internal.toStringUtf8((byte[]) o);
}
}
代码示例来源:origin: yeriomin/play-store-api
private static String asString(Object o) {
if (o instanceof String) {
return (String) o;
} else if (o instanceof ByteString) {
return ((ByteString) o).toStringUtf8();
} else {
return Internal.toStringUtf8((byte[]) o);
}
}
代码示例来源:origin: WeAreFairphone/FP2-Launcher
@Override
public String get(int index) {
Object o = list.get(index);
if (o instanceof String) {
return (String) o;
} else if (o instanceof ByteString) {
ByteString bs = (ByteString) o;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
list.set(index, s);
}
return s;
} else {
byte[] ba = (byte[]) o;
String s = Internal.toStringUtf8(ba);
if (Internal.isValidUtf8(ba)) {
list.set(index, s);
}
return s;
}
}
代码示例来源:origin: com.google.protobuf/protobuf-lite
@Override
public String get(int index) {
Object o = list.get(index);
if (o instanceof String) {
return (String) o;
} else if (o instanceof ByteString) {
ByteString bs = (ByteString) o;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
list.set(index, s);
}
return s;
} else {
byte[] ba = (byte[]) o;
String s = Internal.toStringUtf8(ba);
if (Internal.isValidUtf8(ba)) {
list.set(index, s);
}
return s;
}
}
代码示例来源:origin: yeriomin/play-store-api
@Override
public String get(int index) {
Object o = list.get(index);
if (o instanceof String) {
return (String) o;
} else if (o instanceof ByteString) {
ByteString bs = (ByteString) o;
String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
list.set(index, s);
}
return s;
} else {
byte[] ba = (byte[]) o;
String s = Internal.toStringUtf8(ba);
if (Internal.isValidUtf8(ba)) {
list.set(index, s);
}
return s;
}
}
内容来源于网络,如有侵权,请联系作者删除!