protected boolean writeEndedLine() {
    boolean retval = false;
    try {
      String sLine = environmentSubstitute( meta.getEndedLine() );
      if ( sLine != null ) {
        if ( sLine.trim().length() > 0 ) {
          data.writer.write( getBinaryString( sLine ) );
          incrementLinesOutput();
        }
      }
    } catch ( Exception e ) {
      logError( "Error writing ended tag line: " + e.toString() );
      logError( Const.getStackTracker( e ) );
      retval = true;
    }

    return retval;
  }
@Test
  public void testEndedLineVar() throws Exception {
    TextFileOutputData data = new TextFileOutputData();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    data.writer = baos;
    TextFileOutputMeta meta = new TextFileOutputMeta();
    meta.setEndedLine( "${endvar}" );
    meta.setDefault();
    meta.setEncoding( StandardCharsets.UTF_8.name() );
    stepMockHelper.stepMeta.setStepMetaInterface( meta );
    TextFileOutput textFileOutput =
      new TextFileOutputTestHandler( stepMockHelper.stepMeta, data, 0, stepMockHelper.transMeta,
        stepMockHelper.trans );
    textFileOutput.meta = meta;
    textFileOutput.data = data;
    textFileOutput.setVariable( "endvar", "this is the end" );
    textFileOutput.writeEndedLine();
    assertEquals( "this is the end", baos.toString( StandardCharsets.UTF_8.name() ) );
  }