8036848: Fix deprecation warning in sun.misc.CharacterDecoder
authorbpb
Fri, 07 Mar 2014 13:05:07 -0800
changeset 23334 8b590110ed8e
parent 23333 b0af2c7c8c91
child 23335 25ed8994b97f
child 23631 f6652dee742c
8036848: Fix deprecation warning in sun.misc.CharacterDecoder Summary: Replace use of deprecated method with its recommended successor. Reviewed-by: mchung
jdk/src/share/classes/sun/misc/CharacterDecoder.java
--- a/jdk/src/share/classes/sun/misc/CharacterDecoder.java	Fri Mar 07 13:00:25 2014 -0800
+++ b/jdk/src/share/classes/sun/misc/CharacterDecoder.java	Fri Mar 07 13:05:07 2014 -0800
@@ -183,25 +183,21 @@
      * buffer and returns a byte array containing the data.
      * @exception CEFormatException An error has occurred while decoding
      */
-    public byte decodeBuffer(String inputString)[] throws IOException {
-        byte    inputBuffer[] = new byte[inputString.length()];
-        ByteArrayInputStream inStream;
-        ByteArrayOutputStream outStream;
-
-        inputString.getBytes(0, inputString.length(), inputBuffer, 0);
-        inStream = new ByteArrayInputStream(inputBuffer);
-        outStream = new ByteArrayOutputStream();
+    public byte[] decodeBuffer(String inputString) throws IOException {
+        byte inputBuffer[] = inputString.getBytes();
+        ByteArrayInputStream inStream = new ByteArrayInputStream(inputBuffer);
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
         decodeBuffer(inStream, outStream);
-        return (outStream.toByteArray());
+        return outStream.toByteArray();
     }
 
     /**
      * Decode the contents of the inputstream into a buffer.
      */
-    public byte decodeBuffer(InputStream in)[] throws IOException {
+    public byte[] decodeBuffer(InputStream in) throws IOException {
         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
         decodeBuffer(in, outStream);
-        return (outStream.toByteArray());
+        return outStream.toByteArray();
     }
 
     /**