本文整理了Java中net.openhft.chronicle.bytes.Bytes.toString()
方法的一些代码示例,展示了Bytes.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.toString()
方法的具体详情如下:
包路径:net.openhft.chronicle.bytes.Bytes
类名称:Bytes
方法名:toString
[英]Creates a string from the position to the limit, The buffer is not modified by this call
[中]创建从位置到限制的字符串,此调用不会修改缓冲区
代码示例来源:origin: net.openhft/chronicle-bytes
/**
* Creates a string from the {@code position} to the {@code limit}, The buffer is not modified
* by this call
*
* @param buffer the buffer to use
* @return a string contain the text from the {@code position} to the {@code limit}
*/
static String toString(@NotNull final Bytes<?> buffer) throws BufferUnderflowException {
return toString(buffer, Integer.MAX_VALUE - 4);
}
代码示例来源:origin: net.openhft/chronicle-engine
private void logYamlToStandardOut(@NotNull WireIn in) {
if (YamlLogging.showServerReads()) {
try {
LOG.info("\nServer Receives:\n" +
Wires.fromSizePrefixedBlobs(in));
} catch (Exception e) {
LOG.info("\n\n" +
Bytes.toString(in.bytes()));
}
}
}
代码示例来源:origin: net.openhft/chronicle-engine
private void logToBuffer(@NotNull WireIn in, @NotNull StringBuilder logBuffer, long start) {
if (YamlLogging.showServerReads()) {
logBuffer.setLength(0);
try {
logBuffer.append("\nServer Receives:\n")
.append(Wires.fromSizePrefixedBlobs(in.bytes(), start));
} catch (Exception e) {
logBuffer.append("\n\n").append(Bytes.toString(in.bytes(), start, in.bytes().readLimit() - start));
}
}
}
代码示例来源: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();
}
}
内容来源于网络,如有侵权,请联系作者删除!