Class CsvOutput.CsvRowOutputWithHeaders
- java.lang.Object
-
- com.opengamma.strata.collect.io.CsvOutput.CsvRowOutputWithHeaders
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableList<String>
headers()
Gets the list of headers that are in use.CsvOutput.CsvRowOutputWithHeaders
writeCell(String header, double value)
Writes a single cell by header, with the cell only being output whenwriteNewLine()
is called.CsvOutput.CsvRowOutputWithHeaders
writeCell(String header, long value)
Writes a single cell by header, with the cell only being output whenwriteNewLine()
is called.CsvOutput.CsvRowOutputWithHeaders
writeCell(String header, Object value)
Writes a single cell by header, with the cell only being output whenwriteNewLine()
is called.CsvOutput.CsvRowOutputWithHeaders
writeCell(String header, String value)
Writes a single cell by header, with the cell only being output whenwriteNewLine()
is called.CsvOutput.CsvRowOutputWithHeaders
writeCells(Map<String,String> valueMap)
Writes a map of cells to the output, with the cell only being output whenwriteNewLine()
is called.CsvOutput.CsvRowOutputWithHeaders
writeLine(Map<String,String> valueMap)
Writes a row to the output, specifying each value by the header.CsvOutput.CsvRowOutputWithHeaders
writeNewLine()
Writes a new line character.
-
-
-
Method Detail
-
headers
public ImmutableList<String> headers()
Gets the list of headers that are in use.This is the same list that was passed into
CsvOutput.withHeaders(List, boolean)
.- Returns:
- the list of headers
-
writeLine
public CsvOutput.CsvRowOutputWithHeaders writeLine(Map<String,String> valueMap)
Writes a row to the output, specifying each value by the header.The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.
This method is equivalent to multiple calls to
writeCell(String, String)
followed by one call towriteNewLine()
.- Parameters:
valueMap
- the map of values to write keyed by header- Returns:
- this, for method chaining
- Throws:
IllegalArgumentException
- if one of the headers does not matchUncheckedIOException
- if an IO exception occurs
-
writeCells
public CsvOutput.CsvRowOutputWithHeaders writeCells(Map<String,String> valueMap)
Writes a map of cells to the output, with the cell only being output whenwriteNewLine()
is called.The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.
This method is equivalent to multiple calls to
writeCell(String, String)
.Note that if
writeNewLine()
is not called, the cell will never be output.- Parameters:
valueMap
- the map of values to write keyed by header- Returns:
- this, for method chaining
- Throws:
IllegalArgumentException
- if one of the headers does not matchUncheckedIOException
- if an IO exception occurs
-
writeCell
public CsvOutput.CsvRowOutputWithHeaders writeCell(String header, String value)
Writes a single cell by header, with the cell only being output whenwriteNewLine()
is called.The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.
Note that if
writeNewLine()
is not called, the cell will never be output.- Parameters:
header
- the header to writevalue
- the value to write- Returns:
- this, for method chaining
- Throws:
IllegalArgumentException
- if one of the headers does not matchUncheckedIOException
- if an IO exception occurs
-
writeCell
public CsvOutput.CsvRowOutputWithHeaders writeCell(String header, Object value)
Writes a single cell by header, with the cell only being output whenwriteNewLine()
is called.The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.
Note that if
writeNewLine()
is not called, the cell will never be output.- Parameters:
header
- the header to writevalue
- the value to write- Returns:
- this, for method chaining
- Throws:
IllegalArgumentException
- if one of the headers does not matchUncheckedIOException
- if an IO exception occurs
-
writeCell
public CsvOutput.CsvRowOutputWithHeaders writeCell(String header, double value)
Writes a single cell by header, with the cell only being output whenwriteNewLine()
is called.The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.
Note that if
writeNewLine()
is not called, the cell will never be output.- Parameters:
header
- the header to writevalue
- the value to write- Returns:
- this, for method chaining
- Throws:
IllegalArgumentException
- if one of the headers does not matchUncheckedIOException
- if an IO exception occurs
-
writeCell
public CsvOutput.CsvRowOutputWithHeaders writeCell(String header, long value)
Writes a single cell by header, with the cell only being output whenwriteNewLine()
is called.The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.
Note that if
writeNewLine()
is not called, the cell will never be output.- Parameters:
header
- the header to writevalue
- the value to write- Returns:
- this, for method chaining
- Throws:
IllegalArgumentException
- if one of the headers does not matchUncheckedIOException
- if an IO exception occurs
-
writeNewLine
public CsvOutput.CsvRowOutputWithHeaders writeNewLine()
Writes a new line character.- Returns:
- this, for method chaining
- Throws:
UncheckedIOException
- if an IO exception occurs
-
-