Package ej.websocket.frame
Class FrameScanner
- java.lang.Object
-
- ej.websocket.frame.FrameScanner
-
public class FrameScanner extends Object
A FrameScanner keeps reading theInputStream(which is supposed to be the input stream of aWebSocket. Each time thegetFrame()method is called, it tries to create aRawFramefrom bytes that arrived on the input stream.
-
-
Constructor Summary
Constructors Constructor Description FrameScanner(InputStream is)Create a new FrameScanner for the givenInputStream.
-
-
-
Constructor Detail
-
FrameScanner
public FrameScanner(InputStream is)
Create a new FrameScanner for the givenInputStream.- Parameters:
is- the input stream to read from. It is supposed to be the stream of aWebSocket
-
-
Method Detail
-
getFrame
public RawFrame getFrame() throws IOException, WebSocketException
Get a complete frame from the input stream. This method will block until a frame is completely received or anIOExceptionoccurs.- Returns:
- a websocket frame as a byte array
- Throws:
IOException- if anIOExceptionis encountered by the input streamWebSocketException- if the frame is invalid.
-
-