22
22
23
23
import java .io .BufferedOutputStream ;
24
24
import java .io .File ;
25
- import java .io .FileReader ;
26
25
import java .io .FileWriter ;
27
26
import java .io .IOException ;
28
27
import java .io .InputStream ;
@@ -210,7 +209,7 @@ public void testReaderToOutputStream()
210
209
throws Exception
211
210
{
212
211
File destination = newFile ( "copy3.txt" );
213
- FileReader fin = new FileReader ( testFile );
212
+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
214
213
OutputStream fout = Files .newOutputStream ( destination .toPath () );
215
214
IOUtil .copy ( fin , fout );
216
215
// Note: this method *does* flush. It is equivalent to:
@@ -232,7 +231,7 @@ public void testReaderToWriter()
232
231
throws Exception
233
232
{
234
233
File destination = newFile ( "copy4.txt" );
235
- FileReader fin = new FileReader ( testFile );
234
+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
236
235
FileWriter fout = new FileWriter ( destination );
237
236
IOUtil .copy ( fin , fout );
238
237
@@ -248,7 +247,7 @@ public void testReaderToWriter()
248
247
public void testReaderToString ()
249
248
throws Exception
250
249
{
251
- FileReader fin = new FileReader ( testFile );
250
+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
252
251
String out = IOUtil .toString ( fin );
253
252
assertNotNull ( out );
254
253
assertTrue ( "Wrong output size: out.length()=" + out .length () + "!=" + FILE_SIZE , out .length () == FILE_SIZE );
@@ -260,7 +259,7 @@ public void testStringToOutputStream()
260
259
throws Exception
261
260
{
262
261
File destination = newFile ( "copy5.txt" );
263
- FileReader fin = new FileReader ( testFile );
262
+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
264
263
// Create our String. Rely on testReaderToString() to make sure this is valid.
265
264
String str = IOUtil .toString ( fin );
266
265
OutputStream fout = Files .newOutputStream ( destination .toPath () );
@@ -284,7 +283,7 @@ public void testStringToWriter()
284
283
throws Exception
285
284
{
286
285
File destination = newFile ( "copy6.txt" );
287
- FileReader fin = new FileReader ( testFile );
286
+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
288
287
// Create our String. Rely on testReaderToString() to make sure this is valid.
289
288
String str = IOUtil .toString ( fin );
290
289
FileWriter fout = new FileWriter ( destination );
@@ -316,7 +315,7 @@ public void testInputStreamToByteArray()
316
315
public void testStringToByteArray ()
317
316
throws Exception
318
317
{
319
- FileReader fin = new FileReader ( testFile );
318
+ Reader fin = Files . newBufferedReader ( testFile . toPath () );
320
319
321
320
// Create our String. Rely on testReaderToString() to make sure this is valid.
322
321
String str = IOUtil .toString ( fin );
0 commit comments