annotate src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java @ 107:660b296d4f75

send change screen command throw the tree.
author oc
date Fri, 23 May 2014 17:56:42 +0900
parents
children 1bceae0f5bd3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
107
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
1 package jp.ac.u_ryukyu.treevnc;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
2
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
3 import com.glavsoft.exceptions.TransportException;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
4 import com.glavsoft.rfb.client.ClientToServerMessage;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
5 import com.glavsoft.transport.Writer;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
6
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
7 /**
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
8 * ClientCutText
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
9 * The client has new ISO 8859-1 (Latin-1) text in its cut buffer. Ends of lines are repre-
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
10 * sented by the linefeed / newline character (value 10) alone. No carriage-return (value
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
11 * 13) is needed. There is currently no way to transfer text outside the Latin-1 character
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
12 * set.
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
13 * 1 - U8 - 6
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
14 * 3 - - padding
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
15 * 4 - U32 - length
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
16 * length - U8 array - text
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
17 */
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
18 public class ScreenChangeRequest implements ClientToServerMessage {
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
19 private final byte [] bytes;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
20
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
21 public ScreenChangeRequest(byte[] bytes) {
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
22 this.bytes = bytes;
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
23 }
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
24
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
25 @Override
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
26 public void send(Writer writer) throws TransportException {
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
27 writer.write(SERVER_CHANGE_REQUEST);
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
28 writer.writeByte(0); writer.writeInt16(0); // padding
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
29 writer.write(bytes.length);
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
30 writer.write(bytes); // TODO: [dime] convert 'text' String to byte arrya using right charset
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
31 writer.flush();
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
32 }
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
33
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
34 @Override
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
35 public String toString() {
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
36 return "ClientCutTextMessage: [length: " + bytes.length +", text: ...]";
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
37 }
660b296d4f75 send change screen command throw the tree.
oc
parents:
diff changeset
38 }