거꾸로 바라본 세상
[NIO] 파일 채널(FileChannel)
Language/Java 2016. 4. 6. 12:03

1. 파일채널 생성과 닫기 (1) 파일 채널 생성 - FileChannel은 정적 메소드인 open() 을 호출하여 사용하거나 IO의 FileInputStream, FileOutputStream의 getChannel() 메소드를 호출하여 사용할 수 있다. 1-1. open() 을이용한 파일생성 FileChannel fileChannel = FileChannel.open(Path path, OpenOption ... options); ex)FileChannel fileChannel = FileChannel.open(Paths.get("c://Temp/file.txt"), StandardOpenOption.READ); Paths은 파일의 경로를 지정하는 것이고 , OpenOptions은 StandardOpe..