public class DefaultIoEventSizeEstimator extends Object implements IoEventSizeEstimator
IoEventSizeEstimator
implementation.
Martin's Java Notes was used for estimation. For unknown types, it inspects declaring fields of the class of the specified event and the parameter of the event. The size of unknown declaring fields are approximated to the specified averageSizePerField (default: 64).
All the estimated sizes of classes are cached for performance improvement.
Constructor and Description |
---|
DefaultIoEventSizeEstimator()
Create a new instance of this class, injecting the known size of
basic java types.
|
Modifier and Type | Method and Description |
---|---|
int |
estimateSize(IoEvent event)
Estimate the IoEvent size in number of bytes
|
int |
estimateSize(Object message)
Estimate the size of an Object in number of bytes
|
public DefaultIoEventSizeEstimator()
public int estimateSize(IoEvent event)
estimateSize
in interface IoEventSizeEstimator
event
- The event we want to estimate the size ofpublic int estimateSize(Object message)
message
- The object to estimateCopyright © 2004–2016 Apache MINA Project. All rights reserved.