// Path: excel/src/main/java/com/bing/excel/writer/exception/ExcelOutException.java
// public class ExcelOutException extends RuntimeException {
// 
// 	public ExcelOutException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public ExcelOutException(String message) {
// 		super(message);
// 	}
// 
// 	public ExcelOutException(Throwable cause) {
// 		super(cause);
// 	}
// 
// }


import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.poi.ss.usermodel.Workbook;
import com.bing.excel.writer.exception.ExcelOutException;
package com.bing.excel.writer;




/**
 * 不是线程安全的
 * @author shizhongtao
 *
 */
public class DefaultStreamWriteHandler extends AbstractWriteHandler {
	private transient OutputStream os;

	/**
	 * @param wb
	 * @param outStream
	 *            U should close the stream by youself.
	 * @throws FileNotFoundException 
	 */
	 DefaultStreamWriteHandler(Workbook wb, OutputStream outStream)  {
		super(wb, outStream);
		this.os = super.os;

	}

	

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.chinamobile.excel.writer.WriterHandler#flush()
	 */
	@Override
	public void flush() {
		try {
			if (os != null) {
				this.os.flush();
				super.flush();
			}
		} catch (IOException e) {

// Path: excel/src/main/java/com/bing/excel/writer/exception/ExcelOutException.java
// public class ExcelOutException extends RuntimeException {
// 
// 	public ExcelOutException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public ExcelOutException(String message) {
// 		super(message);
// 	}
// 
// 	public ExcelOutException(Throwable cause) {
// 		super(cause);
// 	}
// 
// }


// Path: excel/src/main/java/com/bing/excel/writer/DefaultStreamWriteHandler.java
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.poi.ss.usermodel.Workbook;
import com.bing.excel.writer.exception.ExcelOutException;

package com.bing.excel.writer;




/**
 * 不是线程安全的
 * @author shizhongtao
 *
 */
public class DefaultStreamWriteHandler extends AbstractWriteHandler {
	private transient OutputStream os;

	/**
	 * @param wb
	 * @param outStream
	 *            U should close the stream by youself.
	 * @throws FileNotFoundException 
	 */
	 DefaultStreamWriteHandler(Workbook wb, OutputStream outStream)  {
		super(wb, outStream);
		this.os = super.os;

	}

	

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.chinamobile.excel.writer.WriterHandler#flush()
	 */
	@Override
	public void flush() {
		try {
			if (os != null) {
				this.os.flush();
				super.flush();
			}
		} catch (IOException e) {

			throw new ExcelOutException("Happen exception when flush", e);