Package java.net

Examples of java.net.URL.openStream()


    protected static InputStream checkValidityAndGetStream(String wfURLString) {
        try {
            logger.fine("checking for world file: " + wfURLString);
            URL wfURL = new URL(wfURLString);
            return wfURL.openStream();
        } catch (MalformedURLException murle) {
            logger.warning("MalformedURLException for " + wfURLString);
        } catch (IOException ioe) {
            logger.warning("IOException for " + wfURLString);
        }
View Full Code Here


        String pkg = (String) dataModel.getValue("package");
        File file = (File) dataModel.getValue("file");

        URL url = this.getClass().getResource(SKELETON_XSL);
        Transformer transformer =
          TransformerFactory.newInstance().newTransformer(new StreamSource(url.openStream()));
        if (pkg.indexOf('.') != -1) {
          transformer.setParameter("package", pkg.substring(0, pkg.lastIndexOf('.')));
          transformer.setParameter("class", pkg.substring(pkg.lastIndexOf(".") + 1, pkg.length()));
        } else {
          transformer.setParameter("package", "");
View Full Code Here

        URL url = Config.class.getResource("/org/chaidb/chaidb.conf");
        if (url == null) {
            return null;
        }
        try {
            return url.openStream();
        } catch (IOException e) {
            return null;
        }
    }
}
View Full Code Here

        if (StringUtils.isNotEmpty(configuration))
        {
            try
            {
                url = new URL(configuration);
                InputStream stream = url.openStream();
                stream.close();
                stream = null;
                configure(url);
                logger.info("Logging configured from external source --> '" + configuration + "'");
            }
View Full Code Here

      if (url == null) {
         throw new XmlBlasterException(this, ErrorCode.RESOURCE_CONFIGURATION,
         "Global", "Can't find java.util.logging.config.file=logging.properties");
      }
      try {
         InputStream in = url.openStream();

         LogManager logManager = LogManager.getLogManager();
         logManager.readConfiguration(in);
         in.close();
View Full Code Here

      try {
        url = new URL(propertyFileUrl);
        this.propertyFileName = url.getFile();
        info.fullPath = this.propertyFileName;
        try {
          info.in = url.openStream();
        }
        catch (java.io.IOException e) {
         System.out.println("Property file " + url + " read error, continuing without it: " + e.toString());
         //throw new XmlBlasterException(ME + ".Error", "URL access: " + e.toString());
        }
View Full Code Here

                k = it.next();
                s = s + "&" + k.getKey() + "=" + k.getValue();               
              }
            // final String s = searchaddress+"&query="+post.get("search")+"&maximumRecords="+post.get("maximumRecords")+"&startRecord="+post.get("startRecord");                      
            final URL url = new URL(s);            
            is = url.openStream();
            final String httpout = new Scanner(is).useDelimiter( "\\Z" ).next();           
            prop.put("http", httpout);
          }
          catch ( final Exception e ) {
            prop.put("url", "error!");
View Full Code Here

         Property p = glob.getProperty();
         URL url = Thread.currentThread().getContextClassLoader().getResource(propFile);
         InputStream is = null;
         if ( url != null) {
            try {
               is= url.openStream();
              
            }catch(java.io.IOException ex) {
               is = null;
            }
         } // end of if ()
View Full Code Here

         if(enm.hasMoreElements()) {
            URL url = (URL)enm.nextElement();
            log.info(method + ": : loading file '" + url.getFile() + "'");
            try {
               StringBuffer buf = new StringBuffer();
               BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
               String line = null;
               while ( (line = reader.readLine()) != null) {
                  if (line.trim().startsWith(cmdSeparator)) {
                     String tmp =  buf.toString();
                     if (tmp.length() > 0)
View Full Code Here

            {
                throw new IllegalStateException(
                    "BuildInformation: could not load file --> '" + buildPropertiesUri + "'");
            }
            final Properties properties = new Properties();
            InputStream stream = versionUri.openStream();
            properties.load(stream);
            stream.close();
            stream = null;
            this.buildDate = properties.getProperty(datePropertyName);
            this.buildSystem = properties.getProperty(systemPropertyName);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.