Examples of SmileFactory


Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

        return _mapper;
    }

    public synchronized ObjectMapper getDefaultMapper() {
        if (_defaultMapper == null) {
            _defaultMapper = new ObjectMapper(new SmileFactory());
            _setAnnotations(_defaultMapper, _defaultAnnotationsToUse);
        }
        return _defaultMapper;
    }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

     * that mapper.
     */
    protected ObjectMapper mapper()
    {
        if (_mapper == null) {
            _mapper = new ObjectMapper(new SmileFactory());
            _setAnnotations(_mapper, _defaultAnnotationsToUse);
        }
        return _mapper;
    }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

    /**********************************************************
     */

    public void testStandardSmile() throws Exception
    {
        final ObjectMapper mapper = new ObjectMapper(new SmileFactory());
        Server server = startServer(TEST_PORT, SimpleResourceApp.class);
        Point p;

        try {
            InputStream in = new URL("http://localhost:"+TEST_PORT+"/point").openStream();
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

  }

  @Provides @LazySingleton @Smile
  public ObjectMapper smileMapper()
  {
    ObjectMapper retVal = new DefaultObjectMapper(new SmileFactory());
    retVal.getFactory().setCodec(retVal);
    return retVal;
  }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

        _jsonMapper = new ObjectMapper();
        // with JSON, don't force numerics
        _jsonMapper.registerModule(new ClusterMateTypesModule(false));
        _jsonMapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
       
        SmileFactory sf = new SmileFactory();
        // for our data, sharing names fine, shared values are 'meh', but enable
        sf.enable(SmileGenerator.Feature.CHECK_SHARED_NAMES);
        sf.enable(SmileGenerator.Feature.CHECK_SHARED_STRING_VALUES);

        // and although we don't necessarily embed binary data, if we do, better be raw
        sf.disable(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT);
        // as to header, trailer: header, absolutely must write and require for reads;
        // trailer: let's not; harmless but useless for our uses
        sf.enable(SmileGenerator.Feature.WRITE_HEADER);
        sf.disable(SmileGenerator.Feature.WRITE_END_MARKER);
        sf.enable(SmileParser.Feature.REQUIRE_HEADER);
       
        ObjectMapper smileMapper = new ObjectMapper(sf);
        // with Smile, numerics make sense:
        smileMapper.registerModule(new ClusterMateTypesModule(true));
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

        _jsonMapper = new ObjectMapper();
        // with JSON, don't force numerics
        _jsonMapper.registerModule(new ClusterMateTypesModule(false));
        _jsonMapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
       
        SmileFactory sf = new SmileFactory();
        // for our data, sharing names fine, shared values are 'meh', but enable
        sf.enable(SmileGenerator.Feature.CHECK_SHARED_NAMES);
        sf.enable(SmileGenerator.Feature.CHECK_SHARED_STRING_VALUES);

        // and although we don't necessarily embed binary data, if we do, better be raw
        sf.disable(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT);
        // as to header, trailer: header, absolutely must write and require for reads;
        // trailer: let's not; harmless but useless for our uses
        sf.enable(SmileGenerator.Feature.WRITE_HEADER);
        sf.disable(SmileGenerator.Feature.WRITE_END_MARKER);
        sf.enable(SmileParser.Feature.REQUIRE_HEADER);
       
        ObjectMapper smileMapper = new ObjectMapper(sf);
        // with Smile, numerics make sense:
        smileMapper.registerModule(new ClusterMateTypesModule(true));
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

    @Override
    protected Object decodeBody(byte[] body)
            throws Exception
    {
        ObjectMapper mapper = new ObjectMapper(new SmileFactory());

        return mapper.readValue(body, Object.class);
    }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

    private Response createSmileResponse(HttpStatus status, Object value)
    {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        try {
            new ObjectMapper(new SmileFactory()).writeValue(outputStream, value);
        }
        catch (IOException e) {
            throw propagate(e);
        }
        return new TestingResponse(status, contentType(MEDIA_TYPE_SMILE), outputStream.toByteArray());
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

            InputStream inputStream)
            throws IOException
    {
        Object object;
        try {
            JsonParser jsonParser = new SmileFactory().createParser(inputStream);

            // Important: we are NOT to close the underlying stream after
            // mapping, so we need to instruct parser:
            jsonParser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

            MediaType mediaType,
            MultivaluedMap<String, Object> httpHeaders,
            OutputStream outputStream)
            throws IOException
    {
        JsonGenerator jsonGenerator = new SmileFactory().createGenerator(outputStream);

        // Important: we are NOT to close the underlying stream after
        // mapping, so we need to instruct generator:
        jsonGenerator.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.