/** * This method is used to flush all of the queued buffers to * the client. This method will not block but will simply flush * any data to the underlying transport. Internally the data * will be queued for delivery to the connected entity. */ public void flush() throws IOException { boolean done = writer.flush(); // returns true only if everything is delivered if(!done) { flusher.flush(); // here we will block for an op write event if the buffer contains a reference } }
/** * This method is used to deliver the provided buffer of bytes to * the underlying transport. This will not modify the data that * is to be written, this will simply queue the buffers in the * order that they are provided. * * @param buffer this is the array of bytes to send to the client */ public void write(ByteBuffer buffer) throws IOException { boolean done = writer.write(buffer); // returns true if we can buffer if(!done) { flusher.flush(); // we could not fully write or buffer the data so we must flush } }
/** * This method is used to flush all of the queued buffers to * the client. This method will not block but will simply flush * any data to the underlying transport. Internally the data * will be queued for delivery to the connected entity. */ public void flush() throws IOException { boolean done = writer.flush(); // returns true only if everything is delivered if(!done) { flusher.flush(); // here we will block for an op write event if the buffer contains a reference } }
/** * This method is used to deliver the provided buffer of bytes to * the underlying transport. This will not modify the data that * is to be written, this will simply queue the buffers in the * order that they are provided. * * @param buffer this is the array of bytes to send to the client */ public void write(ByteBuffer buffer) throws IOException { boolean done = writer.write(buffer); // returns true if we can buffer if(!done) { flusher.flush(); // we could not fully write or buffer the data so we must flush } }