com.buildforge.services.client.api
Class SecureAPIClientBuffer

java.lang.Object
  extended by com.buildforge.services.client.api.APIClientBuffer
      extended by com.buildforge.services.client.api.SecureAPIClientBuffer
All Implemented Interfaces:
IBufferedConnection

public class SecureAPIClientBuffer
extends APIClientBuffer

This class wraps a socket channel with the IBufferedConnection interface using the client-side of an SSLEngine so that it can be used by the API protocol for secure client/server communications.


Method Summary
 void close()
          Shuts down the connection, after which time it should no longer be used.
 int fill(int want)
          Requests that the read buffer be refilled.
 void flush()
          Finishes off the current write buffer and tries to send it.
 
Methods inherited from class com.buildforge.services.client.api.APIClientBuffer
getReadBuffer, getStrict, getWriteBuffer, setCallback, setStrict
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fill

public int fill(int want)
         throws java.io.IOException
Description copied from interface: IBufferedConnection
Requests that the read buffer be refilled. The caller is guaranteed that either the requested number of bytes will be read or the buffer will be filled to its maximum capacity.

Specified by:
fill in interface IBufferedConnection
Overrides:
fill in class APIClientBuffer
Parameters:
want - the number of bytes that the caller would like to be read into the buffer before returning control to the caller
Returns:
the number of bytes actually read, which may be less than want if the buffer is not large enough to hold that much information, or greater than want if additional bytes of information were available without blocking
Throws:
java.io.IOException - if an I/O error occurs or the connection closes before the requested number of bytes have been read

flush

public void flush()
           throws java.io.IOException
Description copied from interface: IBufferedConnection
Finishes off the current write buffer and tries to send it. If writes are busy, then we delegate the write activity to the dispatcher, which will let us know when it's done.

Specified by:
flush in interface IBufferedConnection
Overrides:
flush in class APIClientBuffer
Throws:
java.io.IOException - if an I/O error occurs

close

public void close()
           throws java.io.IOException
Description copied from interface: IBufferedConnection
Shuts down the connection, after which time it should no longer be used.

Specified by:
close in interface IBufferedConnection
Overrides:
close in class APIClientBuffer
Throws:
java.io.IOException - if an I/O error occurs