Examples of openStream()


Examples of java.net.URL.openStream()

    Model cannedDefaultConfigModel = ModelFactory.createDefaultModel();
    URL cannedDefaultConfigURL = getClass()
        .getResource("defaultconfig.rdf");
    String cannedDefaultConfigURLString = cannedDefaultConfigURL.toString();
    try {
      InputStream cannedDefaultConfigInputStream = cannedDefaultConfigURL
          .openStream();
      cannedDefaultConfigModel.read(cannedDefaultConfigInputStream,
          cannedDefaultConfigURLString);
      cannedDefaultConfigInputStream.close();
    } catch (IOException e) {

Examples of java.net.URL.openStream()

    try {
      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());

Examples of java.net.URL.openStream()

      // 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());

Examples of java.net.URL.openStream()

    try {
      URL serverURL = new URL("http://"
          + serverBinding.getInetAddress().getHostAddress() + ":"
          + serverBinding.getPort()
          + "/application/test-dir/test-data?bar.html");
      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());

Examples of java.net.URL.openStream()

      // same with URL-extension
      serverURL = new URL("http://"
          + serverBinding.getInetAddress().getHostAddress() + ":"
          + serverBinding.getPort()
          + "/application/test-dir/test-data.txt?bar.html");
      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());

Examples of java.net.URL.openStream()

public class TestManagedUtil {

  @Test public void testTempURL() throws Exception {
    ByteArrayInputStream bais = new ByteArrayInputStream(new byte[100]);
    URL url = ManagedUtil.getTempURL(bais);
    assertEquals(100, ObjectConverterUtil.convertToByteArray(url.openStream()).length);
  }
 
}

Examples of java.net.URL.openStream()

         {
            url = cl.getResource(name + ".properties");
         }
         if (url != null)
         {
            InputStream is = url.openStream();
            try
            {
               byte[] buf = IOUtil.getStreamContentAsBytes(is);
               return new String(buf, "UTF-8");
            }

Examples of java.net.URL.openStream()

            }
         }

         if (url != null)
         {
            InputStream is = url.openStream();
            try
            {
               byte[] buf = IOUtil.getStreamContentAsBytes(is);
               return new String(buf, "UTF-8");
            }

Examples of java.net.URL.openStream()

      sb.append(":").append(new Integer(properties.getProperty("jbpm.console.server.port")));
      sb.append("/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/");
      sb.append(URLEncoder.encode(id, "UTF-8"));
      sb.append("-image.png");
      URL url = new URL(sb.toString());
      InputStream is = url.openStream();
      if (is != null) {
        return url;
      }
    } catch (Throwable t) {
      t.printStackTrace();

Examples of java.net.URL.openStream()

  public @WebResult(name="albums") FeedType listAlbums(@WebParam(name = "crediential") Crediential crediential) {
    try {
      //TODO from JNDI property
      URL       albumURL   = new URL("http://picasaweb.google.com/data/feed/api/user/"+crediential.getUsername()+"?kind=album");
      Unmarshaller   um       = context.createUnmarshaller();
      FeedType ob = um.unmarshal(new StreamSource(albumURL.openStream()),FeedType.class).getValue();
      return ob;
    } catch (Exception e) {
      e.printStackTrace();
      throw new Error("Album request failed",e);
    }
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.