emul/mini/src/main/java/java/net/URL.java
branchemul
changeset 576 b679a7dad297
parent 554 05224402145d
child 625 8efbe49b283f
     1.1 --- a/emul/mini/src/main/java/java/net/URL.java	Wed Jan 23 20:39:23 2013 +0100
     1.2 +++ b/emul/mini/src/main/java/java/net/URL.java	Thu Jan 24 19:36:40 2013 +0100
     1.3 @@ -29,6 +29,7 @@
     1.4  import java.io.InputStream;
     1.5  import org.apidesign.bck2brwsr.core.JavaScriptBody;
     1.6  
     1.7 +
     1.8  /**
     1.9   * Class <code>URL</code> represents a Uniform Resource
    1.10   * Locator, a pointer to a "resource" on the World
    1.11 @@ -212,6 +213,9 @@
    1.12       * @serial
    1.13       */
    1.14      private int hashCode = -1;
    1.15 +    
    1.16 +    /** input stream associated with the URL */
    1.17 +    private InputStream is;
    1.18  
    1.19      /**
    1.20       * Creates a <code>URL</code> object from the specified
    1.21 @@ -421,6 +425,11 @@
    1.22      public URL(String spec) throws MalformedURLException {
    1.23          this(null, spec);
    1.24      }
    1.25 +    
    1.26 +    private URL(String spec, InputStream is) throws MalformedURLException {
    1.27 +        this(null, spec);
    1.28 +        this.is = is;
    1.29 +    }
    1.30  
    1.31      /**
    1.32       * Creates a URL by parsing the given spec within a specified context.
    1.33 @@ -950,8 +959,10 @@
    1.34       * @see        java.net.URLConnection#getInputStream()
    1.35       */
    1.36      public final InputStream openStream() throws java.io.IOException {
    1.37 +        if (is != null) {
    1.38 +            return is;
    1.39 +        }
    1.40          throw new IOException();
    1.41 -//        return openConnection().getInputStream();
    1.42      }
    1.43  
    1.44      /**
    1.45 @@ -1006,7 +1017,6 @@
    1.46      }
    1.47  
    1.48  }
    1.49 -
    1.50  class Parts {
    1.51      String path, query, ref;
    1.52