Skip to content

Commit

Permalink
doc improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
osiegmar committed Sep 28, 2024
1 parent ef04514 commit ccdb7a1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/src/content/docs/guides/Examples/bean-mapping.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Many CSV libraries come with built-in support for mapping CSV records to Java be
While this is a convenient feature, the reflection-based approach used by most libraries comes with
a heavy performance penalty, which contradicts FastCSV’s design goal of being fast.

Thanks to Java stream mapping, FastCSV can provide a similar feature without sacrificing performance.
Thanks to Java stream mapping, FastCSV can provide similar functionality without sacrificing performance.

## Example

Expand Down
20 changes: 16 additions & 4 deletions docs/src/content/docs/guides/Examples/byte-order-mark.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ FastCSV is capable of reading CSV files with a [Byte order mark](https://en.wiki
(BOM) header.

:::note
A BOM header is a sequence of bytes at the beginning of a text file that indicates the file's encoding,
such as UTF-8, UTF-16, or UTF-32.
Although UTF-8 is the default encoding for most text files today,
some applications still use the BOM header to specify the file's encoding.
A byte order mark (BOM) is a sequence of 2 to 4 bytes at the start of a text file
that serves as a header to indicate the file's Unicode encoding, such as UTF-8, UTF-16, or UTF-32.
For UTF-16 and UTF-32, the BOM header also indicates the byte order (big-endian or little-endian).

While UTF-8 is the standard encoding for most text files today,
some applications still use the BOM header to explicitly specify the file's encoding.
:::

Enabling automatic BOM header detection can impact performance.
Expand All @@ -22,6 +24,16 @@ You may also want to check out the corresponding
[Javadoc](https://javadoc.io/doc/de.siegmar/fastcsv/latest/de.siegmar.fastcsv/de/siegmar/fastcsv/reader/CsvReader.CsvReaderBuilder.html#detectBomHeader(boolean))
for more information.

The following table shows the BOM headers for different Unicode encodings that FastCSV can detect:

| Encoding | BOM header (hex) |
|-------------|------------------|
| UTF-8 | `EF BB BF` |
| UTF-16 (BE) | `FE FF` |
| UTF-16 (LE) | `FF FE` |
| UTF-32 (BE) | `00 00 FE FF` |
| UTF-32 (LE) | `FF FE 00 00` |

## Example

In the following example, a CSV file with a BOM header is created and read using FastCSV.
Expand Down

0 comments on commit ccdb7a1

Please sign in to comment.