com.googlecode.mobilityrpc.network.impl.tcp
Class IncomingByteStreamReader
java.lang.Object
java.lang.Thread
com.googlecode.mobilityrpc.network.impl.tcp.IncomingByteStreamReader
- All Implemented Interfaces:
- Runnable
public class IncomingByteStreamReader
- extends Thread
Continuously extracts individual byte[] messages from an input stream, where each message
is preceded by 4 bytes which indicate the length of the message to follow.
This reader with read continuously until shutdown() is called, or an error occurs.
The reader will submit each message extracted to the supplied IncomingMessageHandler.
If an error occurs, the reader will notify the supplied ConnectionErrorHandler and then
will close the input stream and terminate its thread.
- Author:
- Niall Gallagher
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
IncomingByteStreamReader
public IncomingByteStreamReader(ConnectionId connectionId,
InputStream inputStream,
IncomingMessageHandler incomingMessageHandler,
ConnectionErrorHandler connectionErrorHandler)
- Parameters:
connectionId - Identifies the connection to which the stream belongsinputStream - An input stream from which the reader will read messagesincomingMessageHandler - An object to which the reader will supply messages extracted from the streamconnectionErrorHandler - An object which the reader will notify when any exceptions occur
run
public void run()
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
shutdown
public void shutdown()
isShutdown
public boolean isShutdown()
Copyright © 2012. All Rights Reserved.