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

java.io.ByteArrayOutputStream.toByteArray can be made more efficient

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.4

      Description


      In the famous words :-) of Patrick Chan:

      You might consider a more efficient implementation where
      the client specifies a block size and the implementation creates
      blocks as needed. It should never do copies.

      Then have toByteArray create a single large array and copy in the blocks.

      I'd also recommend another method which returns an enumeration of
      the blocks to avoid the "new" and "copies" of toByteArray().

      Want me to do it for you?

      Also shouldnt write(int b) -> write(byte b)?

      Cheers,
      Pat

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            vssriniv Vijay Srinivasan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: