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 TypeMethodDescriptionvoid
Called when a binary media type message is receivedvoid
close()
Called when the stream is closed.void
Called 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 void
handleMessage
(int stream, InputStream inStream) void
Called when the socket is openedvoid
textMessage
(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.SocketListener
Called when the socket is opened- Specified by:
open
in interfaceWebSockets.SocketListener
-
bytesMessage
Description copied from interface:WebSockets.SocketListener
Called when a binary media type message is received- Specified by:
bytesMessage
in interfaceWebSockets.SocketListener
- Parameters:
in
- The input stream containing the binary data
-
textMessage
Description copied from interface:WebSockets.SocketListener
Called when a text media type message is received- Specified by:
textMessage
in interfaceWebSockets.SocketListener
- Parameters:
in
- The character stream containing the message
-
handleMessage
- Throws:
IOException
-
failure
Description copied from interface:WebSockets.SocketListener
Called when there has been a failure- Specified by:
failure
in interfaceWebSockets.SocketListener
- Parameters:
t
- the exception associated with the failure.
-
getError
-
close
public void close()Description copied from interface:WebSockets.SocketListener
Called when the stream is closed.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in 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.
-