Search in sources :

Example 1 with PrefixInputDecorator

use of com.fasterxml.jackson.dataformat.smile.testutil.PrefixInputDecorator in project jackson-dataformats-binary by FasterXML.

the class StreamingDecoratorsTest method testInputDecorators.

public void testInputDecorators() throws Exception {
    final byte[] DOC = _smileDoc("42   37");
    final SmileFactory streamF = smileFactoryBuilder(false, true, false).inputDecorator(new PrefixInputDecorator(DOC)).build();
    final SmileMapper mapper = SmileMapper.builder(streamF).build();
    JsonParser p = mapper.createParser(new byte[0], 0, 0);
    assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
    assertEquals(42, p.getIntValue());
    assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
    assertEquals(37, p.getIntValue());
    assertNull(p.nextToken());
    p.close();
}
Also used : SmileMapper(com.fasterxml.jackson.dataformat.smile.databind.SmileMapper) PrefixInputDecorator(com.fasterxml.jackson.dataformat.smile.testutil.PrefixInputDecorator)

Aggregations

SmileMapper (com.fasterxml.jackson.dataformat.smile.databind.SmileMapper)1 PrefixInputDecorator (com.fasterxml.jackson.dataformat.smile.testutil.PrefixInputDecorator)1