Example usage for com.rabbitmq.client.impl Frame writeTo

List of usage examples for com.rabbitmq.client.impl Frame writeTo

Introduction

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

Prototype

public void writeTo(DataOutputStream os) throws IOException 

Source Link

Document

Public API - writes this Frame to the given DataOutputStream

Usage

From source file:de.htwk_leipzig.bis.connection.handshake.clientRewrite.AMQCommand.java

License:Mozilla Public License

/**
 * Since we're using a pre-computed value for EMPTY_FRAME_SIZE we check this
 * is actually correct when run against the framing code in Frame.
 *///  ww  w  .  j a v a2  s  . c om
private static void checkEmptyFrameSize() {
    Frame f = new Frame(AMQP.FRAME_BODY, 0, new byte[0]);
    ByteArrayOutputStream s = new ByteArrayOutputStream();
    try {
        f.writeTo(new DataOutputStream(s));
    } catch (IOException ioe) {
        throw new AssertionError("IOException while checking EMPTY_FRAME_SIZE");
    }
    int actualLength = s.toByteArray().length;
    if (EMPTY_FRAME_SIZE != actualLength) {
        throw new AssertionError("Internal error: expected EMPTY_FRAME_SIZE(" + EMPTY_FRAME_SIZE
                + ") is not equal to computed value: " + actualLength);
    }
}