/** * Serilize the current set of objects to a series of SAX events on the * given handler. */ public void serialize(ContentHandler handler, int flags) throws SAXException { serialize(getObjects(), handler, flags); }
public void serialize(Map output, int flags) throws IOException { Map<File, Collection<Object>> files = getFileMap(); if (files == null) return; Writer writer; if (output == null) { _backup = prepareWrite(file); writer = new FileWriter(file); } else xml = new XMLWriter(writer); trans.setResult(new StreamResult(xml)); serialize(fileObjs, trans, flags);
public void serialize(File file, int flags) throws IOException { if (_log != null) _log.info(_loc.get("ser-file", file)); _backup = prepareWrite(file); try { FileWriter out = new FileWriter( AccessController.doPrivileged( J2DoPrivHelper.getCanonicalPathAction(file)), (flags & APPEND) > 0); serialize(out, flags); out.close(); } catch (PrivilegedActionException pae) { throw (IOException) pae.getException(); } }
/** * Serialize the given collection of objects to the given handler. */ private void serialize(Collection<Object> objs, ContentHandler handler, int flags) throws SAXException { if (_log != null && _log.isTraceEnabled()) _log.trace(_loc.get("ser-objs", objs)); _handler = handler; _flags = flags; try { if (!objs.isEmpty()) { handler.startDocument(); serialize(objs); handler.endDocument(); } } finally { reset(); } }
/** * Returns a {@link Map} with keys of the {@link File} to be * written to, and values of a {@link Collection} of * {@link SourceTracker} instances. */ protected Map<File, Collection<Object>> getFileMap() { Collection<Object> objs = getObjects(); if (objs == null || objs.isEmpty()) return null; // create a map of files to lists of objects Map<File, Collection<Object>> files = new HashMap<File, Collection<Object>>(); File file; Collection<Object> fileObjs; for(Object obj : objs) { file = getSourceFile(obj); if (file == null) { if (_log != null && _log.isTraceEnabled()) _log.trace(_loc.get("no-file", obj)); continue; } fileObjs = (Collection<Object>) files.get(file); if (fileObjs == null) { fileObjs = new LinkedList<Object>(); files.put(file, fileObjs); } fileObjs.add(obj); } return files; }
public void serialize(int flags) throws IOException { serialize((Map) null, flags); }
/** * Write the given entity's comments. By default, tests if entity is * {@link Commentable}. */ protected void addComments(Object obj) throws SAXException { if (obj instanceof Commentable) addComments(((Commentable) obj).getComments()); }
public void serialize(Map output, int flags) throws IOException { Map<File, Collection<Object>> files = getFileMap(); if (files == null) return; Writer writer; if (output == null) { _backup = prepareWrite(file); writer = new FileWriter(file); } else xml = new XMLWriter(writer); trans.setResult(new StreamResult(xml)); serialize(fileObjs, trans, flags);
public void serialize(File file, int flags) throws IOException { if (_log != null) _log.info(_loc.get("ser-file", file)); _backup = prepareWrite(file); try { FileWriter out = new FileWriter( AccessController.doPrivileged( J2DoPrivHelper.getCanonicalPathAction(file)), (flags & APPEND) > 0); serialize(out, flags); out.close(); } catch (PrivilegedActionException pae) { throw (IOException) pae.getException(); } }
/** * Serialize the given collection of objects to the given handler. */ private void serialize(Collection objs, ContentHandler handler, int flags) throws SAXException { if (_log != null && _log.isTraceEnabled()) _log.trace(_loc.get("ser-objs", objs)); _handler = handler; _flags = flags; try { if (!objs.isEmpty()) { handler.startDocument(); serialize(objs); handler.endDocument(); } } finally { reset(); } }
/** * Returns a {@link Map} with keys of the {@link File} to be * written to, and values of a {@link Collection} of * {@link SourceTracker} instances. */ protected Map<File, Collection<Object>> getFileMap() { Collection<Object> objs = getObjects(); if (objs == null || objs.isEmpty()) return null; // create a map of files to lists of objects Map<File, Collection<Object>> files = new HashMap<File, Collection<Object>>(); File file; Collection<Object> fileObjs; for(Object obj : objs) { file = getSourceFile(obj); if (file == null) { if (_log != null && _log.isTraceEnabled()) _log.trace(_loc.get("no-file", obj)); continue; } fileObjs = (Collection<Object>) files.get(file); if (fileObjs == null) { fileObjs = new LinkedList<Object>(); files.put(file, fileObjs); } fileObjs.add(obj); } return files; }
public void serialize(int flags) throws IOException { serialize((Map) null, flags); }
/** * Write the given entity's comments. By default, tests if entity is * {@link Commentable}. */ protected void addComments(Object obj) throws SAXException { if (obj instanceof Commentable) addComments(((Commentable) obj).getComments()); }
public void serialize(Map output, int flags) throws IOException { Map files = getFileMap(); if (files == null) return; Writer writer; if (output == null) { _backup = prepareWrite(file); writer = new FileWriter(file); } else xml = new XMLWriter(writer); trans.setResult(new StreamResult(xml)); serialize(fileObjs, trans, flags);
/** * Serilize the current set of objects to a series of SAX events on the * given handler. */ public void serialize(ContentHandler handler, int flags) throws SAXException { serialize(getObjects(), handler, flags); }
public void serialize(File file, int flags) throws IOException { if (_log != null) _log.info(_loc.get("ser-file", file)); _backup = prepareWrite(file); try { FileWriter out = new FileWriter( AccessController.doPrivileged( J2DoPrivHelper.getCanonicalPathAction(file)), (flags & APPEND) > 0); serialize(out, flags); out.close(); } catch (PrivilegedActionException pae) { throw (IOException) pae.getException(); } }
/** * Serialize the given collection of objects to the given handler. */ private void serialize(Collection<Object> objs, ContentHandler handler, int flags) throws SAXException { if (_log != null && _log.isTraceEnabled()) _log.trace(_loc.get("ser-objs", objs)); _handler = handler; _flags = flags; try { if (!objs.isEmpty()) { handler.startDocument(); serialize(objs); handler.endDocument(); } } finally { reset(); } }
/** * Returns a {@link Map} with keys of the {@link File} to be * written to, and values of a {@link Collection} of * {@link SourceTracker} instances. */ protected Map<File, Collection<Object>> getFileMap() { Collection<Object> objs = getObjects(); if (objs == null || objs.isEmpty()) return null; // create a map of files to lists of objects Map<File, Collection<Object>> files = new HashMap<File, Collection<Object>>(); File file; Collection<Object> fileObjs; for(Object obj : objs) { file = getSourceFile(obj); if (file == null) { if (_log != null && _log.isTraceEnabled()) _log.trace(_loc.get("no-file", obj)); continue; } fileObjs = (Collection<Object>) files.get(file); if (fileObjs == null) { fileObjs = new LinkedList<Object>(); files.put(file, fileObjs); } fileObjs.add(obj); } return files; }
public void serialize(int flags) throws IOException { serialize((Map) null, flags); }
/** * Write the given entity's comments. By default, tests if entity is * {@link Commentable}. */ protected void addComments(Object obj) throws SAXException { if (obj instanceof Commentable) addComments(((Commentable) obj).getComments()); }