annotate src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java @ 182:b3426724667b

fix read send data.
author oc
date Mon, 23 Jun 2014 19:30:51 +0900
parents 34b7558aeffa
children 6f452c497e0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
1 package com.glavsoft.rfb.encoding.decoder;
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
2
32
758d025ee24b add TextBox.java
one
parents: 29
diff changeset
3 import jp.ac.u_ryukyu.treevnc.MyRfbProto;
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
4
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
5 import com.glavsoft.drawing.Renderer;
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
6 import com.glavsoft.exceptions.TransportException;
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
7 import com.glavsoft.rfb.encoding.EncodingType;
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
8 import com.glavsoft.transport.Reader;
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
9
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
10 public class ZRLEESender extends Decoder {
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
11
29
57eb5575e6c4 MyRfbProto for client and proxy.
one
parents: 28
diff changeset
12 private MyRfbProto rfb;
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
13
29
57eb5575e6c4 MyRfbProto for client and proxy.
one
parents: 28
diff changeset
14 public ZRLEESender(MyRfbProto rfb) {
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
15 this.rfb = rfb;
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
16 }
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
17
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
18 public ZRLEESender() {
28
18fad65bc447 Create MyRfbProto.java
one
parents: 26
diff changeset
19 }
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
20
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
21 @Override
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
22 public void decode(Reader reader, Renderer renderer,
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
23 FramebufferUpdateRectangle rect) throws TransportException {
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
24 int dataLen = getZrleLength(rect, reader);
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
25 reader.reset();
182
b3426724667b fix read send data.
oc
parents: 178
diff changeset
26 byte[] bytes = new byte[dataLen];
135
ada4d850a820 lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
27 // TreeVNC handling
182
b3426724667b fix read send data.
oc
parents: 178
diff changeset
28 rfb.readSendData(dataLen, reader, bytes);
135
ada4d850a820 lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
29 // reader is reseted read again
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
30
178
34b7558aeffa remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 166
diff changeset
31 if (rfb.hasViewer()) {
166
26bc52699cf3 send initData to lower node.
oc
parents: 135
diff changeset
32 reader.reset();
103
84f254d8bde4 remove isinstaceof
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 68
diff changeset
33 // decode data when it is a client
182
b3426724667b fix read send data.
oc
parents: 178
diff changeset
34 if (!rfb.isRoot())
b3426724667b fix read send data.
oc
parents: 178
diff changeset
35 reader.readBytes(8);
33
9d3478d11d3b Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
36 reader.readByte();// message
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
37 reader.readByte();// padding
33
9d3478d11d3b Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
38 reader.readUInt16();// numberOfRectangle
9d3478d11d3b Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
39 rect.fill(reader);// fill
182
b3426724667b fix read send data.
oc
parents: 178
diff changeset
40 ZRLEDecoder decoder = new ZRLEDecoder();
b3426724667b fix read send data.
oc
parents: 178
diff changeset
41 if (rfb.isRoot())
b3426724667b fix read send data.
oc
parents: 178
diff changeset
42 decoder.decode1(reader, renderer, rect, bytes, dataLen);
b3426724667b fix read send data.
oc
parents: 178
diff changeset
43 else if (!rfb.getCuiVersion())
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
44 decoder.decode(reader, renderer, rect);
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
45 else {
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
46 reader.readBytes((int) reader.readUInt32());
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
47 }
33
9d3478d11d3b Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
48 }
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
49 }
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
50
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
51 private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader)
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
52 throws TransportException {
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
53 int zrleLength = 0;
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
54 if (rect.getEncodingType() == EncodingType.ZRLE
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
55 || rect.getEncodingType() == EncodingType.ZRLEE
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
56 || rect.getEncodingType() == EncodingType.ZLIB) {
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
57 zrleLength = reader.readInt32();
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
58 }
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
59 return zrleLength + 20;
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
60 }
66
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
61
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
62 public void readCheckDelay(Reader reader) {
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
63 try {
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
64 reader.reset();
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
65 rfb.readCheckDelay(reader);
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
66 } catch (TransportException e) {
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
67 e.printStackTrace();
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
68 }
84ad879891e9 dont move
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 65
diff changeset
69 }
26
73b13bc335c2 add ZRLEESender.java, NullRenderer.java and NullRepaintController.java
one
parents:
diff changeset
70 }