* if format is NULL
*/
public Card(File file, Format format) throws IOException {
- this(Parser.parse(file, format));
+ this(Parser.parseContact(file, format));
- if (file != null) {
- if (file.exists()) {
- lastModified = file.lastModified();
- }
+ if (file != null && file.exists()) {
+ lastModified = file.lastModified();
}
this.format = format;
if (this.file != null
&& file.getCanonicalPath().equals(this.file.getCanonicalPath())) {
+ lastModified = file.lastModified();
setPristine();
}
if (file == null)
return false;
- this.replaceListContent(Parser.parse(file, format));
+ this.replaceListContent(Parser.parseContact(file, format));
+ lastModified = file.lastModified();
setPristine();
+
return true;
}
* @return the {@link String}
*/
public String toString(Format format) {
- return Parser.toString(this, format);
+ StringBuilder builder = new StringBuilder();
+ for (String line : Parser.toStrings(this, format)) {
+ builder.append(line);
+ builder.append("\r\n");
+ }
+ return builder.toString();
}
/**