@Override public void write(Writable r) throws IOException {
        BytesWritable bw = (BytesWritable) r;
        int recordLength = bw.getLength();

        //Based on the row length to decide if the length is int or short
        String rowLength = tableProperties
            .getProperty(TeradataBinaryRecordReader.TD_ROW_LENGTH, TeradataBinaryRecordReader.DEFAULT_TD_ROW_LENGTH)
            .toLowerCase();
        LOG.debug(format("The table property %s is: %s", TeradataBinaryRecordReader.TD_ROW_LENGTH, rowLength));

        if (TeradataBinaryRecordReader.TD_ROW_LENGTH_TO_BYTE_NUM.containsKey(rowLength)) {
          if (rowLength.equals(TeradataBinaryRecordReader.DEFAULT_TD_ROW_LENGTH)) {
            EndianUtils.writeSwappedShort(outStream, (short) recordLength); // write the length using little endian
          } else if (rowLength.equals(TeradataBinaryRecordReader.TD_ROW_LENGTH_1MB)) {
            EndianUtils.writeSwappedInteger(outStream, recordLength); // write the length using little endian
          }
        } else {
          throw new IllegalArgumentException(format("%s doesn't support the value %s, the supported values are %s",
              TeradataBinaryRecordReader.TD_ROW_LENGTH, rowLength,
              TeradataBinaryRecordReader.TD_ROW_LENGTH_TO_BYTE_NUM.keySet()));
        }

        outStream.write(bw.getBytes(), 0, bw.getLength()); // write the content (the content is in little endian)
        outStream.write(RECORD_END_BYTE); //write the record ending
      }
create the final out file, and output row by row. After one row is
appended, a configured row separator is appended

@param jc
         the job configuration file
@param outPath
         the final output file to be created
@param valueClass
         the value class used for create
@param isCompressed
         whether the content is compressed or not
@param tableProperties
         the tableProperties of this file's corresponding table
@param progress
         progress used for status report
@return the RecordWriter
ql/src/java/org/apache/hadoop/hive/ql/io/TeradataBinaryFileOutputFormat.java