本文整理了Java中akka.protobuf.ByteString
类的一些代码示例,展示了ByteString
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteString
类的具体详情如下:
包路径:akka.protobuf.ByteString
类名称:ByteString
[英]Immutable sequence of bytes. Substring is supported by sharing the reference to the immutable underlying bytes, as with String. Concatenation is likewise supported without copying (long strings) by building a tree of pieces in RopeByteString.
Like String, the contents of a ByteString can never be observed to change, not even in the presence of a data race or incorrect API usage in the client code.
[中]不可变的字节序列。通过共享对不可变底层字节的引用(如字符串)来支持子字符串。通过在RopeByteString中构建一个片段树,在不复制(长字符串)的情况下也同样支持连接。
与字符串一样,ByteString的内容永远不会被观察到发生更改,即使在客户机代码中存在数据竞争或API使用不正确的情况下也是如此。
代码示例来源:origin: com.typesafe.akka/akka-stream_2.11
/**
* <code>required string path = 1;</code>
*/
public akka.protobuf.ByteString
getPathBytes() {
java.lang.Object ref = path_;
if (ref instanceof java.lang.String) {
akka.protobuf.ByteString b =
akka.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
path_ = b;
return b;
} else {
return (akka.protobuf.ByteString) ref;
}
}
代码示例来源:origin: com.typesafe.akka/akka-stream
/**
* <code>required string path = 1;</code>
*/
public java.lang.String getPath() {
java.lang.Object ref = path_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
akka.protobuf.ByteString bs =
(akka.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
path_ = s;
}
return s;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-stream_2.12
/**
* <code>required string path = 1;</code>
*/
public java.lang.String getPath() {
java.lang.Object ref = path_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((akka.protobuf.ByteString) ref)
.toStringUtf8();
path_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.11
private static ByteString balancedConcat(Iterator<ByteString> iterator,
int length) {
assert length >= 1;
ByteString result;
if (length == 1) {
result = iterator.next();
} else {
int halfLength = length >>> 1;
ByteString left = balancedConcat(iterator, halfLength);
ByteString right = balancedConcat(iterator, length - halfLength);
result = left.concat(right);
}
return result;
}
代码示例来源:origin: com.typesafe.akka/akka-stream_2.11
/**
* <code>required string path = 1;</code>
*/
public java.lang.String getPath() {
java.lang.Object ref = path_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((akka.protobuf.ByteString) ref)
.toStringUtf8();
path_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-protobuf
private static ByteString balancedConcat(Iterator<ByteString> iterator,
int length) {
assert length >= 1;
ByteString result;
if (length == 1) {
result = iterator.next();
} else {
int halfLength = length >>> 1;
ByteString left = balancedConcat(iterator, halfLength);
ByteString right = balancedConcat(iterator, length - halfLength);
result = left.concat(right);
}
return result;
}
代码示例来源:origin: com.typesafe.akka/akka-stream_2.12
/**
* <code>required string path = 1;</code>
*/
public java.lang.String getPath() {
java.lang.Object ref = path_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
akka.protobuf.ByteString bs =
(akka.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
path_ = s;
}
return s;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-stream_2.11
/**
* <code>required string path = 1;</code>
*/
public akka.protobuf.ByteString
getPathBytes() {
java.lang.Object ref = path_;
if (ref instanceof String) {
akka.protobuf.ByteString b =
akka.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
path_ = b;
return b;
} else {
return (akka.protobuf.ByteString) ref;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-stream
/**
* <code>required string path = 1;</code>
*/
public java.lang.String getPath() {
java.lang.Object ref = path_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((akka.protobuf.ByteString) ref)
.toStringUtf8();
path_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.12
private static ByteString balancedConcat(Iterator<ByteString> iterator,
int length) {
assert length >= 1;
ByteString result;
if (length == 1) {
result = iterator.next();
} else {
int halfLength = length >>> 1;
ByteString left = balancedConcat(iterator, halfLength);
ByteString right = balancedConcat(iterator, length - halfLength);
result = left.concat(right);
}
return result;
}
代码示例来源:origin: com.typesafe.akka/akka-stream_2.11
/**
* <code>required string path = 1;</code>
*/
public java.lang.String getPath() {
java.lang.Object ref = path_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
akka.protobuf.ByteString bs =
(akka.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
path_ = s;
}
return s;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-stream_2.12
/**
* <code>required string path = 1;</code>
*/
public akka.protobuf.ByteString
getPathBytes() {
java.lang.Object ref = path_;
if (ref instanceof java.lang.String) {
akka.protobuf.ByteString b =
akka.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
path_ = b;
return b;
} else {
return (akka.protobuf.ByteString) ref;
}
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf
private String asString(Object o) {
if (o instanceof String) {
return (String) o;
} else {
return ((ByteString) o).toStringUtf8();
}
}
代码示例来源:origin: com.typesafe.akka/akka-cluster
/**
* <code>required string system = 1;</code>
*/
public java.lang.String getSystem() {
java.lang.Object ref = system_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
akka.protobuf.ByteString bs =
(akka.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
system_ = s;
}
return s;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-stream
/**
* <code>required string path = 1;</code>
*/
public akka.protobuf.ByteString
getPathBytes() {
java.lang.Object ref = path_;
if (ref instanceof java.lang.String) {
akka.protobuf.ByteString b =
akka.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
path_ = b;
return b;
} else {
return (akka.protobuf.ByteString) ref;
}
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.11
private String asString(Object o) {
if (o instanceof String) {
return (String) o;
} else {
return ((ByteString) o).toStringUtf8();
}
}
代码示例来源:origin: com.typesafe.akka/akka-cluster
/**
* <code>required string manifest = 2;</code>
*/
public java.lang.String getManifest() {
java.lang.Object ref = manifest_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
akka.protobuf.ByteString bs =
(akka.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
manifest_ = s;
}
return s;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-stream
/**
* <code>required string path = 1;</code>
*/
public akka.protobuf.ByteString
getPathBytes() {
java.lang.Object ref = path_;
if (ref instanceof String) {
akka.protobuf.ByteString b =
akka.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
path_ = b;
return b;
} else {
return (akka.protobuf.ByteString) ref;
}
}
/**
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.12
private String asString(Object o) {
if (o instanceof String) {
return (String) o;
} else {
return ((ByteString) o).toStringUtf8();
}
}
代码示例来源:origin: com.typesafe.akka/akka-cluster
/**
* <code>optional string useRole = 4;</code>
*/
public java.lang.String getUseRole() {
java.lang.Object ref = useRole_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
akka.protobuf.ByteString bs =
(akka.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
useRole_ = s;
}
return s;
}
}
/**
内容来源于网络,如有侵权,请联系作者删除!