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

replpp.shaded.os.Internals.scala Maven / Gradle / Ivy

There is a newer version: 0.1.98
Show newest version
package replpp.shaded
package os

import java.io.{InputStream, OutputStream}
import java.nio.file.Files

object Internals {

  val emptyStringArray = Array.empty[String]

  def transfer0(src: InputStream, sink: (Array[Byte], Int) => Unit) = {
    val buffer = new Array[Byte](8192)
    var r = 0
    while (r != -1) {
      r = src.read(buffer)
      if (r != -1) sink(buffer, r)
    }
    src.close()
  }

  def transfer(src: InputStream, dest: OutputStream) = transfer0(
    src,
    dest.write(_, 0, _)
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy