Code example for URLConnection

Methods: getLastModified

0
    public long getFileLastModified(String path, boolean virtual)
            throws IOException { 
        long lastModified = 0;
        try { 
            URLConnection urlConnection = getURLConnection(path, virtual);
            lastModified = urlConnection.getLastModified();
        } catch (IOException e) {
            // Ignore this. It will always fail for non-file based includes 
        } 
        return lastModified;
    } 
 
 
    public long getFileSize(String path, boolean virtual) throws IOException {
        long fileSize = -1;
        try { 
            URLConnection urlConnection = getURLConnection(path, virtual);
            fileSize = urlConnection.getContentLength();
        } catch (IOException e) {
            // Ignore this. It will always fail for non-file based includes 
        }