diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-03 10:39:23 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-03 11:57:22 -0800 |
| commit | b5dc4a85433a908d38d453e98d7d45e22e2a5fc0 (patch) | |
| tree | f186094efa03e9c1144fb5c98161cf3f7b054f90 /mp/src/thirdparty/protobuf-2.3.0/examples/ListPeople.java | |
| parent | Specify clobbered registers in POSIX SSE functions (diff) | |
| download | source-sdk-2013-b5dc4a85433a908d38d453e98d7d45e22e2a5fc0.tar.xz source-sdk-2013-b5dc4a85433a908d38d453e98d7d45e22e2a5fc0.zip | |
Line-ending fixes for most of the remaining files.
Fixes line-endings for files with extensions vcd, cc, txt, bat, fxc, inc, lst,
proto, mak, mm, cfg, res, rc, def, vmt, vsh, vbsp, inl, asm, m4, vcproj,
vcxproj, sln, in, java, la, manifest, am, and rad.
Also fixes README, CONTRIBUTING, CONTRIBUTORS, LICENSE, CHANGES, COPYING, and
gitignore.
Finally, fixes executable bits.
Diffstat (limited to 'mp/src/thirdparty/protobuf-2.3.0/examples/ListPeople.java')
| -rw-r--r-- | mp/src/thirdparty/protobuf-2.3.0/examples/ListPeople.java | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/mp/src/thirdparty/protobuf-2.3.0/examples/ListPeople.java b/mp/src/thirdparty/protobuf-2.3.0/examples/ListPeople.java index defb19c7..b2f153af 100644 --- a/mp/src/thirdparty/protobuf-2.3.0/examples/ListPeople.java +++ b/mp/src/thirdparty/protobuf-2.3.0/examples/ListPeople.java @@ -1,50 +1,50 @@ -// See README.txt for information and build instructions.
-
-import com.example.tutorial.AddressBookProtos.AddressBook;
-import com.example.tutorial.AddressBookProtos.Person;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-
-class ListPeople {
- // Iterates though all people in the AddressBook and prints info about them.
- static void Print(AddressBook addressBook) {
- for (Person person: addressBook.getPersonList()) {
- System.out.println("Person ID: " + person.getId());
- System.out.println(" Name: " + person.getName());
- if (person.hasEmail()) {
- System.out.println(" E-mail address: " + person.getEmail());
- }
-
- for (Person.PhoneNumber phoneNumber : person.getPhoneList()) {
- switch (phoneNumber.getType()) {
- case MOBILE:
- System.out.print(" Mobile phone #: ");
- break;
- case HOME:
- System.out.print(" Home phone #: ");
- break;
- case WORK:
- System.out.print(" Work phone #: ");
- break;
- }
- System.out.println(phoneNumber.getNumber());
- }
- }
- }
-
- // Main function: Reads the entire address book from a file and prints all
- // the information inside.
- public static void main(String[] args) throws Exception {
- if (args.length != 1) {
- System.err.println("Usage: ListPeople ADDRESS_BOOK_FILE");
- System.exit(-1);
- }
-
- // Read the existing address book.
- AddressBook addressBook =
- AddressBook.parseFrom(new FileInputStream(args[0]));
-
- Print(addressBook);
- }
-}
+// See README.txt for information and build instructions. + +import com.example.tutorial.AddressBookProtos.AddressBook; +import com.example.tutorial.AddressBookProtos.Person; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintStream; + +class ListPeople { + // Iterates though all people in the AddressBook and prints info about them. + static void Print(AddressBook addressBook) { + for (Person person: addressBook.getPersonList()) { + System.out.println("Person ID: " + person.getId()); + System.out.println(" Name: " + person.getName()); + if (person.hasEmail()) { + System.out.println(" E-mail address: " + person.getEmail()); + } + + for (Person.PhoneNumber phoneNumber : person.getPhoneList()) { + switch (phoneNumber.getType()) { + case MOBILE: + System.out.print(" Mobile phone #: "); + break; + case HOME: + System.out.print(" Home phone #: "); + break; + case WORK: + System.out.print(" Work phone #: "); + break; + } + System.out.println(phoneNumber.getNumber()); + } + } + } + + // Main function: Reads the entire address book from a file and prints all + // the information inside. + public static void main(String[] args) throws Exception { + if (args.length != 1) { + System.err.println("Usage: ListPeople ADDRESS_BOOK_FILE"); + System.exit(-1); + } + + // Read the existing address book. + AddressBook addressBook = + AddressBook.parseFrom(new FileInputStream(args[0])); + + Print(addressBook); + } +} |