Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4642548

(str) StringBuffer.append(byte[]bytes, int offset, int length, String charsetName)

XMLWordPrintable

    • Fix Understood
    • x86
    • linux, windows_2000

      Name: rmT116609 Date: 02/25/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      Several places in the SDK have code which uses the deprecated String(byte[] ascii, int hibyte, int offset, int count) constructor which is then appended to a StringBuffer. Obviously the String(byte[] bytes, int offset, int length, String charsetName) constructor could be used. However adding a new
      append() method to StringBuffer would avoid unnecessary copies

      to StringBuffer add

         public StringBuffer append(byte[] bytes, int offset, int length, String charsetName)


      CUSTOMER WORKAROUND :
      use

         byte[] bytes = ...
         StringBuffer sb = new StringBuffer();
         String str = new String(bytes, 0, bytes.length, null);
         sb.append(str);
      (Review ID: 143308)
      ======================================================================

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: