⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 download.java

📁 这是一个用jsp+Oracle开发的联系人客户关系管理系统!
💻 JAVA
字号:
import java.io.*;
import net.jxta.pipe.*;
import net.jxta.share.*;
import net.jxta.share.client.*;

public class Download
{
	private PeerGroup netPeerGroup = null;
	private ListContentRequest request = null;
	private String searchString = null;

	public Download(String subStr)
	{
		searchString = subStr;
	}

	public void run()
	{
		try
		{
			netPeerGroup = PeerGroupFactory.newNetPeetGroup();
			request = new MyListRequest(netPeerGroup,searchString);
			request.activateRequest();
		}catch(Exception e)
		{
			System.out.println(e.getMessage());
			System.exit(-1);
		}
	}

	public static void main(String args[])
	{
		Download myShare = new Download("java");
		myShare.run();
	}


	class MyContentRequest extends GetContentRequest
	{
		public MyContentRequest(PeerGroup group,String subString)
		{
			super(group,subString);
		}

		public void notifyDone()
		{
			System.out.println(getFile()+"downloaded");
		}

		public void notifyFailure()
		{
			System.out.println(getFile()+"download failed");
		}

		public void notifyUpdate(int percent)
		{
			System.out.println(getFile()+"downloaded "+percent+"%");
		}
	};

	class MyListRequest extends ListContentRequest
	{
		PeerGroup pggroup = null;
		public MyListRequest(PeerGroup group,String subString)
		{
			super(group,subString);
			pggroup = group;
		}

		public void notifyMoreResults()
		{
			ContentAdvertisement[] res = getResults();
			for(int i=0;i<res.length;i++)
				System.out.println(res[i].getName());
			new MyContentRequest(pggroup,res[0],new File("download.txt"));
		}
	};
}

⌨️ 快捷键说明

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