Package org.apache.wicket.core.util.lang
Class WicketObjects.SerializingObjectSizeOfStrategy
- java.lang.Object
-
- org.apache.wicket.core.util.lang.WicketObjects.SerializingObjectSizeOfStrategy
-
- All Implemented Interfaces:
WicketObjects.IObjectSizeOfStrategy
- Enclosing class:
- WicketObjects
public static final class WicketObjects.SerializingObjectSizeOfStrategy extends Object implements WicketObjects.IObjectSizeOfStrategy
WicketObjects.IObjectSizeOfStrategy
that works by serializing the object to an instance ofByteCountingOutputStream
, which records the number of bytes written to it. Hence, this gives the size of the object as it would be serialized,including all the overhead of writing class headers etc. Not very accurate (the real memory consumption should be lower) but the best we can do in a cheap way pre JDK 5.
-
-
Constructor Summary
Constructors Constructor Description SerializingObjectSizeOfStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
sizeOf(Serializable object)
Computes the size of an object.
-
-
-
Constructor Detail
-
SerializingObjectSizeOfStrategy
public SerializingObjectSizeOfStrategy()
-
-
Method Detail
-
sizeOf
public long sizeOf(Serializable object)
Description copied from interface:WicketObjects.IObjectSizeOfStrategy
Computes the size of an object. This typically is an estimation, not an absolute accurate size.- Specified by:
sizeOf
in interfaceWicketObjects.IObjectSizeOfStrategy
- Parameters:
object
- The serializable object to compute size of- Returns:
- The size of the object in bytes.
-
-