本文整理了Java中org.fusesource.hawtbuf.Buffer.writeTo()
方法的一些代码示例,展示了Buffer.writeTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.writeTo()
方法的具体详情如下:
包路径:org.fusesource.hawtbuf.Buffer
类名称:Buffer
方法名:writeTo
[英]same as out.write(data, offset, length);
[中]和我们一样。写入(数据、偏移量、长度);
代码示例来源:origin: fusesource/mqtt-client
public void onPublish(UTF8Buffer topic, Buffer body, Runnable ack) {
try {
if (showTopic) {
stdout("");
stdout("Topic: " + topic);
body.writeTo(System.out);
stdout("");
} else {
body.writeTo(System.out);
}
ack.run();
} catch (IOException e) {
onFailure(e);
}
}
代码示例来源:origin: org.fusesource.mqtt-client/mqtt-client
public void onPublish(UTF8Buffer topic, Buffer body, Runnable ack) {
try {
if (showTopic) {
stdout("");
stdout("Topic: " + topic);
body.writeTo(System.out);
stdout("");
} else {
body.writeTo(System.out);
}
ack.run();
} catch (IOException e) {
onFailure(e);
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
public void marshal(Object command, DataOutput dataOut) throws IOException {
if (command instanceof ByteBuffer) {
ByteBuffer buffer = (ByteBuffer) command;
if (dataOut instanceof OutputStream) {
WritableByteChannel channel = Channels.newChannel((OutputStream) dataOut);
channel.write(buffer);
} else {
while (buffer.hasRemaining()) {
dataOut.writeByte(buffer.get());
}
}
} else {
Buffer frame = (Buffer) command;
frame.writeTo(dataOut);
}
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
@Override
public void marshal(Object command, DataOutput dataOut) throws IOException {
if (command instanceof ByteBuffer) {
ByteBuffer buffer = (ByteBuffer) command;
if (dataOut instanceof OutputStream) {
WritableByteChannel channel = Channels.newChannel((OutputStream) dataOut);
channel.write(buffer);
} else {
while (buffer.hasRemaining()) {
dataOut.writeByte(buffer.get());
}
}
} else {
Buffer frame = (Buffer) command;
frame.writeTo(dataOut);
}
}
代码示例来源:origin: apache/activemq-artemis
public void send(AmqpHeader header) throws Exception {
IntegrationTestLogger.LOGGER.info("Client sending header: " + header);
OutputStream outputStream = clientSocket.getOutputStream();
header.getBuffer().writeTo(outputStream);
outputStream.flush();
}
代码示例来源:origin: org.apache.activemq/activemq-console
private void store(String ext, Buffer value) throws IOException {
TarEntry entry = new TarEntry(seq + "." + ext);
seq += 1;
entry.setSize(value.length());
stream.putNextEntry(entry);
value.writeTo(stream);
stream.closeEntry();
}
代码示例来源:origin: org.apache.activemq/activemq-all
private void store(String ext, Buffer value) throws IOException {
TarEntry entry = new TarEntry(seq + "." + ext);
seq += 1;
entry.setSize(value.length());
stream.putNextEntry(entry);
value.writeTo(stream);
stream.closeEntry();
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
private void store(String ext, Buffer value) throws IOException {
TarEntry entry = new TarEntry(seq + "." + ext);
seq += 1;
entry.setSize(value.length());
stream.putNextEntry(entry);
value.writeTo(stream);
stream.closeEntry();
}
内容来源于网络,如有侵权,请联系作者删除!