Skip to content

Commit

Permalink
implement fastcsv.org website
Browse files Browse the repository at this point in the history
  • Loading branch information
osiegmar committed Jun 13, 2024
1 parent 14d59dd commit 4312992
Show file tree
Hide file tree
Showing 32 changed files with 6,151 additions and 260 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Are you considering contributing to this project? That's great; help is always welcome.

Please make sure to read the [goals](../doc/goals.md) of FastCSV before investing your time.
Please make sure to read the [goals](https://www.fastcsv.org/architecture/goals/) of FastCSV before investing your time.

If you're unsure, start a [discussion](https://github.com/osiegmar/FastCSV/discussions) about your idea first.

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.

**Goal alignment**
Does this feature align with the [goals](https://github.com/osiegmar/FastCSV/blob/main/doc/goals.md) of FastCSV?
Does this feature align with the [goals](https://www.fastcsv.org/architecture/goals/) of FastCSV?
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
paths-ignore:
- '**/*.md'
- 'docs/**'
pull_request:
paths-ignore:
- '**/*.md'
- 'docs/**'

jobs:
build:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ name: "CodeQL"
on:
push:
branches: [ main ]
paths-ignore:
- '**/*.md'
- 'docs/**'
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
paths-ignore:
- '**/*.md'
- 'docs/**'
schedule:
- cron: '39 5 * * 2'

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Dependency Submission

on: [ push ]
on:
push:
branches: [ main ]
paths-ignore:
- '**/*.md'
- 'docs/**'

permissions:
contents: write
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy to GitHub Pages

on:
push:
branches: [ main ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Install, build, and upload your site
uses: withastro/action@v2
with:
path: docs
node-version: 20
package-manager: pnpm@latest

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
187 changes: 3 additions & 184 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,187 +17,6 @@

------

## Benchmark & Compatibility

![Benchmark](benchmark.webp "Benchmark")

> [!NOTE]
> This selected benchmark is based on the [Java CSV library benchmark suite](https://github.com/osiegmar/JavaCsvBenchmarkSuite)
FastCSV maintains high performance while serving as a strict RFC 4180 CSV writer and can read somewhat garbled CSV data.
See [JavaCsvComparison](https://github.com/osiegmar/JavaCsvComparison) for details.

## Features

The main features of FastCSV include:

- Enables ultra-fast reading and writing of CSV data
- Has zero runtime dependencies
- Maintains a small footprint
- Provides a null-free and developer-friendly API
- Compatible with GraalVM Native Image
- Delivered as an OSGi-compliant bundle
- Actively developed and maintained
- Well-tested and documented
- Crafted with natural intelligence, :heart:, and AI assistance :sparkles:

### Primary use cases are:

- In *big data* applications: efficiently reading and writing data on a massive scale.
- In *small data* applications: serving as a lightweight library without additional dependencies.

### CSV specific

- Compliant with [RFC 4180](https://tools.ietf.org/html/rfc4180) – including:
- Newline and field separator characters in fields
- Quote escaping
- Configurable field separator
- Supports line endings `CRLF` (Windows), `LF` (Unix) and `CR` (old macOS)
- Supports unicode characters

### Reader specific

- Supports reading of some non-compliant (real-world) data
- Preserves line break character(s) within fields
- Preserves the starting line number (even with skipped and multi-line records) – helpful for error messages
- Auto-detection of line delimiters (`CRLF`, `LF`, or `CR` – can also be mixed)
- Configurable data validation
- Supports optional header records (access fields by name)
- Supports skipping empty lines
- Supports commented lines (skipping & reading) with configurable comment character
- Configurable field modifiers (e.g., to trim fields)
- Flexible callback handlers (e.g., to directly map to domain objects)
- BOM (Byte Order Mark) support (UTF-8, UTF-16 LE/BE, UTF-32 LE/BE)

### Writer specific

- Supports flexible quoting strategies (e.g., to differentiate between empty and null)
- Supports writing comments

## Requirements

- for 3.x version: Java ⩾ 11 (Android 13 / API level 33)
- for 2.x version: Java ⩾ 8 (Android 8 / API level 26)

> [!NOTE]
> Checks are included in the continuous integration pipeline to verify the library's functionality with Android.
> Nevertheless, the library is not tested on Android devices nor can I provide any support for Android-specific issues.
## CsvReader examples

### Iterative reading of some CSV data from a string

```java
CsvReader.builder().ofCsvRecord("foo1,bar1\nfoo2,bar2")
.forEach(System.out::println);
```

### Iterative reading of a CSV file

```java
try (CsvReader<CsvRecord> csv = CsvReader.builder().ofCsvRecord(file)) {
csv.forEach(System.out::println);
}
```

### Iterative reading of some CSV data with a header

```java
CsvReader.builder().ofNamedCsvRecord("header 1,header 2\nfield 1,field 2")
.forEach(rec -> System.out.println(rec.getField("header 2")));
```

### Iterative reading of some CSV data with a custom header

```java
CsvCallbackHandler<NamedCsvRecord> callbackHandler =
new NamedCsvRecordHandler("header 1", "header 2");

CsvReader.builder().build(callbackHandler, "field 1,field 2")
.forEach(rec -> System.out.println(rec.getField("header 2")));
```

### Custom settings

```java
CsvReader.builder()
.fieldSeparator(';')
.quoteCharacter('"')
.commentStrategy(CommentStrategy.SKIP)
.commentCharacter('#')
.skipEmptyLines(true)
.ignoreDifferentFieldCount(false)
.acceptCharsAfterQuotes(false)
.detectBomHeader(false);
```

## IndexedCsvReader examples

### Indexed reading of a CSV file

```java
try (IndexedCsvReader<CsvRecord> csv = IndexedCsvReader.builder().ofCsvRecord(file)) {
CsvIndex index = csv.getIndex();

System.out.println("Items of last page:");
int lastPage = index.getPageCount() - 1;
List<CsvRecord> csvRecords = csv.readPage(lastPage);
csvRecords.forEach(System.out::println);
}
```

## CsvWriter examples

### Iterative writing of some data to a writer

```java
var sw = new StringWriter();
CsvWriter.builder().build(sw)
.writeRecord("header 1", "header 2")
.writeRecord("value 1", "value 2");

System.out.println(sw);
```

### Iterative writing of a CSV file

```java
try (CsvWriter csv = CsvWriter.builder().build(file)) {
csv
.writeRecord("header 1", "header 2")
.writeRecord("value 1", "value 2");
}
```

### Custom settings

```java
CsvWriter.builder()
.fieldSeparator(',')
.quoteCharacter('"')
.quoteStrategy(QuoteStrategies.ALWAYS)
.commentCharacter('#')
.lineDelimiter(LineDelimiter.LF);
```

## Further reading

- [Examples](example/src/main/java/example)
- [JavaDoc](https://javadoc.io/doc/de.siegmar/fastcsv)
- [How to Upgrade](UPGRADING.md)
- [Changelog](CHANGELOG.md)
- [Design & Architecture](doc/architecture.md)
- [CSV Interpretation](doc/interpretation.md)
- [Design Goals](doc/goals.md)
- [How to Contribute](.github/CONTRIBUTING.md)

---

## Sponsoring and partnerships

<img src="yklogo.svg" width="185" height="44" alt="FastCSV">

YourKit was used to optimize the performance and footprint of FastCSV.
YourKit is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>,
<a href="https://www.yourkit.com/.net/profiler/">YourKit .NET Profiler</a>,
and <a href="https://www.yourkit.com/youmonitor/">YourKit YouMonitor</a>.
<p align="center">
Visit our website at <a href="https://fastcsv.org">https://fastcsv.org</a>
</p>
21 changes: 0 additions & 21 deletions doc/goals.md

This file was deleted.

21 changes: 21 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
4 changes: 4 additions & 0 deletions docs/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions docs/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
Loading

0 comments on commit 4312992

Please sign in to comment.