Package ubic.gemma.core.util
Class TsvUtils
- java.lang.Object
-
- ubic.gemma.core.util.TsvUtils
-
public class TsvUtils extends Object
Bunch of utilities for writing data to TSV.- Author:
- poirigui
-
-
Field Summary
Fields Modifier and Type Field Description static char
COMMENT
static char
SUB_DELIMITER
Delimiter used when printing a list of strings in a column.
-
Constructor Summary
Constructors Constructor Description TsvUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
format(double d)
static String
format(int i)
static String
format(long l)
static String
format(Double d)
Format aDouble
for TSV.static String
format(Integer i)
static String
format(Long l)
static String
format(Object object)
static String
format(String s)
Format aString
for TSV.static String
format(Date d)
static String
formatComment(String comment)
Format a string as a TSV comment.static org.apache.commons.csv.CSVFormat.Builder
getTsvFormatBuilder(String what, BuildInfo buildInfo, String... extraHeaderComments)
Preconfigure aCSVFormat.Builder
with desirable defaultsstatic Boolean
parseBoolean(String val)
static double
parseDouble(String val)
static Integer
parseInt(String val)
static Long
parseLong(String val)
-
-
-
Field Detail
-
COMMENT
public static final char COMMENT
- See Also:
- Constant Field Values
-
SUB_DELIMITER
public static final char SUB_DELIMITER
Delimiter used when printing a list of strings in a column.- See Also:
- Constant Field Values
-
-
Method Detail
-
getTsvFormatBuilder
public static org.apache.commons.csv.CSVFormat.Builder getTsvFormatBuilder(String what, BuildInfo buildInfo, String... extraHeaderComments)
Preconfigure aCSVFormat.Builder
with desirable defaults- Parameters:
what
- a short description of what data is being writtenbuildInfo
- build information to include in the headerextraHeaderComments
- additional header comments that will be included at the top of the TSV file, right after theConstants.GEMMA_CITATION_NOTICE
andConstants.GEMMA_LICENSE_NOTICE
-
format
public static String format(@Nullable Double d)
Format aDouble
for TSV.- Parameters:
d
- a double to format- Returns:
- a formatted double, an empty string if d is null or NaN or inf/-inf if infinite
-
format
public static String format(double d)
-
format
public static String format(int i)
-
format
public static String format(long l)
-
-