equal
deleted
inserted
replaced
7 package isabelle |
7 package isabelle |
8 |
8 |
9 |
9 |
10 import java.io.{File => JFile, ByteArrayOutputStream, ByteArrayInputStream, |
10 import java.io.{File => JFile, ByteArrayOutputStream, ByteArrayInputStream, |
11 OutputStream, InputStream, FileInputStream, FileOutputStream} |
11 OutputStream, InputStream, FileInputStream, FileOutputStream} |
|
12 import java.net.URL |
12 |
13 |
13 import org.tukaani.xz.{XZInputStream, XZOutputStream} |
14 import org.tukaani.xz.{XZInputStream, XZOutputStream} |
14 |
15 |
15 |
16 |
16 object Bytes |
17 object Bytes |
57 |
58 |
58 def read(file: JFile): Bytes = |
59 def read(file: JFile): Bytes = |
59 using(new FileInputStream(file))(read_stream(_, file.length.toInt)) |
60 using(new FileInputStream(file))(read_stream(_, file.length.toInt)) |
60 |
61 |
61 def read(path: Path): Bytes = read(path.file) |
62 def read(path: Path): Bytes = read(path.file) |
|
63 |
|
64 def read(url: URL): Bytes = using(url.openStream)(read_stream(_)) |
62 |
65 |
63 |
66 |
64 /* write */ |
67 /* write */ |
65 |
68 |
66 def write(file: JFile, bytes: Bytes) |
69 def write(file: JFile, bytes: Bytes) |