< prev index next >

## src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/URLReader.java

Print this page

      20  *
      21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      22  * or visit www.oracle.com if you need additional information or have any
      23  * questions.
      24  */
      25
      26 package jdk.nashorn.api.scripting;
      27
      28 import java.io.CharArrayReader;
      29 import java.io.IOException;
      30 import java.io.Reader;
      31 import java.net.URL;
      32 import java.nio.charset.Charset;
      33 import java.util.Objects;
      34 import jdk.nashorn.internal.runtime.Source;
      35
      36 /**
      37  * A Reader that reads from a URL. Used to make sure that the reader
      38  * reads content from given URL and can be trusted to do so.
      39  *

      40  * @since 1.8u40
      41  */

      42 public final class URLReader extends Reader {
      43     // underlying URL
      44     private final URL url;
      45     // Charset used to convert
      46     private final Charset cs;
      47
      48     // lazily initialized underlying reader for URL
      49     private Reader reader;
      50
      51     /**
      52      * Constructor
      53      *
      54      * @param url URL for this URLReader
      55      * @throws NullPointerException if url is null
      56      */
      57     public URLReader(final URL url) {
      58         this(url, (Charset)null);
      59     }
      60
      61     /**
      20  *
      21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      22  * or visit www.oracle.com if you need additional information or have any
      23  * questions.
      24  */
      25
      26 package jdk.nashorn.api.scripting;
      27
      28 import java.io.CharArrayReader;
      29 import java.io.IOException;
      30 import java.io.Reader;
      31 import java.net.URL;
      32 import java.nio.charset.Charset;
      33 import java.util.Objects;
      34 import jdk.nashorn.internal.runtime.Source;
      35
      36 /**
      37  * A Reader that reads from a URL. Used to make sure that the reader
      38  * reads content from given URL and can be trusted to do so.
      39  *
      40  * @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
      41  * are deprecated with the intent to remove them in a future release.
      42  *
      43  * @since 1.8u40
      44  */
      45 @Deprecated(since="11", forRemoval=true)
      46 public final class URLReader extends Reader {
      47     // underlying URL
      48     private final URL url;
      49     // Charset used to convert
      50     private final Charset cs;
      51
      52     // lazily initialized underlying reader for URL
      53     private Reader reader;
      54
      55     /**
      56      * Constructor
      57      *
      58      * @param url URL for this URLReader
      59      * @throws NullPointerException if url is null
      60      */
      61     public URLReader(final URL url) {
      62         this(url, (Charset)null);
      63     }
      64
      65     /**

< prev index next >