Code example for ObjectOutputStream

Methods: closeflushwriteObject

0
	public boolean add(Record record) throws FileNotFoundException, IOException{
		File category = new File(record.getToid()+File.separator+path);
		if(!category.exists())
			category.mkdirs();
		File file = new File(record.getToid()+File.separator+path+File.separator+record.getFromid()+suffixName);
		ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
		oos.writeObject(record);
		oos.flush();
		oos.close();
		oos = null;
		return true; 
	} 
 
	/**  
	 * ¹ÜÀíÔ±Ìí¼ÓÒ»ÌõмǼ¡£ 
	 * @param record ¼Ç¼¡£ 
	 * @return ·µ»ØÌí¼Ó³É¹¦·ñ¡£ 
	 * @throws FileNotFoundException 
	 * @throws IOException 
	 */