23 lines
446 B
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)
|
|
}
|
|
}
|