Mercurial > hg > Applications > TreeVNC
view src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java @ 232:6ee4cdca104c
send value of port and localhost in checkdelay framebufferupdate, and get this.
author | oc |
---|---|
date | Fri, 10 Oct 2014 23:39:44 +0900 |
parents | 5eb8aa65f387 |
children | 8479ad028ec7 |
line wrap: on
line source
package jp.ac.u_ryukyu.treevnc; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import com.glavsoft.rfb.encoding.EncodingType; public class UpdateRectangleMessage { private ByteBuffer msg; public UpdateRectangleMessage(int i, int j, int width, int height, long time, int port, String localhost, EncodingType desktopSize) throws UnsupportedEncodingException { byte[] bytelocalhost = localhost.getBytes("UTF-8"); msg = ByteBuffer.allocate(52).order(ByteOrder.BIG_ENDIAN); msg.put((byte) 0); // FrameBufferUpdate msg.put((byte) 0); // padding msg.putShort((short) 1); // number of rectangle msg.putShort((short) i); msg.putShort((short) j); msg.putShort((short) width); msg.putShort((short) height); msg.putInt(desktopSize.getId()); msg.putLong(time); msg.putInt(port); msg.putInt(localhost.length()); msg.put(bytelocalhost); msg.flip(); } 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; } }