/** * Serialise the specified file as XML. * * @param f the file. * @param xml the xml where the file information goes to. * @throws IOException Should any IO occurs while retrieving the info or writing XML. */ private void toXML(File f, XMLWriter xml) throws IOException { xml.openElement("file"); xml.attribute("name", f.getName()); xml.attribute("path", FileUtils.path(this.ancestor, f)); if (f.exists()) { SimpleDateFormat ISO8601Local = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); if (f.isDirectory()) { xml.attribute("type", "folder"); for (File x : f.listFiles(DIRECTORIES_OR_PSML_FILES)) { toXML(x, xml); } } else { xml.attribute("type", "file"); xml.attribute("content-type", getMediaType(f)); xml.attribute("media-type", getMediaType(f)); xml.attribute("length", Long.toString(f.length())); xml.attribute("modified", ISO8601Local.format(f.lastModified())); } } else { xml.attribute("status", "not-found"); } xml.closeElement(); }
/** * Serialise the specified file as XML. * * @param f the file. * @param xml the xml where the file information goes to. * @throws IOException Should any IO occurs while retrieving the info or writing XML. */ private void toXML(File f, XMLWriter xml) throws IOException { xml.openElement("file"); xml.attribute("name", f.getName()); xml.attribute("path", FileUtils.path(this.folder, f)); if (f.exists()) { SimpleDateFormat ISO8601Local = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); if (f.isDirectory()) { xml.attribute("type", "folder"); for (File x : f.listFiles(DIRECTORIES_OR_XML_FILES)) { toXML(x, xml); } } else { xml.attribute("type", "file"); xml.attribute("content-type", getMediaType(f)); xml.attribute("media-type", getMediaType(f)); xml.attribute("length", Long.toString(f.length())); xml.attribute("modified", ISO8601Local.format(f.lastModified())); } } else { xml.attribute("status", "not-found"); } xml.closeElement(); }
/** * Serialise the specified file as XML. * * @param f the file. * @param xml the xml where the file information goes to. * @throws IOException Should any IO occurs while retrieving the info or writing XML. */ private void toXML(File f, XMLWriter xml) throws IOException { xml.openElement("file"); xml.attribute("name", f.getName()); xml.attribute("path", FileUtils.path(this.ancestor, f)); if (f.exists()) { SimpleDateFormat ISO8601Local = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); if (f.isDirectory()) { xml.attribute("type", "folder"); for (File x : f.listFiles(DIRECTORIES_OR_PSML_FILES)) { toXML(x, xml); } } else { xml.attribute("type", "file"); xml.attribute("content-type", getMediaType(f)); xml.attribute("media-type", getMediaType(f)); xml.attribute("length", Long.toString(f.length())); xml.attribute("modified", ISO8601Local.format(f.lastModified())); } } else { xml.attribute("status", "not-found"); } xml.closeElement(); }
/** * Serialise the specified file as XML. * * @param f the file. * @param xml the xml where the file information goes to. * @throws IOException Should any IO occurs while retrieving the info or writing XML. */ private void toXML(File f, XMLWriter xml) throws IOException { xml.openElement("file"); xml.attribute("name", f.getName()); xml.attribute("path", FileUtils.path(this.ancestor, f)); if (f.exists()) { SimpleDateFormat ISO8601Local = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); if (f.isDirectory()) { xml.attribute("type", "folder"); for (File x : f.listFiles(DIRECTORIES_OR_PSML_FILES)) { toXML(x, xml); } } else { xml.attribute("type", "file"); xml.attribute("content-type", getMediaType(f)); xml.attribute("media-type", getMediaType(f)); xml.attribute("length", Long.toString(f.length())); xml.attribute("modified", ISO8601Local.format(f.lastModified())); } } else { xml.attribute("status", "not-found"); } xml.closeElement(); }
/** * Serialise the specified file as XML. * * @param f the file. * @param xml the xml where the file information goes to. * @throws IOException Should any IO occurs while retrieving the info or writing XML. */ private void toXML(File f, XMLWriter xml, File ancestor, DateFormat iso) throws IOException { xml.openElement("file"); xml.attribute("name", f.getName()); xml.attribute("path", FileUtils.path(ancestor, f)); if (f.exists()) { if (f.isDirectory()) { xml.attribute("type", "folder"); for (File x : f.listFiles(DIRECTORIES_OR_XSLT_FILES)) { toXML(x, xml, ancestor, iso); } } else { xml.attribute("type", "file"); xml.attribute("content-type", getMediaType(f)); xml.attribute("media-type", getMediaType(f)); xml.attribute("length", Long.toString(f.length())); xml.attribute("modified", iso.format(f.lastModified())); } } else { xml.attribute("status", "not-found"); } xml.closeElement(); }
/** * Serialise the specified file as XML. * * @param f the file. * @param xml the xml where the file information goes to. * @throws IOException Should any IO occurs while retrieving the info or writing XML. */ private void toXML(File f, XMLWriter xml) throws IOException { xml.openElement("file"); xml.attribute("name", f.getName()); xml.attribute("path", FileUtils.path(this.folder, f)); if (f.exists()) { if (f.isDirectory()) { xml.attribute("type", "folder"); for (File x : f.listFiles()) { toXML(x, xml); } } else { xml.attribute("type", "file"); xml.attribute("content-type", getMediaType(f)); xml.attribute("media-type", getMediaType(f)); xml.attribute("length", Long.toString(f.length())); xml.attribute("modified", ISO8601.format(f.lastModified(), ISO8601.DATETIME)); } } else { xml.attribute("status", "not-found"); } xml.closeElement(); }