public class WebSocketStreamHandler extends Object implements WebSockets.SocketListener, Closeable
| Constructor and Description |
|---|
WebSocketStreamHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
bytesMessage(InputStream in)
Called when a binary media type message is received
|
void |
close()
Called when the stream is closed.
|
void |
failure(Throwable t)
Called when there has been a failure
|
Throwable |
getError() |
InputStream |
getInputStream(int stream)
Get a specific input stream using its identifier.
|
OutputStream |
getOutputStream(int stream)
Gets a specific output stream using it's identified
|
protected void |
handleMessage(int stream,
InputStream inStream) |
void |
open(String protocol,
okhttp3.WebSocket socket)
Called when the socket is opened
|
void |
textMessage(Reader in)
Called when a text media type message is received
|
void |
waitForInitialized() |
public void waitForInitialized()
throws InterruptedException
InterruptedExceptionpublic void open(String protocol, okhttp3.WebSocket socket)
WebSockets.SocketListeneropen in interface WebSockets.SocketListenerpublic void bytesMessage(InputStream in)
WebSockets.SocketListenerbytesMessage in interface WebSockets.SocketListenerin - The input stream containing the binary datapublic void textMessage(Reader in)
WebSockets.SocketListenertextMessage in interface WebSockets.SocketListenerin - The character stream containing the messageprotected void handleMessage(int stream,
InputStream inStream)
throws IOException
IOExceptionpublic void failure(Throwable t)
WebSockets.SocketListenerfailure in interface WebSockets.SocketListenert - the exception associated with the failure.public Throwable getError()
public void close()
WebSockets.SocketListenerclose in interface WebSockets.SocketListenerclose in interface Closeableclose in interface AutoCloseablepublic InputStream getInputStream(int stream)
stream - The stream to returnpublic OutputStream getOutputStream(int stream)
stream - The stream to returnCopyright © 2021. All rights reserved.