1 22 package org.xsocket.stream; 23 24 import java.io.IOException ; 25 import java.io.UnsupportedEncodingException ; 26 import java.nio.BufferUnderflowException ; 27 import java.nio.ByteBuffer ; 28 import java.nio.channels.WritableByteChannel ; 29 30 import org.xsocket.ClosedConnectionException; 31 import org.xsocket.MaxReadSizeExceededException; 32 33 34 39 public interface INonBlockingConnection extends IConnection { 40 41 public static final int UNLIMITED = Integer.MAX_VALUE; 42 public static final FlushMode INITIAL_FLUSH_MODE = FlushMode.SYNC; 43 44 45 50 public int getNumberOfAvailableBytes(); 51 52 53 54 63 public int indexOf(String str); 64 65 66 76 public int getIndexOf(String str) throws IOException , ClosedConnectionException, BufferUnderflowException ; 77 78 79 91 public int getIndexOf(String str, int maxLength) throws IOException , ClosedConnectionException, BufferUnderflowException , MaxReadSizeExceededException; 92 93 94 95 96 103 public ByteBuffer [] readAvailable() throws IOException , ClosedConnectionException; 104 105 106 107 122 public boolean readAvailableByDelimiter(String delimiter, WritableByteChannel outputChannel) throws IOException , ClosedConnectionException; 123 124 125 139 public boolean readAvailableByDelimiter(String delimiter, String encoding, WritableByteChannel outputChannel) throws IOException , ClosedConnectionException; 140 141 142 143 155 public ByteBuffer [] readByteBufferByDelimiter(String delimiter) throws IOException , ClosedConnectionException, BufferUnderflowException ; 156 157 158 159 172 public ByteBuffer [] readByteBufferByDelimiter(String delimiter, int maxLength) throws IOException , ClosedConnectionException, MaxReadSizeExceededException, BufferUnderflowException ; 173 174 175 176 177 189 public ByteBuffer [] readByteBufferByLength(int length) throws IOException , ClosedConnectionException, BufferUnderflowException ; 190 191 192 205 public byte[] readBytesByDelimiter(String delimiter) throws IOException , ClosedConnectionException, BufferUnderflowException ; 206 207 208 209 222 public byte[] readBytesByDelimiter(String delimiter, int maxLength) throws IOException , ClosedConnectionException, MaxReadSizeExceededException, BufferUnderflowException ; 223 224 225 226 227 239 public byte[] readBytesByLength(int length) throws IOException , ClosedConnectionException, BufferUnderflowException ; 240 241 242 243 254 public String readStringByDelimiter(String delimiter) throws IOException , ClosedConnectionException, BufferUnderflowException , UnsupportedEncodingException ; 255 256 257 258 270 public String readStringByDelimiter(String delimiter, int maxLength) throws IOException , ClosedConnectionException, BufferUnderflowException , UnsupportedEncodingException , MaxReadSizeExceededException; 271 272 273 274 284 public String readStringByLength(int length) throws IOException , ClosedConnectionException, BufferUnderflowException , UnsupportedEncodingException ; 285 286 287 298 public String readStringByDelimiter(String delimiter, String encoding) throws IOException , ClosedConnectionException, BufferUnderflowException , UnsupportedEncodingException ; 299 300 301 302 314 public String readStringByDelimiter(String delimiter, String encoding, int maxLength) throws IOException , ClosedConnectionException, BufferUnderflowException , UnsupportedEncodingException , MaxReadSizeExceededException; 315 316 317 318 319 330 public String readStringByLength(int length, String encoding) throws IOException , ClosedConnectionException, BufferUnderflowException , UnsupportedEncodingException ; 331 332 333 341 public int readInt() throws IOException , ClosedConnectionException, BufferUnderflowException ; 342 343 344 352 public long readLong() throws IOException , ClosedConnectionException, BufferUnderflowException ; 353 354 355 363 public double readDouble() throws IOException , ClosedConnectionException, BufferUnderflowException ; 364 365 366 374 public byte readByte() throws IOException , ClosedConnectionException, BufferUnderflowException ; 375 376 377 392 public void setWriteTransferRate(int bytesPerSecond) throws ClosedConnectionException, IOException ; 393 394 395 403 public void flush() throws ClosedConnectionException, IOException ; 404 405 406 407 423 public int write(ByteBuffer buffer) throws ClosedConnectionException, IOException ; 424 425 426 442 public long write(ByteBuffer [] buffers) throws ClosedConnectionException, IOException ; 443 444 445 446 458 public void setFlushmode(FlushMode flushMode); 459 460 464 public FlushMode getFlushmode(); 465 466 467 475 public INonBlockingConnection setOption(String name, Object value) throws IOException ; 476 477 } 478 | Popular Tags |