Skip n bytes while reading the file using FileInputStream


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Main {
  public static void main(String[] args) {
    File file = new File("C:/data.dat");
    try {
      FileInputStream fin = new FileInputStream(file);
      int ch;
      fin.skip(10);
      while ((ch = fin.read()) != -1){
        System.out.print((char) ch);
      }
    } catch (FileNotFoundException e) {
      System.out.println("File not found" + e);
    } catch (IOException ioe) {
      System.out.println("Exception while reading the file " + ioe);
    }
  }
}
Home 
  Java Book 
    File Stream  

FileInputStream:
  1. FileInputStream
  2. Skip n bytes while reading the file using FileInputStream
  3. FileInputStream and FileOutputStream to copy a file