java.lang.Object
net.i2p.stat.PersistenceHelper
Output rate data. This is used via ProfilePersistenceHelper and the output must be compatible.
Field Summary
Constructor Summary
ConstructorsConstructorDescriptionThe writers and readers below are static and the class holds only the line separator, so an instance carries no state.Method Summary
All MethodsModifier and TypeMethodDescriptionstatic final voidadd(StringBuilder buf, boolean addComments, String prefix, String name, String description, double value) Append a double value to the buffer.static final voidadd(StringBuilder buf, boolean addComments, String prefix, String name, String description, long value) Append a long value to the buffer.static final voidaddDate(StringBuilder buf, boolean addComments, String prefix, String name, String description, long value) Append a date value to the buffer.static final voidaddTime(StringBuilder buf, boolean addComments, String prefix, String name, String description, long value) Append a time duration to the buffer.static final doublegetDouble(Properties props, String prefix, String name) Read a double value from properties.static final intgetInt(Properties props, String prefix, String name) Read an integer value from properties.static final longgetLong(Properties props, String prefix, String name) Read a long value from properties.
Field Details
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 toaddComments- if true, prepend a comment line instead of the valueprefix- property key prefixname- property key suffixdescription- 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 toaddComments- if true, prepend a comment line instead of the valueprefix- property key prefixname- property key suffixdescription- 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 toaddComments- if true, prepend a comment line instead of the valueprefix- property key prefixname- property key suffixdescription- 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 toaddComments- if true, prepend a comment line instead of the valueprefix- property key prefixname- property key suffixdescription- description of the value (used as comment when addComments is true)value- the long to append
getLong
Read a long value from properties.- Parameters:
props- properties to read fromprefix- property key prefixname- property key suffix- Returns:
- non-negative, returns 0 on error
getDouble
Read a double value from properties.- Parameters:
props- properties to read fromprefix- property key prefixname- property key suffix- Returns:
- 0 on error
getInt
Read an integer value from properties.- Parameters:
props- properties to read fromprefix- property key prefixname- property key suffix- Returns:
- non-negative, returns 0 on error