`

scala InputStream to Array[Byte] method

阅读更多
/**
 * inputStream to Array[Byte] method
 **/
def inputStreamToByteArray(is: InputStream): Array[Byte] = {
      val buf = ListBuffer[Byte]()
    var b = is.read()
    while (b != -1) {
        buf.append(b.byteValue)
        b = is.read()
    }
    buf.toArray
    // Resource.fromInputStream(in).byteArray
}
 

import scala.collection.mutable.ListBuffer

分享到:
评论

相关推荐

    scala-to-java:将Scala代码转换为Java代码的命令行工具

    在目标目录中scala-to-java.jar将创建scala-to-java.jar 使用java -jar target/scala-to-java.jar --slim运行应用程序。 可选的--slim标志可从输出中删除一些样板 输入任何scala代码,例如println("hello, world")...

    beginners-guide-to-scala

    SCALA学习手册SCALA学习手册SCALA学习手册SCALA学习手册

    testing in scala

    Testing in Scala starts with an introduction of the Scala programming language, explains why project infrastructure is critical, and provides compelling reasons to use Scala testing frameworks to not ...

    Scala-in-Action.pdf

    Scala in Action targets developers who not only want to learn the language but also want to build real-world applications using Scala. This book, in other words, covers not only the language and its ...

    2018 Scala for Java Developers: A Practical Primer

    This book will help you translate what you already know in Java to Scala to start your functional programming journey. Learn Scala is split into four parts: a tour of Scala, a comparison between Java...

    A Brief Introduction to Scala

    2010 JAVA ONE大会 ppt A Brief Introduction to Scala

    Scala and Spark for Big Data Analytics.pdf

    Chapter 1, Introduction to Scala, will teach big data analytics using the Scalabased APIs of Spark. Spark itself is written with Scala and naturally, as a starting point, we will discuss a brief ...

    Scala and Spark for Big Data Analytics

    Work on a wide array of applications, from simple batch jobs to stream processing and machine learning Explore the most common as well as some complex use-cases to perform large-scale data analysis ...

    Programming-in-Scala-2nd.pdf

    Scala there to wield to your advantage. That’s not complexity. It’s flexibility. To be clear: Scala will challenge you. That’s part of the joy of using it. Youwon’...

    A.Beginner's.Guide.to.Scala

    Scala初学者指南 A.Beginner's.Guide.to.Scala

    scala sdk scala-2.12.3

    scala-2.12.3 scala-2.12.3 scala-2.12.3 scala-2.12.3

    Scala编程详解 第9讲-Scala编程详解:数组操作之Array、ArrayBuffer以及遍历数组 共7页.pptx

    第9讲-Scala编程详解:数组操作之Array、ArrayBuffer以及遍历数组 共7页 第10讲-Scala编程详解:数组操作之数组转换 共5页 第11讲-Scala编程详解:Map与Tuple 共8页 第12讲-Scala编程详解:面向对象编程之类 共12页 ...

    Scala 初学者指南

    The Neophyte's Guide to Scala 是 Daniel Westheide 写的一系列有关 Scala 的文章。 ---------------------------------------------------- 本 PDF 基于开源文档,目录书签齐全。 版权归原作者,翻译版权归译者。...

    Functional Programming in Scala

    Its familiar syntax and transparent interoperability with existing Java libraries make Scala a great place to start learning FP., Functional Programming in Scala is a serious tutorial for programmers...

    scala-sbt-scala编译工具

    scala 编译工具 sbt 安装包。 Little or no configuration required for simple projects Scala-based build definition that can use the full flexibility of Scala code Accurate incremental recompilation ...

    Scala.Functional.Programming.Patterns.178398

    If you have done Java programming before and have a basic knowledge of Scala and its syntax, then this book is an ideal choice to help you to understand the context, the traditional design pattern ...

    A Field Guide to DSL Design in Scala

    A Field Guide to DSL Design in Scala,PPT,下载整理。

    Scala编程实战.zip

    此文档是讲解实战Scala,希望对喜欢大数据的同学有所帮助!!! 学习Scala语言,不仅仅意味着熟悉新的API,更重要的是一种思维方式的转变。从原有的面向对象编程(OO)到函数式编程(FP)的思想。本书面向实际的使用场景...

    Scala in Depth.pdf

    I believed Scala needed a “practical Scala” book to help guide those new to the lan- guage. Scala is a beautiful language, but it brings many new concepts to the table. I had watched as the ...

Global site tag (gtag.js) - Google Analytics