-
- BufferedReader buffer = new BufferedReader(new InputStreamReader(
- new FileInputStream(file), "UTF-8"));
- List<String> lines = new LinkedList<String>();
- for (String line = buffer.readLine(); line != null; line = buffer
- .readLine()) {
- lines.add(line);
- }
- buffer.close();
-
- load(lines, format);
- dirty = false; // initial load, so no change yet, so no need to call
- // setPristine()
- }
-
- /**
- * Return the number of {@link Contact} present in this {@link Card}.
- *
- * @return the number of {@link Contact}s
- */
- public int size() {
- return contacts.size();
- }
-
- /**
- * Return the {@link Contact} at index <i>index</i>.
- *
- * @param index
- * the index of the {@link Contact} to find
- *
- * @return the {@link Contact}
- *
- * @throws IndexOutOfBoundsException
- * if the index is < 0 or >= {@link Card#size()}
- */
- public Contact get(int index) {
- return contacts.get(index);
- }
-
- /**
- * Add a new {@link Contact} in this {@link Card}.
- *
- * @param contact
- * the new contact
- */
- public void add(Contact contact) {
- contact.setParent(this);
- contact.setDirty();
- contacts.add(contact);
- }
-
- /**
- * Remove the given {@link Contact} from its this {@link Card} if it is in.
- *
- * @return TRUE in case of success
- */
- public boolean remove(Contact contact) {
- if (contacts.remove(contact)) {
- setDirty();
- }
-
- return false;