Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-752

Use LinkedList in org.apache.commons.io.output.AbstractByteArrayOutputStream

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Incomplete
    • 2.11.0
    • None
    • Streams/Writers
    • None

    Description

      Hi,

      org.apache.commons.io.output.AbstractByteArrayOutputStream is super class which
      (unlike java.io.ByteArrayOutputStream)
      not realocate memory/copy arrays - if data buffer is groving.

      Instead of it use List of 1KB byte[] chunks and simply add new chunk into list.

      private final List<byte[]> buffers = new ArrayList<>();

      But as List implementation there is used "ArrayList" so the "array of pointers to chunks" is stil realocated in memory.

      I suggest to use LinkedList instead.

      With best regards

      Vladimir Vasa

      Attachments

        Activity

          People

            Unassigned Unassigned
            vlavasa Vladimír Váša
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: