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

getText(position,length,Segment) should allow partial returns

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.2.0
    • client-libs
    • None
    • beta
    • x86
    • windows_95

      I think the definition of getText should be like the
      OS read() methods: the length parameter is a suggestion,
      and you get told how many actually got read. This would
      allow representations like GapContent to *never* allocate
      memory. As it is, if you're writing a search routine
      (like me) and you try something foolish like getText(0,doc.getLength(),segment)
      GapContent will make a full copy of the document! What's worse,
      there's no real way to avoid this since you can't tell where
      the split in GapContent's buffer is (I now do getText's in
      small chunks so that I avoid the huge allocation).

      It may be that you actually want a new method, getTextPartial(...)
      but I do believe these partial result semantics are *essential* for
      a wide variety of purposes.

            tprinzing Tim Prinzing (Inactive)
            jag James Gosling (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: