Add some missing javadoc comments.
[sonitus.git] / src / main / java / net / pterodactylus / sonitus / data / sink / FileSink.java
index 92dd59a..48476b3 100644 (file)
@@ -26,6 +26,9 @@ import java.util.logging.Logger;
 import net.pterodactylus.sonitus.data.Controller;
 import net.pterodactylus.sonitus.data.Metadata;
 import net.pterodactylus.sonitus.data.Sink;
+import net.pterodactylus.sonitus.data.event.MetadataUpdated;
+
+import com.google.common.eventbus.EventBus;
 
 /**
  * {@link net.pterodactylus.sonitus.data.Sink} that writes all received data
@@ -38,9 +41,13 @@ public class FileSink implements Sink {
        /** The logger. */
        private static final Logger logger = Logger.getLogger(FileSink.class.getName());
 
+       /** The event bus. */
+       private final EventBus eventBus;
+
        /** The path of the file to write to. */
        private final String path;
 
+       /** The output stream writing to the file. */
        private FileOutputStream fileOutputStream;
 
        /** The current metadata. */
@@ -49,10 +56,13 @@ public class FileSink implements Sink {
        /**
         * Creates a new file sink that will write to the given path.
         *
+        * @param eventBus
+        *              The event bus
         * @param path
         *              The path of the file to write to
         */
-       public FileSink(String path) {
+       public FileSink(EventBus eventBus, String path) {
+               this.eventBus = eventBus;
                this.path = path;
        }
 
@@ -97,6 +107,7 @@ public class FileSink implements Sink {
        @Override
        public void metadataUpdated(Metadata metadata) {
                this.metadata = metadata;
+               eventBus.post(new MetadataUpdated(this, metadata));
        }
 
        @Override