Source Code Cross Referenced for StreamExchangeDbImpl.java in  » Net » Remote-desktop » org » rdesktop » objects » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Remote desktop » org.rdesktop.objects 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        ///////////////////////////////////////////////////////////////////////////////
002:        //
003:        //   Copyright (C) 2003-@year@ by Thomas M. Hazel, MyOODB (www.myoodb.org)
004:        //
005:        //                          All Rights Reserved
006:        //
007:        //   This program is free software; you can redistribute it and/or modify
008:        //   it under the terms of the GNU General Public License and GNU Library
009:        //   General Public License as published by the Free Software Foundation;
010:        //   either version 2, or (at your option) any later version.
011:        //
012:        //   This program is distributed in the hope that it will be useful,
013:        //   but WITHOUT ANY WARRANTY; without even the implied warranty of
014:        //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015:        //   GNU General Public License and GNU Library General Public License
016:        //   for more details.
017:        //
018:        //   You should have received a copy of the GNU General Public License
019:        //   and GNU Library General Public License along with this program; if
020:        //   not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
021:        //   MA 02139, USA.
022:        //
023:        ///////////////////////////////////////////////////////////////////////////////
024:
025:        package org.rdesktop.objects;
026:
027:        import java.io.*;
028:        import java.net.*;
029:
030:        public class StreamExchangeDbImpl extends
031:                org.myoodb.collectable.CollectableDbImpl implements 
032:                StreamExchange {
033:            private static final org.myoodb.util.Logger LOGGER = org.myoodb.util.Logger
034:                    .getLogger(StreamExchange.class);
035:
036:            protected transient int m_port;
037:            protected transient String m_host;
038:            protected transient Socket m_socket;
039:            protected transient OutputStream m_outputStream;
040:            protected transient DataInputStream m_inputStream;
041:
042:            public StreamExchangeDbImpl() {
043:                m_inputStream = null;
044:                m_outputStream = null;
045:            }
046:
047:            public void onDelete() {
048:                super .onDelete();
049:
050:                try {
051:                    close();
052:                } catch (Exception e) {
053:                    LOGGER.error("failed close(" + m_host + "," + m_port + ")",
054:                            e);
055:                }
056:            }
057:
058:            public void open(String host, int port) throws java.io.IOException,
059:                    java.net.UnknownHostException {
060:                m_host = host;
061:                m_port = port;
062:
063:                try {
064:                    m_socket = new Socket(m_host, m_port);
065:
066:                    m_inputStream = new DataInputStream(
067:                            new BufferedInputStream(m_socket.getInputStream(),
068:                                    16384));
069:                    m_outputStream = m_socket.getOutputStream();
070:                } catch (java.io.IOException e) {
071:                    LOGGER.error("failed open(" + m_host + "," + m_port
072:                            + ") - " + e);
073:
074:                    throw e;
075:                }
076:            }
077:
078:            public String getHost() {
079:                return m_host;
080:            }
081:
082:            public int getPort() {
083:                return m_port;
084:            }
085:
086:            public void close() throws java.io.IOException {
087:                if (m_socket != null) {
088:                    m_socket.close();
089:                    m_socket = null;
090:                }
091:            }
092:
093:            public int available() throws java.io.IOException {
094:                return m_inputStream.available();
095:            }
096:
097:            public byte readByte() throws java.io.IOException {
098:                return m_inputStream.readByte();
099:            }
100:
101:            public byte[] readFully(int len) throws java.io.IOException {
102:                byte[] b = new byte[len];
103:
104:                m_inputStream.readFully(b);
105:
106:                return b;
107:            }
108:
109:            /*
110:            public void readFully(byte[] b) throws java.io.IOException
111:            {
112:                m_inputStream.readFully(b);
113:            }
114:
115:            public void readFully(byte[] b, int off, int len) throws java.io.IOException
116:            {
117:                m_inputStream.readFully(b, off, len);
118:            }
119:             */
120:
121:            public byte[] readFully(byte[] b) throws java.io.IOException {
122:                m_inputStream.readFully(b);
123:
124:                return b;
125:            }
126:
127:            public byte[] readFully(byte[] b, int off, int len)
128:                    throws java.io.IOException {
129:                m_inputStream.readFully(b, off, len);
130:
131:                return b;
132:            }
133:
134:            public int readInt() throws java.io.IOException {
135:                int x = m_inputStream.readInt();
136:
137:                return x;
138:            }
139:
140:            public int readUnsignedByte() throws java.io.IOException {
141:                int x = m_inputStream.readUnsignedByte();
142:
143:                return x;
144:            }
145:
146:            public int readUnsignedShort() throws java.io.IOException {
147:                int x = m_inputStream.readUnsignedShort();
148:
149:                return x;
150:            }
151:
152:            public int skipBytes(int n) throws java.io.IOException {
153:                return m_inputStream.skipBytes(n);
154:            }
155:
156:            public void write(byte[] b) throws java.io.IOException {
157:                m_outputStream.write(b);
158:            }
159:
160:            public void write(byte[] b, int off, int len)
161:                    throws java.io.IOException {
162:                m_outputStream.write(b, off, len);
163:            }
164:
165:            public void write(int b) throws java.io.IOException {
166:                m_outputStream.write(b);
167:            }
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.