Class WebChannelParser
java.lang.Object
com.codename1.cloud.firebase.WebChannelParser
Splits a WebChannel response body into its framed arrays.
The Firestore Listen channel answers with frames of the form
<length>\n<json array>. The array holds [arrayId, payload] pairs. The
parser is incremental: text can arrive in any split and is buffered until
a frame is complete. The length counts characters of the decoded text, as
the JavaScript client reads it.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne[arrayId, payload]entry of a frame. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds text and returns every entry of the frames it completed.longReturns
voidDiscards buffered text, for a new response.
-
Constructor Details
-
WebChannelParser
public WebChannelParser()
-
-
Method Details
-
feed
Adds text and returns every entry of the frames it completed.
Parameters
text: the next part of the response body
Returns
the completed entries in order, possibly empty
Throws
IllegalStateException: when the body is not WebChannel framing
-
getLastArrayId
public long getLastArrayId()Returns
the highest array ID seen, or -1
-
resetBuffer
public void resetBuffer()Discards buffered text, for a new response.
-