How to make a while loop with properties I been 2 days playing with Iterator, toString parse and a lot of another forms here is the format I want to display. Work perfect only for one set of properties so only display the last items from the query.
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while((line=in.readLine())!=null){
System.out.println(line);
}
Display 2 sets in a bad format
Now this is the perfect format but only print the last item:
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
Properties prop= new Properties();
while((line=in.readLine())!=null){
prop.load(in);
String amount = prop.getProperty("ssl_amount");
String card = prop.getProperty("ssl_card_number");
String approval = prop.getProperty("ssl_approval_code");
String results = prop.getProperty("ssl_result_message");
String time = prop.getProperty("ssl_txn_time");
System.out.println(amount+" "+card+" "+approval+" "+results+" "+time+" ");
}
How I can make a loop to print all the entry's in the correct format? This is the Raw Input stream:
ssl_txn_count=2
ssl_txn_id=071214A15-B805A410-E9F4-4D6D-AA87-0E9923FBC7FA
ssl_user_id=webpage
ssl_trans_status=STL
ssl_card_type=CREDITCARD
ssl_transaction_type=SALE
ssl_txn_time=12/07/2014 11:28:00 PM
ssl_first_name=
ssl_last_name=
ssl_card_number=41**********1111
ssl_exp_date=1115
ssl_entry_mode=K
ssl_avs_response=
ssl_cvv2_response=P
ssl_amount=10.00
ssl_invoice_number=
ssl_result_message=APPROVAL
ssl_approval_code=CVI064
ssl_txn_id=061214A15-8921B6B0-FF9E-4DA5-97D1-288C28272B10
ssl_user_id=webpage
ssl_trans_status=STL
ssl_card_type=CREDITCARD
ssl_transaction_type=SALE
ssl_txn_time=12/06/2014 01:25:18 AM
ssl_first_name=
ssl_last_name=
ssl_card_number=41**********1111
ssl_exp_date=1215
ssl_entry_mode=K
ssl_avs_response=
ssl_cvv2_response=P
ssl_amount=12.00
ssl_invoice_number=
ssl_result_message=APPROVAL
ssl_approval_code=CVI806
And here is the good format I want it : (like you can see only report 1 of them and not 2)
run:
12.00 41**********1111 CVI806 APPROVAL 12/06/2014 01:25:18 AM
BUILD SUCCESSFUL (total time: 1 second)