test.java

来自「Light in the box 抓取程序。 使用HttpClient」· Java 代码 · 共 45 行

JAVA
45
字号
package com.blogool.crawl;

import java.util.*;

import org.flytinge.*;

public class Test {
	/*
	public static void main(String[] args) {
		List<HttpListGetItem> list = new ArrayList<HttpListGetItem>();
		HttpListGetItem hlgi = new HttpListGetItem();
		hlgi.setEnds("</html>");
		
		SuperContentHandle sch = new SuperContentHandle() {

			public void handle(HttpListGetItem item, String content) {
				System.out.println(content);
			}
			
		};
		
		hlgi.setHandle(sch);
		hlgi.setUrl("http://www.lightinthebox.com");
		list.add(hlgi);
		String ps = "152.157.252.5:2207";
		String[] pss = ps.split("\\:");
		
		HttpListGet hlg = new HttpListGet(list, pss[0], Integer.parseInt(pss[1]));
		hlg.start();
	}*/
	
	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		int count = 0;
		Object obj = new Object();
		String str = null;
		for (int i = 0; i < 10000000; i ++) {
			str = obj.toString();
		}
		
		System.out.println("time:" + (System.currentTimeMillis() - start) + "ms");
		System.out.println("result:" + str);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?