|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.glassfish.grizzly.AbstractTransformer<org.glassfish.grizzly.Buffer,com.google.protobuf.MessageLite>
me.cmoz.grizzly.protobuf.Varint32ProtobufDecoder
public class Varint32ProtobufDecoder
Decodes Protocol Buffers messages from the input stream using a
Varint32 encoded header to determine message size.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.glassfish.grizzly.AbstractTransformer |
|---|
org.glassfish.grizzly.AbstractTransformer.LastResultAwareState<K,L> |
| Field Summary | |
|---|---|
static int |
IO_HEADER_ENCODING_ERROR
The error code for a malformed header. |
static int |
IO_PROTOBUF_PARSE_ERROR
The error code for a failed protobuf parse of a message. |
static java.lang.String |
MESSAGE_LENGTH_ATTR
The name of the decoder attribute for the size of the message. |
| Fields inherited from class org.glassfish.grizzly.AbstractTransformer |
|---|
attributeBuilder, stateAttr |
| Constructor Summary | |
|---|---|
Varint32ProtobufDecoder(com.google.protobuf.MessageLite prototype,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
A protobuf decoder that uses a Varint32 encoded header to
determine the size of a message to be decoded. |
|
| Method Summary | |
|---|---|
java.lang.String |
getName()
|
boolean |
hasInputRemaining(org.glassfish.grizzly.attributes.AttributeStorage storage,
org.glassfish.grizzly.Buffer input)
|
int |
readHeader(org.glassfish.grizzly.Buffer input)
Reads the header from the supplied input. |
protected org.glassfish.grizzly.TransformationResult<org.glassfish.grizzly.Buffer,com.google.protobuf.MessageLite> |
transformImpl(org.glassfish.grizzly.attributes.AttributeStorage storage,
org.glassfish.grizzly.Buffer input)
|
| Methods inherited from class org.glassfish.grizzly.AbstractTransformer |
|---|
createStateObject, getLastResult, getMemoryManager, getNamePrefix, getValue, obtainMemoryManager, obtainStateObject, release, saveLastResult, setMemoryManager, transform |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int IO_PROTOBUF_PARSE_ERROR
public static final int IO_HEADER_ENCODING_ERROR
public static final java.lang.String MESSAGE_LENGTH_ATTR
| Constructor Detail |
|---|
public Varint32ProtobufDecoder(@NonNull
com.google.protobuf.MessageLite prototype,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Varint32 encoded header to
determine the size of a message to be decoded.
prototype - The base protocol buffers serialization unit.extensionRegistry - A table of known extensions, searchable by name
or field number, may be null.| Method Detail |
|---|
public int readHeader(org.glassfish.grizzly.Buffer input)
throws java.io.IOException
input.
input - The input buffer to read the header from.
java.io.IOException - If the header could not be read.public java.lang.String getName()
getName in interface org.glassfish.grizzly.Transformer<org.glassfish.grizzly.Buffer,com.google.protobuf.MessageLite>
protected final org.glassfish.grizzly.TransformationResult<org.glassfish.grizzly.Buffer,com.google.protobuf.MessageLite> transformImpl(org.glassfish.grizzly.attributes.AttributeStorage storage,
@NonNull
org.glassfish.grizzly.Buffer input)
throws org.glassfish.grizzly.TransformationException
transformImpl in class org.glassfish.grizzly.AbstractTransformer<org.glassfish.grizzly.Buffer,com.google.protobuf.MessageLite>org.glassfish.grizzly.TransformationException
public final boolean hasInputRemaining(org.glassfish.grizzly.attributes.AttributeStorage storage,
org.glassfish.grizzly.Buffer input)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||