Mercurial > hg > Applications > TreeVNC
view src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java @ 178:34b7558aeffa
remove TreeTask, StartTreeHandling
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 22 Jun 2014 19:05:04 +0900 |
parents | 26bc52699cf3 |
children | b3426724667b |
line wrap: on
line source
package com.glavsoft.rfb.encoding.decoder; import jp.ac.u_ryukyu.treevnc.MyRfbProto; import com.glavsoft.drawing.Renderer; import com.glavsoft.exceptions.TransportException; import com.glavsoft.rfb.encoding.EncodingType; import com.glavsoft.transport.Reader; public class ZRLEESender extends Decoder { private MyRfbProto rfb; public ZRLEESender(MyRfbProto rfb) { this.rfb = rfb; } public ZRLEESender() { } @Override public void decode(Reader reader, Renderer renderer, FramebufferUpdateRectangle rect) throws TransportException { int dataLen = getZrleLength(rect, reader); reader.reset(); // TreeVNC handling rfb.readSendData(dataLen, reader); // reader is reseted read again if (rfb.hasViewer()) { reader.reset(); // decode data when it is a client reader.readBytes(8); reader.readByte();// message reader.readByte();// padding reader.readUInt16();// numberOfRectangle rect.fill(reader);// fill Decoder decoder = new ZRLEDecoder(); if (!rfb.getCuiVersion()) decoder.decode(reader, renderer, rect); else { reader.readBytes((int) reader.readUInt32()); } } } private int getZrleLength(FramebufferUpdateRectangle rect, Reader reader) throws TransportException { int zrleLength = 0; if (rect.getEncodingType() == EncodingType.ZRLE || rect.getEncodingType() == EncodingType.ZRLEE || rect.getEncodingType() == EncodingType.ZLIB) { zrleLength = reader.readInt32(); } return zrleLength + 20; } public void readCheckDelay(Reader reader) { try { reader.reset(); rfb.readCheckDelay(reader); } catch (TransportException e) { e.printStackTrace(); } } }