me.cmoz.grizzly.protobuf
Class FixedLengthProtobufFilter

java.lang.Object
  extended by org.glassfish.grizzly.filterchain.BaseFilter
      extended by org.glassfish.grizzly.filterchain.AbstractCodecFilter<org.glassfish.grizzly.Buffer,com.google.protobuf.MessageLite>
          extended by me.cmoz.grizzly.protobuf.FixedLengthProtobufFilter
All Implemented Interfaces:
org.glassfish.grizzly.Codec<org.glassfish.grizzly.Buffer,com.google.protobuf.MessageLite>, org.glassfish.grizzly.filterchain.CodecFilter<org.glassfish.grizzly.Buffer,com.google.protobuf.MessageLite>, org.glassfish.grizzly.filterchain.Filter

public final class FixedLengthProtobufFilter
extends org.glassfish.grizzly.filterchain.AbstractCodecFilter<org.glassfish.grizzly.Buffer,com.google.protobuf.MessageLite>

A filter for Google's Protocol Buffers serialization format that uses a fixed length header that stores the size of a message.


Field Summary
static int DEFAULT_HEADER_LENGTH
          The default length of the fixed header.
 
Constructor Summary
FixedLengthProtobufFilter(com.google.protobuf.MessageLite prototype)
          A Protocol Buffers filter that uses the DEFAULT_HEADER_LENGTH as the header length containing the size of the message.
FixedLengthProtobufFilter(com.google.protobuf.MessageLite prototype, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          A Protocol Buffers filter that uses the DEFAULT_HEADER_LENGTH as the header length containing the size of a message with the supplied extensionRegistry.
FixedLengthProtobufFilter(com.google.protobuf.MessageLite prototype, com.google.protobuf.ExtensionRegistryLite extensionRegistry, int headerLength)
          A Protocol Buffers filter that uses the supplied headerLength as the header length containing the size of a message.
FixedLengthProtobufFilter(com.google.protobuf.MessageLite prototype, int headerLength)
          A Protocol Buffers filter that uses the supplied headerLength as the header length containing the size of a message.
 
Method Summary
 
Methods inherited from class org.glassfish.grizzly.filterchain.AbstractCodecFilter
getDecoder, getEncoder, handleRead, handleWrite
 
Methods inherited from class org.glassfish.grizzly.filterchain.BaseFilter
createContext, exceptionOccurred, handleAccept, handleClose, handleConnect, handleEvent, onAdded, onFilterChainChanged, onRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.glassfish.grizzly.filterchain.Filter
exceptionOccurred, handleAccept, handleClose, handleConnect, handleEvent, onAdded, onFilterChainChanged, onRemoved
 

Field Detail

DEFAULT_HEADER_LENGTH

public static final int DEFAULT_HEADER_LENGTH
The default length of the fixed header.

See Also:
Constant Field Values
Constructor Detail

FixedLengthProtobufFilter

public FixedLengthProtobufFilter(@NonNull
                                 com.google.protobuf.MessageLite prototype)
A Protocol Buffers filter that uses the DEFAULT_HEADER_LENGTH as the header length containing the size of the message.

Parameters:
prototype - The base protocol buffers serialization unit.

FixedLengthProtobufFilter

public FixedLengthProtobufFilter(@NonNull
                                 com.google.protobuf.MessageLite prototype,
                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
A Protocol Buffers filter that uses the DEFAULT_HEADER_LENGTH as the header length containing the size of a message with the supplied extensionRegistry.

Parameters:
prototype - The base protocol buffers serialization unit.
extensionRegistry - A table of known extensions, searchable by name or field number, may be null.

FixedLengthProtobufFilter

public FixedLengthProtobufFilter(@NonNull
                                 com.google.protobuf.MessageLite prototype,
                                 int headerLength)
A Protocol Buffers filter that uses the supplied headerLength as the header length containing the size of a message.

Parameters:
prototype - The base protocol buffers serialization unit.
headerLength - The length of the header storing the size of a message.

FixedLengthProtobufFilter

public FixedLengthProtobufFilter(@NonNull
                                 com.google.protobuf.MessageLite prototype,
                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry,
                                 int headerLength)
A Protocol Buffers filter that uses the supplied headerLength as the header length containing the size of a message.

Parameters:
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 header storing the size of a message.