Advertisement
bkit4s0

[readAllByte]

Mar 11th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.FileNotFoundException;
  3. import java.io.FileReader;
  4. import java.io.IOException;
  5. import java.net.URI;
  6. import java.net.URISyntaxException;
  7. import java.nio.file.Files;
  8. import java.nio.file.Path;
  9. import java.nio.file.Paths;
  10.  
  11. public class main {
  12.     public static void main(String[] args) throws URISyntaxException {
  13.         /*
  14.          * byte[] a = new byte[10];
  15.          *
  16.          * int b,c; b = 10; c = b >> 1; //a[1]= a[0] >> 1; a[0] = 4;
  17.          * System.out.println(a[0]);
  18.          */
  19.         /*URI uri = new URI("D:\\in.txt");
  20.         Path path = Paths.get(uri);
  21.         try {
  22.             byte[] data = Files.readAllBytes(path);
  23.         } catch (IOException e) {
  24.             // TODO Auto-generated catch block
  25.             e.printStackTrace();
  26.         }*/
  27.         FileReader fr;
  28.         try {
  29.             fr = new FileReader("D:\\in.txt");
  30.         } catch (FileNotFoundException e) {
  31.             // TODO Auto-generated catch block
  32.             e.printStackTrace();
  33.         }
  34.         BufferedReader br = new BufferedReader(fr);
  35.         String s;
  36.         while ((s=br.readLine()) !=null)
  37.             System.out.println(s);
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement