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