Javaday 33简单线程池 输入输出流 练习 和 一个简单的浏览器程序

多文件拷贝

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MultithreadedCopy {
	//文件拷贝的核心方法
	public static void test() {
		String str = null;
		try (BufferedReader in = new BufferedReader(new FileReader("A.txt"));
				PrintWriter out = new PrintWriter(System.currentTimeMillis()+Math.random()+".txt")){
			while((str = in.readLine())!=null) {
				out.write(str+"\r");
			}
			out.flush();
			out.close();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	@SuppressWarnings("resource")
	public static void main(String[] args){
		System.out.println("请输入要拷贝的数量");
		ExecutorService pool = Executors.newCachedThreadPool();
		//根据输入的个数,创建相应的线程进行拷贝
		int i = new Scanner(System.in).nextInt();
		while(i>0) {
			pool.execute(()->{
				MultithreadedCopy.test();
			});
			i--;
		}
		pool.shutdown();
		System.out.println("拷贝完成");
	}
}

  1. 完成一个线程计算1-100之间所有数的和,另外一个线程取1-100之间所有数的和的过程

2.读取文件stus,文件中的每一行都代表一个学生的信息,请读取文件中每个学生的信息,转换成Student对象,然后将读取到的所有student信息,持久化到文件stusObj中。再提供一个方法,能够从stusObj文件中将所有学生信息读取回来。

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test {
	static boolean flag = false;
	static int sum = 0;
	@org.junit.Test
	public void test1() {
		ExecutorService pool = Executors.newFixedThreadPool(2);
		pool.execute(()->{
			synchronized (pool) {
				
				for (int i = 1; i <= 100; i++) {
					if(flag!=false) {
						pool.notify();
						try {
							pool.wait();
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
					}
					System.out.print(sum+"+"+i+"=");
					sum+=i;
					flag = !flag;
				}
				pool.notify();
			}
		});
		pool.execute(()->{
			synchronized (pool) {
				
				for (int i = 1; i <= 100; i++) {
					if(flag!=true) {
						pool.notify();
						try {
							pool.wait();
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
					}
					System.out.print(sum+"\n");
					System.out.println();
					flag = !flag;
				}
			}
		});
	}
	@org.junit.Test
	public void test2() throws Exception {
		ArrayList<Student> list = new ArrayList<>();
		BufferedReader in = new BufferedReader(new FileReader("D:\\QQ接收\\stus"));
		BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream("stusObj.txt"));
		ObjectOutputStream out = new ObjectOutputStream(stream);
		String str = null;
		while((str = in.readLine())!=null) {
			String[] sp = str.split(":");
			char[] array = sp[3].toCharArray();
			list.add(new Student(Integer.parseInt(sp[0]), sp[1], Byte.parseByte(sp[2]), array[0]));
		}
		out.writeObject(list);
		out.flush();
		out.close();
		in.close();
		stream.close();
		
	}
	@SuppressWarnings({ "unchecked", "resource" })
	@org.junit.Test
	public void test3() throws Exception {
		BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream("stusObj.txt"));
		ObjectInputStream inob = new ObjectInputStream(inputStream);
		ArrayList<Student> listin =(ArrayList<Student>) inob.readObject();
		for (int i = 0; i < listin.size(); i++) {
			Student stu = listin.get(i);
			System.out.println(stu+"\n");
		}
	}
}




class Student implements Serializable{

	private static final long serialVersionUID = 1L;
	private int  id;
	private String name;
	private byte age;
	private char gender;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public byte getAge() {
		return age;
	}
	public void setAge(byte age) {
		this.age = age;
	}
	public char getGender() {
		return gender;
	}
	public void setGender(char gender) {
		this.gender = gender;
	}
	public Student(int id,String name, byte age, char gender) {
		super();
		this.id = id;
		this.name = name;
		this.age = age;
		this.gender = gender;
	}
	@Override
	public String toString() {
		return "Student信息 \nid="+id+"\nname=" + name + "\nage=" + age + "\ngender=" + gender;
	}
	
	
}

stus
1:zhangsan:18:男
2:lisi:19:男
3:red:17:女
4:terry:18:男
5:haha:19:女

浏览器程序
具体的注解 和 优化 会后期给出

主程序

import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import com.briup.server.pojo.Request;
import com.briup.server.pojo.Response;
import com.briup.server.util.FileTypeUtil;
import com.briup.server.util.JudgmentFile;
import com.briup.server.util.SocketTrans;
import com.briup.server.util.StateCodeEnum;
import com.briup.server.util.TreaPoolUtil;

public class Application {
	@SuppressWarnings("resource")
	public static void main(String[] args) throws Exception {

		//创建服务端
		try {
			ServerSocket ss = new ServerSocket(8081);
			System.out.println("服务端已经启动........");
			while(true) {
				//服务端一直开启
				Socket socket = ss.accept();
				//socket 转为request
				Request request = SocketTrans.socketToRequest(socket);
				Response response = new Response();
				String fileName = request.getRequestSource();
				
				File file = new File("source",fileName);
			
				if(file.exists()) {
					String substring = fileName.substring(fileName.lastIndexOf("."));
					response.getMap().put("Content-Type",FileTypeUtil.map.get(substring)+";charset=utf-8");
					response.setStateCode(StateCodeEnum.OK);
					TreaPoolUtil.execut(response, socket,request,substring);
					
				}else {
					response.setStateCode(StateCodeEnum.NOT_FOUND);
					JudgmentFile.isJudgmentFile(request,response,socket);
					
				}
				
			}
		} catch (IOException e) {
			System.out.println("系统故障");
			e.printStackTrace();
		}
	}
}

封装请求对象

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class Request implements Serializable{

	private static final long serialVersionUID = 1L;
	//请求头部
	private String requestMethod;
	//请求资源
	private String requestSource;
	//存放请求头
	private Map<String, String> map = new HashMap<>();
	
	private String requestBody;

	public String getRequestMethod() {
		return requestMethod;
	}

	public void setRequestMethod(String requestMethod) {
		this.requestMethod = requestMethod;
	}

	public String getRequestSource() {
		return requestSource;
	}

	public void setRequestSource(String requestSource) {
		this.requestSource = requestSource;
	}

	public Map<String, String> getMap() {
		return map;
	}

	public void setMap(Map<String, String> map) {
		this.map = map;
	}

	public String getRequestBody() {
		return requestBody;
	}

	public void setRequestBody(String requestBody) {
		this.requestBody = requestBody;
	}

	@Override
	public String toString() {
		return "Request [requestMethod=" + requestMethod + ", requestSource=" + requestSource + ", map=" + map
				+ ", requestBody=" + requestBody + "]";
	}
	
	
}

封装响应对象

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import com.briup.server.util.StateCodeEnum;

public class Response implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private String agreement = "HTTP/1.1";
	//响应的状态码信息
	private StateCodeEnum stateCode;
	//相应头
	private Map<String, String> map = new HashMap<>();

	public String getAgreement() {
		return agreement;
	}

	public void setAgreement(String agreement) {
		this.agreement = agreement;
	}

	public StateCodeEnum getStateCode() {
		return stateCode;
	}

	public void setStateCode(StateCodeEnum stateCode) {
		this.stateCode = stateCode;
	}

	public Map<String, String> getMap() {
		return map;
	}

	public void setMap(Map<String, String> map) {
		this.map = map;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public String toString() {
		return "Response [agreement=" + agreement + ", stateCode=" + stateCode + ", map=" + map + "]";
	}
	
	
}

为对象赋客户端传过来的值

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Arrays;

import com.briup.server.pojo.Request;

public class SocketTrans {
	public static Request socketToRequest(Socket socket) {
		Request request = new Request();
		ArrayList<String> list = new ArrayList<>();
		try {
			InputStream stream = socket.getInputStream();
			BufferedReader in = new BufferedReader(new InputStreamReader(stream));
			String line = in.readLine();
			while(true) {
				if(null==line) {
				}else {
					break;
				}
			}
			String[] split = line.split("/");
			
			String[] strings = split[1].split(" ");
			String[] split2 = strings[0].split("\\?");
			if(split2.length>1) {
				request.setRequestBody(split2[1]);
			}
			request.setRequestSource(split2[0]);
			if("GET".equals(split[0].trim())) {
				request.setRequestMethod("GET");
				System.out.println(request);
			}else{
				
				request.setRequestMethod("POST");
				System.out.println(request);
				String strs = null;
				while((strs = in.readLine())!=null) {
					list.add(strs);
				}
				request.setRequestBody(list.get(list.size()-1));
			}
			
			socket.shutdownInput();
			
		} catch (IOException e) {
			e.printStackTrace();
		}
		return request;
	}
}

输出数据的方法

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.briup.server.pojo.Request;
import com.briup.server.pojo.Response;

public class TreaPoolUtil {
	public static final ExecutorService pool;
	static {
		 pool = Executors.newCachedThreadPool();
	}
	@SuppressWarnings("resource")
	public static void execut(Response response,Socket socket,Request request,String str) {
		pool.execute(()->{
			try {
				
				BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream("source/"+request.getRequestSource()));
				BufferedOutputStream outputStream = new BufferedOutputStream(socket.getOutputStream());
				outputStream.write((response.getAgreement()+" "+response.getStateCode().getCode()+" "+response.getStateCode().getMsg()+"\r\n").getBytes());
				outputStream.write(("Content-Type: "+response.getMap().get("Content-Type")+"\r\n").getBytes());
				outputStream.write("\r\n".getBytes());
				int len = -1;
				byte[] buf = new byte[10240];
				while((len = inputStream.read(buf))!=-1) {
					outputStream.write(buf,0,len);
				}
				outputStream.flush();
				
				socket.shutdownOutput();
			} catch (Exception e) {
				e.printStackTrace();
			}
			
		
		});
	}
}

特俗情况输出(文件找不到,登录,注册)

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;

import com.briup.server.pojo.Request;
import com.briup.server.pojo.Response;

public class JudgmentFile {
	@SuppressWarnings("resource")
	public static void isJudgmentFile(Request request,Response response,Socket socket) throws Exception {

		if("login".equals(request.getRequestSource())) {

			String[] split = request.getRequestBody().split("&");
			BufferedReader inputStream = new BufferedReader(new FileReader("source/register.txt"));
			ArrayList<String> list = new ArrayList<>();
			String str = null;
			while((str = inputStream.readLine())!=null) {
				list.add(str.trim());
			}
			boolean b =false;
			for (int i = 0; i < list.size(); i++) {
				if(list.get(i).equals(request.getRequestBody())&&split.length>1) {
					b = true;
					break;
				}else {
					b =false;
				}
			}
			if(b==true) {
				BufferedInputStream in =new BufferedInputStream(new FileInputStream("source/su.jpg"));
				JudgmentFile.test1(in, socket);
			}else {
				BufferedInputStream in =new BufferedInputStream(new FileInputStream("source/ss.jpg"));
				JudgmentFile.test2(in, socket);
			}
		}else if("register".equals(request.getRequestSource())) {
			String[] split = request.getRequestBody().split("&");
			String substring1 = split[0].substring(0, split[0].indexOf("=")+1);
			String substring2 = split[1].substring(0, split[1].indexOf("=")+1);
			if("username=".equals(substring1)&&"password=".equals(substring2)) {
			BufferedOutputStream outs = new BufferedOutputStream(new FileOutputStream("source/register.txt", true));
			outs.write((request.getRequestBody()+"\n").getBytes());
			outs.flush();
			BufferedInputStream in =new BufferedInputStream(new FileInputStream("source/ssss.jpg"));
			JudgmentFile.test1(in, socket);
			}else {
				BufferedInputStream in = new BufferedInputStream(new FileInputStream("source/susu.jpg"));
				JudgmentFile.test2(in, socket);
			}
		}else{
			BufferedOutputStream stream = new BufferedOutputStream(socket.getOutputStream());
			BufferedInputStream in = new BufferedInputStream(new FileInputStream("source/timg.jpg"));
			stream.write(("HTTP/1.1 404 NOT_FOUND\r\n".getBytes()));
			stream.write("Content-Type: image/jpeg;charset=UTF-8\r\n".getBytes());
			stream.write("\r\n".getBytes());
			byte[] buf = new byte[1024];
			int len = -1;
			while((len = in.read(buf))!=-1) {
				stream.write(buf, 0, len);
			}
			stream.flush();
			socket.shutdownOutput();

		}
		
	}
	
	private static void test1(BufferedInputStream in,Socket socket) throws IOException {
		BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream());
		out.write("HTTP/1.1 200 OK\r\n".getBytes());
		out.write("Content-Type: image/jpeg;charset=UTF-8\r\n".getBytes());
		out.write("\r\n".getBytes());
		int len = -1;
		byte[] buf = new byte[1024];
		while((len = in.read(buf))!=-1) {
			out.write(buf, 0, len);
			
		}
		out.flush();
		socket.shutdownOutput();
	}
	
	private static void test2(BufferedInputStream in,Socket socket) throws IOException {
		BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream());
		out.write("HTTP/1.1 401 Unauthorized\r\n".getBytes());
		out.write("Content-Type: image/jpeg;charset=UTF-8\r\n".getBytes());
		out.write("\r\n".getBytes());
		int len = -1;
		byte[] buf = new byte[1024];
		while((len = in.read(buf))!=-1) {
			out.write(buf, 0, len);
		}
		out.flush();
		socket.shutdownOutput();
	}
}

