@@ -0,0 +1,837 @@
+package com.codeofdan.nio;%0A%0Aimport java.io.IOException;%0Aimport java.nio.ByteBuffer;%0Aimport java.nio.channels.FileChannel;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0A%0Apublic class FileReader %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        Path filePath = Paths.get(args%5B0%5D);%0A%0A        try (FileChannel fileChannel = FileChannel.open(filePath)) %7B%0A%0A            ByteBuffer buffer = ByteBuffer.allocate(1024);%0A%0A            int bytesRead = 0;%0A%0A            do %7B%0A                bytesRead += fileChannel.read(buffer);%0A                System.out.print(new String(buffer.array(), 0, buffer.position()));%0A                buffer.rewind();%0A            %7D%0A            while (bytesRead != fileChannel.size());%0A%0A            System.out.println();%0A%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D%0A%0A%0A    %7D%0A%7D%0A

Read file using NIO