Mercurial > hg > Applications > TreeVNC
view src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java @ 145:649794dfb9d5
add my hostname to handle multiple network
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 12 Jun 2014 22:01:05 +0900 |
parents | bce2ef0a2e79 |
children | 2c36ea3f93da |
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; public ScreenChangeRequest(String adr) { this.bytes = adr; System.out.println("Client send change screen server request :" + adr); } @Override public void send(Writer writer) throws TransportException { ByteBuffer out = ByteBuffer.allocate(bytes.length()+16); out.order(ByteOrder.BIG_ENDIAN); out.put(SERVER_CHANGE_REQUEST); out.put((byte)0); out.putShort((byte)0); // padding out.putInt(bytes.length()); out.put(bytes.getBytes()); writer.write(out.array(), 0, out.position()); writer.flush(); } @Override public String toString() { return "Screen change request: [length: " + bytes.length() +", text: ...]" + new String (bytes); } }