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]