Advertisement
parkerlreed

Untitled

Oct 12th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.         int choice;
  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("Choose from the following options\n"
  19.                         + "    1. Up\n"
  20.                         + "    2. Down\n"
  21.                         + "    3. Left\n"
  22.                         + "    4. Right\n"
  23.                         + "Enter your choice: ");
  24.         choice = kb.nextInt();
  25.         kb.nextLine();
  26.         switch(choice)
  27.         {
  28.             case 1: up.getInputStream();
  29.                     break;
  30.             case 2: down.getInputStream();
  31.                     break;
  32.             case 3: left.getInputStream();
  33.                     break;
  34.             case 4: right.getInputStream();
  35.                     break;
  36.             default: System.out.println("EXTERMINATE!");
  37.                     break;
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement