X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fdata%2Fsource%2FMultiSource.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fdata%2Fsource%2FMultiSource.java;h=b5705d5a76e6d144a6bcb4862e4dabc7d155d1f9;hb=7188da95cfb6dc2bf140eb8ac7e4dc99a0761a97;hp=0000000000000000000000000000000000000000;hpb=3d073631242b121378ff9c60104170d13cab52d7;p=sonitus.git
diff --git a/src/main/java/net/pterodactylus/sonitus/data/source/MultiSource.java b/src/main/java/net/pterodactylus/sonitus/data/source/MultiSource.java
new file mode 100644
index 0000000..b5705d5
--- /dev/null
+++ b/src/main/java/net/pterodactylus/sonitus/data/source/MultiSource.java
@@ -0,0 +1,118 @@
+/*
+ * Sonitus - MultiSource.java - Copyright © 2013 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package net.pterodactylus.sonitus.data.source;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.logging.Logger;
+
+import net.pterodactylus.sonitus.data.Metadata;
+import net.pterodactylus.sonitus.data.Source;
+import net.pterodactylus.sonitus.data.event.SourceFinishedEvent;
+
+import com.google.common.eventbus.EventBus;
+import com.google.inject.Inject;
+
+/**
+ * {@link Source} implementation that simply forwards another source and
+ * supports changing the source without letting the {@link
+ * net.pterodactylus.sonitus.data.Sink} know.
+ *
+ * @author David âBombeâ Roden
+ */
+public class MultiSource implements Source {
+
+ /** The logger. */
+ private static final Logger logger = Logger.getLogger(MultiSource.class.getName());
+
+ /** The event bus. */
+ private final EventBus eventBus;
+
+ /** The current source. */
+ private final AtomicReference