You can go to a specific position in the file using FileChannel#position(long) and then read a buffer in the desired size.
Up vote 0 down vote favorite share g+ share fb share tw.
I have a RandomAccessFile and its FileChannel. What I'm trying to do is read a specific section of the bytes from said file; however, while looking over the FileChannel read methods, I didn't see overloads that would help with what I'm trying to do, only methods which would read the entire content, or read content to a specific position in the buffer that the read method takes in. Is there a method that I'm missing that will help me accomplish my goal of reading a specific chunk of bytes, or will I need to read in the entire channel into the buffer and then parse out the section somehow?
Java buffer nio bytebuffer filechannel link|improve this question asked Oct 25 '11 at 21:13Chris V.2027 62% accept rate.
I don't see any overloaded reads that specify the buffer size. – Chris V. Oct 25 '11 at 21:36 @ChrisV.
Create the ByteBuffer of the size required. Or else just use RandomAccessFile. Read(buffer,int,int), unless you have a strong reason for using a channel.
– EJP Oct 25 '11 at 22:20.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.