java.lang.Object
net.i2p.stat.PersistenceHelper

class PersistenceHelperextends Object
Output rate data. This is used via ProfilePersistenceHelper and the output must be compatible.
  • Field Details

    • NL

      private static final String NL
      Line separator of the persisted file.
  • Constructor Details

    • PersistenceHelper

      PersistenceHelper()
      The writers and readers below are static and the class holds only the line separator, so an instance carries no state.
  • Method Details

    • add

      public static final void add(StringBuilder buf, boolean addComments, String prefix, String name, String description, double value)
      Append a double value to the buffer.
      Parameters:
      buf - the buffer to append to
      addComments - if true, prepend a comment line instead of the value
      prefix - property key prefix
      name - property key suffix
      description - description of the value (used as comment when addComments is true)
      value - the double to append
    • addDate

      public static final void addDate(StringBuilder buf, boolean addComments, String prefix, String name, String description, long value)
      Append a date value to the buffer.
      Parameters:
      buf - the buffer to append to
      addComments - if true, prepend a comment line instead of the value
      prefix - property key prefix
      name - property key suffix
      description - description of the value (used as comment when addComments is true)
      value - the epoch millisecond date value
    • addTime

      public static final void addTime(StringBuilder buf, boolean addComments, String prefix, String name, String description, long value)
      Append a time duration to the buffer.
      Parameters:
      buf - the buffer to append to
      addComments - if true, prepend a comment line instead of the value
      prefix - property key prefix
      name - property key suffix
      description - description of the value (used as comment when addComments is true)
      value - the duration in milliseconds
    • add

      public static final void add(StringBuilder buf, boolean addComments, String prefix, String name, String description, long value)
      Append a long value to the buffer.
      Parameters:
      buf - the buffer to append to
      addComments - if true, prepend a comment line instead of the value
      prefix - property key prefix
      name - property key suffix
      description - description of the value (used as comment when addComments is true)
      value - the long to append
    • getLong

      public static final long getLong(Properties props, String prefix, String name)
      Read a long value from properties.
      Parameters:
      props - properties to read from
      prefix - property key prefix
      name - property key suffix
      Returns:
      non-negative, returns 0 on error
    • getDouble

      public static final double getDouble(Properties props, String prefix, String name)
      Read a double value from properties.
      Parameters:
      props - properties to read from
      prefix - property key prefix
      name - property key suffix
      Returns:
      0 on error
    • getInt

      public static final int getInt(Properties props, String prefix, String name)
      Read an integer value from properties.
      Parameters:
      props - properties to read from
      prefix - property key prefix
      name - property key suffix
      Returns:
      non-negative, returns 0 on error