-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supporting different compressions csv
- Loading branch information
1 parent
843be8e
commit 2f51ebf
Showing
13 changed files
with
224 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
dataframe-csv/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/CsvCompression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.jetbrains.kotlinx.dataframe.io | ||
|
||
import java.io.InputStream | ||
import java.util.zip.GZIPInputStream | ||
import java.util.zip.ZipInputStream | ||
|
||
/** | ||
* Compression algorithm to use when reading csv files. | ||
* We support GZIP and ZIP compression out of the box. | ||
* | ||
* Custom compression algorithms can be added by creating an instance of [Custom]. | ||
*/ | ||
public sealed class CsvCompression<I : InputStream>(public open val wrapStream: (InputStream) -> I) : | ||
(InputStream) -> I by wrapStream { | ||
|
||
public data object Gzip : CsvCompression<GZIPInputStream>(::GZIPInputStream) | ||
|
||
public data object Zip : CsvCompression<ZipInputStream>(::ZipInputStream) | ||
|
||
public data object None : CsvCompression<InputStream>({ it }) | ||
|
||
public data class Custom<I : InputStream>(override val wrapStream: (InputStream) -> I) : | ||
CsvCompression<I>(wrapStream) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.