- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 - 31
 - 32
 - 33
 - 34
 - 35
 - 36
 - 37
 - 38
 - 39
 
                        import java.util.*;
import java.net.*;
import java.io.*;
public class Main
{
	public static void main(String[] args) throws MalformedURLException, IOException
	{
		URL url = new URL("http://pro-java.ru");
		URLConnection connect = url.openConnection();
		
	    long d = connect.getLastModified();
		if(d == 0)
			System.out.println("Сведения о дате последней модификации отсутствуют.");
		else
		System.out.println("Дата последней модификации: " + new Date(d));
		
		System.out.println("=== Содержимое ===");
		InputStream input = connect.getInputStream();
		int c, i=0;
		char[] arr = new char[70000];
		while(((c = input.read()) != -1)) {
			//System.out.print((char) c);
			i++;
			arr[i] = (char)c;
		}
		System.out.println(i);
		
		String text = "";
		String s = "";
		for(int b=0;b<i;b++)
		{
			s = String.valueOf(arr[b]);
			text = text+s;
		}
		System.out.println(text.length);
		
	}
}
                                 
        
Комментарии (0) RSS
Добавить комментарий