Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws Exception {
- String st = readAllBytesJava7(
- "C:\\Users\\Sergey\\Google Drive\\Магистратура\\Мартемьянов\\WpfApp\\WpfApp\\Files\\BVx400.mbv");
- }
- private static String readAllBytesJava7(String filePath) {
- String content = "";
- try {
- byte[] b = Files.readAllBytes(Paths.get(filePath));
- List<Integer> arr = new ArrayList<Integer>();
- for (int i = 0; i < b.length; i++) {
- arr.add(b[i] < 0 ? b[i] + 256 : b[i]);
- }
- int width = arr.get(1) << 8 | arr.get(0);
- int height = arr.get(2) | arr.get(3) << 8;
- // int height = arr[2 | arr[3] << 8;
- content = new String(b);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return content;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement