本文整理了Java中net.openhft.chronicle.bytes.Bytes.append()
方法的一些代码示例,展示了Bytes.append()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.append()
方法的具体详情如下:
包路径:net.openhft.chronicle.bytes.Bytes
类名称:Bytes
方法名:append
暂无
代码示例来源:origin: OpenHFT/Chronicle-Queue
for (int i = 0; i < REQUIRED_COUNT; i++) {
message.clear();
message.append(i);
appender.writeBytes(message);
代码示例来源: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);
}
代码示例来源:origin: net.openhft/chronicle-bytes
private void copyToText(long pos) {
if (lineLength() == 0 && offsetFormat != null) {
appendOffset(pos);
startOfLine = text.writePosition();
}
long end = base.writePosition();
if (pos < end) {
doIndent();
do {
int value = base.readUnsignedByte(pos);
long ll = lineLength();
if (ll >= numberWrap * 3 - 1) {
newLine();
appendOffset(pos);
doIndent();
startOfLine = text.writePosition();
}
pos++;
long wp = text.writePosition();
if (wp > 0 && text.peekUnsignedByte(wp - 1) > ' ')
text.append(' ');
text.appendBase16(value, 2);
} while (pos < end);
}
}
代码示例来源:origin: OpenHFT/Chronicle-Queue
pinger.ping(pdtio);
assertEquals(PingDTO.constructionExpected, PingDTO.constructionCounter);
pdtio.bytes.append("hi");
代码示例来源:origin: net.openhft/chronicle-bytes
@Override
public int read(@NotNull char[] cbuf, int off, int len) throws IOException {
int len2 = reader.read(cbuf, off, len);
base.append(new String(cbuf, off, len)); // TODO Optimise
return len2;
}
代码示例来源:origin: net.openhft/chronicle-bytes
private void newLine() {
if (this.comment.readRemaining() > 0) {
while (lineLength() < numberWrap * 3 - 3)
this.text.append(" ");
while (lineLength() < numberWrap * 3)
this.text.append(' ');
this.text.append("# ");
this.text.append(comment);
comment.clear();
}
this.text.append('\n');
startOfLine = this.text.writePosition();
}
代码示例来源:origin: net.openhft/chronicle-bytes
public static void append(@NotNull Appendable sb, double value)
throws IllegalArgumentException, BufferOverflowException {
if (sb instanceof StringBuilder)
((StringBuilder) sb).append(value);
else if (sb instanceof Bytes)
((Bytes) sb).append(value);
else
throw new IllegalArgumentException("" + sb.getClass());
}
代码示例来源:origin: net.openhft/chronicle-bytes
public static void append(@NotNull Appendable sb, long value)
throws IllegalArgumentException, BufferOverflowException {
if (sb instanceof StringBuilder)
((StringBuilder) sb).append(value);
else if (sb instanceof Bytes)
((Bytes) sb).append(value);
else
throw new IllegalArgumentException("" + sb.getClass());
}
代码示例来源:origin: net.openhft/chronicle-bytes
@Override
public Bytes<Void> comment(CharSequence comment) {
if (this.comment.readRemaining() > 0 || comment.length() == 0)
newLine();
if (comment.length() > 0 && comment.charAt(0) == '#') {
indent = 0;
this.text.append('#').append(comment).append('\n');
startOfLine = this.text.writePosition();
} else {
this.comment.clear().append(comment);
}
return this;
}
代码示例来源:origin: net.openhft/chronicle-bytes
public static void write(@NotNull Bytes bytes, int value) throws BufferOverflowException {
long position = bytes.writePosition();
bytes.write(template);
try {
bytes.append(position + VALUE, value, DIGITS);
} catch (IllegalArgumentException e) {
throw new AssertionError(e);
}
}
代码示例来源:origin: net.openhft/chronicle-bytes
public static void write(@NotNull Bytes bytes, long value) throws BufferOverflowException, IllegalArgumentException {
long position = bytes.writePosition();
bytes.write(template);
bytes.append(position + VALUE, value, DIGITS);
}
代码示例来源:origin: net.openhft/chronicle-bytes
private void doIndent() {
if (lineLength() == 0 && indent > 0) {
for (int i = 0; i < indent; i++)
text.append(" ");
startOfLine = text.writePosition();
}
}
代码示例来源:origin: net.openhft/chronicle-bytes
private void appendOffset(long offset) {
if (offsetFormat == null) return;
offsetFormat.append(offset, this.text);
long wp = text.writePosition();
if (wp > 0 && text.peekUnsignedByte(wp - 1) > ' ')
text.append(' ');
startOfLine = text.writePosition();
}
内容来源于网络,如有侵权,请联系作者删除!