From de77b3e10c648a8ea35a690c02aeab1d1d6ca950 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 18 Mar 2013 11:11:19 +0100 Subject: [PATCH] Send event when source reached EOF. --- .../net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java b/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java index 6092a4e..d62ba97 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java +++ b/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java @@ -63,7 +63,12 @@ public class MultiSourceFilter implements Filter, ReusableSink { @Override public byte[] get(int bufferSize) throws EOFException, IOException { - return source.get().get(bufferSize); + try { + return source.get().get(bufferSize); + } catch (EOFException eofe1) { + eventBus.post(new SourceFinishedEvent(source.get())); + throw eofe1; + } } @Override @@ -75,8 +80,6 @@ public class MultiSourceFilter implements Filter, ReusableSink { checkArgument(oldSource.metadata().channels() == source.metadata().channels(), "source’s channel count must equal existing source’s channel count"); checkArgument(oldSource.metadata().frequency() == source.metadata().frequency(), "source’s frequency must equal existing source’s frequency"); checkArgument(oldSource.metadata().encoding().equalsIgnoreCase(source.metadata().encoding()), "source’s encoding must equal existing source’s encoding"); - - eventBus.post(new SourceFinishedEvent(oldSource)); } } -- 2.7.4