com.nitorcreations.willow.deployer.StreamLinePumper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of willow-deployer Show documentation
Show all versions of willow-deployer Show documentation
Willow elastic cloud application deployer
package com.nitorcreations.willow.deployer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URISyntaxException;
import com.nitorcreations.willow.messages.OutputMessage;
import com.nitorcreations.willow.messages.WebSocketTransmitter;
class StreamLinePumper implements Runnable {
private final BufferedReader in;
private final String name;
private final WebSocketTransmitter transmitter;
public StreamLinePumper(InputStream in, WebSocketTransmitter transmitter, String name) throws URISyntaxException {
this.transmitter = transmitter;
this.in = new BufferedReader(new InputStreamReader(in));
this.name = name;
}
@Override
public void run() {
try {
String line;
while ((line = in.readLine()) != null) {
OutputMessage msg = new OutputMessage(name, line);
transmitter.queue(msg);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy