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)));
}
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)));
}
- relates to
-
JDK-4183159 SequenceInputStream(ListIterator) constructor to enforce ordering
-
- Closed
-