# TSV format

A tab-separated values (TSV) file is a simple text format for storing data in a tabular structure, eg. database table or spreadsheet data, and a way of exchanging information between databases. Each record in the table is one line of the text file. Each field value of a record is separated from the next by a tab character.

# Dependencies

Add DataTree Adapters and OpenCSV JARs to the classpath:

<!-- DATATREE API -->
<dependency>
    <groupId>com.github.berkesa</groupId>
    <artifactId>datatree-adapters</artifactId>
    <version>1.0.15</version>
</dependency>

<!-- CSV API -->
<dependency>
    <groupId>com.opencsv</groupId>
    <artifactId>opencsv</artifactId>
    <version>5.4</version>
</dependency>

# Reading and writing TSV documents

// Parsing TSV document
String tsv = " ... TSV document ... ";
Tree document = new Tree(tsv, "tsv");

// Getting / setting values
for (Tree row: document) {
  for (Tree cell: row) {
    ...
  }
}

// Generating TSV string from Tree
String tsv = document.toString("tsv");