Package java.net

Examples of java.net.URL.openStream()


                } else {
                    // Otherwise treat it as a raw URL.
                    if (DEBUG)
                        Debug.output("PropUtils.getROFOU(): Not a file, checking as URL");
                    retval = new URL(name);
                    java.io.InputStream is = retval.openStream();
                    is.close();
                    if (DEBUG)
                        Debug.output("PropUtils.getROFOU(): OK as URL :)");
                }
            } catch (java.io.IOException ioe) {
View Full Code Here


        InputStream in = null;
        String truename = null;
        URL url = Lisp.class.getResource(filename);
        if (url != null) {
            try {
                in = url.openStream();
                truename = url.getPath();
            }
            catch (IOException e) {
                in = null;
            }
View Full Code Here

      context.checkRead(file.getPath());
      return new InputSource(new FileInputStream(file));
     
    } else if (source instanceof AnyURL) {
      URL url = (URL)source.toObject();
      return new InputSource(url.openStream());
     
    } else if (source instanceof AnyInputStream) {
      InputStream input = (InputStream)source.toObject();
      return new InputSource(input);
     
View Full Code Here

    } catch (MalformedURLException e) {
      return null;
    }
    InputStream input = null;
    try {
      input = url.openStream();
      int length = (int)input.available();
      int offset = 0;
      byte[] data = new byte[length];
      while(offset < length) {
        int read = input.read(data, offset, length - offset);
View Full Code Here

        }
    }

    private void doMain(String[] args) throws IOException, XQueryException, XMLStreamException {
        URL queryFileUrl = Example1.class.getResource("bib_relative.xq");
        InputStream input1 = queryFileUrl.openStream();
        URI baseUri = NetUtils.toURI(queryFileUrl); // This baseUri effects to fn:doc(...)
        invokeQueryPullMode(input1, baseUri);
        input1.close();

        System.out.println("--------------------------------");
View Full Code Here

            if (shape.endsWith(".shp")) {
                shape = shape.substring(0, shape.length() - 4);

                try {
                    URL shx = PropUtils.getResourceOrFileOrURL(shape + ".shx");
                    InputStream is = shx.openStream();
                    ShxInputStream pis = new ShxInputStream(is);
                    int[][] index = pis.getIndex();
                    is.close();
                   
                    RandomAccessFile raf = new RandomAccessFile(shape + ".shp", "rw");
View Full Code Here

        }

        try {

            URL dbf = new URL(args[0]);
            DbfInputStream dis = new DbfInputStream(dbf.openStream());
            DbfTableModel dtm = new DbfTableModel(dis);

            MetaDbfTableModel mdtm = new MetaDbfTableModel(dtm);
            mdtm.showGUI(args[0]);
            mdtm.exitOnClose = true;
View Full Code Here

        if (arg != null) {
            String ps = arg[0];
            try {
                ProjectionFactory.loadDefaultProjections();
                URL url = PropUtils.getResourceOrFileOrURL(null, ps);
                InputStream inputStream = url.openStream();

                props = new Properties();
                props.load(inputStream);

                Projection proj = null;
View Full Code Here

                + pointVisibleProperty, -1f);

        try {

            URL fileURL = PropUtils.getResourceOrFileOrURL(null, mifFileName);
            BufferedReader bfr = new BufferedReader(new InputStreamReader(fileURL
                      .openStream()));

            mifl = new MIFLoader(bfr, accurate, textVisible, pointVisible);
        } catch (IOException ioe) {
            Debug.error("MIFLayer: didn't find file " + mifFileName);
View Full Code Here

        } else {

            try {

                URL dbf = PropUtils.getResourceOrFileOrURL(args[0]);
                InputStream is = dbf.openStream();
                DbfInputStream dis = new DbfInputStream(is);
                DbfTableModel dtm = new DbfTableModel(dis);
                dtm.setWritable(true);
                dtm.exitOnClose = true;
                dtm.showGUI(args[0], MODIFY_ROW_MASK | MODIFY_COLUMN_MASK
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.