Class CSVFormatter
- java.lang.Object
-
- java.util.logging.Formatter
-
- de.aristaflow.adept2.base.registry.CSVFormatter
-
public class CSVFormatter extends Formatter
-
-
Constructor Summary
Constructors Constructor Description CSVFormatter()
Creates a new formatter for CSV.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
escape(String string)
Checks whether the designated string contains control characters (field or record separators) and escapes them if required.protected String
escapedString(String string)
Escapes all control characters in the designated string and encloses the string with the corresponding characters.protected boolean
escapeRequired(String string)
Gets whether the designated string contains control characters (field or record separators) and therefore needs escaping.String
format(LogRecord record)
String
getHead(Handler h)
Gets the header line containing the names of the fields of a record as needed for a CSV.-
Methods inherited from class java.util.logging.Formatter
formatMessage, getTail
-
-
-
-
Method Detail
-
getHead
public String getHead(Handler h)
Gets the header line containing the names of the fields of a record as needed for a CSV.
-
escape
protected String escape(String string)
Checks whether the designated string contains control characters (field or record separators) and escapes them if required.- Parameters:
string
- The string to check for required escaping.- Returns:
- The designated string with the corresponding characters escaped if required.
-
escapeRequired
protected boolean escapeRequired(String string)
Gets whether the designated string contains control characters (field or record separators) and therefore needs escaping.- Parameters:
string
- The string to check for required escaping.- Returns:
- Whether the designated string contains control characters (field or record separators) and therefore needs escaping.
-
escapedString
protected String escapedString(String string)
Escapes all control characters in the designated string and encloses the string with the corresponding characters.- Parameters:
string
- The string to enclose within the corresponding characters and to escape the used control characters.- Returns:
- The designated string enclosed and having the appropriate characters escaped.
-
-