diff options
author | Haoyi Li <haoyi@haoyi-mbp.corp.dropbox.com> | 2014-11-26 00:50:50 -0800 |
---|---|---|
committer | Haoyi Li <haoyi@haoyi-mbp.corp.dropbox.com> | 2014-11-26 00:50:50 -0800 |
commit | 88595a41e3ec13c1a516e847fe3d0b279facf3fc (patch) | |
tree | 4f03b902de7b81fa2e32792e84b680038345e761 /examples/scala-js/javalib/src/main/scala/java/io/ByteArrayInputStream.scala | |
parent | 82773a11c99d260e97ca63356bfb7b417599b1e9 (diff) | |
download | hands-on-scala-js-88595a41e3ec13c1a516e847fe3d0b279facf3fc.tar.gz hands-on-scala-js-88595a41e3ec13c1a516e847fe3d0b279facf3fc.tar.bz2 hands-on-scala-js-88595a41e3ec13c1a516e847fe3d0b279facf3fc.zip |
killed
Diffstat (limited to 'examples/scala-js/javalib/src/main/scala/java/io/ByteArrayInputStream.scala')
-rw-r--r-- | examples/scala-js/javalib/src/main/scala/java/io/ByteArrayInputStream.scala | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/examples/scala-js/javalib/src/main/scala/java/io/ByteArrayInputStream.scala b/examples/scala-js/javalib/src/main/scala/java/io/ByteArrayInputStream.scala deleted file mode 100644 index 697e07b..0000000 --- a/examples/scala-js/javalib/src/main/scala/java/io/ByteArrayInputStream.scala +++ /dev/null @@ -1,58 +0,0 @@ -package java.io - -class ByteArrayInputStream( - protected val buf: Array[Byte], - offset: Int, length: Int) extends InputStream { - - protected val count: Int = offset + length - protected var mark: Int = offset - protected var pos: Int = offset - - def this(buf: Array[Byte]) = this(buf, 0, buf.length) - - override def read(): Int = { - if (pos >= count) - -1 - else { - val res = buf(pos) & 0xFF // convert to unsigned int - pos += 1 - res - } - } - - override def read(b: Array[Byte], off: Int, reqLen: Int): Int = { - if (off < 0 || reqLen < 0 || reqLen > b.length - off) - throw new IndexOutOfBoundsException - - val len = Math.min(reqLen, count - pos) - - if (reqLen == 0) - 0 // 0 requested, 0 returned - else if (len == 0) - -1 // nothing to read at all - else { - System.arraycopy(buf, pos, b, off, len) - pos += len - len - } - } - - override def skip(n: Long): Long = { - val k = Math.max(0, Math.min(n, count - pos)) - pos += k.toInt - k.toLong - } - - override def available(): Int = count - pos - - override def markSupported(): Boolean = true - - override def mark(readlimit: Int): Unit = - mark = pos - - override def reset(): Unit = - pos = mark - - override def close(): Unit = () - -} |