org.apache.wicket.util.lang
Class Objects.SerializingObjectSizeOfStrategy

java.lang.Object
  extended by org.apache.wicket.util.lang.Objects.SerializingObjectSizeOfStrategy
All Implemented Interfaces:
Objects.IObjectSizeOfStrategy
Enclosing class:
Objects

public static final class Objects.SerializingObjectSizeOfStrategy
extends Object
implements Objects.IObjectSizeOfStrategy

Objects.IObjectSizeOfStrategy that works by serializing the object to an instance of ByteCountingOutputStream, 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
Objects.SerializingObjectSizeOfStrategy()
           
 
Method Summary
 long sizeOf(Object object)
          Computes the size of an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Objects.SerializingObjectSizeOfStrategy

public Objects.SerializingObjectSizeOfStrategy()
Method Detail

sizeOf

public long sizeOf(Object object)
Description copied from interface: Objects.IObjectSizeOfStrategy
Computes the size of an object. This typically is an estimation, not an absolute accurate size.

Specified by:
sizeOf in interface Objects.IObjectSizeOfStrategy
Parameters:
object - Object to compute size of
Returns:
The size of the object in bytes.
See Also:
Objects.IObjectSizeOfStrategy.sizeOf(java.lang.Object)


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.