@@ -538,7 +538,7 @@ public void testChecksum() throws Exception {
538538 // create a test file
539539 final String text = "Imagination is more important than knowledge - Einstein" ;
540540 final File file = new File (tempDirFile , "checksum-test.txt" );
541- FileUtils .writeStringToFile (file , text , "US-ASCII" );
541+ FileUtils .writeStringToFile (file , text , StandardCharsets . US_ASCII . name () );
542542
543543 // compute the expected checksum
544544 final Checksum expectedChecksum = new CRC32 ();
@@ -559,7 +559,7 @@ public void testChecksumCRC32() throws Exception {
559559 // create a test file
560560 final String text = "Imagination is more important than knowledge - Einstein" ;
561561 final File file = new File (tempDirFile , "checksum-test.txt" );
562- FileUtils .writeStringToFile (file , text , "US-ASCII" );
562+ FileUtils .writeStringToFile (file , text , StandardCharsets . US_ASCII . name () );
563563
564564 // compute the expected checksum
565565 final Checksum expectedChecksum = new CRC32 ();
@@ -577,12 +577,12 @@ public void testChecksumDouble() throws Exception {
577577 // create a test file
578578 final String text1 = "Imagination is more important than knowledge - Einstein" ;
579579 final File file1 = new File (tempDirFile , "checksum-test.txt" );
580- FileUtils .writeStringToFile (file1 , text1 , "US-ASCII" );
580+ FileUtils .writeStringToFile (file1 , text1 , StandardCharsets . US_ASCII . name () );
581581
582582 // create a second test file
583583 final String text2 = "To be or not to be - Shakespeare" ;
584584 final File file2 = new File (tempDirFile , "checksum-test2.txt" );
585- FileUtils .writeStringToFile (file2 , text2 , "US-ASCII" );
585+ FileUtils .writeStringToFile (file2 , text2 , StandardCharsets . US_ASCII . name () );
586586
587587 // compute the expected checksum
588588 final Checksum expectedChecksum = new CRC32 ();
@@ -609,7 +609,7 @@ public void testChecksumOnNullChecksum() throws Exception {
609609 // create a test file
610610 final String text = "Imagination is more important than knowledge - Einstein" ;
611611 final File file = new File (tempDirFile , "checksum-test.txt" );
612- FileUtils .writeStringToFile (file , text , "US-ASCII" );
612+ FileUtils .writeStringToFile (file , text , StandardCharsets . US_ASCII . name () );
613613 assertThrows (NullPointerException .class , () -> FileUtils .checksum (file , null ));
614614 }
615615
@@ -2925,12 +2925,12 @@ public void testWriteLines_3arg_nullSeparator() throws Exception {
29252925 final List <Object > list = Arrays .asList (data );
29262926
29272927 final File file = TestUtils .newFile (tempDirFile , "lines.txt" );
2928- FileUtils .writeLines (file , "US-ASCII" , list );
2928+ FileUtils .writeLines (file , StandardCharsets . US_ASCII . name () , list );
29292929
29302930 final String expected = "hello" + System .lineSeparator () + "world" + System .lineSeparator () +
29312931 System .lineSeparator () + "this is" + System .lineSeparator () +
29322932 System .lineSeparator () + "some text" + System .lineSeparator ();
2933- final String actual = FileUtils .readFileToString (file , "US-ASCII" );
2933+ final String actual = FileUtils .readFileToString (file , StandardCharsets . US_ASCII . name () );
29342934 assertEquals (expected , actual );
29352935 }
29362936
@@ -2972,10 +2972,10 @@ public void testWriteLines_4arg() throws Exception {
29722972 final List <Object > list = Arrays .asList (data );
29732973
29742974 final File file = TestUtils .newFile (tempDirFile , "lines.txt" );
2975- FileUtils .writeLines (file , "US-ASCII" , list , "*" );
2975+ FileUtils .writeLines (file , StandardCharsets . US_ASCII . name () , list , "*" );
29762976
29772977 final String expected = "hello*world**this is**some text*" ;
2978- final String actual = FileUtils .readFileToString (file , "US-ASCII" );
2978+ final String actual = FileUtils .readFileToString (file , StandardCharsets . US_ASCII . name () );
29792979 assertEquals (expected , actual );
29802980 }
29812981
@@ -2986,19 +2986,19 @@ public void testWriteLines_4arg_nullSeparator() throws Exception {
29862986 final List <Object > list = Arrays .asList (data );
29872987
29882988 final File file = TestUtils .newFile (tempDirFile , "lines.txt" );
2989- FileUtils .writeLines (file , "US-ASCII" , list , null );
2989+ FileUtils .writeLines (file , StandardCharsets . US_ASCII . name () , list , null );
29902990
29912991 final String expected = "hello" + System .lineSeparator () + "world" + System .lineSeparator () +
29922992 System .lineSeparator () + "this is" + System .lineSeparator () +
29932993 System .lineSeparator () + "some text" + System .lineSeparator ();
2994- final String actual = FileUtils .readFileToString (file , "US-ASCII" );
2994+ final String actual = FileUtils .readFileToString (file , StandardCharsets . US_ASCII . name () );
29952995 assertEquals (expected , actual );
29962996 }
29972997
29982998 @ Test
29992999 public void testWriteLines_4arg_Writer_nullData () throws Exception {
30003000 final File file = TestUtils .newFile (tempDirFile , "lines.txt" );
3001- FileUtils .writeLines (file , "US-ASCII" , null , "*" );
3001+ FileUtils .writeLines (file , StandardCharsets . US_ASCII . name () , null , "*" );
30023002
30033003 assertEquals (0 , file .length (), "Sizes differ" );
30043004 }
0 commit comments