XlsSerializer implements Serializer { @Override public InputStream serialize(InputStream givenInputStream, DataSetMetadata metadata, long limit) { try { PipedInputStream pipe = new PipedInputStream(); PipedOutputStream jsonOutput = new PipedOutputStream(pipe); InputStream inputStream = givenInputStream; if (!inputStream.markSupported()) { inputStream = new BufferedInputStream(inputStream); } inputStream.mark(Integer.MAX_VALUE); boolean newExcelFormat = XlsUtils.isNewExcelFormat(inputStream); inputStream.reset(); Runnable runnable = newExcelFormat ? serializeNew(inputStream, metadata, limit, jsonOutput) : serializeOld(inputStream, metadata, limit, jsonOutput); executor.execute(runnable); return pipe; } catch (IOException e) { throw new TDPException(CommonErrorCodes.UNABLE_TO_SERIALIZE_TO_JSON, e); } }  static boolean isHeaderLine(int lineIndex, List<ColumnMetadata> columns); @Override InputStream serialize(InputStream givenInputStream, DataSetMetadata metadata, long limit);  }
@Test public void testGeneralNumberFormat_TDP_222() throws Exception { final DataSetMetadata metadata = metadataBuilder .metadata() .id("1234") .row(column().name("id").id(0).type(Type.INTEGER), column().name("value1").id(1).type(Type.INTEGER)) .build(); Format format = assertFormat("excel_numbers.xls"); InputStream input = this.getClass().getResourceAsStream("excel_numbers.xls"); final String result = IOUtils.toString(format.getFormatFamily().getSerializer().serialize(input, metadata, -1), UTF_8); final String expected = "[{\"0000\":\"1\",\"0001\":\"123\"},{\"0000\":\"2\",\"0001\":\"123.1\"},{\"0000\":\"3\",\"0001\":\"209.9\"}]"; assertThat(result, sameJSONAs(expected)); }