wyl232 发表于 2013-2-5 01:16:03

java中文件操作大全

【转】java中文件操作大全

一.获得控制台用户输入的信息
Java代码 http://kuangbaoxu.iteye.com/images/icon_copy.gif
<div class="dp-highlighter">
[*]/** *//**获得控制台用户输入的信息  
[*]     * @return  
[*]     * @throws IOException  
[*]     */  
[*]    public String getInputMessage() throws IOException...{   
[*]        System.out.println("请输入您的命令∶");   
[*]        byte buffer[]=new byte[1024];   
[*]        int count=System.in.read(buffer);   
[*]        char[] ch=new char2];//最后两位为结束符,删去不要   
[*]        for(int i=0;i<count-2;i++)   
[*]            ch=(char)buffer;   
[*]        String str=new String(ch);   
[*]        return str;   
[*]    }  
页: [1]
查看完整版本: java中文件操作大全