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

provide SequenceInputStream(List) constructor

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 5.0
    • core-libs

      A DESCRIPTION OF THE REQUEST :
      java.io.SequenceInputStream has two constructors: an Enumeration, and two other input streams.

      It would be good if it supported varargs.

      JUSTIFICATION :
      Enumeration is rather old these days, and is discouraged. As the enumeration is simply a way to provide multiple input streams, varargs support would be cleaner and more typesafe.

      This is also consistent with Bug 4183159, which suggests adding a ListIterator constructor.

      See http://twasink.net/blog/archives/2005/09/xml_javaio_and_1.html for a real-world scenario where this would have helped.


      CUSTOMER SUBMITTED WORKAROUND :
      Well, one obvious workaround is to implement a factory method like so:

      InputStream sequenceStreams(InputStream ... streamsToSequence) {
        return new SequenceInputStream(Collections.enumeration(Arrays.asList(streamsToSequence)));
      }

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: