NIO Demo

1136 단어 #자바
private static List getLines(File file) {
        try {
            return Files.readAllLines(file.toPath());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }

private static writeFile(List strings){
    File wFile = new File("xxx");
        if(!file.exists()){
            wFile.createNewFile();
        }else{
            wFile.delete();
            wFile.createNewFile();
        }
    Files.write(wFile.toPath(), strings);
}

좋은 웹페이지 즐겨찾기