public class URLInputStream extends FilterInputStream
To open HTTP resources use standard HTTP URL syntax:
To open FTP resources use standard FTP URL syntax:
To open file use either local file name or standard file URL syntax:
Modifier and Type | Field and Description |
---|---|
protected URLConnection |
connection |
in
Constructor and Description |
---|
URLInputStream(String url)
Creates a URLInputStream for specified URL.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
long |
getLastModified()
This method returns last modification time from this
URLInputStream . |
static long |
getLastModified(String url)
Returns last modification time for a specified URL.
|
static byte[] |
readURL(String url)
Reads content for specified URL and returns it as a byte array.
|
available, mark, markSupported, read, read, read, reset, skip
protected final URLConnection connection
public URLInputStream(String url) throws IOException
url
- the URL to openIOException
- if an I/O error occurspublic static byte[] readURL(String url) throws IOException
url
- the URL to readIOException
- if an I/O error occurspublic static long getLastModified(String url) throws IOException
IOException
- if there is some problem retrieving last modification time or it is not known.public long getLastModified()
URLInputStream
.
Returns 0 when last modification time is not known.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterInputStream
IOException
protected void finalize() throws IOException
finalize
in class Object
IOException
Copyright © 2014 Devexperts. All Rights Reserved.