问题1:  java数据报能不能实现视频聊天功能?
问题2: 如何用java删除txt文件里的一行记录?小弟,无名虾在线苦等!!谢谢各位赐教哈!!不会就帮忙顶一下,拜托咯!
希望说明具体一点,能有实例最好!!
邮箱[email protected]
qq 453305761

解决方案 »

  1.   

    问题1:UDP你想用它来传送什么数据都可以,只不过是java处理视频的效率太低,光文本聊天还可以!
    问题2:给你一个能用的但绝不是最好的方法
        public static void main(String[] args) {
            try {
                String filePath = "E:/a.txt";
                BufferedReader bReader = new BufferedReader(new FileReader(
                        filePath));
                StringBuffer strBuffer = new StringBuffer();
                String lineStr = bReader.readLine();
                while (null != lineStr) {
                    if (!"line2".equals(lineStr))//此处判断你要删除的记录
                        strBuffer.append(lineStr + System.getProperty("line.separator"));
                    lineStr = bReader.readLine();
                }
                bReader.close();
                
                //写入新的内容
                OutputStream outFile = new FileOutputStream(filePath);
                outFile.write(strBuffer.toString().getBytes());
                outFile.close();
            } catch (FileNotFoundException ex) {
            } catch (IOException ex) {
            }    }
      

  2.   

    up! outFile.write(strBuffer.toString().getBytes());这句话是什么意思啊?