This repository has been archived on 2024-09-28. You can view files and clone it, but cannot push or open issues or pull requests.
test2gis/src/main/scala/model/lib/StreamUtil.scala

23 lines
446 B
Scala

package com.voronind.doublegis.test
package model.lib
import java.io.{InputStream, OutputStream}
import scala.language.postfixOps
/**
* Utils for Java IO streams.
*/
object StreamUtil {
/**
* Copy one stream into another.
* @param in Source stream.
* @param out Destination stream.
*/
def copyStream(in: InputStream, out: OutputStream): Unit = {
Iterator
.continually(in.read)
.takeWhile(-1 !=)
.foreach(out.write)
}
}