Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. {
  2.     InputStream in = getClass().getClassLoader().getResourceAsStream("test/firmware.txt");
  3.    
  4.  public static void main(String args[])
  5.    {
  6.      
  7.   try{
  8.      
  9.   // Open the file that is the first
  10.   // command line parameter
  11.   FileInputStream fstream = new FileInputStream("test/firmware.txt");
  12.   // Get the object of DataInputStream
  13.   DataInputStream in = new DataInputStream(fstream);
  14.   BufferedReader br = new BufferedReader(new InputStreamReader(in));
  15.    String strLine;
  16.   //Read File Line By Line
  17.   while ((strLine = br.readLine()) != null)   {
  18.   // Print the content on the console
  19.   System.out.println (strLine);
  20.   }
  21.   //Close the input stream
  22.   in.close();
  23.     }catch (Exception e){//Catch exception if any
  24.   System.err.println("Error: " + e.getMessage());
  25.    }
  26.    }
  27.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement