APISonar


com.streamsets.pipeline.lib.parser.DataParserFormat.JSON

> com > streamsets > pipeline > lib > parser > DataParserFormat > JSON
com APIs streamsets APIs pipeline APIs lib APIs parser APIs DataParserFormat APIs JSON APIs

Example 1
public void testGetParserString() throws Exception {
    DataParserFactoryBuilder dataParserFactoryBuilder =
        new DataParserFactoryBuilder(getContext(), DataParserFormat.JSON);
    DataParserFactory factory = dataParserFactoryBuilder
        .setMaxDataLen(1000)
        .setMode(JsonMode.MULTIPLE_OBJECTS)
        .build();

    DataParser parser = factory.getParser("id", "[\"Hello\"]\n".getBytes());
    Assert.assertEquals(0, Long.parseLong(parser.getOffset()));
    Record record = parser.parse();
    Assert.assertTrue(record.has(""));
    Assert.assertEquals(9, Long.parseLong(parser.getOffset()));
    parser.close();
  }