List of usage examples for java.net URL getContent
public final Object getContent(Class<?>[] classes) throws java.io.IOException
From source file:org.getobjects.foundation.NSXMLPropertyListParser.java
/** * This method calls getContent() on the given URL and parses the result as * a property list.//from w ww .j ava 2s . c o m * * @param _url - the URL to parse from * @return a plist object, or null on error */ public Object parse(final URL _url) { if (_url == null) return null; if (log.isDebugEnabled()) log.debug("parse URL: " + _url); Object o = null; try { o = _url.getContent(urlTypes); } catch (IOException e) { log.error("failed to read from URL: " + _url, e); } if (o == null) return null; if (o instanceof InputStream) return this.parse((InputStream) o); log.error("don't know how to deal with URL content: " + o.getClass()); return null; }
From source file:org.getobjects.foundation.NSPropertyListParser.java
/** * This method calls getContent() on the given URL and parses the result as * a property list./*w w w .j av a 2s .c o m*/ * * @param _url - the URL to parse from * @return a plist object, or null on error */ public Object parse(final URL _url) { if (_url == null) return null; if (this.log.isDebugEnabled()) this.log.debug("parse URL: " + _url); Object o = null; try { o = _url.getContent(urlTypes); } catch (IOException e) { this.log.error("failed to read from URL: " + _url, e); } if (o == null) return null; if (o instanceof String) return this.parse((String) o); if (o instanceof byte[]) // TODO: check charset header? return this.parse((byte[]) o); if (o instanceof InputStream) // TODO: check charset header? return this.parse((InputStream) o); this.log.error("don't know how to deal with URL content: " + o.getClass()); return null; }