Class RemoteControlClient
- java.lang.Object
-
- com.tagtraum.beatunes.remotecontrol.RemoteControlClient
-
public class RemoteControlClient extends Object
Client forRemoteControlService
. Connects to127.0.0.1/::1
to send one or more commands separated by newlines.- Author:
- Hendrik Schreiber
- See Also:
RemoteControlService
-
-
Constructor Summary
Constructors Constructor Description RemoteControlClient()
Creates this client.RemoteControlClient(int port)
Creates this client.RemoteControlClient(Path portFile)
Creates this client.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(String[] args)
String
run(String command)
Run a command.void
run(String command, Writer writer)
Runs one or more commands.String
toString()
-
-
-
Constructor Detail
-
RemoteControlClient
public RemoteControlClient() throws IOException
Creates this client.- Throws:
IOException
- in case we cannot find the portfile, i.e.is not running
-
RemoteControlClient
public RemoteControlClient(Path portFile) throws IOException
Creates this client.- Throws:
IOException
- in case we cannot read the portfile, i.e.is not running
-
RemoteControlClient
public RemoteControlClient(int port)
Creates this client.
-
-
Method Detail
-
run
public String run(String command) throws IOException
Run a command.- Parameters:
command
- a command- Returns:
- a JSON-formatted status message or other output provided by the action.
- Throws:
IOException
- if a communication error occurred.
-
run
public void run(String command, Writer writer) throws IOException
Runs one or more commands.- Parameters:
command
- a commandwriter
- the writer to write a response to- Throws:
IOException
- if a communication error occurred.
-
main
public static void main(String[] args) throws IOException
- Throws:
IOException
-
-