git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@833375
13f79535-47bb-0310-9956-
ffa450edef68
} else {
writer.write("\n ");
}
- writer.write('/');
- writer.write(key);
+ writer.write(PDFName.escapeName(key));
writer.write(' ');
Object obj = this.entries.get(key);
formatObject(obj, out, writer);
}
- private static String escapeName(String name) {
+ /**
+ * Escapes a PDF name. It adds the leading slash and escapes characters as necessary.
+ * @param name the name
+ * @return the escaped name
+ */
+ static String escapeName(String name) {
StringBuffer sb = new StringBuffer(Math.min(16, name.length() + 4));
if (!name.startsWith("/")) {
sb.append('/');