From: David ‘Bombe’ Roden Date: Mon, 18 Mar 2013 10:11:19 +0000 (+0100) Subject: Send event when source reached EOF. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=de77b3e10c648a8ea35a690c02aeab1d1d6ca950;p=sonitus.git Send event when source reached EOF. --- 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)); } }