akka.stream.alpakka.csv.scaladsl.CsvParsing.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of akka-stream-alpakka-csv_3 Show documentation
Show all versions of akka-stream-alpakka-csv_3 Show documentation
Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
/*
* Copyright (C) since 2016 Lightbend Inc.
*/
package akka.stream.alpakka.csv.scaladsl
import akka.NotUsed
import akka.stream.alpakka.csv.impl.CsvParsingStage
import akka.stream.scaladsl.Flow
import akka.util.ByteString
object CsvParsing {
val Backslash: Byte = '\\'
val Comma: Byte = ','
val SemiColon: Byte = ';'
val Colon: Byte = ':'
val Tab: Byte = '\t'
val DoubleQuote: Byte = '"'
val maximumLineLengthDefault: Int = 10 * 1024
/** Creates CSV parsing flow that reads CSV lines from incoming
* [[akka.util.ByteString]] objects.
*/
def lineScanner(delimiter: Byte = Comma,
quoteChar: Byte = DoubleQuote,
escapeChar: Byte = Backslash,
maximumLineLength: Int = maximumLineLengthDefault): Flow[ByteString, List[ByteString], NotUsed] =
Flow.fromGraph(new CsvParsingStage(delimiter, quoteChar, escapeChar, maximumLineLength))
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy