Advertisement
parkerlreed

Untitled

Oct 12th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.net.*;
  3. import java.io.*;
  4. public class Xbmcremote
  5. {
  6. public static void main(String[] args) throws Exception
  7. {
  8. URL sendup = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Up%22}");
  9. URL senddown = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Down%22}");
  10. URL sendleft = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Left%22}");
  11. URL sendright = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Right%22}");
  12. String direction = "";
  13. URLConnection up = sendup.openConnection();
  14. URLConnection down = senddown.openConnection();
  15. URLConnection left = sendleft.openConnection();
  16. URLConnection right = sendright.openConnection();
  17. Scanner kb = new Scanner(System.in);
  18. System.out.print("Up, Down, Left, or Right? ");
  19. direction = kb.nextLine();
  20. switch(direction)
  21. {
  22. case "up": up.getInputStream();
  23. break;
  24. case "down": down.getInputStream();
  25. break;
  26. case "left": left.getInputStream();
  27. break;
  28. case "right": right.getInputStream();
  29. break;
  30. default: System.out.println("EXTERMINATE!");
  31. break;
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement