Mercurial > hg > Applications > TreeVNC
view src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java @ 417:c225c7963778
Send screen position
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 14 Dec 2015 16:20:20 +0900 |
parents | da1d6d6b4981 |
children | ed15f0bd8dfa |
line wrap: on
line source
package jp.ac.u_ryukyu.treevnc; import java.nio.ByteBuffer; import java.nio.ByteOrder; import com.glavsoft.exceptions.TransportException; import com.glavsoft.rfb.client.ClientToServerMessage; import com.glavsoft.transport.Writer; /** * ServerChangeRequest * Change VNCServer * 1 - U8 - 240 * 3 - - padding * 4 - - id * 4 - U32 - length * length - U8 array - text */ public class ScreenChangeRequest implements ClientToServerMessage { final String bytes; private final int scale; private final int x; private final int y; private short id; private int frameSizeWidth; private int frameSizeHeight; private int port; private int shareScreenNumber; public ScreenChangeRequest(String adr, int port, short id, int x, int y, int width, int height, int shareScreenNumber, int scale) { this.bytes = adr; this.port = port; this.id = id; this.x = x; this.y = y; this.frameSizeWidth = width; this.frameSizeHeight = height; this.shareScreenNumber = shareScreenNumber; this.scale = scale; System.out.println("Client send change screen server request :" + adr); } @Override public void send(Writer writer) throws TransportException { ByteBuffer out = ByteBuffer.allocate(bytes.length()+37); out.order(ByteOrder.BIG_ENDIAN); out.put(SERVER_CHANGE_REQUEST); out.put((byte)0); // padding out.putShort(id); out.putInt(bytes.length()); out.put(bytes.getBytes()); out.putInt(x); out.putInt(y); out.putInt(frameSizeWidth); out.putInt(frameSizeHeight); out.putInt(port); out.putInt(shareScreenNumber); out.putInt(scale); writer.write(out.array(), 0, out.position()); writer.flush(); } @Override public String toString() { return "Screen change request: [length: " + bytes.length() +", text: ...]" + new String (bytes) + " : " + port; } }