Mercurial > hg > Applications > TreeVNC
changeset 548:673f0e672a02
fix MessageDump method
author | e165729 <e165729@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Dec 2019 19:14:43 +0900 |
parents | 6b6e022e48d4 |
children | e68154211286 |
files | src/main/java/com/glavsoft/rfb/encoding/decoder/ZlibDecoder.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java |
diffstat | 3 files changed, 19 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZlibDecoder.java Mon Dec 16 15:49:56 2019 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZlibDecoder.java Tue Dec 24 19:14:43 2019 +0900 @@ -59,6 +59,7 @@ } decoder.setInput(bytes, 0, zippedLength); try { + messageDump(new Reader(new ByteArrayInputStream(bytes)), "infrate: "); decoder.inflate(bytes, zippedLength, length); } catch (DataFormatException e) { throw new TransportException("cannot inflate Zlib data", e); @@ -71,4 +72,17 @@ decoder = null; } + private void messageDump(Reader reader, String msg) { + System.out.print(msg); + reader.mark(30); + try { + for (int i = 0; i < 24; i++) { // 20 + 4 + System.out.print(String.format("%02x ", reader.readByte())); + } + reader.reset(); + } catch (TransportException e) { + + } + System.out.println(); + } }
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Mon Dec 16 15:49:56 2019 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Tue Dec 24 19:14:43 2019 +0900 @@ -203,7 +203,7 @@ } else { reader.mark(20+4); } - rfb.messageDump(reader, "get receive massage: "); + //rfb.messageDump(reader, "get receive massage: "); return reader.readByte(); }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Mon Dec 16 15:49:56 2019 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Tue Dec 24 19:14:43 2019 +0900 @@ -350,7 +350,7 @@ while (inputIndex < bufs.size()) { ByteBuffer b = bufs.get(inputIndex++); os.write(b.array(), b.position(), b.limit()); - messageDump(new Reader(new ByteArrayInputStream(b.array())), "write to client: "); + //messageDump(new Reader(new ByteArrayInputStream(b.array())), "write to client: "); } os.flush(); multicastqueue.heapAvailable(); @@ -958,17 +958,14 @@ public void messageDump(Reader reader, String msg) { System.out.print(msg); try { + reader.mark(30); for (int i = 0; i < 24; i++) { // 20 + 4 - System.out.print(String.format("%02x " ,reader.readByte())); + System.out.print(String.format("%02x ", reader.readByte())); } + reader.reset(); } catch (TransportException e) { } System.out.println(); - try { - reader.reset(); - } catch (TransportException e) { - - } } } \ No newline at end of file