1 /*
2 * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
215 node.setAttribute("text", toISO8859(text));
216
217 root.appendChild(node);
218 }
219
220 // Application extensions
221 int numAppExtensions = applicationIDs == null ?
222 0 : applicationIDs.size();
223 if (numAppExtensions > 0) {
224 node = new IIOMetadataNode("ApplicationExtensions");
225 for (int i = 0; i < numAppExtensions; i++) {
226 IIOMetadataNode appExtNode =
227 new IIOMetadataNode("ApplicationExtension");
228 byte[] applicationID = (byte[])applicationIDs.get(i);
229 appExtNode.setAttribute("applicationID",
230 toISO8859(applicationID));
231 byte[] authenticationCode = (byte[])authenticationCodes.get(i);
232 appExtNode.setAttribute("authenticationCode",
233 toISO8859(authenticationCode));
234 byte[] appData = (byte[])applicationData.get(i);
235 appExtNode.setUserObject((byte[])appData.clone());
236 node.appendChild(appExtNode);
237 }
238
239 root.appendChild(node);
240 }
241
242 // Comment extensions
243 int numComments = comments == null ? 0 : comments.size();
244 if (numComments > 0) {
245 node = new IIOMetadataNode("CommentExtensions");
246 for (int i = 0; i < numComments; i++) {
247 IIOMetadataNode commentNode =
248 new IIOMetadataNode("CommentExtension");
249 byte[] comment = (byte[])comments.get(i);
250 commentNode.setAttribute("value", toISO8859(comment));
251 node.appendChild(commentNode);
252 }
253
254 root.appendChild(node);
255 }
|
1 /*
2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
215 node.setAttribute("text", toISO8859(text));
216
217 root.appendChild(node);
218 }
219
220 // Application extensions
221 int numAppExtensions = applicationIDs == null ?
222 0 : applicationIDs.size();
223 if (numAppExtensions > 0) {
224 node = new IIOMetadataNode("ApplicationExtensions");
225 for (int i = 0; i < numAppExtensions; i++) {
226 IIOMetadataNode appExtNode =
227 new IIOMetadataNode("ApplicationExtension");
228 byte[] applicationID = (byte[])applicationIDs.get(i);
229 appExtNode.setAttribute("applicationID",
230 toISO8859(applicationID));
231 byte[] authenticationCode = (byte[])authenticationCodes.get(i);
232 appExtNode.setAttribute("authenticationCode",
233 toISO8859(authenticationCode));
234 byte[] appData = (byte[])applicationData.get(i);
235 appExtNode.setUserObject(appData.clone());
236 node.appendChild(appExtNode);
237 }
238
239 root.appendChild(node);
240 }
241
242 // Comment extensions
243 int numComments = comments == null ? 0 : comments.size();
244 if (numComments > 0) {
245 node = new IIOMetadataNode("CommentExtensions");
246 for (int i = 0; i < numComments; i++) {
247 IIOMetadataNode commentNode =
248 new IIOMetadataNode("CommentExtension");
249 byte[] comment = (byte[])comments.get(i);
250 commentNode.setAttribute("value", toISO8859(comment));
251 node.appendChild(commentNode);
252 }
253
254 root.appendChild(node);
255 }
|