< prev index next >

src/java.base/share/classes/java/io/OutputStreamWriter.java

Print this page
rev 15365 : imported patch 8163517-Various-cleanup-in-java-io-code

@@ -231,26 +231,20 @@
         se.write(str, off, len);
     }
 
     @Override
     public Writer append(CharSequence csq, int start, int end) throws IOException {
-        if (csq == null) {
-            write("null".subSequence(start, end).toString());
-            return this;
-        } else {
+        if (csq == null) csq = "null";
             return append(csq.subSequence(start, end));
         }
-    }
 
     @Override
     public Writer append(CharSequence csq) throws IOException {
-        if (csq == null) {
-            se.write("null");
-        } else if (csq instanceof CharBuffer) {
+        if (csq instanceof CharBuffer) {
             se.write((CharBuffer) csq);
         } else {
-            se.write(csq.toString());
+            se.write(String.valueOf(csq));
         }
         return this;
     }
 
     /**
< prev index next >