public final class URLReader extends Reader
Constructor and Description |
---|
URLReader(URL url)
Constructor
|
URLReader(URL url,
Charset cs)
Constructor
|
URLReader(URL url,
String charsetName)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream and releases any system resources associated with
it.
|
Charset |
getCharset()
Charset used by this reader
|
URL |
getURL()
URL of this reader
|
int |
read(char[] cbuf,
int off,
int len)
Reads characters into a portion of an array.
|
public URLReader(URL url)
url
- URL for this URLReaderNullPointerException
- if url is nullpublic URLReader(URL url, String charsetName)
url
- URL for this URLReadercharsetName
- Name of the Charset used to convert bytes to charsNullPointerException
- if url is nullpublic URLReader(URL url, Charset cs)
url
- URL for this URLReadercs
- Charset used to convert bytes to charsNullPointerException
- if url is nullpublic int read(char[] cbuf, int off, int len) throws IOException
java.io.Reader
read
in class Reader
cbuf
- Destination bufferoff
- Offset at which to start storing characterslen
- Maximum number of characters to readIOException
- If an I/O error occurspublic void close() throws IOException
java.io.Reader
close
in interface Closeable
close
in interface AutoCloseable
close
in class Reader
IOException
- If an I/O error occurspublic URL getURL()
public Charset getCharset()
Copyright © 2014, 2015, Oracle and/or its affiliates. All rights reserved.