Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public static void main(String[] args) throws Exception {
  2.  
  3. String st = readAllBytesJava7(
  4. "C:\\Users\\Sergey\\Google Drive\\Магистратура\\Мартемьянов\\WpfApp\\WpfApp\\Files\\BVx400.mbv");
  5. }
  6.  
  7. private static String readAllBytesJava7(String filePath) {
  8. String content = "";
  9. try {
  10. byte[] b = Files.readAllBytes(Paths.get(filePath));
  11. List<Integer> arr = new ArrayList<Integer>();
  12. for (int i = 0; i < b.length; i++) {
  13. arr.add(b[i] < 0 ? b[i] + 256 : b[i]);
  14. }
  15.  
  16. int width = arr.get(1) << 8 | arr.get(0);
  17. int height = arr.get(2) | arr.get(3) << 8;
  18. // int height = arr[2 | arr[3] << 8;
  19. content = new String(b);
  20. } catch (IOException e) {
  21. e.printStackTrace();
  22. }
  23. return content;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement