Phone.class:
Code:
package com.techventus.server.voice;
public class Phone
{
public String id;
public String number;
public String formattedNumber;
public String type;
public String name;
public String carrier;
public Boolean verified;
public String toString()
{
String ret = "";
if (this.id != null) {
ret = ret + "id=" + this.id + ";";
}
if (this.number != null) {
ret = ret + "number=" + this.number + ";";
}
if (this.name != null) {
ret = ret + "name=" + this.name + ";";
}
if (this.carrier != null) {
ret = ret + "carrier=" + this.carrier + ";";
}
if (this.type != null) {
ret = ret + "type=" + this.type + ";";
}
if (this.verified != null) {
ret = ret + "verified=" + this.verified + ";";
}
if (this.formattedNumber != null) {
ret = ret + "formattedNumber=" + this.formattedNumber + ";";
}
return ret;
}
}
test.class:
Code:
package test;
import com.techventus.server.voice.Phone;
import com.techventus.server.voice.Voice;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.List;
public class test
{
public static void main(String[] args)
{
System.out.println("Enter Your Google Voice Username, eg user@gmail.com:");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String userName = null;
try {
userName = br.readLine();
} catch (IOException ioe) {
System.out.println("IO error trying to read your name!");
System.exit(1);
}
System.out.println("Enter Your Password:");
String pass = null;
try {
pass = br.readLine();
} catch (IOException ioe) {
System.out.println("IO error trying to read your name!");
System.exit(1);
}
try
{
Voice voice = new Voice(userName, pass);
try
{
Thread.sleep(2000L);
if ((voice.phoneList != null) && (voice.phoneList.size() > 0)) {
for (int i = 0; i < voice.phoneList.size(); ++i)
System.out.println(((Phone)voice.phoneList.get(i)).toString());
}
Thread.sleep(2000L);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
I have attached the Voice.class (the most important one) to this as a txt file.