I have used FileInputStream class but its not working properly to divide the bits into blocks.I will attach the coding,help me out to fix the problem.
public static void main(String[] args) { ReadFileExample newclass = new ReadFileExample(); System.out.println("cryptography"); File input = new File("D:/java/source.txt"); File output = new File("D:/java/target.txt"); byte[] block = new byte[18]; try { FileInputStream fis = new FileInputStream(input); FileOutputStream fos = new FileOutputStream(output); //CipherOutputStream cos = new CipherOutputStream(fos); System.out.println("Total file size to read (in bytes) : " + fis.length()); int i; while ((i = fis.read(byte[18]))!= -1) { System.out.println(block); fos.write(block, 0, i); } fos.close(); } catch (Exception e) { System.out.println("invalid"); } }}