/** * returns the OutputWiter if exists. Otherwhise it will create a new one. * * @return * @throws KettleException */ Writer getWriter(Object source) throws KettleException { try { Writer outputStreamWriter = (Writer) writers.get(source); if (outputStreamWriter != null) return outputStreamWriter; FileObject file = getReplayFilename( destinationDirectory, processingFilename, dateString, fileExtension, source); ResultFile resultFile = new ResultFile( ResultFile.FILE_TYPE_GENERAL, file, baseStep.getTransMeta().getName(), baseStep.getStepname()); baseStep.addResultFile(resultFile); try { if (encoding == null) { outputStreamWriter = new OutputStreamWriter(KettleVFS.getOutputStream(file, false)); } else { outputStreamWriter = new OutputStreamWriter(KettleVFS.getOutputStream(file, false), encoding); } } catch (Exception e) { throw new KettleException( Messages.getString( "AbstractFileErrorHandler.Exception.CouldNotCreateFileErrorHandlerForFile") //$NON-NLS-1$ + file.getName().getURI(), e); } writers.put(source, outputStreamWriter); return outputStreamWriter; } catch (IOException e) { throw new KettleException( Messages.getString( "AbstractFileErrorHandler.Exception.CouldNotCreateFileErrorHandlerForFile"), e); } }