blob: 412d84b7b2f7e4df9152b803c9e45160e4c63497 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
package java.io
abstract class InputStream extends Closeable {
def read(): Int
def read(b: Array[Byte]): Int = read(b, 0, b.length)
def read(b: Array[Byte], off: Int, len: Int): Int = {
if (off < 0 || len < 0 || len > b.length - off)
throw new IndexOutOfBoundsException
if (len == 0) 0
else {
var bytesWritten = 0
var next = 0
while (bytesWritten < len && next != -1) {
next =
if (bytesWritten == 0) read()
else {
try read()
catch { case _: IOException => -1 }
}
if (next != -1) {
b(off + bytesWritten) = next.toByte
bytesWritten += 1
}
}
if (bytesWritten <= 0) -1
else bytesWritten
}
}
def skip(n: Long): Long = {
var skipped = 0
while (skipped < n && read() != -1)
skipped += 1
skipped
}
def available(): Int = 0
def close(): Unit = ()
def mark(readlimit: Int): Unit = ()
def reset(): Unit =
throw new IOException("Reset not supported")
def markSupported(): Boolean = false
}
|