import java.util.List;
import java.util.ListIterator;
-import be.nikiroo.jvcard.resources.StringUtils;
+import be.nikiroo.utils.StringUtils;
/**
* This class is basically a List with a parent and a "dirty" state check. It
* </p>
*
* @author niki
- *
+ *
* @param <E>
* the type of the child elements
*/
public String getContentState(boolean self) {
StringBuilder builder = new StringBuilder();
buildContentStateRaw(builder, self);
- return StringUtils.getHash(builder.toString());
+ return StringUtils.getMd5Hash(builder.toString());
}
/**
}
}
+ /**
+ * Escape the given value to VCF standard.
+ *
+ * @param value
+ * the value to escape
+ *
+ * @return the escaped value
+ */
+ protected String escape(String value) {
+ if (value == null)
+ return null;
+
+ return value.replaceAll(",", "\\\\,").replaceAll(";", "\\\\;")
+ .replaceAll("\n", "\\\\n");
+ }
+
+ /**
+ * Unescape the given value from the VCF standard.
+ *
+ * @param value
+ * the value to unescape
+ *
+ * @return the unescaped value
+ */
+ protected String unescape(String value) {
+ if (value == null)
+ return null;
+
+ return value.replaceAll("\\\\,", ",").replaceAll("\\\\;", ";")
+ .replaceAll("\\\\n", "\n");
+ }
+
/**
* Each element that leaves the parent will pass trough here.
*