summaryrefslogtreecommitdiff
path: root/libjava/gnu/gcj/convert
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-26 01:05:13 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-26 01:05:13 +0000
commit8b05ee0d4d590350b6553ac0d48927441639ebf0 (patch)
tree0ff7b2f7b85266bd1b1efa1fa9c345d114f18d8f /libjava/gnu/gcj/convert
parentc1b21d32ced355dd8cbe74bdeaf06e950d538a8d (diff)
downloadgcc-8b05ee0d4d590350b6553ac0d48927441639ebf0.tar.gz
PR libgcj/29594:
* gnu/gcj/convert/Convert.java (main): Correctly handle missing input or output encodings. Removed unused local variables. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121197 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/gcj/convert')
-rw-r--r--libjava/gnu/gcj/convert/Convert.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/libjava/gnu/gcj/convert/Convert.java b/libjava/gnu/gcj/convert/Convert.java
index afeac649248..cf67061d6b7 100644
--- a/libjava/gnu/gcj/convert/Convert.java
+++ b/libjava/gnu/gcj/convert/Convert.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2002, 2005, 2006 Free Software Foundation
+/* Copyright (C) 1999, 2002, 2005, 2006, 2007 Free Software Foundation
This file is part of libgcj.
@@ -151,12 +151,6 @@ public class Convert
try
{
- BytesToUnicode inDecoder
- = inEncodingName == null ? BytesToUnicode.getDefaultDecoder()
- : BytesToUnicode.getDecoder(inEncodingName);
- UnicodeToBytes outEncoder
- = outEncodingName == null ? UnicodeToBytes.getDefaultEncoder()
- : UnicodeToBytes.getEncoder(outEncodingName);
InputStream inStream = inName.equals("-") ? System.in
: new FileInputStream(inName);
OutputStream outStream;
@@ -165,9 +159,13 @@ public class Convert
else
outStream = new FileOutputStream(outName);
InputStreamReader in
- = new InputStreamReader(inStream, inEncodingName);
+ = (inEncodingName == null
+ ? new InputStreamReader(inStream)
+ : new InputStreamReader(inStream, inEncodingName));
OutputStreamWriter out
- = new OutputStreamWriter(outStream, outEncodingName);
+ = (outEncodingName == null
+ ? new OutputStreamWriter(outStream)
+ : new OutputStreamWriter(outStream, outEncodingName));
char[] buffer = new char[2048];
for (;;)
{