org.xsocket.connection
Interface IWriteCompletionHandler

Package class diagram package IWriteCompletionHandler

public interface IWriteCompletionHandler

Call back handler. Example:

 class MyWriteCompletionHandler implements IWriteCompletionHandler {
 
    public void onWritten(int written) throws IOException {
       // ...
    }
    
    public void onException(IOException ioe) {
       // ...
    }
 }

 
 ReadableByteChannel channel = ...
 INonBlockingConnection con = ...
 MyWriteCompletionHandler writeCompletionHandler = new MyWriteCompletionHandler();
 
 con.setFlushmode(FlushMode.ASYNC);
 con.write(transferBuffer, writeCompletionHandler);  // returns immediately
 
 // ...
 
 


Method Summary
 void onException(IOException ioe)
          call back to sginal a write error
 void onWritten(int written)
          call back, which will be called after the data is written
 

Method Detail

onWritten

void onWritten(int written)
               throws IOException
call back, which will be called after the data is written

Parameters:
written - the written size
Throws:
IOException - if an exception occurs. By throwing this exception the connection will be closed by xSocket

onException

void onException(IOException ioe)
call back to sginal a write error

Parameters:
ioe - the exception