/** * */ package at.gv.egiz.pdfas.impl.api.commons; import java.io.IOException; import java.io.OutputStream; import at.gv.egiz.pdfas.api.io.DataSink; /** * Adapter that converts an API DataSink to a framework DataSink. * * @author wprinz */ public class DataSinkAdapter implements at.gv.egiz.pdfas.framework.output.DataSink { /** * The API DataSink to be adapted to a framework DataSink. */ protected at.gv.egiz.pdfas.api.io.DataSink apiDataSink = null; /** * Constructor. * * @param apiDataSink * The API DataSink to be adapted to a framework DataSink. */ public DataSinkAdapter(DataSink apiDataSink) { this.apiDataSink = apiDataSink; } /** * @see at.gv.egiz.pdfas.framework.output.DataSink#createOutputStream(java.lang.String) */ public OutputStream createOutputStream(String mimeType) { try { return this.apiDataSink.createOutputStream(mimeType); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException(e); } } /** * @see at.gv.egiz.pdfas.framework.output.DataSink#createOutputStream(java.lang.String, * java.lang.String) */ public OutputStream createOutputStream(String mimeType, String characterEncoding) { try { return this.apiDataSink.createOutputStream(mimeType, characterEncoding); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException(e); } } /** * @see at.gv.egiz.pdfas.framework.output.DataSink#getCharacterEncoding() */ public String getCharacterEncoding() { return this.apiDataSink.getCharacterEncoding(); } /** * @see at.gv.egiz.pdfas.framework.output.DataSink#getMimeType() */ public String getMimeType() { return this.apiDataSink.getMimeType(); } }