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 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');
  }
 public static void writeEscapedString(OutputStream fos, String s) throws IOException {
   writeEscapedString(fos, s, false);
 }