comparison src/main/java/com/glavsoft/rfb/encoding/ServerInitMessage.java @ 0:4689cc86d6cb

create TreeViewer2 Repository
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Tue, 03 Jul 2012 13:20:49 +0900
parents
children 718cdde720d4 17b702648079
comparison
equal deleted inserted replaced
-1:000000000000 0:4689cc86d6cb
1 // Copyright (C) 2010, 2011 GlavSoft LLC.
2 // All rights reserved.
3 //
4 //-------------------------------------------------------------------------
5 // This file is part of the TightVNC software. Please visit our Web site:
6 //
7 // http://www.tightvnc.com/
8 //
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License along
20 // with this program; if not, write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 //-------------------------------------------------------------------------
23 //
24
25 package com.glavsoft.rfb.encoding;
26
27 import com.glavsoft.exceptions.TransportException;
28 import com.glavsoft.transport.Reader;
29
30 /**
31 * Struct filled from the ServerInit message
32 * 2 - U16 - framebuffer-width
33 * 2 - U16 - framebuffer-height
34 * 16 - PixelFormat - server-pixel-format
35 * 4 - U32 - name-length
36 * name-length - U8 array - name-string
37 */
38 public class ServerInitMessage {
39 protected int frameBufferWidth;
40 protected int frameBufferHeight;
41 protected PixelFormat pixelFormat;
42 protected String name;
43
44 public ServerInitMessage(Reader reader) throws TransportException {
45 frameBufferWidth = reader.readUInt16();
46 frameBufferHeight = reader.readUInt16();
47 pixelFormat = new PixelFormat();
48 pixelFormat.fill(reader);
49 name = reader.readString();
50 }
51
52 protected ServerInitMessage() {
53 // empty
54 }
55
56 public int getFrameBufferWidth() {
57 return frameBufferWidth;
58 }
59
60 public int getFrameBufferHeight() {
61 return frameBufferHeight;
62 }
63
64 public PixelFormat getPixelFormat() {
65 return pixelFormat;
66 }
67
68 public String getName() {
69 return name;
70 }
71
72 @Override
73 public String toString() {
74 return "ServerInitMessage: [name: "+ name +
75 ", framebuffer-width: " + String.valueOf(frameBufferWidth) +
76 ", framebuffer-height: " + String.valueOf(frameBufferHeight) +
77 ", server-pixel-format: " + pixelFormat +
78 "]";
79 }
80 }