状态码枚举类封装

public enum StateCodeEnum {
	OK(200,"OK"),NOT_FOUND(404,"NOT FOUND");
	private int code;
	private String msg;
	
	private StateCodeEnum(int code,String msg){
		this.code = code;
		this.msg = msg;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
}

获取相应数据 封装

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;

public class FileTypeUtil {
	public static Map<String, String> map = null;
	static {
		map = new HashMap<>();
		try {
			BufferedReader reader = new BufferedReader(new FileReader("source/3.txt"));
			String str =null;
			while((str = reader.readLine())!=null&&!"".equals(reader.readLine())){
				String[] split = str.split("=");
				map.put(split[0].trim(), split[1].trim());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		
	} 
}

主要文件

  • = application/octet-stream
    .001 = application/x-001
    .301 = application/x-301
    .323 = text/h323
    .906 = application/x-906
    .907 = drawing/907
    .a11 = application/x-a11
    .acp = audio/x-mei-aac
    .ai = application/postscript
    .aif = audio/aiff
    .aifc = audio/aiff
    .aiff = audio/aiff
    .anv = application/x-anv
    .asa = text/asa
    .asf = video/x-ms-asf
    .asp = text/asp
    .asx = video/x-ms-asf
    .au = audio/basic
    .avi = video/avi
    .awf = application/vnd.adobe.workflow
    .biz = text/xml
    .bmp = application/x-bmp
    .bot = application/x-bot
    .c4t = application/x-c4t
    .c90 = application/x-c90
    .cal = application/x-cals
    .cat = application/vnd.ms-pki.seccat
    .cdf = application/x-netcdf
    .cdr = application/x-cdr
    .cel = application/x-cel
    .cer = application/x-x509-ca-cert
    .cg4 = application/x-g4
    .cgm = application/x-cgm
    .cit = application/x-cit
    .class = java/*
    .cml = text/xml
    .cmp = application/x-cmp
    .cmx = application/x-cmx
    .cot = application/x-cot
    .crl = application/pkix-crl
    .crt = application/x-x509-ca-cert
    .csi = application/x-csi
    .css = text/css
    .cut = application/x-cut
    .dbf = application/x-dbf
    .dbm = application/x-dbm
    .dbx = application/x-dbx
    .dcd = text/xml
    .dcx = application/x-dcx
    .der = application/x-x509-ca-cert
    .dgn = application/x-dgn
    .dib = application/x-dib
    .dll = application/x-msdownload
    .doc = application/msword
    .dot = application/msword
    .drw = application/x-drw
    .dtd = text/xml
    .dwf = Model/vnd.dwf
    .dwf = application/x-dwf
    .dwg = application/x-dwg
    .dxb = application/x-dxb
    .dxf = application/x-dxf
    .edn = application/vnd.adobe.edn
    .emf = application/x-emf
    .eml = message/rfc822
    .ent = text/xml
    .epi = application/x-epi
    .eps = application/x-ps
    .eps = application/postscript
    .etd = application/x-ebx
    .exe = application/x-msdownload
    .fax = image/fax
    .fdf = application/vnd.fdf
    .fif = application/fractals
    .fo = text/xml
    .frm = application/x-frm
    .g4 = application/x-g4
    .gbr = application/x-gbr
    .gcd = application/x-gcd
    .gif = image/gif
    .gl2 = application/x-gl2
    .gp4 = application/x-gp4
    .hgl = application/x-hgl
    .hmr = application/x-hmr
    .hpg = application/x-hpgl
    .hpl = application/x-hpl
    .hqx = application/mac-binhex40
    .hrf = application/x-hrf
    .hta = application/hta
    .htc = text/x-component
    .htm = text/html
    .html = text/html
    .htt = text/webviewhtml
    .htx = text/html
    .icb = application/x-icb
    .ico = image/x-icon
    .ico = application/x-ico
    .iff = application/x-iff
    .ig4 = application/x-g4
    .igs = application/x-igs
    .iii = application/x-iphone
    .img = application/x-img
    .ins = application/x-internet-signup
    .isp = application/x-internet-signup
    .IVF = video/x-ivf
    .java = java/*
    .jfif = image/jpeg
    .jpe = image/jpeg
    .jpe = application/x-jpe
    .jpeg = image/jpeg
    .jpg = image/jpeg
    .jpg = application/x-jpg
    .js = application/x-javascript
    .jsp = text/html
    .la1 = audio/x-liquid-file
    .lar = application/x-laplayer-reg
    .latex = application/x-latex
    .lavs = audio/x-liquid-secure
    .lbm = application/x-lbm
    .lmsff = audio/x-la-lms
    .ls = application/x-javascript
    .ltr = application/x-ltr
    .m1v = video/x-mpeg
    .m2v = video/x-mpeg
    .m3u = audio/mpegurl
    .m4e = video/mpeg4
    .mac = application/x-mac
    .man = application/x-troff-man
    .math = text/xml
    .mdb = application/msaccess
    .mdb = application/x-mdb
    .mfp = application/x-shockwave-flash
    .mht = message/rfc822
    .mhtml = message/rfc822
    .mi = application/x-mi
    .mid = audio/mid
    .midi = audio/mid
    .mil = application/x-mil
    .mml = text/xml
    .mnd = audio/x-musicnet-download
    .mns = audio/x-musicnet-stream
    .mocha = application/x-javascript
    .movie = video/x-sgi-movie
    .mp1 = audio/mp1
    .mp2 = audio/mp2
    .mp2v = video/mpeg
    .mp3 = audio/mp3
    .mp4 = video/mpeg4
    .mpa = video/x-mpg
    .mpd = application/vnd.ms-project
    .mpe = video/x-mpeg
    .mpeg = video/mpg
    .mpg = video/mpg
    .mpga = audio/rn-mpeg
    .mpp = application/vnd.ms-project
    .mps = video/x-mpeg
    .mpt = application/vnd.ms-project
    .mpv = video/mpg
    .mpv2 = video/mpeg
    .mpw = application/vnd.ms-project
    .mpx = application/vnd.ms-project
    .mtx = text/xml
    .mxp = application/x-mmxp
    .net = image/pnetvue
    .nrf = application/x-nrf
    .nws = message/rfc822
    .odc = text/x-ms-odc
    .out = application/x-out
    .p10 = application/pkcs10
    .p12 = application/x-pkcs12
    .p7b = application/x-pkcs7-certificates
    .p7c = application/pkcs7-mime
    .p7m = application/pkcs7-mime
    .p7r = application/x-pkcs7-certreqresp
    .p7s = application/pkcs7-signature
    .pc5 = application/x-pc5
    .pci = application/x-pci
    .pcl = application/x-pcl
    .pcx = application/x-pcx
    .pdf = application/pdf
    .pdf = application/pdf
    .pdx = application/vnd.adobe.pdx
    .pfx = application/x-pkcs12
    .pgl = application/x-pgl
    .pic = application/x-pic
    .pko = application/vnd.ms-pki.pko
    .pl = application/x-perl
    .plg = text/html
    .pls = audio/scpls
    .plt = application/x-plt
    .png = image/png
    .png = application/x-png
    .pot = application/vnd.ms-powerpoint
    .ppa = application/vnd.ms-powerpoint
    .ppm = application/x-ppm
    .pps = application/vnd.ms-powerpoint
    .ppt = application/vnd.ms-powerpoint
    .ppt = application/x-ppt
    .pr = application/x-pr
    .prf = application/pics-rules
    .prn = application/x-prn
    .prt = application/x-prt
    .ps = application/x-ps
    .ps = application/postscript
    .ptn = application/x-ptn
    .pwz = application/vnd.ms-powerpoint
    .r3t = text/vnd.rn-realtext3d
    .ra = audio/vnd.rn-realaudio
    .ram = audio/x-pn-realaudio
    .ras = application/x-ras
    .rat = application/rat-file
    .rdf = text/xml
    .rec = application/vnd.rn-recording
    .red = application/x-red
    .rgb = application/x-rgb
    .rjs = application/vnd.rn-realsystem-rjs
    .rjt = application/vnd.rn-realsystem-rjt
    .rlc = application/x-rlc
    .rle = application/x-rle
    .rm = application/vnd.rn-realmedia
    .rmf = application/vnd.adobe.rmf
    .rmi = audio/mid
    .rmj = application/vnd.rn-realsystem-rmj
    .rmm = audio/x-pn-realaudio
    .rmp = application/vnd.rn-rn_music_package
    .rms = application/vnd.rn-realmedia-secure
    .rmvb = application/vnd.rn-realmedia-vbr
    .rmx = application/vnd.rn-realsystem-rmx
    .rnx = application/vnd.rn-realplayer
    .rp = image/vnd.rn-realpix
    .rpm = audio/x-pn-realaudio-plugin
    .rsml = application/vnd.rn-rsml
    .rt = text/vnd.rn-realtext
    .rtf = application/msword
    .rtf = application/x-rtf
    .rv = video/vnd.rn-realvideo
    .sam = application/x-sam
    .sat = application/x-sat
    .sdp = application/sdp
    .sdw = application/x-sdw
    .sit = application/x-stuffit
    .slb = application/x-slb
    .sld = application/x-sld
    .slk = drawing/x-slk
    .smi = application/smil
    .smil = application/smil
    .smk = application/x-smk
    .snd = audio/basic
    .sol = text/plain
    .sor = text/plain
    .spc = application/x-pkcs7-certificates
    .spl = application/futuresplash
    .spp = text/xml
    .ssm = application/streamingmedia
    .sst = application/vnd.ms-pki.certstore
    .stl = application/vnd.ms-pki.stl
    .stm = text/html
    .sty = application/x-sty
    .svg = text/xml
    .swf = application/x-shockwave-flash
    .tdf = application/x-tdf
    .tg4 = application/x-tg4
    .tga = application/x-tga
    .tif = image/tiff
    .tif = application/x-tif
    .tiff = image/tiff
    .tld = text/xml
    .top = drawing/x-top
    .torrent = application/x-bittorrent
    .tsd = text/xml
    .txt = text/plain
    .uin = application/x-icq
    .uls = text/iuls
    .vcf = text/x-vcard
    .vda = application/x-vda
    .vdx = application/vnd.visio
    .vml = text/xml
    .vpg = application/x-vpeg005
    .vsd = application/vnd.visio
    .vsd = application/x-vsd
    .vss = application/vnd.visio
    .vst = application/vnd.visio
    .vst = application/x-vst
    .vsw = application/vnd.visio
    .vsx = application/vnd.visio
    .vtx = application/vnd.visio
    .vxml = text/xml
    .wav = audio/wav
    .wax = audio/x-ms-wax
    .wb1 = application/x-wb1
    .wb2 = application/x-wb2
    .wb3 = application/x-wb3
    .wbmp = image/vnd.wap.wbmp
    .wiz = application/msword
    .wk3 = application/x-wk3
    .wk4 = application/x-wk4
    .wkq = application/x-wkq
    .wks = application/x-wks
    .wm = video/x-ms-wm
    .wma = audio/x-ms-wma
    .wmd = application/x-ms-wmd
    .wmf = application/x-wmf
    .wml = text/vnd.wap.wml
    .wmv = video/x-ms-wmv
    .wmx = video/x-ms-wmx
    .wmz = application/x-ms-wmz
    .wp6 = application/x-wp6
    .wpd = application/x-wpd
    .wpg = application/x-wpg
    .wpl = application/vnd.ms-wpl
    .wq1 = application/x-wq1
    .wr1 = application/x-wr1
    .wri = application/x-wri
    .wrk = application/x-wrk
    .ws = application/x-ws
    .ws2 = application/x-ws
    .wsc = text/scriptlet
    .wsdl = text/xml
    .wvx = video/x-ms-wvx
    .xdp = application/vnd.adobe.xdp
    .xdr = text/xml
    .xfd = application/vnd.adobe.xfd
    .xfdf = application/vnd.adobe.xfdf
    .xhtml = text/html
    .xls = application/vnd.ms-excel
    .xls = application/x-xls
    .xlw = application/x-xlw
    .xml = text/xml
    .xpl = audio/scpls
    .xq = text/xml
    .xql = text/xml
    .xquery = text/xml
    .xsd = text/xml
    .xsl = text/xml
    .xslt = text/xml
    .xwd = application/x-xwd
    .x_b = application/x-x_b
    .x_t = application/x-x_t

其他文件可以自行添加

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值