# HG changeset patch
# User Ed Swartz <ed.swartz@nokia.com>
# Date 1263921380 21600
# Node ID e6e4e53ddc173e0924c0808b1647da82bbb83690
# Parent  cb7e68ca1ef4e6ded58497d84915a003d8cd887c
Add buffering to cache files to fix bug #10318 and bug #10533

diff -r cb7e68ca1ef4 -r e6e4e53ddc17 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java	Fri Jan 15 14:08:27 2010 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java	Tue Jan 19 11:16:20 2010 -0600
@@ -12,6 +12,8 @@
 */
 package com.nokia.carbide.cpp.internal.api.sdk;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -561,10 +563,11 @@
 		ObjectOutputStream os = null;
 		try {
 			File cacheFile = getCacheFile();
-			if (DEBUG) System.out.println("Saving to " + cacheFile); //$NON-NLS-1$
-			os = new ObjectOutputStream(new FileOutputStream(cacheFile));
+			if (DEBUG) System.out.print("Saving to " + cacheFile + "... "); //$NON-NLS-1$ //$NON-NLS-2$
+			os = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(cacheFile)));
 			doSaveCache(os);
 			changed = false;
+			if (DEBUG) System.out.println("done."); //$NON-NLS-1$
 		} catch (ObjectStreamException e) {
 			Logging.log(SDKCorePlugin.getDefault(), 
 					Logging.newStatus(SDKCorePlugin.getDefault(), 
@@ -594,7 +597,7 @@
 		final ClassLoader classLoader = SDKCorePlugin.getDefault().getClass().getClassLoader();
 		File cacheFile = getCacheFile();
 		try {
-			is = new ObjectInputStream(new FileInputStream(cacheFile)) {
+			is = new ObjectInputStream(new BufferedInputStream(new FileInputStream(cacheFile))) {
 				/* (non-Javadoc)
 				 * @see java.io.ObjectInputStream#resolveClass(java.io.ObjectStreamClass)
 				 */