Commit a74e3b77 by Michael Koch Committed by Michael Koch

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
parent 84ebbc67
2003-12-02 Michael Koch <konqueror@gmx.de> 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: * gnu/java/net/protocol/file/Connection.java:
Some reformating. Some reformating.
(file): Renamed from fileIn. (file): Renamed from fileIn.
......
...@@ -164,7 +164,46 @@ public class Connection extends URLConnection ...@@ -164,7 +164,46 @@ public class Connection extends URLConnection
return outputStream; 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 * This method returns a <code>Permission</code> object representing the
* permissions required to access this URL. This method returns a * permissions required to access this URL. This method returns a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment