@Test public void testSerialize() throws StreamSerDeException, IOException, StreamingException { Object[] obj = {StreamingDataType.TIMESTAMP.createValue("2014-10-05 11:08:00")}; List<Object[]> events = new ArrayList<Object[]>(); events.add(obj); Object result = new SimpleSerDe().serialize(events); assertTrue("2014-10-05 11:08:00.000".equals(result.toString())); }
@Override public Object serialize(List<Object[]> event) throws StreamSerDeException { if (event == null) { LOG.info("Input event is null."); return null; } sb.delete(0, sb.length()); for (int i = 0; i < event.size(); i++) { Object[] vals = event.get(i); String result = lineSerialize(vals); if (result != null) { sb.append(result + LINE_SEPARATOR_UNIX); } } return sb.substring(0, sb.length() - LINE_SEPARATOR_UNIX.length()); }
SimpleSerDe extends BaseSerDe { @Override public Object serialize(List<Object[]> event) throws StreamSerDeException { if (event == null) { LOG.info("Input event is null."); return null; } sb.delete(0, sb.length()); for (int i = 0; i < event.size(); i++) { Object[] vals = event.get(i); String result = lineSerialize(vals); if (result != null) { sb.append(result + LINE_SEPARATOR_UNIX); } } return sb.substring(0, sb.length() - LINE_SEPARATOR_UNIX.length()); } }
SimpleSerDe extends BaseSerDe { @Override public Object serialize(List<Object[]> event) throws StreamSerDeException { if (event == null) { LOG.info("Input event is null."); return null; } sb.delete(0, sb.length()); for (int i = 0; i < event.size(); i++) { Object[] vals = event.get(i); String result = lineSerialize(vals); if (result != null) { sb.append(result + LINE_SEPARATOR_UNIX); } } return sb.substring(0, sb.length() - LINE_SEPARATOR_UNIX.length()); }  }
SimpleSerDe extends BaseSerDe { @Override public Object serialize(List<Object[]> event) throws StreamSerDeException { if (event == null) { LOG.info("Input event is null."); return null; } sb.delete(0, sb.length()); for (int i = 0; i < event.size(); i++) { Object[] vals = event.get(i); String result = lineSerialize(vals); if (result != null) { sb.append(result + LINE_SEPARATOR_UNIX); } } return sb.substring(0, sb.length() - LINE_SEPARATOR_UNIX.length()); }  @Override void setConfig(StreamingConfig conf); @Override void initialize(); @Override List<Object[]> deSerialize(Object data); @Override Object serialize(List<Object[]> event); }
SimpleSerDe extends BaseSerDe { @Override public Object serialize(List<Object[]> event) throws StreamSerDeException { if (event == null) { LOG.info("Input event is null."); return null; } sb.delete(0, sb.length()); for (int i = 0; i < event.size(); i++) { Object[] vals = event.get(i); String result = lineSerialize(vals); if (result != null) { sb.append(result + LINE_SEPARATOR_UNIX); } } return sb.substring(0, sb.length() - LINE_SEPARATOR_UNIX.length()); }  @Override void setConfig(StreamingConfig conf); @Override void initialize(); @Override List<Object[]> deSerialize(Object data); @Override Object serialize(List<Object[]> event); static final String LINE_SEPARATOR_UNIX; }