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

bio.ferlab.datalake.spark3.utils.ResourceLoader.scala Maven / Gradle / Ivy

There is a newer version: 14.8.0
Show newest version
package bio.ferlab.datalake.spark3.utils

import scala.io.Source
import scala.util.{Failure, Success, Try, Using}

object ResourceLoader {

  def loadResource(path: String): Option[String] = {
    Using(getClass.getClassLoader.getResourceAsStream(path)) { is =>
      if (is == null) None else Some(Source.fromInputStream(is).mkString)
    }.toOption.flatten
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy