import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.lang.AutoCloseable; public class PipeReader implements AutoCloseable { private BufferedReader pipe; public PipeReader(String pipe_path) throws IOException { this.pipe = new BufferedReader(new FileReader(pipe_path)); } public void close() throws IOException { this.pipe.close(); } public String recvMessage() throws IOException { return this.pipe.readLine(); } }