class TextFileOutput extends BaseTransform<Meta, Data> implements ITransform<Meta, Data> {

  public void writeRow( IRowMeta rowMeta, Object[] r ) throws HopTransformException {
    try {
      if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) {
        /*
         * Write all values in stream to text file.
         */
        for ( int i = 0; i < rowMeta.size(); i++ ) {
          if ( i > 0 && data.binarySeparator.length > 0 ) {
            data.writer.write( data.binarySeparator );
          }
          IValueMeta v = rowMeta.getValueMeta( i );
          Object valueData = r[ i ];

          // no special null value default was specified since no fields are specified at all
          // As such, we pass null
          //
          writeField( v, valueData, null );
        }
        data.writer.write( data.binaryNewline );
      } else {
        /*
         * Only write the fields specified!
         */
        for ( int i = 0; i < meta.getOutputFields().length; i++ ) {
          if ( i > 0 && data.binarySeparator.length > 0 ) {
            data.writer.write( data.binarySeparator );
          }

          IValueMeta v = rowMeta.getValueMeta( data.fieldnrs[ i ] );
          Object valueData = r[ data.fieldnrs[ i ] ];
          writeField( v, valueData, data.binaryNullValue[ i ] );
        }
        data.writer.write( data.binaryNewline );
      }

      incrementLinesOutput();

    } catch ( Exception e ) {
      throw new HopTransformException( "Error writing line", e );
    }
  }

  public  TextFileOutput( TransformMeta transformMeta, Meta meta, Data data, int copyNr, PipelineMeta pipelineMeta,
                         Pipeline pipeline );

}