Class StringMeter

java.lang.Object
org.github.jamm.string.StringMeter

public abstract class StringMeter extends Object
Utility to measure the value field of a String
  • Field Details

    • ENABLED

      public static final boolean ENABLED
      Enable or disable string optimization through the org.github.jamm.string.Optimize String system property. true by default.
    • STRING_SHALLOW_SIZE

      public static final long STRING_SHALLOW_SIZE
      The String shallow size stored as a constant to have it compiled directly into the measure method.
  • Constructor Details

    • StringMeter

      public StringMeter()
  • Method Details

    • measureDeep

      public long measureDeep(MemoryMeterStrategy strategy, String s)
      Measure the deep size of the specified String.
      Parameters:
      strategy - the strategy to perform the measurement
      s - the string
      Returns:
      the size of the deep string
    • measureStringValue

      protected abstract long measureStringValue(MemoryMeterStrategy strategy, String s)
      Measure the size of the value of the specified String.
      Parameters:
      strategy - the strategy to perform the measurement
      s - the string
      Returns:
      the size of the string value field
    • newInstance

      public static StringMeter newInstance()
      Creates a new StringMeter instance.
      Returns:
      a new StringMeter instance.