protected RenderableSVG toRenderableSVG(String svgfile, URL svgUrl) throws SAXException, IOException { RenderableSVG svg; String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); String svgUri = svgfile; // Remove parameters from file URLs, as it is not supported by Windows if ("file".equals(svgUrl.getProtocol()) && svgUrl.getQuery() != null) { int idx = svgfile.indexOf('?'); if (idx > -1) { svgUri = svgfile.substring(0, idx); } } Document doc = f.createDocument(svgUri); Map<String, String> parameters = getParametersFromUrl(svgfile); if (!parameters.isEmpty() || hasParameters(doc.getDocumentElement())) { replaceParameters(doc.getDocumentElement(), parameters); } svg = new RenderableSVG(doc); return svg; }
/** * Construct a ParsedURL from the given java.net.URL instance. * This is useful if you already have a valid java.net.URL * instance. This bypasses most of the parsing and hence is * quicker and less prone to reinterpretation than converting the * URL to a string before construction. * * @param url The URL to "mimic". */ public ParsedURL(URL url) { userAgent = getGlobalUserAgent(); data = new ParsedURLData(url); }
/** * Gets the value of an entry * @return the value or null */ public Object get(Object o1, Object o2) { int hash = hashCode(o1, o2) & 0x7FFFFFFF; int index = hash % table.length; for (Entry e = table[index]; e != null; e = e.next) { if ((e.hash == hash) && e.match(o1, o2)) { return e.value; } } return null; }
/** * <b>DOM</b>: Implements {@link org.w3c.dom.Document#setDocumentURI(String)}. */ public void setDocumentURI(String uri) { documentURI = uri; url = uri == null ? null : new ParsedURL(uri); }
/** * Gets the value of a variable * @return the value or null */ public Object get( Object o1, Object o2 ) { int hash = hashCode( o1, o2 ) & 0x7FFFFFFF; int index = hash % table.length; for ( Entry e = table[ index ]; e != null; e = e.next ) { if ( ( e.hash == hash ) && e.match( o1, o2 ) ) { return e.get(); } } return null; }
/** * Subclasses can override these method to construct alternate * subclasses of ParsedURLData. * @param url the java.net.URL class we reference. */ protected ParsedURLData constructParsedURLData(URL url) { return new ParsedURLData(url); }
/** * Removes all elements from the list. */ public synchronized void empty() { while(size > 0) pop(); }
/** * Moves <code>nde</code> to the head of the list (equivilent to * remove(nde); add(nde); but faster. */ public void touch(Node nde) { if (nde == null) return; nde.insertBefore(head); head = nde; }
/** * This is a utility function others can call that checks if * is is a GZIP stream if so it returns a GZIPInputStream that * will decode the contents, otherwise it returns (or a * buffered version of is) untouched. * @param is Stream that may potentially be a GZIP stream. */ public static InputStream checkGZIP(InputStream is) throws IOException { return ParsedURLData.checkGZIP(is); }
/** * Implement Object.hashCode. * Relies on the contained ParsedURLData's implementation * of hashCode. */ public int hashCode() { return data.hashCode(); }
/** * Attempt to open the stream checking for common compression * types, and automatically decompressing them if found. */ public InputStream openStream() throws IOException { return data.openStream(userAgent, null); }
/** * Called when execution is being resumed. * Currently just notifies runHandler */ protected synchronized void executionResumed() { // System.err.println("Resumed Sent"); if (runHandler != null) { runHandler.executionResumed(this); } }
public int read() throws IOException { if (out_offset == 3) { if (EOF || getNextAtom()) { EOF = true; return -1; } } return ((int)out_buffer[out_offset++])&0xFF; }
/** * Returns an iterator on the entries of the table. */ public Iterator iterator() { return new TableIterator(); }
/** * Associate bi with profileName. bi is only referenced through * a soft reference so don't rely on the cache to keep it * around. If the map no longer contains our profileName it was * probably cleared or flushed since we were put on the hook * for it, so in that case we will do nothing. */ public synchronized void put(String profileName, ICCColorSpaceWithIntent bi) { super.putImpl(profileName, bi); } }
String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); Document doc;
/** * Construct a ParsedURL from the given java.net.URL instance. * This is useful if you already have a valid java.net.URL * instance. This bypasses most of the parsing and hence is * quicker and less prone to reinterpretation than converting the * URL to a string before construction. * * @param url The URL to "mimic". */ public ParsedURL(URL url) { userAgent = getGlobalUserAgent(); data = new ParsedURLData(url); }
/** * Adds <code>nde</code> to head of list */ public void unpop(Node nde) { nde.insertBefore(head); head = nde; size++; } }
/** * Construct a ParsedURL from the given java.net.URL instance. * This is useful if you already have a valid java.net.URL * instance. This bypasses most of the parsing and hence is * quicker and less prone to reinterpretation than converting the * URL to a string before construction. * * @param url The URL to "mimic". */ public ParsedURL(URL url) { userAgent = getGlobalUserAgent(); data = new ParsedURLData(url); }