summaryrefslogtreecommitdiffstats
path: root/libjava/gnu/java/net/protocol
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-02 14:36:22 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-02 14:36:22 +0000
commit2cb41cbf4b189c87b688366d2a4213c6b804e2ac (patch)
tree1619416f9cb25c9c7f59c3d968b1cab95a4a0b6a /libjava/gnu/java/net/protocol
parentb35e3284abf5fc37dfb4cdbe403be7adc9ade06b (diff)
downloadppe42-gcc-2cb41cbf4b189c87b688366d2a4213c6b804e2ac.tar.gz
ppe42-gcc-2cb41cbf4b189c87b688366d2a4213c6b804e2ac.zip
2003-12-02 Michael Koch <konqueror@gmx.de>
* gnu/java/net/protocol/file/Connection.java (getLastModified): Implement for file connections. (getContentLength): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74180 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/java/net/protocol')
-rw-r--r--libjava/gnu/java/net/protocol/file/Connection.java41
1 files changed, 40 insertions, 1 deletions
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 <code>Permission</code> object representing the
* permissions required to access this URL. This method returns a
OpenPOWER on IntegriCloud