
io.lemonlabs.uri.decoding.ChainedUriDecoder.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scala-uri_sjs1_2.12 Show documentation
Show all versions of scala-uri_sjs1_2.12 Show documentation
Simple scala library for building and parsing URIs
The newest version!
package io.lemonlabs.uri.decoding
case class ChainedUriDecoder(decoders: Seq[UriDecoder]) extends UriDecoder {
override def decodeBytes(data: String, charset: String): Array[Byte] = {
val asStr = decoders.foldLeft(data) { (str, decoder) =>
new String(decoder.decodeBytes(str, charset), charset)
}
asStr.getBytes(charset)
}
override def decode(data: String): String =
decoders.foldLeft(data) { (str, decoder) =>
decoder.decode(str)
}
override def +(encoder: UriDecoder): ChainedUriDecoder = copy(decoders = decoders :+ encoder)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy