<commit_before>Serializer (Beta)
=================

**NOTE: Only writing is supported for now !**

The purpose of this library is to give you a tool to quickly and easily read/write objects to various text formats in Java.
You can do that without having to include numerous jars that are sometimes very heavy.

By default any object you write or read doesn't need to be configured, but sometimes and for optimal results,
you will have to write a few more lines to get the expected result.

Supported text formats :

* CSV (Comma Separated Values)
* JSON (JavaScript Object Notation)
* XML (Extended Markup Language)


Examples
--------

**Write to CSV**

    // Create the serializer and the writer
    final CsvSerializer csv = new CsvSerializer();
    final BufferedWriter writer = new BufferedWriter(new FileWriter(new File("fruits.csv")));

    // Fill the list
    final Set<Fruit> fruits = new HashSet<Fruit>();
    fruits.add(new Fruit("Apple", "Red"));
    fruits.add(new Fruit("Banana", "Yellow"));
    fruits.add(new Fruit("Kiwi", "Green"));

    // Serialize the objects
    csv.write(fruits, writer);

    // Close the writer
    writer.close();


**Write to JSON**

    // Create the serializer and the writer
    final JsonSerializer json = new JsonSerializer();
    final BufferedWriter writer = new BufferedWriter(new FileWriter(new File("person.json")));

    // Serialize the object
    json.write(new Person("Douglas", "Crockford"), writer);

    // Close the writer
    writer.close();


**Write to XML**

    // Create the serializer and the writer
    final XmlSerializer xml = new XmlSerializer();
    final BufferedWriter writer = new BufferedWriter(new FileWriter(new File("person.xml")));

    // Serialize the object
    xml.write(new Person("Linus", "Torvalds"), writer);

    // Close the writer
    writer.close();<commit_msg>- Added color to code blocks in readme<commit_after>Serializer (Beta)
=================

**NOTE: Only writing is supported for now !**

The purpose of this library is to give you a tool to quickly and easily read/write objects to various text formats in Java.
You can do that without having to include numerous jars that are sometimes very heavy.

By default any object you write or read doesn't need to be configured, but sometimes and for optimal results,
you will have to write a few more lines to get the expected result.

Supported text formats :

* CSV (Comma Separated Values)
* JSON (JavaScript Object Notation)
* XML (Extended Markup Language)


Examples
--------

**Write to CSV**

```java
// Create the serializer and the writer
final CsvSerializer csv = new CsvSerializer();
final BufferedWriter writer = new BufferedWriter(new FileWriter(new File("fruits.csv")));

// Fill the list
final Set<Fruit> fruits = new HashSet<Fruit>();
fruits.add(new Fruit("Apple", "Red"));
fruits.add(new Fruit("Banana", "Yellow"));
fruits.add(new Fruit("Kiwi", "Green"));

// Serialize the objects
csv.write(fruits, writer);

// Close the writer
writer.close();
```


**Write to JSON**

```java
// Create the serializer and the writer
final JsonSerializer json = new JsonSerializer();
final BufferedWriter writer = new BufferedWriter(new FileWriter(new File("person.json")));

// Serialize the object
json.write(new Person("Douglas", "Crockford"), writer);

// Close the writer
writer.close();
```


**Write to XML**

```java
// Create the serializer and the writer
final XmlSerializer xml = new XmlSerializer();
final BufferedWriter writer = new BufferedWriter(new FileWriter(new File("person.xml")));

// Serialize the object
xml.write(new Person("Linus", "Torvalds"), writer);

// Close the writer
writer.close();
```
{'fraction_non_alphanumeric': 0.12074134641591715, 'fraction_numerical': 0.0, 'mean_word_length': 4.161744022503516, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4055968', 'n_tokens_mistral': 1056, 'n_tokens_neox': 1002, 'n_words': 423}