view src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java @ 237:0815ed7f54a7

clean code.
author oc
date Sat, 11 Oct 2014 14:13:29 +0900
parents 8479ad028ec7
children
line wrap: on
line source

package jp.ac.u_ryukyu.treevnc;

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

import com.glavsoft.rfb.encoding.EncodingType;

public class UpdateRectangleMessage {

    private ByteBuffer msg;

    public UpdateRectangleMessage(int width, int height,
            EncodingType desktopSize, byte[] initData, short id) {
        msg = ByteBuffer.allocate(16+4+initData.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) width);
        msg.putShort((short) height);
        msg.putInt(desktopSize.getId());
        msg.putInt(initData.length);
        msg.put(initData);

        msg.flip();

    }

    public ByteBuffer getMessage(){
        return msg;
    }


}