private void validateLiteral(Object o) { DebugUtils.testNull("o", o); if (strictValidator != null) { strictValidator.validateLiteral(o); } }
public static <T> void writeLiteral( OutputStream os, String s, String p, T o, boolean escapeUnicode) throws IOException { DebugUtils.testNull("os", os, "p", p, "o", o); writeResource(os, s); os.write(' '); writeResource(os, p); os.write(' '); if (o.getClass() == Date.class) { os.write('"'); xsdDate.format(o).getBytes(); os.write(xsdDate.format(o).getBytes(CHARSET)); os.write('"'); } else if (o instanceof String) { writeEscapedString(os, (String) o, escapeUnicode); } else { writeEscapedString(os, o.toString(), escapeUnicode); } if (rdfTypes.containsKey(o.getClass())) { os.write("^^<http://www.w3.org/2001/XMLSchema#".getBytes(CHARSET)); String rdfType = rdfTypes.get(o.getClass()); os.write(rdfType.getBytes(CHARSET)); os.write('>'); } os.write(' '); os.write('.'); os.write('\n'); }
public static void writeComment(OutputStream os, String comment) throws IOException { DebugUtils.testNull("os", os, "comment", comment); for (String s : comment.split("\n")) { os.write('#'); os.write(s.getBytes()); os.write('\n'); } }
public static void writeComment(Writer fos, String comment) throws IOException { DebugUtils.testNull("fos", fos, "comment", comment); for (String s : comment.split("\n")) { fos.write('#'); fos.write(s); fos.write('\n'); } }
private void validateUri(String uri) { DebugUtils.testNull("uri", uri); if (strictValidator != null) { strictValidator.validateUri(uri); } else { if (basicInvalidUriPattern.matcher(uri).find()) { throw new RuntimeException("URI is empty or contains illegal characters (" + uri + ")"); } } }
public static void writeLiteral(OutputStream os, String s, String p, String o) throws IOException { DebugUtils.testNull("os", os, "s", s, "p", p, "o", o); writeResource(os, s); os.write(' '); writeResource(os, p); os.write(' '); writeEscapedString(os, o, false); os.write(' '); os.write('.'); os.write('\n'); }