1 22 23 package org.xsocket.stream; 24 25 import java.io.IOException ; 26 import java.io.UnsupportedEncodingException ; 27 import java.net.SocketTimeoutException ; 28 import java.nio.ByteBuffer ; 29 30 import org.xsocket.ClosedConnectionException; 31 import org.xsocket.MaxReadSizeExceededException; 32 33 34 40 public interface IBlockingConnection extends IConnection { 41 42 public static final long INITIAL_RECEIVE_TIMEOUT = 1 * 60 * 1000; 43 44 45 50 public void setReceiveTimeoutMillis(long timeout); 51 52 53 66 public String readStringByDelimiter(String delimiter) throws IOException , ClosedConnectionException, UnsupportedEncodingException , SocketTimeoutException ; 67 68 69 70 71 85 public String readStringByDelimiter(String delimiter, int maxLength) throws IOException , ClosedConnectionException, UnsupportedEncodingException , SocketTimeoutException , MaxReadSizeExceededException; 86 87 88 89 101 public String readStringByDelimiter(String delimiter, String encoding) throws IOException , ClosedConnectionException, UnsupportedEncodingException , SocketTimeoutException ; 102 103 104 105 106 119 public String readStringByDelimiter(String delimiter, String encoding, int maxLength) throws IOException , ClosedConnectionException, UnsupportedEncodingException , SocketTimeoutException , MaxReadSizeExceededException; 120 121 122 123 124 133 public String readStringByLength(int length) throws IOException , ClosedConnectionException, SocketTimeoutException ; 134 135 136 148 public String readStringByLength(int length, String encoding) throws IOException , ClosedConnectionException, SocketTimeoutException ; 149 150 151 152 165 public ByteBuffer [] readByteBufferByDelimiter(String delimiter) throws IOException , ClosedConnectionException, SocketTimeoutException ; 166 167 168 169 170 183 public ByteBuffer [] readByteBufferByDelimiter(String delimiter, int maxLength) throws IOException , ClosedConnectionException, SocketTimeoutException , MaxReadSizeExceededException; 184 185 186 187 198 public ByteBuffer [] readByteBufferByLength(int length) throws IOException , ClosedConnectionException, SocketTimeoutException ; 199 200 201 202 214 public byte[] readBytesByDelimiter(String delimiter) throws IOException , ClosedConnectionException, SocketTimeoutException ; 215 216 217 218 231 public byte[] readBytesByDelimiter(String delimiter, int maxLength) throws IOException , ClosedConnectionException, SocketTimeoutException , MaxReadSizeExceededException; 232 233 234 235 236 246 public int getIndexOf(String str) throws IOException , ClosedConnectionException, SocketTimeoutException ; 247 248 249 261 public int getIndexOf(String str, int maxLength) throws IOException , ClosedConnectionException, MaxReadSizeExceededException, SocketTimeoutException ; 262 263 264 265 266 277 public byte[] readBytesByLength(int length) throws IOException , ClosedConnectionException, SocketTimeoutException ; 278 279 280 281 289 public int readInt() throws IOException , ClosedConnectionException, SocketTimeoutException ; 290 291 292 300 public long readLong() throws IOException , ClosedConnectionException, SocketTimeoutException ; 301 302 303 311 public double readDouble() throws IOException , ClosedConnectionException, SocketTimeoutException ; 312 313 314 315 323 public byte readByte() throws IOException , ClosedConnectionException, SocketTimeoutException ; 324 325 326 336 public int write(String message, String encoding) throws ClosedConnectionException, IOException , SocketTimeoutException ; 337 338 339 348 public int write(String message) throws ClosedConnectionException, IOException , SocketTimeoutException ; 349 350 351 360 public int write(byte b) throws ClosedConnectionException, IOException , SocketTimeoutException ; 361 362 363 372 public int write(byte... bytes) throws ClosedConnectionException, IOException , SocketTimeoutException ; 373 374 375 386 public int write(byte[] bytes, int offset, int length) throws ClosedConnectionException, IOException , SocketTimeoutException ; 387 388 389 398 public int write(ByteBuffer buffer) throws ClosedConnectionException, IOException , SocketTimeoutException ; 399 400 401 410 public long write(ByteBuffer [] buffers) throws ClosedConnectionException, IOException , SocketTimeoutException ; 411 412 413 422 public int write(int i) throws ClosedConnectionException, IOException , SocketTimeoutException ; 423 424 425 434 public int write(long l) throws ClosedConnectionException, IOException , SocketTimeoutException ; 435 436 437 446 public int write(double d) throws ClosedConnectionException, IOException , SocketTimeoutException ; 447 448 449 450 459 public void flush() throws ClosedConnectionException, IOException , SocketTimeoutException ; 460 461 462 463 464 472 public IBlockingConnection setOption(String name, Object value) throws IOException ; 473 } 474 | Popular Tags |