00001
package com.quadcap.io.dir;
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
import java.io.File;
00042
import java.io.IOException;
00043
import java.io.InputStream;
00044
00045
import java.util.Enumeration;
00046
import java.util.Properties;
00047
00048
import java.net.URL;
00049
import java.net.URLConnection;
00050
00051
import com.quadcap.io.IO;
00052
00053
00054
00055
00056
00057
00058 public class Test extends com.quadcap.util.
Test {
00059 public Test() {
00060 }
00061
00062 public void testProperties(String args[])
throws IOException {
00063 Properties p = System.getProperties();
00064 Enumeration e = p.keys();
00065
while (e.hasMoreElements()) {
00066 String key = e.nextElement().toString();
00067 String val = p.getProperty(key);
00068 System.out.println(key +
": " + val);
00069 }
00070 }
00071
00072 public void testURL(String args[])
throws IOException {
00073 URL base =
new URL(
"jar:file:foo.jar!/");
00074 URL url =
new URL(base,
"Test.java");
00075 URLConnection conn = url.openConnection();
00076 InputStream is = conn.getInputStream();
00077
IO.copyStream(is, System.out);
00078 is.close();
00079 }
00080
00081 public void testDirectory(String args[])
throws IOException {
00082
for (
int i = 0; i < args.length; i++) {
00083 System.out.println(
"------------------ " + args[i]);
00084
Directory d =
Directory.getDirectory(
new File(args[i]));
00085 Enumeration e = d.
entries();
00086
while (e.hasMoreElements()) {
00087 System.out.println(e.nextElement().toString());
00088 }
00089 }
00090 }
00091
00092 public static void main(String args[]) {
00093
Test t =
new Test();
00094 t.
test(args);
00095 }
00096 }