Examples of openStream()


Examples of java.net.URL.openStream()

        if (file.equalsIgnoreCase("-url"))
        {
      if (args.length > 1)
      {
        URL u = new URL(args[1]);
            Player player = new Player(new BufferedInputStream(u.openStream(), 2048));
            System.out.println("starting");
            player.play();
            System.out.println("ending");
      }
      else

Examples of java.net.URL.openStream()

       URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
      
       log.debug("Execute SQL from resource URL: "+url);
      
       String sql = getStringFromStream(url.openStream());
       sql = sql.replaceAll("(?m)^--([^\n]+)?$", ""); // Remove all commented lines
       final String[] statements ;
       if (useEOL) {
           statements = sql.split("[\n;]");
       } else {

Examples of java.net.URL.openStream()

                }
            } else {
                InputStream in = null;
                try {
          URL url = new URL(uri);
          in = new BufferedInputStream(url.openStream());
          info("Found config override URI " + uri);
          temp.load(in);
        } catch (MalformedURLException e) {
                    warning("URI for override properties is malformed, skipping: " + uri);
                    return;

Examples of java.net.URL.openStream()

        if (obj instanceof String) {
            try {
                // first try to interpret string as URL
                URL url = new URL(obj.toString());
                return getHtmlDocument(new InputStreamReader(url.openStream()));
            } catch (MalformedURLException nourl) {
                // if not a URL, maybe it is the XML itself
                return getHtmlDocument(new StringReader(obj.toString()));
            }
        } else if (obj instanceof InputStream) {

Examples of java.net.URL.openStream()

                    // try to interpret argument as URL if it contains a colon,
                    // otherwise or if URL is malformed interpret as file name.
                    if (str.indexOf(":") > -1) {
                        try {
                            URL url = new URL(str);
                            in = url.openStream();
                        } catch (MalformedURLException mux) {
                            in = new FileInputStream(str);
                        }
                    } else {
                        in = new FileInputStream(str);

Examples of java.net.URL.openStream()

  @Test
  public void testParse() throws Exception {
    ResourceLoader loader = new ResourceLoader();
    URL url = loader.getResource("dozerBeanMapping.xml");

    Document document = XMLParserFactory.getInstance().createParser().parse(url.openStream());
    parser = new XMLParser(document);

    MappingFileData mappings = parser.load();
    assertNotNull(mappings);
  }

Examples of java.net.URL.openStream()

  @Test
  public void testParseCustomConverterParam() throws Exception {
    ResourceLoader loader = new ResourceLoader();
    URL url = loader.getResource("fieldCustomConverterParam.xml");

    Document document = XMLParserFactory.getInstance().createParser().parse(url.openStream());
    parser = new XMLParser(document);
   
    MappingFileData mappings = parser.load();

    assertNotNull("The mappings should not be null", mappings);

Examples of java.net.URL.openStream()

                while(readmes.hasMoreElements()) {
                    ++cnt;
                    URL url = (URL) readmes.nextElement();
                    sb.append("Patch " + url.getFile() + ":"); //$NON-NLS-1$ //$NON-NLS-2$
                    sb.append( LINE_SEPARATOR );
                    InputStream is = url.openStream();
                    byte[] data = ObjectConverterUtil.convertToByteArray(is);
                    sb.append(new String(data));
                    sb.append("-------------------------------------");//$NON-NLS-1$
                    sb.append( LINE_SEPARATOR );
                    is.close();

Examples of java.net.URL.openStream()

      HTMLDocument document;
      try
      {
         URL url_ = new URL("http://www.24h.com.vn");
         document = HTMLParser.createDocument(url_.openConnection().getInputStream(), null);
         document = HTMLParser.createDocument(url_.openStream(), null);
      }
      catch (java.net.UnknownHostException e)
      {
         return;
      }

Examples of java.net.URL.openStream()

            System.out.println("CHARSET = " + charset);
         }
      });

      URL url = new URL(argv[0]);
      BufferedInputStream imp = new BufferedInputStream(url.openStream());

      byte[] buf = new byte[1024];
      int len;
      boolean done = false;
      boolean isAscii = true;
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.