Mercurial > hg > Applications > TreeVNC
view src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java @ 275:0f9b3de45fb2
set main display size.
author | oc |
---|---|
date | Tue, 06 Jan 2015 19:07:27 +0900 |
parents | 11b59b223222 |
children | 9c5874d0f37e |
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; /** * ClientCutText * The client has new ISO 8859-1 (Latin-1) text in its cut buffer. Ends of lines are repre- * sented by the linefeed / newline character (value 10) alone. No carriage-return (value * 13) is needed. There is currently no way to transfer text outside the Latin-1 character * set. * 1 - U8 - 6 * 3 - - padding * 4 - U32 - length * length - U8 array - text */ public class ScreenChangeRequest implements ClientToServerMessage { final String bytes; private short id; private int frameSizeWidth; private int frameSizeHeight; public ScreenChangeRequest(String adr, short id, int width, int height) { this.bytes = adr; this.id = id; this.frameSizeWidth = width; this.frameSizeHeight = height; System.out.println("Client send change screen server request :" + adr); } @Override public void send(Writer writer) throws TransportException { ByteBuffer out = ByteBuffer.allocate(bytes.length()+25); 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(frameSizeWidth); out.putInt(frameSizeHeight); writer.write(out.array(), 0, out.position()); writer.flush(); } @Override public String toString() { return "Screen change request: [length: " + bytes.length() +", text: ...]" + new String (bytes); } }