Package org.github.jamm.string
Class StringMeter
java.lang.Object
org.github.jamm.string.StringMeter
Utility to measure the value field of a
String-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanEnable or disable string optimization through theorg.github.jamm.string.OptimizeString system property.static final longThe String shallow size stored as a constant to have it compiled directly into the measure method. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongmeasureDeep(MemoryMeterStrategy strategy, String s) Measure the deep size of the specified String.protected abstract longmeasureStringValue(MemoryMeterStrategy strategy, String s) Measure the size of the value of the specified String.static StringMeterCreates a newStringMeterinstance.
-
Field Details
-
ENABLED
public static final boolean ENABLEDEnable or disable string optimization through theorg.github.jamm.string.OptimizeString system property.trueby default. -
STRING_SHALLOW_SIZE
public static final long STRING_SHALLOW_SIZEThe String shallow size stored as a constant to have it compiled directly into the measure method.
-
-
Constructor Details
-
StringMeter
public StringMeter()
-
-
Method Details
-
measureDeep
Measure the deep size of the specified String.- Parameters:
strategy- the strategy to perform the measurements- the string- Returns:
- the size of the deep string
-
measureStringValue
Measure the size of the value of the specified String.- Parameters:
strategy- the strategy to perform the measurements- the string- Returns:
- the size of the string value field
-
newInstance
Creates a newStringMeterinstance.- Returns:
- a new
StringMeterinstance.
-