changeset 23334:8b590110ed8e

8036848: Fix deprecation warning in sun.misc.CharacterDecoder Summary: Replace use of deprecated method with its recommended successor. Reviewed-by: mchung
author bpb
date Fri, 07 Mar 2014 13:05:07 -0800
parents b0af2c7c8c91
children 25ed8994b97f f6652dee742c
files jdk/src/share/classes/sun/misc/CharacterDecoder.java
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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();
     }
 
     /**