projects
/
sonitus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move event and metadata handling into abstract base class.
[sonitus.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sonitus
/
data
/
sink
/
FileSink.java
diff --git
a/src/main/java/net/pterodactylus/sonitus/data/sink/FileSink.java
b/src/main/java/net/pterodactylus/sonitus/data/sink/FileSink.java
index
b3b1ff0
..
be934f3
100644
(file)
--- a/
src/main/java/net/pterodactylus/sonitus/data/sink/FileSink.java
+++ b/
src/main/java/net/pterodactylus/sonitus/data/sink/FileSink.java
@@
-27,9
+27,6
@@
import net.pterodactylus.sonitus.data.AbstractControlledComponent;
import net.pterodactylus.sonitus.data.Controller;
import net.pterodactylus.sonitus.data.Metadata;
import net.pterodactylus.sonitus.data.Sink;
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
/**
* {@link net.pterodactylus.sonitus.data.Sink} that writes all received data
@@
-42,28
+39,20
@@
public class FileSink extends AbstractControlledComponent implements Sink {
/** The logger. */
private static final Logger logger = Logger.getLogger(FileSink.class.getName());
/** 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 path of the file to write to. */
private final String path;
/** The output stream writing to the file. */
private FileOutputStream fileOutputStream;
- /** The current metadata. */
- private Metadata metadata;
-
/**
* Creates a new file sink that will write to the given path.
*
/**
* 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
*/
* @param path
* The path of the file to write to
*/
- public FileSink(
EventBus eventBus,
String path) {
-
this.eventBus = eventBus
;
+ public FileSink(String path) {
+
super(path)
;
this.path = path;
}
this.path = path;
}
@@
-72,16
+61,6
@@
public class FileSink extends AbstractControlledComponent implements Sink {
//
@Override
//
@Override
- public String name() {
- return path;
- }
-
- @Override
- public Metadata metadata() {
- return metadata;
- }
-
- @Override
public List<Controller<?>> controllers() {
return Collections.emptyList();
}
public List<Controller<?>> controllers() {
return Collections.emptyList();
}
@@
-106,13
+85,6
@@
public class FileSink extends AbstractControlledComponent implements Sink {
}
@Override
}
@Override
- public void metadataUpdated(Metadata metadata) {
- this.metadata = metadata;
- fireMetadataUpdated(metadata);
- eventBus.post(new MetadataUpdated(this, metadata));
- }
-
- @Override
public void process(byte[] buffer) throws IOException {
fileOutputStream.write(buffer);
logger.finest(String.format("FileSink: Wrote %d Bytes.", buffer.length));
public void process(byte[] buffer) throws IOException {
fileOutputStream.write(buffer);
logger.finest(String.format("FileSink: Wrote %d Bytes.", buffer.length));