You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2020/04/21 02:56:40 UTC

[james-project] 04/19: [Refactoring] avoid using recursive SequenceInputStream

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 6547b42c82b55bcee3da94b4a2507e0fa69b7633
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Wed Apr 15 22:50:02 2020 +0200

    [Refactoring] avoid using recursive SequenceInputStream
---
 .../main/java/org/apache/james/util/InputStreamUtils.java    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/container/util/src/main/java/org/apache/james/util/InputStreamUtils.java b/server/container/util/src/main/java/org/apache/james/util/InputStreamUtils.java
index d522965..0d96591 100644
--- a/server/container/util/src/main/java/org/apache/james/util/InputStreamUtils.java
+++ b/server/container/util/src/main/java/org/apache/james/util/InputStreamUtils.java
@@ -21,14 +21,14 @@ package org.apache.james.util;
 
 import java.io.InputStream;
 import java.io.SequenceInputStream;
-import java.util.Arrays;
-import java.util.stream.Stream;
+import java.util.Collections;
+
+import com.google.common.collect.Lists;
 
 public class InputStreamUtils {
     public static InputStream concat(InputStream inputStream, InputStream... additionalInputStreams) {
-        Stream<InputStream> inputStreams = Stream.concat(Stream.of(inputStream), Arrays.stream(additionalInputStreams));
-
-        return inputStreams.reduce(SequenceInputStream::new)
-            .get();
+        return new SequenceInputStream(
+            Collections.enumeration(
+                Lists.asList(inputStream, additionalInputStreams)));
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org