aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/testsuite/java.net/URLTest.java
blob: 026ea12b56a21867ea02d13c8c88d7eb0582fcd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.net.*;
import java.io.*;

public class URLTest
{
  public static void main(String args[])
    {
      try {
	URL url = new URL("http://www.hungry.com/");
	InputStream stream = url.openStream();

	int size = 0;

	while (-1 != stream.read()) { size++; }

	stream.close();

	System.out.println("PASSED: new URL() size=" + size );
      } catch (Exception e) {
	System.out.println("FAILED: " + e);
      }
    }
}