From: Michael Koch Date: Tue, 2 Dec 2003 14:36:22 +0000 (+0000) Subject: 2003-12-02 Michael Koch X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a74e3b77079e534b3c394235503e626b30c6e5d4;p=gcc.git 2003-12-02 Michael Koch * gnu/java/net/protocol/file/Connection.java (getLastModified): Implement for file connections. (getContentLength): Likewise. From-SVN: r74180 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3e9b3d517d2..f652a2cf7b4 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2003-12-02 Michael Koch + + * gnu/java/net/protocol/file/Connection.java + (getLastModified): Implement for file connections. + (getContentLength): Likewise. + 2003-12-02 Michael Koch * gnu/java/net/protocol/file/Connection.java: diff --git a/libjava/gnu/java/net/protocol/file/Connection.java b/libjava/gnu/java/net/protocol/file/Connection.java index fcae745e130..bd3c915a3d0 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 Permission object representing the * permissions required to access this URL. This method returns a