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

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

XMLWordPrintable

    • sparc
    • solaris_2.4


      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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: