六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 29|回复: 0

java中文件操作大全

[复制链接]

升级  30%

25

主题

25

主题

25

主题

秀才

Rank: 2

积分
95
 楼主| 发表于 2013-2-4 19:49:12 | 显示全部楼层 |阅读模式
一.获得控制台用户输入的信息
<div style="padding-right: 5.4pt; padding-left: 5.4pt; background: #e6e6e6 0% 50%; padding-bottom: 4px; width: 95%; padding-top: 4px;">/** *//**获得控制台用户输入的信息
     * 
@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 char[count-2];//最后两位为结束符,删去不要
        for(int i=0;i<count-2;i++)
            ch
=(char)buffer;
        String str
=new String(ch);
        
return str;
    }
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表