- java.lang.Object
-
- java.io.Reader
-
- jdk.nashorn.api.scripting.URLReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
@Deprecated(since="11", forRemoval=true) public final class URLReader extends Reader
Deprecated, for removal: This API element is subject to removal in a future version.Nashorn JavaScript script engine and APIs, and the jjs tool are deprecated with the intent to remove them in a future release.A Reader that reads from a URL. Used to make sure that the reader reads content from given URL and can be trusted to do so.- Since:
- 1.8u40
-
-
Constructor Summary
Constructors Constructor Description URLReader(URL url)Deprecated, for removal: This API element is subject to removal in a future version.ConstructorURLReader(URL url, String charsetName)Deprecated, for removal: This API element is subject to removal in a future version.ConstructorURLReader(URL url, Charset cs)Deprecated, for removal: This API element is subject to removal in a future version.Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated, for removal: This API element is subject to removal in a future version.Closes the stream and releases any system resources associated with it.CharsetgetCharset()Deprecated, for removal: This API element is subject to removal in a future version.Charset used by this readerURLgetURL()Deprecated, for removal: This API element is subject to removal in a future version.URL of this readerintread(char[] cbuf, int off, int len)Deprecated, for removal: This API element is subject to removal in a future version.Reads characters into a portion of an array.-
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
URLReader
public URLReader(URL url)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor- Parameters:
url- URL for this URLReader- Throws:
NullPointerException- if url is null
-
URLReader
public URLReader(URL url, String charsetName)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor- Parameters:
url- URL for this URLReadercharsetName- Name of the Charset used to convert bytes to chars- Throws:
NullPointerException- if url is null
-
URLReader
public URLReader(URL url, Charset cs)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor- Parameters:
url- URL for this URLReadercs- Charset used to convert bytes to chars- Throws:
NullPointerException- if url is null
-
-
Method Detail
-
read
public int read(char[] cbuf, int off, int len) throws IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.Description copied from class:ReaderReads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.- Specified by:
readin classReader- Parameters:
cbuf- Destination bufferoff- Offset at which to start storing characterslen- Maximum number of characters to read- Returns:
- The number of characters read, or -1 if the end of the stream has been reached
- Throws:
IOException- If an I/O error occurs
-
close
public void close() throws IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.Description copied from class:ReaderCloses the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException- If an I/O error occurs
-
getURL
public URL getURL()
Deprecated, for removal: This API element is subject to removal in a future version.URL of this reader- Returns:
- the URL from which this reader reads.
-
getCharset
public Charset getCharset()
Deprecated, for removal: This API element is subject to removal in a future version.Charset used by this reader- Returns:
- the Charset used to convert bytes to chars
-
-