|
37 | 37 | import java.io.ByteArrayInputStream;
|
38 | 38 | import java.io.ByteArrayOutputStream;
|
39 | 39 | import java.io.File;
|
40 |
| -import java.io.FileInputStream; |
41 | 40 | import java.io.FileOutputStream;
|
42 | 41 | import java.io.FileReader;
|
43 | 42 | import java.io.FileWriter;
|
44 | 43 | import java.io.IOException;
|
45 | 44 | import java.io.InputStream;
|
46 | 45 | import java.io.InputStreamReader;
|
47 | 46 | import java.io.OutputStream;
|
| 47 | +import java.nio.file.Files; |
48 | 48 | import java.util.ArrayList;
|
49 | 49 | import java.util.Arrays;
|
50 | 50 | import java.util.List;
|
@@ -244,10 +244,8 @@ public void testListener() throws Exception {
|
244 | 244 | // get settings filename
|
245 | 245 | File file = getFileInFilesystem(project, qualifier);
|
246 | 246 | Properties props = new Properties();
|
247 |
| - try (FileInputStream fileInput = new FileInputStream(file)) { |
248 |
| - try (InputStream input = new BufferedInputStream(fileInput)) { |
249 |
| - props.load(input); |
250 |
| - } |
| 247 | + try (BufferedReader reader = Files.newBufferedReader(file.toPath())) { |
| 248 | + props.load(reader); |
251 | 249 | }
|
252 | 250 |
|
253 | 251 | // change settings in the file
|
@@ -987,10 +985,8 @@ public void testListenerOnChangeFile() throws Exception {
|
987 | 985 | // get settings filename
|
988 | 986 | File file = getFileInFilesystem(project, qualifier);
|
989 | 987 | Properties props = new Properties();
|
990 |
| - try (InputStream fileInput = new FileInputStream(file)) { |
991 |
| - try (InputStream input = new BufferedInputStream(fileInput)) { |
992 |
| - props.load(input); |
993 |
| - } |
| 988 | + try (BufferedReader input = Files.newBufferedReader(file.toPath())) { |
| 989 | + props.load(input); |
994 | 990 | }
|
995 | 991 |
|
996 | 992 | // reset the listener
|
@@ -1052,16 +1048,9 @@ public void testLoadIsImport() throws Exception {
|
1052 | 1048 | node.flush();
|
1053 | 1049 | assertEquals("1.00", oldValue, node.get(key, null));
|
1054 | 1050 |
|
1055 |
| - byte[] buffer = null; |
1056 | 1051 | // copy the data into a buffer for later use
|
1057 | 1052 | File fileInFS = getFileInFilesystem(project, qualifier);
|
1058 |
| - try (InputStream fileInput = new FileInputStream(fileInFS)) { |
1059 |
| - try (InputStream input = new BufferedInputStream(fileInput)) { |
1060 |
| - ByteArrayOutputStream output = new ByteArrayOutputStream(1024); |
1061 |
| - buffer = output.toByteArray(); |
1062 |
| - input.transferTo(output); |
1063 |
| - } |
1064 |
| - } |
| 1053 | + byte[] buffer = Files.readAllBytes(fileInFS.toPath()); |
1065 | 1054 |
|
1066 | 1055 | // remove the file from the project
|
1067 | 1056 | IFile fileInWS = getFileInWorkspace(project, qualifier);
|
|
0 commit comments