tcMenuJavaAPI
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
com.thecoderscorner.menu.remote.SharedStreamConnection Class Referenceabstract
Inheritance diagram for com.thecoderscorner.menu.remote.SharedStreamConnection:
com.thecoderscorner.menu.remote.StreamRemoteConnector com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection com.thecoderscorner.menu.remote.socket.SocketBasedConnector

Public Member Functions

MenuCommand readCommandFromStream () throws IOException
 
void sendMenuCommand (MenuCommand msg) throws IOException
 
abstract boolean isDeviceConnected ()
 
abstract String getConnectionName ()
 
abstract boolean canSendMessageNow (MenuCommand cmd)
 

Static Public Member Functions

static boolean doesBufferHaveEOM (ByteBuffer inputBuffer)
 

Protected Member Functions

 SharedStreamConnection (MenuCommandProtocol protocol)
 
void readCompleteMessage (ByteBuffer inputBuffer) throws IOException
 
abstract void getAtLeastBytes (ByteBuffer inputBuffer, int len, StreamRemoteConnector.ReadMode mode) throws IOException
 
void logByteBuffer (String msg, ByteBuffer inBuffer)
 
void connectionLog (System.Logger.Level l, String s)
 
abstract void sendInternal (ByteBuffer cmdBuffer) throws IOException
 

Protected Attributes

final System.Logger logger = System.getLogger(getClass().getSimpleName())
 
final MenuCommandProtocol protocol
 
final ByteBuffer inputBuffer = ByteBuffer.allocate(MAX_MSG_EXPECTED).order(ByteOrder.BIG_ENDIAN)
 
final ByteBuffer cmdBuffer = ByteBuffer.allocate(MAX_MSG_EXPECTED).order(ByteOrder.BIG_ENDIAN)
 

Static Protected Attributes

static final int MAX_MSG_EXPECTED = 1024
 

Member Function Documentation

◆ getAtLeastBytes()

abstract void com.thecoderscorner.menu.remote.SharedStreamConnection.getAtLeastBytes ( ByteBuffer  inputBuffer,
int  len,
StreamRemoteConnector.ReadMode  mode 
) throws IOException
abstractprotected

Reads at least the number of bytes requested waiting if need be for more data.

Parameters
inputBufferthe buffer to read from
lenthe minimum number of bytes needed
Exceptions
IOExceptionif there are problems reading.

Reimplemented in com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection, and com.thecoderscorner.menu.remote.socket.SocketBasedConnector.

◆ logByteBuffer()

void com.thecoderscorner.menu.remote.SharedStreamConnection.logByteBuffer ( String  msg,
ByteBuffer  inBuffer 
)
protected

Helper method that logs the entire message buffer when at debug logging level.

Parameters
msgthe message to print first
inBufferthe buffer to be logged

◆ sendMenuCommand()

void com.thecoderscorner.menu.remote.SharedStreamConnection.sendMenuCommand ( MenuCommand  msg) throws IOException

Sends a command to the remote with the protocol and usual headers.

Parameters
msgthe message to send.
Exceptions
IOExceptionif there are issues with the transport

The documentation for this class was generated from the following file: