IdentityHdfsRecordFormat implements RecordFormat { @Override public byte[] format(Tuple tuple) { byte[] data = ((StreamlineEvent) tuple.getValueByField(StreamlineEvent.STREAMLINE_EVENT)).getBytes(); byte[] recordDelimiter = "\n".getBytes(); byte[] result = new byte[data.length + recordDelimiter.length]; System.arraycopy(data, 0, result, 0, data.length); System.arraycopy(recordDelimiter, 0, result, data.length, recordDelimiter.length); return result; }  @Override byte[] format(Tuple tuple);  }
@Test public void testFormat () { byte[] bytes = format.format(mockTuple); Assert.assertTrue(Arrays.equals(TEST_BYTES_RESULT, bytes)); }