From 0b6a51224f68786177d4e3a261e7e7bfb6c353c4 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Wed, 9 Jul 2008 08:27:48 +0000 Subject: [PATCH] Exporting index-databases larger than 1GB, bug 239462. --- .../cdt/internal/core/pdom/db/Database.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java index 254037f0556..9e256d33d85 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java @@ -170,8 +170,18 @@ public class Database { public void transferTo(FileChannel target) throws IOException { assert fLocked; - final FileChannel from= fFile.getChannel(); - from.transferTo(0, from.size(), target); + final FileChannel from= fFile.getChannel(); + long nRead = 0; + long position = 0; + long size = from.size(); + while (position < size) { + nRead = from.transferTo(position, 4096*16, target); + if (nRead == 0) { + break; // should not happen + } else { + position+= nRead; + } + } } public int getVersion() throws CoreException {