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

org.clulab.openie.ResourceUtils.scala Maven / Gradle / Ivy

The newest version!
package org.clulab.openie

import java.io.InputStream
import scala.util.Using

object ResourceUtils {

  // methods for reading rules

  def streamFromResource(path: String): InputStream = {
    val stream = getClass.getClassLoader.getResourceAsStream(path)
    stream
  }

  def readResource(path: String): String = {
    Using.resource(scala.io.Source.fromInputStream(streamFromResource(path))) { source =>
      source.mkString
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy