private void writeBNode(BNode bNode) throws IOException { String nextId = bNode.getID(); writer.append("_:"); if (nextId.isEmpty()) { writer.append("genid"); writer.append(Integer.toHexString(bNode.hashCode())); } else { if (!NTriplesUtil.isLetter(nextId.charAt(0))) { writer.append("genid"); writer.append(Integer.toHexString(nextId.charAt(0))); } for (int i = 0; i < nextId.length(); i++) { if (NTriplesUtil.isLetterOrNumber(nextId.charAt(i))) { writer.append(nextId.charAt(i)); } else { // Append the character as its hex representation writer.append(Integer.toHexString(nextId.charAt(i))); } } } }
private void writeBNode(BNode bNode) throws IOException { String nextId = bNode.getID(); writer.append("_:"); if (nextId.isEmpty()) { writer.append("genid"); writer.append(Integer.toHexString(bNode.hashCode())); } else { if (!NTriplesUtil.isLetter(nextId.charAt(0))) { writer.append("genid"); writer.append(Integer.toHexString(nextId.charAt(0))); } for (int i = 0; i < nextId.length(); i++) { if (NTriplesUtil.isLetterOrNumber(nextId.charAt(i))) { writer.append(nextId.charAt(i)); } else { // Append the character as its hex representation writer.append(Integer.toHexString(nextId.charAt(i))); } } } }
public static void append(BNode bNode, Appendable appendable) throws IOException { String nextId = bNode.getID(); appendable.append("_:"); if (nextId.isEmpty()) { appendable.append("genid"); appendable.append(Integer.toHexString(bNode.hashCode())); } else { if (!isLetter(nextId.charAt(0))) { appendable.append("genid"); appendable.append(Integer.toHexString(nextId.charAt(0))); } for (int i = 0; i < nextId.length(); i++) { if (isLetterOrNumber(nextId.charAt(i))) { appendable.append(nextId.charAt(i)); } else { // Append the character as its hex representation appendable.append(Integer.toHexString(nextId.charAt(i))); } } } }
public static void append(BNode bNode, Appendable appendable) throws IOException { String nextId = bNode.getID(); appendable.append("_:"); if (nextId.isEmpty()) { appendable.append("genid"); appendable.append(Integer.toHexString(bNode.hashCode())); } else { if (!isLetter(nextId.charAt(0))) { appendable.append("genid"); appendable.append(Integer.toHexString(nextId.charAt(0))); } for (int i = 0; i < nextId.length(); i++) { if (isLetterOrNumber(nextId.charAt(i))) { appendable.append(nextId.charAt(i)); } else { // Append the character as its hex representation appendable.append(Integer.toHexString(nextId.charAt(i))); } } } }