view src/main/java/jp/ac/u_ryukyu/treevnc/ChildNodeAnnounce.java @ 412:372532ae5f4d

Add ErrorAnnounce
author innparusu
date Thu, 19 Nov 2015 16:53:50 +0900
parents
children
line wrap: on
line source

package jp.ac.u_ryukyu.treevnc;

import com.glavsoft.rfb.encoding.EncodingType;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * Created by one on 11/19/15.
 */
public class ChildNodeAnnounce {
    private ByteBuffer msg;

    public ChildNodeAnnounce(EncodingType announce, byte[] error, short id) {
        msg = ByteBuffer.allocate(16+4+error.length).order(ByteOrder.BIG_ENDIAN);
        msg.put((byte) 0); // FrameBufferUpdate
        msg.put((byte) 0); // padding
        msg.putShort((short) 1); // number of rectangle
        msg.putShort((short) id);
        msg.putShort((short) 0);
        msg.putShort((short) 0);
        msg.putShort((short) 0);
        msg.putInt(announce.getId());
        msg.putInt(error.length);
        msg.put(error);

        msg.flip();

    }

    public ByteBuffer getMessage(){
        return msg;
    }

}