本文整理了Java中akka.protobuf.ByteString.size()
方法的一些代码示例,展示了ByteString.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteString.size()
方法的具体详情如下:
包路径:akka.protobuf.ByteString
类名称:ByteString
方法名:size
[英]Gets the number of bytes.
[中]获取字节数。
代码示例来源:origin: com.typesafe.akka/akka-protobuf
/**
* Returns {@code true} if the size is {@code 0}, {@code false} otherwise.
*
* @return true if this is zero bytes long
*/
public boolean isEmpty() {
return size() == 0;
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.11
/**
* Returns {@code true} if the size is {@code 0}, {@code false} otherwise.
*
* @return true if this is zero bytes long
*/
public boolean isEmpty() {
return size() == 0;
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf
/**
* Compute the number of bytes that would be needed to encode a
* {@code bytes} field.
*/
public static int computeBytesSizeNoTag(final ByteString value) {
return computeRawVarint32Size(value.size()) +
value.size();
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.12
/**
* Compute the number of bytes that would be needed to encode a
* {@code bytes} field.
*/
public static int computeBytesSizeNoTag(final ByteString value) {
return computeRawVarint32Size(value.size()) +
value.size();
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.12
@Override
public String toString() {
return String.format("<ByteString@%s size=%d>",
Integer.toHexString(System.identityHashCode(this)), size());
}
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.11
@Override
public String toString() {
return String.format("<ByteString@%s size=%d>",
Integer.toHexString(System.identityHashCode(this)), size());
}
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.12
/**
* Tests if this bytestring starts with the specified prefix.
* Similar to {@link String#startsWith(String)}
*
* @param prefix the prefix.
* @return <code>true</code> if the byte sequence represented by the
* argument is a prefix of the byte sequence represented by
* this string; <code>false</code> otherwise.
*/
public boolean startsWith(ByteString prefix) {
return size() >= prefix.size() &&
substring(0, prefix.size()).equals(prefix);
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf
/**
* Copies bytes to a {@code byte[]}.
*
* @return copied bytes
*/
public byte[] toByteArray() {
int size = size();
byte[] result = new byte[size];
copyToInternal(result, 0, 0, size);
return result;
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.11
/**
* Copies bytes into a buffer at the given offset.
*
* @param target buffer to copy into
* @param offset in the target buffer
* @throws IndexOutOfBoundsException if the offset is negative or too large
*/
public void copyTo(byte[] target, int offset) {
copyTo(target, 0, offset, size());
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf
/**
* Copies bytes into a buffer at the given offset.
*
* @param target buffer to copy into
* @param offset in the target buffer
* @throws IndexOutOfBoundsException if the offset is negative or too large
*/
public void copyTo(byte[] target, int offset) {
copyTo(target, 0, offset, size());
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.12
/**
* Copies bytes into a buffer at the given offset.
*
* @param target buffer to copy into
* @param offset in the target buffer
* @throws IndexOutOfBoundsException if the offset is negative or too large
*/
public void copyTo(byte[] target, int offset) {
copyTo(target, 0, offset, size());
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.11
/**
* Return the substring from {@code beginIndex}, inclusive, to the end of the
* string.
*
* @param beginIndex start at this index
* @return substring sharing underlying data
* @throws IndexOutOfBoundsException if {@code beginIndex < 0} or
* {@code beginIndex > size()}.
*/
public ByteString substring(int beginIndex) {
return substring(beginIndex, size());
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.12
/**
* Copies bytes to a {@code byte[]}.
*
* @return copied bytes
*/
public byte[] toByteArray() {
int size = size();
byte[] result = new byte[size];
copyToInternal(result, 0, 0, size);
return result;
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.12
/** Write a byte string. */
public void writeRawBytes(final ByteString value) throws IOException {
writeRawBytes(value, 0, value.size());
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.11
/**
* Due to the optional field can be duplicated at the end of serialized
* bytes, which will make the serialized size changed after LazyField
* parsed. Be careful when using this method.
*/
public int getSerializedSize() {
if (isDirty) {
return value.getSerializedSize();
}
return bytes.size();
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf
/** Write a {@code bytes} field to the stream. */
public void writeBytesNoTag(final ByteString value) throws IOException {
writeRawVarint32(value.size());
writeRawBytes(value);
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.12
/** Write a {@code bytes} field to the stream. */
public void writeBytesNoTag(final ByteString value) throws IOException {
writeRawVarint32(value.size());
writeRawBytes(value);
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf
@Override
public boolean isValidUtf8() {
int leftPartial = left.partialIsValidUtf8(Utf8.COMPLETE, 0, leftLength);
int state = right.partialIsValidUtf8(leftPartial, 0, right.size());
return state == Utf8.COMPLETE;
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.11
/** Write a {@code bytes} field to the stream. */
public void writeBytesNoTag(final ByteString value) throws IOException {
writeRawVarint32(value.size());
writeRawBytes(value);
}
代码示例来源:origin: com.typesafe.akka/akka-protobuf_2.11
@Override
public boolean isValidUtf8() {
int leftPartial = left.partialIsValidUtf8(Utf8.COMPLETE, 0, leftLength);
int state = right.partialIsValidUtf8(leftPartial, 0, right.size());
return state == Utf8.COMPLETE;
}
内容来源于网络,如有侵权,请联系作者删除!