Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.util
Class CacheSizes

java.lang.Object
  extended by com.jivesoftware.util.CacheSizes

public class CacheSizes
extends java.lang.Object

Utility class for determining the sizes in bytes of commonly used objects. Classes implementing the Cacheable interface should use this class to determine their size.


Method Summary
static int sizeOfBoolean()
          Returns the size in bytes of a primitive boolean.
static int sizeOfChar()
          Returns the size in bytes of a primitive char.
static int sizeOfDate()
          Returns the size in bytes of a Date.
static int sizeOfDouble()
          Returns the size in bytes of a primitive double.
static int sizeOfInt()
          Returns the size in bytes of a primitive int.
static int sizeOfList(java.util.List list)
          Returns the size in bytes of a List object.
static int sizeOfLong()
          Returns the size in bytes of a primitive long.
static int sizeOfMap(java.util.Map map)
          Returns the size in bytes of a Map object.
static int sizeOfObject()
          Returns the size in bytes of a basic Object.
static int sizeOfString(java.lang.String string)
          Returns the size in bytes of a String.
static int sizeOfString(java.lang.String[] string)
          Returns the size in bytes of a String array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sizeOfObject

public static int sizeOfObject()
Returns the size in bytes of a basic Object. This method should only be used for actual Object objects and not classes that extend Object.

Returns:
the size of an Object.

sizeOfString

public static int sizeOfString(java.lang.String string)
Returns the size in bytes of a String.

Parameters:
string - the String to determine the size of.
Returns:
the size of a String.

sizeOfString

public static int sizeOfString(java.lang.String[] string)
Returns the size in bytes of a String array.

Parameters:
string - the String array to determine the size of.
Returns:
the size of a String.

sizeOfInt

public static int sizeOfInt()
Returns the size in bytes of a primitive int.

Returns:
the size of a primitive int.

sizeOfChar

public static int sizeOfChar()
Returns the size in bytes of a primitive char.

Returns:
the size of a primitive char.

sizeOfBoolean

public static int sizeOfBoolean()
Returns the size in bytes of a primitive boolean.

Returns:
the size of a primitive boolean.

sizeOfLong

public static int sizeOfLong()
Returns the size in bytes of a primitive long.

Returns:
the size of a primitive long.

sizeOfDouble

public static int sizeOfDouble()
Returns the size in bytes of a primitive double.

Returns:
the size of a primitive double.

sizeOfDate

public static int sizeOfDate()
Returns the size in bytes of a Date.

Returns:
the size of a Date.

sizeOfMap

public static int sizeOfMap(java.util.Map map)
Returns the size in bytes of a Map object. All keys and values must be Strings.

Parameters:
map - the Map object to determine the size of.
Returns:
the size of the Map object.

sizeOfList

public static int sizeOfList(java.util.List list)
Returns the size in bytes of a List object. Elements are assumed to be of type String, Long, Boolean, Integer, or Cacheable.

Parameters:
list - the List object to determine the size of.
Returns:
the size of the List object.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.