classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] inputstreamreader quickfix


From: Robert Schuster
Subject: [cp-patches] inputstreamreader quickfix
Date: Tue, 22 Feb 2005 04:12:51 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.5) Gecko/20050107

Fixes a compilation problem in java/io/InputStreamReader.


2005-02-22  Robert Schuster  <address@hidden>

       * java/io/InputStreamReader.java: Fixed compilation
       problem.



cu
Robert
Index: java/io/InputStreamReader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/InputStreamReader.java,v
retrieving revision 1.19
diff -u -r1.19 InputStreamReader.java
--- java/io/InputStreamReader.java      21 Feb 2005 18:07:30 -0000      1.19
+++ java/io/InputStreamReader.java      22 Feb 2005 03:07:31 -0000
@@ -43,6 +43,7 @@
 import java.nio.charset.CharsetDecoder;
 
 import gnu.java.io.EncodingManager;
+import gnu.java.io.decode.Decoder;
 
 /**
  * This class reads characters from a byte input stream.   The characters
@@ -97,6 +98,8 @@
    */
   private Reader in;
 
+  private String encoding;
+  
   /**
    * This method initializes a new instance of <code>InputStreamReader</code>
    * to read from the specified stream using the default encoding.
@@ -107,7 +110,11 @@
   {
     if (in == null)
       throw new NullPointerException();
-    this.in = EncodingManager.getDecoder(in);
+    
+    Decoder decoder =  EncodingManager.getDecoder(in);
+    encoding = decoder.getSchemeName();
+    
+    this.in = decoder;
   }
 
   /**
@@ -129,7 +136,11 @@
         || encoding_name == null)
       throw new NullPointerException();
     
-    this.in = EncodingManager.getDecoder(in, encoding_name);
+    Decoder decoder = EncodingManager.getDecoder(in, encoding_name);
+    encoding = decoder.getSchemeName();
+    
+    this.in = decoder;
+    
   }
 
   /**
@@ -144,6 +155,8 @@
      * encoding/decoding.
      */
     this.in = Channels.newReader(Channels.newChannel(in), 
charset.newDecoder(), -1);
+    
+    encoding = charset.name();
   }
 
   /**
@@ -153,6 +166,8 @@
   public InputStreamReader(InputStream in, CharsetDecoder decoder) {
     // FIXME: see address@hidden InputStreamReader(InputStream, Charset)
     this.in = Channels.newReader(Channels.newChannel(in), decoder, -1);
+    
+    encoding = decoder.charset().name();
   }
   
   /**
@@ -180,7 +195,7 @@
    */
   public String getEncoding()
   {
-    return in != null ? in.getSchemeName() : null;
+    return in != null ? encoding : null;
   }
 
   /**

reply via email to

[Prev in Thread] Current Thread [Next in Thread]