Class GrpcFrames.Decoder
java.lang.Object
com.codename1.backend.grpc.GrpcFrames.Decoder
- Enclosing class:
GrpcFrames
Reassembles messages from bytes as they arrive. Not thread safe; one per
stream direction.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Decoder
public Decoder(int maxMessage, boolean gzipAccepted) - Parameters:
maxMessage- the largest message accepted, compressed or notgzipAccepted- whether the peer declaredgrpc-encoding: gzip
-
-
Method Details
-
feed
Feeds bytes and returns every message they completed, in order.- Parameters:
data- the bytesoffset- where they startlength- how many- Returns:
- the completed messages, possibly empty, never null
- Throws:
GrpcException- on a malformed or oversized message
-
isIdle
public boolean isIdle()Whether the stream ended cleanly between messages. A stream that ends halfway through one lost data, and the caller must say so.- Returns:
- true when no partial message is buffered
-