scala.meta.internal.io.InputStreamIO.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of io_sjs0.6_2.11 Show documentation
Show all versions of io_sjs0.6_2.11 Show documentation
Scalameta APIs for input/output
The newest version!
package scala.meta.internal.io
import java.io._
object InputStreamIO {
def readBytes(is: InputStream): Array[Byte] = {
val baos = new ByteArrayOutputStream()
val buffer = new Array[Byte](4096)
var nread = -1
do {
nread = is.read(buffer, 0, buffer.length)
if (nread != -1) baos.write(buffer, 0, nread)
} while (nread != -1)
baos.toByteArray
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy