1 28 29 package com.caucho.vfs; 30 31 import java.io.IOException ; 32 import java.net.InetAddress ; 33 import java.nio.channels.SelectableChannel ; 34 import java.security.cert.X509Certificate ; 35 36 39 abstract public class QSocket { 40 43 abstract public InetAddress getLocalAddress(); 44 45 48 abstract public int getLocalPort(); 49 50 53 abstract public InetAddress getRemoteAddress(); 54 55 58 public String getRemoteHost() 59 { 60 return getRemoteAddress().getHostAddress(); 61 } 62 63 66 public int getRemoteAddress(byte []buffer, int offset, int length) 67 { 68 String name = getRemoteHost(); 69 int len = name.length(); 70 71 for (int i = 0; i < len; i++) 72 buffer[i + offset] = (byte) name.charAt(i); 73 74 return len; 75 } 76 77 80 abstract public int getRemotePort(); 81 82 85 public boolean isSecure() 86 { 87 return false; 88 } 89 90 93 public SelectableChannel getSelectableChannel() 94 { 95 return null; 96 } 97 98 101 public boolean readNonBlock(int ms) 102 { 103 return false; 104 } 105 106 109 public String getCipherSuite() 110 { 111 return null; 112 } 113 114 117 public int getCipherBits() 118 { 119 return 0; 120 } 121 122 125 public X509Certificate getClientCertificate() 126 throws java.security.cert.CertificateException 127 { 128 return null; 129 } 130 131 134 public X509Certificate []getClientCertificates() 135 throws java.security.cert.CertificateException 136 { 137 X509Certificate cert = getClientCertificate(); 138 139 if (cert != null) 140 return new X509Certificate [] { cert }; 141 else 142 return null; 143 } 144 145 149 abstract public StreamImpl getStream() 150 throws IOException ; 151 152 153 156 abstract public long getTotalReadBytes(); 157 158 161 abstract public long getTotalWriteBytes(); 162 163 166 abstract public boolean isClosed(); 167 168 abstract public void close() 169 throws IOException ; 170 171 } 172 173 | Popular Tags |