/** * Checks whether the supplied character is a letter or number according to the N-Triples specification. * * @see #isLetter * @see #isNumber */ public static boolean isLetterOrNumber(int c) { return isLetter(c) || isNumber(c); }
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))); } } } }
/** * Checks whether the supplied character is a letter or number according to the N-Triples specification. * * @see #isLetter * @see #isNumber */ public static boolean isLetterOrNumber(int c) { return isLetter(c) || isNumber(c); }
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))); } } } }
if (!NTriplesUtil.isLetter(c)) { reportError("Expected a letter, found: " + new String(Character.toChars(c)), NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES);
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))); } } } }
if (!NTriplesUtil.isLetter(c)) { reportError("Expected a letter, found: " + new String(Character.toChars(c)), NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES);