首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

io 资料读取通用格式

2012-12-23 
io 文件读取通用格式public static void main(String[] args) throws IOException{InputStream is new F

io 文件读取通用格式

public static void main(String[] args) throws IOException    {        InputStream is = new FileInputStream("D:\\workspace\\files\\test.txt");                byte[] buff = new byte[1024];                //length:以整数形式返回实际读取的字节数        int length;                while (-1 != (length = is.read(buff, 0, 1024)))        {                        String str = new String(buff, 0, length);            System.out.println(str);        }                is.close();    }
?

热点排行