Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I used <code>scala-io</code>, <code>scala-arm</code> to write a binary stream of <code>Long</code>-s. The libraries itself are supposed to be a Scala-way to do things, but these are not in Scala <code>master</code> branch - maybe someone knows why? I use them from time to time.</p> <p>1) Clone <code>scala-io</code>:</p> <p><code>git clone https://github.com/scala-incubator/scala-io.git</code></p> <p>Go to <code>scala-io/package</code> and change in <code>Build.scala</code>, <code>val scalaVersion</code> to yours </p> <p><code>sbt package</code></p> <p>2) Clone <code>scala-arm</code>:</p> <p><code>git clone https://github.com/jsuereth/scala-arm.git</code></p> <p>Go to <code>scala-arm/package</code> and change in <code>build.scala</code>, <code>scalaVersion :=</code> to yours </p> <p><code>sbt package</code></p> <p>3) Copy somewhere not too far:</p> <p><code>scala-io/core/target/scala-xxx/scala-io-core_xxx-0.5.0-SNAPSHOT.jar</code></p> <p><code>scala-io/file/target/scala-xxx/scala-io-file_xxx-0.5.0-SNAPSHOT.jar</code></p> <p><code>scala-arm/target/scala-xxx/scala-arm_xxx-1.3-SNAPSHOT.jar</code></p> <p>4) Start REPL: <code>scala -classpath "/opt/scala-io/scala-io-core_2.10-0.5.0-SNAPSHOT.jar: /opt/scala-io/scala-io-file_2.10-0.5.0-SNAPSHOT.jar: /opt/scala-arm/scala-arm_2.10-1.3-SNAPSHOT.jar"</code></p> <p>5) <code>:paste</code> actual code:</p> <pre><code>import scalax.io._ // create data stream val EOData = Vector(0xffffffffffffffffL) val data = List( (0, Vector(0L,1L,2L,3L)) ,(1, Vector(4L,5L)) ,(2, Vector(6L,7L,8L)) ,(3, Vector(9L)) ) var it = Iterator[Long]() for (rec &lt;- data) { it = it ++ Vector(rec._1).iterator.map(_.toLong) it = it ++ rec._2.iterator it = it ++ EOData.iterator } // write data at once val out: Output = Resource.fromFile("/tmp/data") out.write(it)(OutputConverter.TraversableLongConverter) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload