Package uk.ac.starlink.ecsv
Class EcsvHeader
java.lang.Object
uk.ac.starlink.ecsv.EcsvHeader
Represents the part of an ECSV file preceding the actual data lines.
- Since:
- 28 Apr 2020
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the CSV-formatted line supposed to contain column names.String[]
Returns the lines of YAML containing header information.static boolean
isMagic
(byte[] intro) Indicates whether a byte sequence indicates the start of an ECSV file.static EcsvHeader
readHeader
(LineReader rdr) Constructs an EcsvHeader instance by reading lines from a file.
-
Constructor Details
-
EcsvHeader
Constructor.- Parameters:
yamlLines
- lines of YAML containing header information; these lines exclude the leading "# " characters found in the ECSV filenamesLine
- first non-YAML line in the ECSV file, which is supposed to contain a redundant list of column names
-
-
Method Details
-
getYamlLines
Returns the lines of YAML containing header information. Leading "# " characters are not included.- Returns:
- YAML text as array of lines
-
getNamesLine
Returns the CSV-formatted line supposed to contain column names.- Returns:
- column names line
-
readHeader
Constructs an EcsvHeader instance by reading lines from a file.- Parameters:
rdr
- line reader returning input lines- Returns:
- header instance
- Throws:
IOException
EcsvFormatException
-
isMagic
public static boolean isMagic(byte[] intro) Indicates whether a byte sequence indicates the start of an ECSV file.- Parameters:
intro
- first few bytes of a file- Returns:
- true iff file looks like ECSV
-