diff options
author | Michael Koch <konqueror@gmx.de> | 2003-12-02 14:36:22 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-12-02 14:36:22 +0000 |
commit | a74e3b77079e534b3c394235503e626b30c6e5d4 (patch) | |
tree | 1619416f9cb25c9c7f59c3d968b1cab95a4a0b6a /libjava | |
parent | 84ebbc677783b09fd7031a6fb3ccfad89f0c3fc1 (diff) | |
download | gcc-a74e3b77079e534b3c394235503e626b30c6e5d4.zip gcc-a74e3b77079e534b3c394235503e626b30c6e5d4.tar.gz gcc-a74e3b77079e534b3c394235503e626b30c6e5d4.tar.bz2 |
2003-12-02 Michael Koch <konqueror@gmx.de>
* gnu/java/net/protocol/file/Connection.java
(getLastModified): Implement for file connections.
(getContentLength): Likewise.
From-SVN: r74180
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/gnu/java/net/protocol/file/Connection.java | 41 |
2 files changed, 46 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3e9b3d5..f652a2c 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,11 @@ 2003-12-02 Michael Koch <konqueror@gmx.de> + * gnu/java/net/protocol/file/Connection.java + (getLastModified): Implement for file connections. + (getContentLength): Likewise. + +2003-12-02 Michael Koch <konqueror@gmx.de> + * gnu/java/net/protocol/file/Connection.java: Some reformating. (file): Renamed from fileIn. diff --git a/libjava/gnu/java/net/protocol/file/Connection.java b/libjava/gnu/java/net/protocol/file/Connection.java index fcae745..bd3c915 100644 --- a/libjava/gnu/java/net/protocol/file/Connection.java +++ b/libjava/gnu/java/net/protocol/file/Connection.java @@ -164,7 +164,46 @@ public class Connection extends URLConnection return outputStream; } - // Override default method in URLConnection. + /** + * Get the last modified time of the resource. + * + * @return the time since epoch that the resource was modified. + */ + public long getLastModified() + { + try + { + if (!connected) + connect(); + + return file.lastModified(); + } + catch (IOException e) + { + return -1; + } + } + + /** + * Get the length of content. + * + * @return the length of the content. + */ + public int getContentLength() + { + try + { + if (!connected) + connect(); + + return (int) file.length(); + } + catch (IOException e) + { + return -1; + } + } + /** * This method returns a <code>Permission</code> object representing the * permissions required to access this URL. This method returns a |