Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. try (BufferedInputStream input = new BufferedInputStream(new FileInputStream("File.txt"))) {
  2.    byte[] bytes = new byte[input.available()];
  3.    if (input.read(bytes) != bytes.length) {
  4.       throw new IOException("Не удалось вычитать все данные из файла!");
  5.    }
  6.    String result = new String(bytes, "UTF-16");
  7.    System.out.println(result);
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement