diff src/org/tmatesoft/hg/internal/DataAccessProvider.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 ed243b668502
children e1b29756f901
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/DataAccessProvider.java	Mon May 06 20:28:21 2013 +0200
+++ b/src/org/tmatesoft/hg/internal/DataAccessProvider.java	Tue May 07 14:16:35 2013 +0200
@@ -84,14 +84,14 @@
 		return mapioBoundary == 0 ? Integer.MAX_VALUE : mapioBoundary;
 	}
 
-	public DataAccess createReader(File f) {
+	public DataAccess createReader(File f, boolean shortRead) {
 		if (!f.exists()) {
 			return new DataAccess();
 		}
 		try {
 			FileChannel fc = new FileInputStream(f).getChannel();
 			long flen = fc.size();
-			if (flen > mapioMagicBoundary) {
+			if (!shortRead && flen > mapioMagicBoundary) {
 				// TESTS: bufLen of 1024 was used to test MemMapFileAccess
 				return new MemoryMapFileAccess(fc, flen, mapioBufSize, context.getLog());
 			} else {