class MetadataEntityHeaderParser {

    public MetadataHeader readHeader(InputStream stream) {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
            String line = reader.readLine();
            if (StringUtils.isBlank(line)) {
                throw new MetadataReadingException("Input file doesn't have expected header.");
            }
            String[] columns = line.split(delimiter);
            if (columns.length < 1) {
                throw new MetadataReadingException("At least one column should be present.");
            }
            MetadataHeader header = new MetadataHeader(headerParser.readClassColumn(columns[0]));
            for (int i = 1; i < columns.length; i++) {
                header.addField(i, headerParser.readFieldColumn(columns[i]));
            }
            return header;
        } catch (IOException e) {
            throw new MetadataReadingException(e.getMessage(), e);
        }
    }

    public  MetadataEntityHeaderParser(String delimiter);

}