net.sf.sparql.benchmarking.util
Class FormatUtils

java.lang.Object
  extended by net.sf.sparql.benchmarking.util.FormatUtils

public class FormatUtils
extends Object

Helper class with utility methods related to formatting

Author:
rvesse

Method Summary
static String escapeQuotesForCsv(String value)
          Escapes quotes in a string for use in a double quoted CSV string
static String formatInstant(org.joda.time.Instant instant)
          Formats an instant using the configured instant formatter
static String formatResultCount(long resultCount)
          Formats the result count taking account of the special values OperationRun.NOT_YET_RUN or OperationRun.UNKNOWN
static String formatSeconds(double time)
          Formats Time to show as seconds
static String formatSeconds(long time)
          Formats Time to show as seconds
static void resetInstantFormatter()
          Resets the instant formatter to the default which is dd/MM/yyyy HH:mm:ss Z
static void setInstantFormatter(org.joda.time.format.DateTimeFormatter formatter)
          Sets the date time formatter to use
static String toCsv(String value)
          Formats a string for CSV escaping it as a double quoted CSV string if necessary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setInstantFormatter

public static void setInstantFormatter(org.joda.time.format.DateTimeFormatter formatter)
Sets the date time formatter to use

Parameters:
formatter - Formatter

resetInstantFormatter

public static void resetInstantFormatter()
Resets the instant formatter to the default which is dd/MM/yyyy HH:mm:ss Z


formatSeconds

public static String formatSeconds(long time)
Formats Time to show as seconds

Parameters:
time - Time in nanoseconds
Returns:
Time in seconds

formatSeconds

public static String formatSeconds(double time)
Formats Time to show as seconds

Parameters:
time - Time in nanoseconds
Returns:
Time in seconds

formatInstant

public static String formatInstant(org.joda.time.Instant instant)
Formats an instant using the configured instant formatter

Parameters:
instant - Instant
Returns:
Formatted instant

toCsv

public static String toCsv(String value)
Formats a string for CSV escaping it as a double quoted CSV string if necessary

Parameters:
value -
Returns:
Sanitized string

escapeQuotesForCsv

public static String escapeQuotesForCsv(String value)
Escapes quotes in a string for use in a double quoted CSV string

Parameters:
value -
Returns:
Sanitized string

formatResultCount

public static String formatResultCount(long resultCount)
Formats the result count taking account of the special values OperationRun.NOT_YET_RUN or OperationRun.UNKNOWN

Parameters:
resultCount - Result Count
Returns:
Formatted results count


Copyright © 2014. All Rights Reserved.