Source Code : Read from back

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Read from back

  

import java.io.EOFException;
import java.io.RandomAccessFile;

class Tail {
  public static void main(String args[]) throws Exception {
    RandomAccessFile raf = new RandomAccessFile(args[0], "r");
    long count = 10;
    long position = raf.length();
    position -= count;
    if (position < 0)
      position = 0;
    raf.seek(position);
    while (true) {
      try {
        byte b = raf.readByte();
        System.out.print((char) b);
      } catch (EOFException eofe) {
        break;
      }
    }
  }
}

   
    
  

Thank with us