|
||||||||
| 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.FixedLengthProtobufDecoder
public class FixedLengthProtobufDecoder
Decodes Protocol Buffers messages from the input stream using a fixed header to determine the size of a message.
| 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 | |
|---|---|
FixedLengthProtobufDecoder(com.google.protobuf.MessageLite prototype,
com.google.protobuf.ExtensionRegistryLite extensionRegistry,
int headerLength)
A protobuf decoder that uses the supplied headerLength to
determine the size of the 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 FixedLengthProtobufDecoder(@NonNull
com.google.protobuf.MessageLite prototype,
com.google.protobuf.ExtensionRegistryLite extensionRegistry,
int headerLength)
headerLength to
determine the size of the 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.headerLength - The length of the fixed header storing the size of
the message.| 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 | |||||||