comparison src/org/tmatesoft/hg/repo/HgBundle.java @ 606:5daa42067e7c

Avoid mmap files when only few bytes are to be read
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 07 May 2013 14:16:35 +0200
parents 243202f1bda5
children 6526d8adbc0f
comparison
equal deleted inserted replaced
605:c56edf42be64 606:5daa42067e7c
58 accessProvider = dap; 58 accessProvider = dap;
59 bundleFile = bundle; 59 bundleFile = bundle;
60 } 60 }
61 61
62 private DataAccess getDataStream() throws IOException { 62 private DataAccess getDataStream() throws IOException {
63 DataAccess da = accessProvider.createReader(bundleFile); 63 DataAccess da = accessProvider.createReader(bundleFile, false);
64 byte[] signature = new byte[6]; 64 byte[] signature = new byte[6];
65 if (da.length() > 6) { 65 if (da.length() > 6) {
66 da.readBytes(signature, 0, 6); 66 da.readBytes(signature, 0, 6);
67 if (signature[0] == 'H' && signature[1] == 'G' && signature[2] == '1' && signature[3] == '0') { 67 if (signature[0] == 'H' && signature[1] == 'G' && signature[2] == '1' && signature[3] == '0') {
68 if (signature[4] == 'G' && signature[5] == 'Z') { 68 if (signature[4] == 'G' && signature[5] == 'Z') {