MCPcopy Create free account
hub / github.com/apple/coremltools / main

Method main

deps/protobuf/examples/AddPerson.java:62–94  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

60 // adds one person based on user input, then writes it back out to the same
61 // file.
62 public static void main(String[] args) throws Exception {
63 if (args.length != 1) {
64 System.err.println("Usage: AddPerson ADDRESS_BOOK_FILE");
65 System.exit(-1);
66 }
67
68 AddressBook.Builder addressBook = AddressBook.newBuilder();
69
70 // Read the existing address book.
71 try {
72 FileInputStream input = new FileInputStream(args[0]);
73 try {
74 addressBook.mergeFrom(input);
75 } finally {
76 try { input.close(); } catch (Throwable ignore) {}
77 }
78 } catch (FileNotFoundException e) {
79 System.out.println(args[0] + ": File not found. Creating a new file.");
80 }
81
82 // Add an address.
83 addressBook.addPeople(
84 PromptForAddress(new BufferedReader(new InputStreamReader(System.in)),
85 System.out));
86
87 // Write the new address book back to disk.
88 FileOutputStream output = new FileOutputStream(args[0]);
89 try {
90 addressBook.build().writeTo(output);
91 } finally {
92 output.close();
93 }
94 }
95}

Callers 15

test_model.pyFile · 0.45
test_kmeans1d.pyFile · 0.45
reflection_test.pyFile · 0.45
generator_test.pyFile · 0.45
message_test.pyFile · 0.45
keywords_test.pyFile · 0.45

Calls 7

PromptForAddressMethod · 0.95
exitMethod · 0.80
newBuilderMethod · 0.65
mergeFromMethod · 0.65
writeToMethod · 0.65
buildMethod · 0.65
closeMethod · 0.45

Tested by

no test coverage detected