From: David ‘Bombe’ Roden Date: Thu, 14 Mar 2013 21:29:37 +0000 (+0100) Subject: Return the new stream directly. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0c170835a9bc25d24c01f119d87fe3644052381f;p=sonitus.git Return the new stream directly. --- diff --git a/src/main/java/net/pterodactylus/sonitus/io/RememberingInputStream.java b/src/main/java/net/pterodactylus/sonitus/io/RememberingInputStream.java index ac2e5f0..5fae4b2 100644 --- a/src/main/java/net/pterodactylus/sonitus/io/RememberingInputStream.java +++ b/src/main/java/net/pterodactylus/sonitus/io/RememberingInputStream.java @@ -22,6 +22,7 @@ import java.io.ByteArrayOutputStream; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.SequenceInputStream; /** * Wrapper around an {@link InputStream} that remembers all bytes that have been @@ -51,12 +52,13 @@ public class RememberingInputStream extends FilterInputStream { // /** - * Returns all remembered bytes as an {@link InputStream}. + * Returns an input stream that repeats the originally wrapped stream, + * including all bytes that have already been read. * - * @return All remembered bytes + * @return A new input stream with the original content */ public InputStream remembered() { - return new ByteArrayInputStream(rememberBuffer.toByteArray()); + return new SequenceInputStream(new ByteArrayInputStream(rememberBuffer.toByteArray()), in); } //