@Override public FileObject getHeaderFileObject( final TransMeta transMeta ) { final String filename = transMeta.environmentSubstitute( getFilename() ); try { return KettleVFS.getFileObject( filename ); } catch ( final KettleFileException e ) { return null; } }
wIncludeFilename.setSelection( inputMeta.isIncludingFilename() ); } else { wFilename.setText( Const.NVL( inputMeta.getFilename(), "" ) );
/**' * Returns the {@link InputStreamReader} corresponding to the csv file, or null if the file cannot be read. * @return the {@link InputStreamReader} corresponding to the csv file, or null if the file cannot be read */ private InputStreamReader getReader( final CsvInputMeta meta, final InputStream inputStream ) { InputStreamReader reader = null; try { String filename = transMeta.environmentSubstitute( meta.getFilename() ); FileObject fileObject = KettleVFS.getFileObject( filename ); if ( !( fileObject instanceof LocalFile ) ) { // We can only use NIO on local files at the moment, so that's what we // limit ourselves to. // throw new KettleException( BaseMessages.getString( PKG, "CsvInput.Log.OnlyLocalFilesAreSupported" ) ); } String realEncoding = transMeta.environmentSubstitute( meta.getEncoding() ); if ( Utils.isEmpty( realEncoding ) ) { reader = new InputStreamReader( inputStream ); } else { reader = new InputStreamReader( inputStream, realEncoding ); } } catch ( final Exception e ) { logError( BaseMessages.getString( PKG, "CsvInputDialog.ErrorGettingFileDesc.DialogMessage" ), e ); } return reader; }
/**' * Returns the {@link InputStream} corresponding to the csv file, or null if the file cannot be read. * @return the {@link InputStream} corresponding to the csv file, or null if the file cannot be read */ private InputStream getInputStream( final CsvInputMeta meta ) { InputStream inputStream = null; try { final String filename = transMeta.environmentSubstitute( meta.getFilename() ); final FileObject fileObject = KettleVFS.getFileObject( filename ); if ( !( fileObject instanceof LocalFile ) ) { // We can only use NIO on local files at the moment, so that's what we // limit ourselves to. // throw new KettleException( BaseMessages.getString( PKG, "CsvInput.Log.OnlyLocalFilesAreSupported" ) ); } inputStream = KettleVFS.getInputStream( fileObject ); } catch ( final Exception e ) { logError( BaseMessages.getString( PKG, "CsvInputDialog.ErrorGettingFileDesc.DialogMessage" ), e ); } return inputStream; }
if ( Utils.isEmpty( meta.getFilename() ) ) { return;
String filename = environmentSubstitute( meta.getFilename() );