Package java.net

Examples of java.net.URL.openStream()


  private String getProgramSource(final String file) throws IOException {
    InputStream source = null;
    URL sourceURL = Thread.currentThread().getContextClassLoader().getResource(file);
    if(sourceURL != null) {
      source = sourceURL.openStream();
    }
    if ( source == null ) // dev-mode
      source = new FileInputStream("src/java/" + file);
    final BufferedReader reader = new BufferedReader(new InputStreamReader(source));
View Full Code Here


      {
        final URL url = (URL) userConfigs.nextElement();
        try
        {
          final PropertyFileConfiguration baseProperty = new PropertyFileConfiguration();
          final InputStream in = url.openStream();
          try
          {
            baseProperty.load(in);
          }
          finally
View Full Code Here

                }
                return in;
            }
            // otherwise an URL is assumed
            URL url = new URL(fileName);
            InputStream in = url.openStream();
            return in;
        }
        fileName = translateFileName(fileName);
        FileInputStream in = new FileInputStream(fileName);
        IOUtils.trace("openFileInputStream", fileName, in);
View Full Code Here

        if(_sharedCache.containsKey(docurl)) {
            return true;
        } else {
            final InputStream is;
            try {
                is = docurl.openStream();
            } catch (IOException e) {
                return false;
            }
            try {
                if(is.available() > 0) {
View Full Code Here

                }

                URL zipurl = PropUtils.getResourceOrFileOrURL(zipFileName);
                if (zipurl != null) {

                    in = new BufferedInputStream(zipurl.openStream());

                    if (Debug.debugging("zip")) {
                        Debug.output(" unzipping " + zipFileName);
                    }
                    ZipInputStream zin = new ZipInputStream(in);
View Full Code Here

    }

    try {
      log.debug("loading transformer ..");
      URL xslFile = getClass().getResource("/resources/xmlgui/help.xsl");
      transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(xslFile.openStream()));
      transformer.setParameter("locale", locale);
    } catch (Exception e) {
      throw new HelpException("Error while constructing the transformer", e);
    }
View Full Code Here

                        float lrlon = ((Double) record.get(lrlonIndex)).floatValue();
                        imageURLString = (String) record.get(urlIndex);

                        URL imageURL = PropUtils.getResourceOrFileOrURL(imageURLString);

                        FileCacheImageInputStream fciis = new FileCacheImageInputStream(imageURL.openStream(), null);
                        BufferedImage fileImage = ImageIO.read(fciis);

                        // ImageIcon ii = new ImageIcon(imageURL);
                        // Image fileImage = ii.getImage();
View Full Code Here

    }

    public static InputStream getResourceAsStream(String resourceName, Class callingClass) {
        try {
            URL url = getResource(resourceName, callingClass);
            return url == null ? null : url.openStream();
        } catch (IOException e) {
            return null;
        }
    }
View Full Code Here

                URL dbfFileURL = null;
                if (dbfFile != null) {
                    dbfFileURL = PropUtils.getResourceOrFileOrURL(this, dbfFile);
                }
                if (dbfFileURL != null) {
                    InputStream is = dbfFileURL.openStream();
                    dbfModel = new DbfTableModel(new DbfInputStream(is));
                }
                if (dbfModel == null) {
                    String csvFile = props.getProperty(prefix + csvFileProperty);
                    URL infofileURL = null;
View Full Code Here

        try {
            Properties properties = new Properties();
            // Read in the properties.
            URL propertiesURL = new URL(propertiesFile);
            InputStream is = propertiesURL.openStream();
            properties.load(is);

            // Let's make a file
            ShapeLayer sl = new ShapeLayer();
            sl.setProperties(prefix, properties);
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.