FileChannel.read(ByteBuffer[],int,int)
-java-NIO의 방법을 사용하여 파일의 특정 부분을 읽는 방법을 아는 사람이 있습니까?Java-NIO : 오프셋 주소/NullPointer와 함께 FileChannel.read() 사용
ByteBuffer[] bb = new ByteBuffer[(int) fChannel.size()];
fChannel.read(bb, offsetAddress, endAddress);
read() - 메서드를 실행하는 동안 NullPointer를 throw합니다. 버퍼가 충분히 커야합니다. offsetAddress는 0이고 endAddress는 255이며, 파일 크기는 그 이상입니다.
그래서 파일의 모든 바이트마다 ByteBuffer를 만들고 있습니까? 그것의 요점은 무엇입니까? 파일 크기는 얼마입니까? –