Example usage for com.rabbitmq.client.impl MethodArgumentWriter MethodArgumentWriter

List of usage examples for com.rabbitmq.client.impl MethodArgumentWriter MethodArgumentWriter

Introduction

In this page you can find the example usage for com.rabbitmq.client.impl MethodArgumentWriter MethodArgumentWriter.

Prototype

public MethodArgumentWriter(ValueWriter out) 

Source Link

Document

Constructs a MethodArgumentWriter targeting the given DataOutputStream.

Usage

From source file:uk.trainwatch.rabbitmq.RabbitMQ.java

License:Apache License

/**
 * Convert a map to an AMQP table//from  w  w w. ja va 2s  .  c o  m
 *
 * @param args
 *
 * @return
 */
public static byte[] toAMQPTable(Map<String, Object> args) {
    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        MethodArgumentWriter writer = new MethodArgumentWriter(new ValueWriter(new DataOutputStream(buffer)));

        writer.writeTable(fixAMQPTable(args));
        writer.flush();
        return buffer.toByteArray();
    } catch (IOException ex) {
        throw new UncheckedIOException(ex);
    }
}