public static void main(String args[]) throws Exception {

		SdfsClient client = new SdfsClient();
		String inputLine;
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		System.out.print("[Please Enter Command]$ ");
		while ((inputLine = in.readLine()) != null) {
			
			if (inputLine.startsWith("put")) {
			     long starttime =System.currentTimeMillis();
				if (inputLine.split(" ").length == 3) {
					String localFileName = inputLine.substring(
							inputLine.indexOf(" ") + 1,
							inputLine.lastIndexOf(" "));
					String sdfsFileName = inputLine.substring(inputLine
							.lastIndexOf(" ") + 1);
					System.out.println("In put");
					
					client.chunkAndSend(localFileName, sdfsFileName);
				} else {
					String arguments[] = inputLine.split(" ");
					String localFileName = arguments[1];
					String sdfsFileName = arguments[2];
					InetAddress bootStrapNode = InetAddress
							.getByName(arguments[3]);
					client.chunkAndSend(localFileName, sdfsFileName,
							bootStrapNode);

				}
				System.out.println("Time taken for put::" +(System.currentTimeMillis()-starttime));

			} else if (inputLine.startsWith("get")) {
				long starttime =System.currentTimeMillis();
				if (inputLine.split(" ").length == 2) {
					
					
					String sdfsFileName = inputLine.substring(inputLine
							.indexOf(" ") + 1);
					client.getFile(sdfsFileName);
				} else {
					String arguments[] = inputLine.split(" ");
					String sdfsFileName = arguments[1];
					InetAddress bootStrapNode = InetAddress
							.getByName(arguments[2]);
					client.getFile(sdfsFileName, bootStrapNode);

				}
				System.out.println("Time taken:: for get" +(System.currentTimeMillis()-starttime));
			} else if (inputLine.startsWith("delete")) {
				long starttime =System.currentTimeMillis();
				if (inputLine.split(" ").length == 2) {
					String sdfsFileName = inputLine.substring(inputLine
							.indexOf(" ") + 1);
					client.deleteFile(sdfsFileName);
				} else {
					String arguments[] = inputLine.split(" ");
					String sdfsFileName = arguments[1];
					InetAddress bootStrapNode = InetAddress
							.getByName(arguments[2]);
					client.deleteFile(sdfsFileName, bootStrapNode);
					
					System.out.println("Time taken::" +(System.currentTimeMillis()-starttime));
					
				} 
			} else {
				System.out.println("Command entered in wrong format.Enter the following format");
				System.out.println("put <localfileName> <sdfsfilename>");
				System.out.println("get <sdfsfileNamw>");
				System.out.println("delete <sdfsfilename>");

			}
			System.out.print("[Please Enter Command]$ ");

		}

	}