|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.buildforge.services.client.api.APIClientBuffer
public class APIClientBuffer
This class wraps a socket channel with the IBufferedConnection interface so that it can be used by the API protocol.
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. |
java.nio.ByteBuffer |
getReadBuffer()
Provides direct access to the connection's read buffer. |
boolean |
getStrict()
Returns whether or not this client buffer is strict. |
java.nio.ByteBuffer |
getWriteBuffer()
Provides direct access to the connection's write buffer. |
void |
setCallback(IBufferedConnectionCallback callback)
Sets the callback for activity on the connection and initializes the request dispatching mechanism (optional). |
void |
setStrict(boolean strict)
Controls whether or not this client buffer will be strict. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public boolean getStrict()
setStrict(boolean)
public void setStrict(boolean strict)
fill(int)
will never
return more bytes than are requested. This will generally be neither
necessary nor as efficient as allowing the buffer to be filled with
whatever is available, so stict mode is off by default.
strict
- true to enable strict modepublic java.nio.ByteBuffer getReadBuffer()
IBufferedConnection
getReadBuffer
in interface IBufferedConnection
public java.nio.ByteBuffer getWriteBuffer()
IBufferedConnection
getWriteBuffer
in interface IBufferedConnection
public int fill(int want) throws java.io.IOException
IBufferedConnection
fill
in interface IBufferedConnection
want
- the number of bytes that the caller would like to be
read into the buffer before returning control to the caller
java.io.IOException
- if an I/O error occurs or the connection closes
before the requested number of bytes have been readpublic void flush() throws java.io.IOException
IBufferedConnection
flush
in interface IBufferedConnection
java.io.IOException
- if an I/O error occurspublic void setCallback(IBufferedConnectionCallback callback)
IBufferedConnection
setCallback
in interface IBufferedConnection
callback
- the callback to use for activitypublic void close() throws java.io.IOException
IBufferedConnection
close
in interface IBufferedConnection
java.io.IOException
- if an I/O error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |