Top Description Inners Fields Constructors Methods
io.netty.channel

public final Class DefaultMessageSizeEstimator

extends Object
implements MessageSizeEstimator
Class Inheritance
All Implemented Interfaces
io.netty.channel.MessageSizeEstimator
Static Imports
io.netty.util.internal.ObjectUtil.checkPositiveOrZero

Default MessageSizeEstimator implementation which supports the estimation of the size of ByteBuf, ByteBufHolder and FileRegion.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public static final MessageSizeEstimator
DEFAULT

Return the default implementation which returns 8 for unknown messages.

private final MessageSizeEstimator.Handle

Constructor Summary

AccessConstructor and Description
public
DefaultMessageSizeEstimator(int
The size which is returned for unknown messages.
unknownSize
)

Create a new instance

Method Summary

Modifier and TypeMethod and Description
public MessageSizeEstimator.Handle
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULTback to summary
public static final MessageSizeEstimator DEFAULT

Return the default implementation which returns 8 for unknown messages.

handleback to summary
private final MessageSizeEstimator.Handle handle

Constructor Detail

DefaultMessageSizeEstimatorback to summary
public DefaultMessageSizeEstimator(int unknownSize)

Create a new instance

Parameters
unknownSize:int

The size which is returned for unknown messages.

Method Detail

newHandleback to summary
public MessageSizeEstimator.Handle newHandle()

Implements io.netty.channel.MessageSizeEstimator.newHandle.

Doc from io.netty.channel.MessageSizeEstimator.newHandle.

Creates a new handle. The handle provides the actual operations.

Annotations
@Override
io.netty.channel back to summary

private final Class DefaultMessageSizeEstimator.HandleImpl

extends Object
implements Handle
Class Inheritance
All Implemented Interfaces
io.netty.channel.MessageSizeEstimator.Handle

Field Summary

Modifier and TypeField and Description
private final int

Constructor Summary

AccessConstructor and Description
private
HandleImpl(int unknownSize)

Method Summary

Modifier and TypeMethod and Description
public int
size(Object
The message for which the size should be calculated
msg
)

Implements io.netty.channel.MessageSizeEstimator.Handle.size.

Calculate the size of the given message.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

unknownSizeback to summary
private final int unknownSize

Constructor Detail

HandleImplback to summary
private HandleImpl(int unknownSize)

Method Detail

sizeback to summary
public int size(Object msg)

Implements io.netty.channel.MessageSizeEstimator.Handle.size.

Doc from io.netty.channel.MessageSizeEstimator.Handle.size.

Calculate the size of the given message.

Parameters
msg:Object

The message for which the size should be calculated

Returns:int

size The size in bytes. The returned size must be >= 0

Annotations
@Override