All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ciris.ConfigSourcePlatformSpecific.scala Maven / Gradle / Ivy

There is a newer version: 0.12.1
Show newest version
package ciris

import ciris.api._

import java.io.{File => JFile}
import java.nio.charset.Charset

import scala.io.Source

private[ciris] trait ConfigSourcePlatformSpecific {
  object File extends ConfigSource[Id, (JFile, Charset), String](ConfigKeyType.File) {
    private val delegate: ConfigSource[Id, (JFile, Charset), String] =
      ConfigSource.catchNonFatal(keyType) {
        case (file, charset) =>
          Source.fromFile(file, charset.name).mkString
      }

    override def read(key: (JFile, Charset)): ConfigEntry[Id, (JFile, Charset), String, String] =
      delegate.read(key)

    override def toString: String =
      "File"
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy