class ReplaceStringMeta extends BaseTransformMeta implements ITransformMeta<ReplaceString, ReplaceStringData> {

  public void getFields( IRowMeta inputRowMeta, String name, IRowMeta[] info, TransformMeta nextTransform,
                         IVariables variables, IHopMetadataProvider metadataProvider ) throws HopTransformException {
    int nrFields = fieldInStream == null ? 0 : fieldInStream.length;
    for ( int i = 0; i < nrFields; i++ ) {
      String fieldName = variables.environmentSubstitute( fieldOutStream[ i ] );
      IValueMeta valueMeta;
      if ( !Utils.isEmpty( fieldOutStream[ i ] ) ) {
        // We have a new field
        valueMeta = new ValueMetaString( fieldName );
        valueMeta.setOrigin( name );
        //set encoding to new field from source field http://jira.pentaho.com/browse/PDI-11839
        IValueMeta sourceField = inputRowMeta.searchValueMeta( fieldInStream[ i ] );
        if ( sourceField != null ) {
          valueMeta.setStringEncoding( sourceField.getStringEncoding() );
        }
        inputRowMeta.addValueMeta( valueMeta );
      } else {
        valueMeta = inputRowMeta.searchValueMeta( fieldInStream[ i ] );
        if ( valueMeta == null ) {
          continue;
        }
        valueMeta.setStorageType( IValueMeta.STORAGE_TYPE_NORMAL );
      }
    }
  }

  public  ReplaceStringMeta();

}