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

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

Introduction

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

Prototype

public ValueWriter(DataOutputStream out) 

Source Link

Usage

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

License:Apache License

/**
 * Convert a map to an AMQP table/*  w w w  .j av  a  2s.  c  om*/
 *
 * @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);
    }
}