Code example for InputSource

Methods: setByteStreamsetSystemId

0
        this.baseUri = null;
    } 
 
    public InputSource getBaseInputSource() {
        try { 
            InputSource is = new InputSource();
            is.setByteStream(openResource(baseUri));
            is.setSystemId(baseUri.toString());
            return is;
        } catch (IOException e) {
            log.error("Unable to create InputSource for " + baseUri, e);
            return null; 
        } 
    } 
 
    public InputStream openResource(URI uri) throws IOException {
        if (uri.isAbsolute() && uri.getScheme().equals("file")) {
            try { 
                return uri.toURL().openStream();
            } catch (Exception except) {
                log.error("openResource: unable to open file URL " + uri + "; " + except.toString());