/**
 * 
 */
package com.rana.cache;

import java.beans.XMLEncoder;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.Serializable;

/**
 * @author pramod_rana7
 *
 */
public class CacheWrite implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * @throws FileNotFoundException 
	 * 
	 */
	public CacheWrite(File paramFile) throws FileNotFoundException {
		this.encode = new XMLEncoder(new FileOutputStream(paramFile));
		this.size=0;
	}
	
	public void write(Object paramObject){
		this.encode.writeObject(paramObject);
		this.encode.flush();
		this.size++;
	}
	
	/**
	 * close the cache writer when the writing finish
	 */
	public void close(){
		if(this.encode!=null){
			this.encode.flush();
			this.encode.close();
			this.encode=null;
		}
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#finalize()
	 */
	@Override
	protected void finalize() throws Throwable {
		this.close();
		super.finalize();
	}
	public int getSize(){
		return this.size;
	}
	
	/** encoding **/
	private XMLEncoder encode;
	
	/** Counting Number of input **/
	private int size;
}

@@ -212,17 +212,60 @@
 rana7%0A *
+ Creating Cache to store object in xml file
 %0A
-
  */%0Apubl
@@ -378,24 +378,79 @@
 = 1L;%0A%0A%09/**%0A
+%09 * @param File object in which the object is written.%0A
 %09 * @throws 
@@ -472,21 +472,16 @@
 eption %0A
-%09 * %0A
 %09 */%0A%09pu
@@ -628,16 +628,97 @@
 0;%0A%09%7D%0A%09%0A
+%09/**%0A%09 * Writhing object into file%0A%09 * @param object write object into file%0A%09 */%0A
 %09public 
@@ -1171,19 +1171,136 @@
 lize();%0A
-
 %09%7D%0A
+%09%0A%09/**%0A%09 * Get total number of object store in the file%0A%09 * @retunr integer count of object written in the file%0A%09 */%0A
 %09public 

Update cacheWrite.java