本文整理了Java中net.openhft.chronicle.bytes.Bytes.appendUtf8()
方法的一些代码示例,展示了Bytes.appendUtf8()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.appendUtf8()
方法的具体详情如下:
包路径:net.openhft.chronicle.bytes.Bytes
类名称:Bytes
方法名:appendUtf8
暂无
代码示例来源:origin: net.openhft/chronicle-engine
private static <T> BiFunction<T, Bytes, Bytes> toBytes(Class type) {
if (type == String.class)
return (t, bytes) -> (Bytes) bytes.appendUtf8((String) t);
throw new UnsupportedOperationException("todo");
}
代码示例来源:origin: net.openhft/chronicle-engine
static <T> BiFunction<T, Bytes, Bytes> toBytes(@NotNull Class type, @NotNull Function<Bytes, Wire> wireType) {
if (type == String.class)
return (t, bytes) -> (Bytes) bytes.appendUtf8((String) t);
if (Marshallable.class.isAssignableFrom(type))
return (t, bytes) -> {
t = acquireInstance(type, t);
((Marshallable) t).writeMarshallable(wireType.apply(bytes));
return bytes;
};
throw new UnsupportedOperationException("todo");
}
代码示例来源:origin: net.openhft/chronicle-engine
@Nullable
@Override
public String getAndPut(String key, @NotNull String value) {
Buffers b = BUFFERS.get();
Bytes<ByteBuffer> bytes = b.valueBuffer;
bytes.clear();
bytes.appendUtf8(value);
@Nullable BytesStore retBytes = kvStore.getAndPut(key, bytes);
if (retBytes == null) return null;
else {
String s = retBytes.toString();
retBytes.release();
return s;
}
}
代码示例来源:origin: net.openhft/chronicle-bytes
public static <ACS extends Appendable & CharSequence> void append(ACS a, CharSequence cs, long start, long len) {
if (a instanceof StringBuilder) {
if (cs instanceof Bytes)
((StringBuilder) a).append(Bytes.toString(((Bytes) cs), start, len));
else
((StringBuilder) a).append(cs.subSequence(Maths.toInt32(start), Maths.toInt32(len)));
} else if (a instanceof Bytes) {
((Bytes) a).appendUtf8(cs, Maths.toInt32(start), Maths.toInt32(len));
} else {
throw new UnsupportedOperationException();
}
}
代码示例来源:origin: net.openhft/chronicle-bytes
public static void write(@NotNull Bytes bytes, long capacity) {
long start = bytes.writePosition();
bytes.write(SECTION1);
bytes.append(capacity);
while (bytes.writePosition() - start < CAPACITY + DIGITS) {
bytes.writeUnsignedByte(' ');
}
bytes.write(SECTION2);
bytes.write(ZERO);
bytes.write(SECTION3);
for (long i = 0; i < capacity; i++) {
if (i > 0)
bytes.appendUtf8(", ");
bytes.write(ZERO);
}
bytes.write(SECTION4);
}
内容来源于网络,如有侵权,请联系作者删除!