1. File FILE = new File("C:\\primes.txt");
2. FileChannel fileChannel = new FileInputStream(FILE).getChannel();
//MappedByteBuffer mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
3. ByteBuffer buffer = ByteBuffer.allocate((int)fileChannel.size());
4.fileChannel.read(buffer);
5.CharBuffer cb = decoder.decode(buffer);
6.BufferedReader br = new BufferedReader(new CharArrayReader(cb.array()));
7.String line;
8.while ((line = br.readLine()) != null) {
9. System.out.println(" FileChannel : "+line);
10.}
in the above program , the line number 9 is not printing the line(String value which is read from the file) ,
if i add buffer.flip(); after 4th line , then i can able to print the line.
could you someone let me know is there any mistake above code .
Regards
Dhaneshkumar