随笔分类 -  Java

摘要:转自http://www.cnblogs.com/mailingfeng/archive/2012/01/18/2325707.html1. json-lib是一个java类库,提供将Java对象,包括beans, maps, collections, java arrays and XML等转换成... 阅读全文
posted @ 2014-11-16 20:08 Varorbc 阅读(186) 评论(0) 推荐(0)
摘要:出现乱码请修改为BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(path), "GBK"));一.获得控制台用户输入的信息 public String getInputMessage() throws IOException...{ System.out.println("请输入您的命令∶"); byte buffer[]=new byte[1024]; int count=System.in.read(buffer)... 阅读全文
posted @ 2013-11-27 21:16 Varorbc 阅读(562) 评论(0) 推荐(0)
摘要:public HttpServletResponse download(String path, HttpServletResponse response) { try { // path是指欲下载的文件的路径。 File file = new File(path); // 取得文件名。 String filename = file.getName(); // 取得文件的后缀名。 String ext = filename.substring(fil... 阅读全文
posted @ 2013-11-27 07:33 Varorbc 阅读(210) 评论(0) 推荐(0)
摘要:1.使用Scanner使用时需要引入包import java.util.Scanner;首先定义Scanner对象Scanner sc = new Scanner(System.in);如果要输入整数,则 int n = sc.nextInt();String类型的,则String temp = sc.next();比如:import java.util.Scanner;public class Test { @SuppressWarnings("resource") public static void main(String[] args) { Scanner scan 阅读全文
posted @ 2013-11-25 19:20 Varorbc 阅读(778) 评论(0) 推荐(0)
摘要:import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.io.OutputStream;import java.io.PrintWriter;impor... 阅读全文
posted @ 2013-11-25 10:03 Varorbc 阅读(342) 评论(0) 推荐(1)