|
57 | 57 | import java.io.*; |
58 | 58 | import java.lang.reflect.*; |
59 | 59 | import java.net.*; |
| 60 | +import java.nio.charset.StandardCharsets; |
60 | 61 | import java.text.*; |
61 | 62 | import java.util.*; |
62 | 63 | import java.util.regex.*; |
@@ -6562,10 +6563,8 @@ static public BufferedReader createReader(File file) { |
6562 | 6563 | * following lines any more I'm gonna send Sun my medical bills. |
6563 | 6564 | */ |
6564 | 6565 | static public BufferedReader createReader(InputStream input) { |
6565 | | - InputStreamReader isr = null; |
6566 | | - try { |
6567 | | - isr = new InputStreamReader(input, "UTF-8"); |
6568 | | - } catch (UnsupportedEncodingException e) { } // not gonna happen |
| 6566 | + InputStreamReader isr = |
| 6567 | + new InputStreamReader(input, StandardCharsets.UTF_8); |
6569 | 6568 | return new BufferedReader(isr); |
6570 | 6569 | } |
6571 | 6570 |
|
@@ -6625,12 +6624,10 @@ static public PrintWriter createWriter(File file) { |
6625 | 6624 | * It's the JavaSoft API engineers who need to explain themselves. |
6626 | 6625 | */ |
6627 | 6626 | static public PrintWriter createWriter(OutputStream output) { |
6628 | | - try { |
6629 | | - BufferedOutputStream bos = new BufferedOutputStream(output, 8192); |
6630 | | - OutputStreamWriter osw = new OutputStreamWriter(bos, "UTF-8"); |
6631 | | - return new PrintWriter(osw); |
6632 | | - } catch (UnsupportedEncodingException e) { } // not gonna happen |
6633 | | - return null; |
| 6627 | + BufferedOutputStream bos = new BufferedOutputStream(output, 8192); |
| 6628 | + OutputStreamWriter osw = |
| 6629 | + new OutputStreamWriter(bos, StandardCharsets.UTF_8); |
| 6630 | + return new PrintWriter(osw); |
6634 | 6631 | } |
6635 | 6632 |
|
6636 | 6633 |
|
|
0 commit comments