@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); } }
@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); } }
public void send(AmqpHeader header) throws Exception { IntegrationTestLogger.LOGGER.info("Client sending header: " + header); OutputStream outputStream = clientSocket.getOutputStream(); header.getBuffer().writeTo(outputStream); outputStream.flush(); }
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(); }
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(); }
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(); }