Package io.kubernetes.client.util
Class WebSocketStreamHandler
java.lang.Object
io.kubernetes.client.util.WebSocketStreamHandler
- All Implemented Interfaces:
WebSockets.SocketListener,Closeable,AutoCloseable
WebSocketStreamHandler understands the Kubernetes streaming protocol and separates a single
WebSockets stream into a number of different streams using that protocol.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when a binary media type message is receivedvoidclose()Called when the stream is closed.voidCalled when there has been a failuregetError()getInputStream(int stream) Get a specific input stream using its identifier.getOutputStream(int stream) Gets a specific output stream using it's identifiedprotected voidhandleMessage(int stream, InputStream inStream) voidCalled when the socket is openedvoidtextMessage(Reader in) Called when a text media type message is receivedvoid
-
Constructor Details
-
WebSocketStreamHandler
public WebSocketStreamHandler()
-
-
Method Details
-
waitForInitialized
- Throws:
InterruptedException
-
open
Description copied from interface:WebSockets.SocketListenerCalled when the socket is opened- Specified by:
openin interfaceWebSockets.SocketListener
-
bytesMessage
Description copied from interface:WebSockets.SocketListenerCalled when a binary media type message is received- Specified by:
bytesMessagein interfaceWebSockets.SocketListener- Parameters:
in- The input stream containing the binary data
-
textMessage
Description copied from interface:WebSockets.SocketListenerCalled when a text media type message is received- Specified by:
textMessagein interfaceWebSockets.SocketListener- Parameters:
in- The character stream containing the message
-
handleMessage
- Throws:
IOException
-
failure
Description copied from interface:WebSockets.SocketListenerCalled when there has been a failure- Specified by:
failurein interfaceWebSockets.SocketListener- Parameters:
t- the exception associated with the failure.
-
getError
-
close
public void close()Description copied from interface:WebSockets.SocketListenerCalled when the stream is closed.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceWebSockets.SocketListener
-
getInputStream
Get a specific input stream using its identifier. Caller is responsible for closing these streams.- Parameters:
stream- The stream to return- Returns:
- The specified stream.
-
getOutputStream
Gets a specific output stream using it's identified- Parameters:
stream- The stream to return- Returns:
- The specified stream.
-