boolean isFile(URI id) throws IOException { final String entry = id.toASCIIString(); final List<String> entries = new ArrayList<String>(); DataStore store = runtime.getDataStore(); store.infoEntry(entry, entry, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { if (media != null) { entries.add(media); } } }); return !entries.isEmpty(); } }
boolean isFile(URI id) throws IOException { final String entry = id.toASCIIString(); final List<String> entries = new ArrayList<String>(); DataStore store = runtime.getDataStore(); store.infoEntry(entry, entry, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { if (media != null) { entries.add(media); } } }); return !entries.isEmpty(); } }
public void infoEntry(String href, String base, String accept, DataInfo handler) throws MalformedURLException, FileNotFoundException, IOException { URI baseURI = URI.create(base); URI uri = baseURI.resolve(href); if ("file".equalsIgnoreCase(uri.getScheme())) { File file = URIUtils.toFile(uri); String type; if (file.isFile()) { type = getContentTypeFromName(file.getName()); } else if (file.exists()) { type = null; } else { throw new FileNotFoundException(file.getAbsolutePath()); } handler.list(file.toURI(), type, file.lastModified()); } else { fallback.infoEntry(href, base, accept, handler); } }
private long readLastModified(URI uri) { if (srcManifest.containsKey(origHref)) { // If the document to be zipped is in the set of source documents, // don't try to read its timestamp from the disk or the web. // Use "now". Date date = new Date(); return date.getTime(); } final List<Long> list = new ArrayList<Long>(1); DataStore store = runtime.getDataStore(); try { store.infoEntry(uri.toASCIIString(), uri.toASCIIString(), "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { list.add(lastModified); } }); } catch (IOException e) { throw new XProcException(e); } if (list.size() == 1) { return list.get(0); } else { return -1; } } }
private long readLastModified(URI uri) { if (srcManifest.containsKey(origHref)) { // If the document to be zipped is in the set of source documents, // don't try to read its timestamp from the disk or the web. // Use "now". Date date = new Date(); return date.getTime(); } final List<Long> list = new ArrayList<Long>(1); DataStore store = runtime.getDataStore(); try { store.infoEntry(uri.toASCIIString(), uri.toASCIIString(), "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { list.add(lastModified); } }); } catch (IOException e) { throw new XProcException(e); } if (list.size() == 1) { return list.get(0); } else { return -1; } } }
public void infoEntry(String href, String base, String accept, DataInfo handler) throws MalformedURLException, FileNotFoundException, IOException { URI baseURI = URI.create(base); URI uri = baseURI.resolve(href); if ("file".equalsIgnoreCase(uri.getScheme())) { File file = URIUtils.toFile(uri); String type; if (file.isFile()) { type = getContentTypeFromName(file.getName()); } else if (file.exists()) { type = null; } else { throw new FileNotFoundException(file.getAbsolutePath()); } handler.list(file.toURI(), type, file.lastModified()); } else { fallback.infoEntry(href, base, accept, handler); } }
fallback.infoEntry(href, base, accept, handler);
fallback.infoEntry(href, base, accept, handler);
if (!sameDocumentReference && "file".equalsIgnoreCase(baseURI.resolve(uri).getScheme())) { final DataStore store = runtime.getDataStore(); store.infoEntry(uri, base, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException {
if (!sameDocumentReference && "file".equalsIgnoreCase(baseURI.resolve(uri).getScheme())) { final DataStore store = runtime.getDataStore(); store.infoEntry(uri, base, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException {
String base = href.getBaseURI().toASCIIString(); try { store.infoEntry(href.getString(), base, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException {
String base = href.getBaseURI().toASCIIString(); try { store.infoEntry(href.getString(), base, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException {