1 14 15 package org.quickserver.net.server; 16 17 import java.io.BufferedInputStream ; 18 import java.io.BufferedOutputStream ; 19 import java.io.BufferedReader ; 20 import java.io.BufferedWriter ; 21 import java.io.IOException ; 22 import java.io.InputStream ; 23 import java.io.ObjectInputStream ; 24 import java.io.ObjectOutputStream ; 25 import java.io.OutputStream ; 26 import java.io.OutputStreamWriter ; 27 import java.net.InetAddress ; 28 import java.net.Socket ; 29 import java.net.SocketException ; 30 import java.nio.channels.ClosedChannelException ; 31 import java.nio.channels.SelectionKey ; 32 import java.nio.channels.SocketChannel ; 33 import java.security.KeyManagementException ; 34 import java.security.NoSuchAlgorithmException ; 35 import java.sql.Connection ; 36 import java.util.Date ; 37 import java.util.logging.Level ; 38 import java.util.logging.Logger ; 39 import javax.net.ssl.SSLSocket; 40 import org.quickserver.util.MyString; 41 42 50 public interface ClientHandler extends Runnable { 51 52 56 void addEvent(ClientEvent event); 57 58 62 void removeEvent(ClientEvent event); 63 64 void clean(); 65 66 67 void closeConnection(); 68 69 73 void forceClose() throws IOException ; 74 75 79 Logger getAppLogger(); 80 81 87 BufferedInputStream getBufferedInputStream(); 88 89 95 BufferedOutputStream getBufferedOutputStream(); 96 97 102 BufferedReader getBufferedReader(); 103 104 105 110 String getCharset(); 111 112 118 Date getClientConnectedTime(); 119 120 125 ClientData getClientData(); 126 127 132 boolean getCommunicationLogging(); 133 134 139 DataMode getDataMode(DataType dataType); 140 141 145 String getHostAddress(); 146 147 151 InputStream getInputStream(); 152 153 159 Date getLastCommunicationTime(); 160 161 166 String getMaxConnectionMsg(); 167 168 172 String getName(); 173 174 182 ObjectInputStream getObjectInputStream(); 183 184 192 ObjectOutputStream getObjectOutputStream(); 193 194 199 OutputStream getOutputStream(); 200 201 205 SelectionKey getSelectionKey(); 206 207 210 QuickServer getServer(); 211 212 213 Socket getSocket(); 214 215 219 SocketChannel getSocketChannel(); 220 221 226 int getTimeout(); 227 228 234 void handleClient(TheClient theClient); 235 236 240 boolean hasEvent(ClientEvent event); 241 242 247 String info(); 248 249 254 boolean isClientEventNext(ClientEvent clientEvent); 255 256 260 boolean isClosed(); 261 262 263 268 boolean isConnected() throws SocketException ; 269 270 275 boolean isOpen(); 276 277 283 boolean isSecure(); 284 285 294 void makeSecure() throws IOException , NoSuchAlgorithmException , KeyManagementException ; 295 296 307 void makeSecure(boolean useClientMode, boolean needClientAuth, boolean autoClose, String protocol) throws IOException , NoSuchAlgorithmException , KeyManagementException ; 308 309 317 void makeSecure(String protocol) throws IOException , NoSuchAlgorithmException , KeyManagementException ; 318 319 326 byte[] readBinary() throws IOException ; 327 328 335 String readBytes() throws IOException ; 336 337 342 void registerForRead() throws IOException , ClosedChannelException ; 343 344 348 void registerForWrite() throws IOException , ClosedChannelException ; 349 350 void run(); 351 352 359 void sendClientBinary(byte[] data) throws IOException ; 360 361 368 void sendClientBinary(byte[] data, int off, int len) throws IOException ; 369 370 377 void sendClientBytes(String msg) throws IOException ; 378 379 386 void sendClientMsg(String msg) throws IOException ; 387 388 399 void sendClientObject(Object msg) throws IOException ; 400 401 405 void sendSystemMsg(String msg); 406 407 412 void sendSystemMsg(String msg, Level level); 413 414 420 void setCharset(String charset); 421 422 427 void setCommunicationLogging(boolean communicationLogging); 428 429 440 void setDataMode(DataMode dataMode, DataType dataType) throws IOException ; 441 442 446 void setMaxConnectionMsg(String msg); 447 448 455 void setOutputStream(OutputStream out) throws IOException ; 456 457 463 void setSecure(boolean secure); 464 465 469 void setSelectionKey(SelectionKey selectionKey); 470 471 476 void setSocket(Socket socket); 477 478 482 void setSocketChannel(SocketChannel socketChannel); 483 484 490 void setTimeout(int time); 491 492 497 String toString(); 498 499 505 void updateInputOutputStreams() throws IOException ; 506 507 511 void updateLastCommunicationTime(); 512 513 522 Connection getConnection(String id) throws Exception ; 523 524 529 boolean isConected() throws SocketException ; 530 531 537 void sendSystemMsg(String msg, boolean newline); 538 539 544 BufferedWriter getBufferedWriter(); 545 } 546 | Popular Tags |