adsense


Showing posts with label JAVA EXAMPLES FILE MODIFICATION TIME. Show all posts
Showing posts with label JAVA EXAMPLES FILE MODIFICATION TIME. Show all posts

Saturday, 31 October 2015

JAVA EXAMPLES FILE MODIFICATION TIME PAGE 173

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



JAVA EXAMPLES FILE MODIFICATION TIME







Java Examples - File Modification Time



Problem Description:
How to check a file is modified at a server or not?
Solution:
Following example shows How to check a file is modified at a server or not.
import java.net.URL;
import java.net.URLConnection;

public class Main {
   public static void main(String[] argv) 
   throws Exception {
      URL u = new URL("http://127.0.0.1/java.bmp");
      URLConnection uc = u.openConnection();
      uc.setUseCaches(false);
      long timestamp = uc.getLastModified();
      System.out.println("The last modification time 
      of java.bmp is :"+timestamp);
   }
}
Result:
The above code sample will produce the following result.
The last modification time of java.bmp is :24 May 2009 12:14:50