2222
2323import java .io .BufferedOutputStream ;
2424import java .io .File ;
25- import java .io .FileReader ;
2625import java .io .FileWriter ;
2726import java .io .IOException ;
2827import java .io .InputStream ;
@@ -210,7 +209,7 @@ public void testReaderToOutputStream()
210209 throws Exception
211210 {
212211 File destination = newFile ( "copy3.txt" );
213- FileReader fin = new FileReader ( testFile );
212+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
214213 OutputStream fout = Files .newOutputStream ( destination .toPath () );
215214 IOUtil .copy ( fin , fout );
216215 // Note: this method *does* flush. It is equivalent to:
@@ -232,7 +231,7 @@ public void testReaderToWriter()
232231 throws Exception
233232 {
234233 File destination = newFile ( "copy4.txt" );
235- FileReader fin = new FileReader ( testFile );
234+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
236235 FileWriter fout = new FileWriter ( destination );
237236 IOUtil .copy ( fin , fout );
238237
@@ -248,7 +247,7 @@ public void testReaderToWriter()
248247 public void testReaderToString ()
249248 throws Exception
250249 {
251- FileReader fin = new FileReader ( testFile );
250+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
252251 String out = IOUtil .toString ( fin );
253252 assertNotNull ( out );
254253 assertTrue ( "Wrong output size: out.length()=" + out .length () + "!=" + FILE_SIZE , out .length () == FILE_SIZE );
@@ -260,7 +259,7 @@ public void testStringToOutputStream()
260259 throws Exception
261260 {
262261 File destination = newFile ( "copy5.txt" );
263- FileReader fin = new FileReader ( testFile );
262+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
264263 // Create our String. Rely on testReaderToString() to make sure this is valid.
265264 String str = IOUtil .toString ( fin );
266265 OutputStream fout = Files .newOutputStream ( destination .toPath () );
@@ -284,7 +283,7 @@ public void testStringToWriter()
284283 throws Exception
285284 {
286285 File destination = newFile ( "copy6.txt" );
287- FileReader fin = new FileReader ( testFile );
286+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
288287 // Create our String. Rely on testReaderToString() to make sure this is valid.
289288 String str = IOUtil .toString ( fin );
290289 FileWriter fout = new FileWriter ( destination );
@@ -316,7 +315,7 @@ public void testInputStreamToByteArray()
316315 public void testStringToByteArray ()
317316 throws Exception
318317 {
319- FileReader fin = new FileReader ( testFile );
318+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
320319
321320 // Create our String. Rely on testReaderToString() to make sure this is valid.
322321 String str = IOUtil .toString ( fin );
0 commit comments