}
@SuppressWarnings("null")
private static void writeXRefClause(@Nonnull Clause clause,
@Nonnull BufferedWriter writer) throws IOException {
Xref xref = clause.getValue(Xref.class);
if (xref != null) {
StringBuilder sb = new StringBuilder();
sb.append(clause.getTag());
sb.append(": ");
String idref = xref.getIdref();
int colonPos = idref.indexOf(':');
if (colonPos > 0) {
sb.append(escapeOboString(idref.substring(0, colonPos),
EscapeMode.xref));
sb.append(':');
sb.append(escapeOboString(idref.substring(colonPos + 1),
EscapeMode.xref));
} else {
sb.append(escapeOboString(idref, EscapeMode.xref));
}
String annotation = xref.getAnnotation();
if (annotation != null) {
sb.append(" \"");
sb.append(escapeOboString(annotation, EscapeMode.quotes));
sb.append('"');
}