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