title: How to decompress snappy (hadoop file formatted) file using Scala
body: <p>Following from my <a href="https://stackoverflow.com/questions/59612261/uncompress-hadoop-compatible-snappy-file">previous</a> question, I've hadoop file formatted snappy compressed file and I want to decompress and write content to csv file, just like <a href="https://github.com/kubo/snzip" rel="nofollow noreferrer">snzip</a> tool does it,
  <code>snzip -d /Path/to/file.snappy</code>. I found out that <a href="https://github.com/xerial/snappy-java" rel="nofollow noreferrer">snappy-java</a> doesn't has support for decompressing such format. So I decided to use <code>org.apache.hadoop.io.compress.SnappyCodec</code> from hadoop common package. But I can't find any example of how to do it. Here is what I've tried;</p>
  
  <pre><code>object test extends App {
      val input: Array[Byte] = Files.readAllBytes(Paths.get("/Path/to/file.snappy"))
      val s: SnappyDecompressor = new SnappyDecompressor()
      val dec = s.decompress(input, 0, input.length)
      println(dec)
  </code></pre>
  
  <p>but this gives me following output;</p>
  
  <pre><code>20/01/07 12:59:57 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  0
  </code></pre>
  
  <p>Bonus question: how to compress a given .csv file ? </p>