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
This commit is contained in:
Michael Koch 2003-12-02 14:36:22 +00:00 committed by Michael Koch
parent 84ebbc6777
commit a74e3b7707
2 changed files with 46 additions and 1 deletions

View File

@ -1,3 +1,9 @@
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:

View File

@ -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