Examples of openStream()


Examples of java.net.URL.openStream()

                    targetUri = URI.create(uri);
                } else {
                    targetUri = baseuri.resolve(uri);
                }
                URL targetUrl = targetUri.toURL();
                InputStream is = targetUrl.openStream();
                String rules = IOUtils.toString(is);
                col = new RuleBasedCollator(rules);
            } catch (Exception e) {
                return null;
            }

Examples of java.net.URL.openStream()

    public static InputStream getClassAsStream(@Nonnull Class<?> clazz) throws IOException {
        String className = clazz.getName();
        String path = getRelativeClassFilePath(className);
        URL url = clazz.getResource('/' + path);
        return url.openStream();
    }

    public static long getLastModified(@Nonnull Class<?> clazz) {
        File file = getClassFile(clazz);
        String path = file.getPath();

Examples of java.net.URL.openStream()

        final InputStream is;
        try {
            url = getServletContext().getResource(path);
            assert (url != null);
            lastModified = url.openConnection().getLastModified();
            is = url.openStream();
        } catch (IOException e) {
            log(PrintUtils.prettyPrintStackTrace(e, -1));
            throw e;
        }

Examples of java.net.URL.openStream()

        mkdirs(targetFile.getAbsoluteFile().getParentFile());
        ByteArrayOutputStream buff = new ByteArrayOutputStream();
        try {
            println("Downloading " + fileURL);
            URL url = new URL(fileURL);
            InputStream in = new BufferedInputStream(url.openStream());
            long last = System.currentTimeMillis();
            int len = 0;
            while (true) {
                long now = System.currentTimeMillis();
                if (now > last + 1000) {

Examples of java.net.URL.openStream()

        mkdirs(targetFile.getAbsoluteFile().getParentFile());
        ByteArrayOutputStream buff = new ByteArrayOutputStream();
        try {
            println("Downloading " + fileURL);
            URL url = new URL(fileURL);
            InputStream in = new BufferedInputStream(url.openStream());
            long last = System.currentTimeMillis();
            int len = 0;
            while (true) {
                long now = System.currentTimeMillis();
                if (now > last + 1000) {

Examples of java.net.URL.openStream()

            }

            if (uri == null) {
                return;
            }
            is = uri.openStream();
            InputSource ip = new InputSource(is);
            ip.setSystemId(uri.toExternalForm());

            // Parse the web application deployment descriptor
            TreeNode webtld = null;

Examples of java.net.URL.openStream()

    CannedDataReader.readCannedData(store, directory, baseURLString);
    Source source = new SourceImpl("http://example.org/graph-source");
    NamedNode config = new NamedNodeImpl("http://example.org/config#");
    WebServer webServer = GVSServerLauncher.launchGVSServer(store, serverBinding, null, Collections.singleton(source), config);
    URL serverURL = new URL("http://"+serverBinding.getInetAddress().getHostAddress()+":"+serverBinding.getPort()+"/application/test-dir/test-data");
    InputStream remoteStream = serverURL.openStream();
    InputStream resourceStream = ApplicationServerHandler.class.getResourceAsStream("/META-INF/web/application/test-dir/test-data.txt");
    for (int i = resourceStream.read(); i > -1; i = resourceStream.read()) {
      assertEquals(i, remoteStream.read());
    }
    //same with URL-extension

Examples of java.net.URL.openStream()

    for (int i = resourceStream.read(); i > -1; i = resourceStream.read()) {
      assertEquals(i, remoteStream.read());
    }
    //same with URL-extension
    serverURL = new URL("http://"+serverBinding.getInetAddress().getHostAddress()+":"+serverBinding.getPort()+"/application/test-dir/test-data.txt");
    remoteStream = serverURL.openStream();
    resourceStream = ApplicationServerHandler.class.getResourceAsStream("/META-INF/web/application/test-dir/test-data.txt");
    for (int i = resourceStream.read(); i > -1; i = resourceStream.read()) {
      assertEquals(i, remoteStream.read());
    }
    webServer.stop();

Examples of java.net.URL.openStream()

      try {
        URL metaFileUrl = metaFile.toURL();
        if (log.isDebugEnabled()) {
          log.debug("reading: " + metaFileUrl.toString());
        }
        InputStream modelFileInputStream = metaFileUrl.openStream();
        try {
          indexModel.read(modelFileInputStream, metaFileUrl
              .toString(), "N-TRIPLE");
        } finally {
          modelFileInputStream.close();

Examples of java.net.URL.openStream()

        try {
          URL modelFileUrl = modelFile.toURL();
          if (log.isDebugEnabled()) {
            log.debug("reading: " + modelFileUrl.toString());
          }
          InputStream modelFileInputStream = modelFileUrl
              .openStream();
          try {
            model.read(modelFileInputStream, modelFileUrl
                .toString(), "N-TRIPLE");
          } finally {
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.