本文整理了Java中org.fusesource.hawtbuf.Buffer.toByteBuffer()
方法的一些代码示例,展示了Buffer.toByteBuffer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.toByteBuffer()
方法的具体详情如下:
包路径:org.fusesource.hawtbuf.Buffer
类名称:Buffer
方法名:toByteBuffer
暂无
代码示例来源:origin: fusesource/hawtjournal
/**
* Read the record stored at the given {@link Location}.
*
* @param location
* @return
* @throws IOException
* @throws IllegalStateException
*/
public ByteBuffer read(Location location) throws IOException, IllegalStateException {
Buffer buffer = accessor.readLocation(location);
return buffer.toByteBuffer();
}
代码示例来源:origin: org.fusesource.hawtdispatch/hawtdispatch-transport
protected void flushNextWriteBuffer() {
DataByteArrayOutputStream next = allocateNextWriteBuffer();
ByteBuffer bb = nextWriteBuffer.toBuffer().toByteBuffer();
writeBuffer.add(bb);
writeBufferRemaining += bb.remaining();
nextWriteBuffer = next;
}
代码示例来源:origin: jboss-fuse/fabric8
public BufferState write(Object value) throws IOException {
if (full()) {
return BufferState.FULL;
} else {
boolean wasEmpty = empty();
Buffer buffer = (Buffer) value;
next_write_size += buffer.length;
next_write_buffers.add(buffer.toByteBuffer());
return wasEmpty ? BufferState.WAS_EMPTY : BufferState.NOT_EMPTY;
}
}
代码示例来源:origin: org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin
public BufferState write(Object value) throws IOException {
if (full()) {
return BufferState.FULL;
} else {
boolean wasEmpty = empty();
Buffer buffer = (Buffer) value;
next_write_size += buffer.length;
next_write_buffers.add(buffer.toByteBuffer());
return wasEmpty ? BufferState.WAS_EMPTY : BufferState.NOT_EMPTY;
}
}
代码示例来源:origin: eclipse/kapua
protected void handleMessageArrived(final String topic, final Buffer payload, final Callback<Callback<Void>> ack) {
final MqttMessageHandler handler;
synchronized (this) {
handler = subscriptions.get(topic);
}
if (handler != null) {
try {
handler.handleMessage(topic, payload.toByteBuffer());
ack.onSuccess(null);
} catch (Exception e) {
ack.onFailure(e);
}
}
}
代码示例来源:origin: org.eclipse.kapua/kapua-client-gateway-provider-fuse
protected void handleMessageArrived(final String topic, final Buffer payload, final Callback<Callback<Void>> ack) {
final MqttMessageHandler handler;
synchronized (this) {
handler = subscriptions.get(topic);
}
if (handler != null) {
try {
handler.handleMessage(topic, payload.toByteBuffer());
ack.onSuccess(null);
} catch (Exception e) {
ack.onFailure(e);
}
}
}
代码示例来源:origin: fusesource/hawtjournal
private Location recoveryCheck() throws IOException {
Location location = goToFirstLocation(dataFiles.firstEntry().getValue(), Location.BATCH_CONTROL_RECORD_TYPE, false);
while (true) {
ByteBuffer buffer = accessor.readLocation(location).toByteBuffer();
for (int i = 0; i < BATCH_CONTROL_RECORD_MAGIC.length; i++) {
if (buffer.get() != BATCH_CONTROL_RECORD_MAGIC[i]) {
throw new IOException("Bad control record magic for location: " + location);
}
}
if (isChecksum()) {
long expectedChecksum = buffer.getLong();
byte data[] = new byte[buffer.remaining()];
Checksum checksum = new Adler32();
buffer.get(data);
checksum.update(data, 0, data.length);
if (expectedChecksum != checksum.getValue()) {
throw new IOException("Bad checksum for location: " + location);
}
}
Location next = goToNextLocation(location, Location.BATCH_CONTROL_RECORD_TYPE, true);
if (next != null) {
location = next;
} else {
break;
}
}
return location;
}
代码示例来源:origin: org.apache.qpid/proton-hawtdispatch
@Override
public void onTransportCommand(Object command) {
if( state != CONNECTED ) {
return;
}
try {
Buffer buffer;
if (command.getClass() == AmqpHeader.class) {
buffer = ((AmqpHeader) command).getBuffer();
} else {
buffer = (Buffer) command;
}
ByteBuffer bbuffer = buffer.toByteBuffer();
do {
ByteBuffer input = protonTransport.getInputBuffer();
ByteBufferUtils.pour(bbuffer, input);
protonTransport.processInput();
} while (bbuffer.remaining() > 0);
process();
pumpOut();
} catch (Exception e) {
onFailure(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!