1 | ByteArrayOutputStream readBA(String name) throws IOException {↵ | | 1 | ByteArrayOutputStream readBA(String name) throws IOException {↵
|
2 | BufferedInputStream bis = new BufferedInputStream(new FileInputStream(findTestFile(name)));↵ | | 2 | BufferedInputStream bis = new BufferedInputStream(new FileInputStream(findTestFile(name)));↵
|
3 | ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);↵ | | 3 | ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);↵
|
4 | int len = 0;↵ | | 4 | int len = 0;↵
|
5 | byte[] data = new byte[512];↵ | | 5 | byte[] data = new byte[512];↵
|
6 | while ((len = bis.read(data)) >= 0) {↵ | | 6 | while ((len = bis.read(data)) >= 0) {↵
|
7 | baos.write(data, 0, len);↵ | | 7 | baos.write(data, 0, len);↵
|
8 | }↵ | | 8 | }↵
|
9 | bis.close();↵ | | 9 | bis.close();↵
|
10 | return baos;↵ | | 10 | return baos;↵
|
11 | }↵ | | 11 | }↵
|
|
12 | private byte[] readFile(String name) throws IOException {↵ | | 12 | private byte[] readFile(String name) throws IOException {↵
|
13 | return readBA(name).toByteArray();↵ | | 13 | return readBA(name).toByteArray();↵
|
14 | | | 14 |
|