import java.io.*;
import java.net.*;
import java.util.Date;
import java.util.*;
public class HeaderViewer
{
public static void main(String args[])
{
for(int i=0;i<args.length;i++)
{
try
{
URL u=new URL(args[i]);
URLConnectionuc=u.openConnection();
System.out.println(“Content- type:”+uc.getContentType());
System.out.println(“Content- encoding:”+uc.getContentEncoding());
System.out.println(“Date:”+new Date(uc.getDate()));
System.out.println(“LastModified:”+new Date(uc.getLastModified()));
System.out.println(“Expiration Date:”+new Date(uc.getExpiration()));
System.out.println(“Content- length:”+uc.getContentLength());
}
catch(MalformedURLException ex)
{
System.err.println(args[i]+”is not a URL I understand”)’
}
catch(IOException ex)
{
System.err.println(ex);
}
}
}
}
No comments:
Post a Comment