(str) Add a getChars method to java.lang.CharSequence

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 6
    • Component/s: core-libs
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      String and AbstractStringBuilder both have a

       public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)

      method. Unfortunately this method is not in CharSequence.

      JUSTIFICATION :
      java.lang.CharSequence has a method

       CharSequence subSequence(int start, int end)

      to get parts of the sequence. So there is no reason why there shouldn't be also a

       public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)

      to read character data efficiently into an existind buffer. This would allow for efficient generalizations.

      Example:
      StringReader then could take CharSequence as construction parameter wo wrap arbitrary CharSequences in Readers. It could then copy character data while avoiding unneccessary in-memory copies of these data.


      CUSTOMER SUBMITTED WORKAROUND :
      Make case differentiations between String, StringBuffer, StringBuilder,...

            Assignee:
            Martin Buchholz
            Reporter:
            Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: