Mercurial > hg > Applications > TreeVNC
view src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java @ 246:5a09805898d2
small fix.
author | one@firefly.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Thu, 16 Oct 2014 18:45:48 +0900 |
parents | 2c36ea3f93da |
children | 11b59b223222 |
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; public ScreenChangeRequest(String adr, short id) { this.bytes = adr; this.id = id; 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(id); // 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); } }