Example usage for com.fasterxml.jackson.core.util BufferRecycler BufferRecycler

List of usage examples for com.fasterxml.jackson.core.util BufferRecycler BufferRecycler

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core.util BufferRecycler BufferRecycler.

Prototype

public BufferRecycler() 

Source Link

Usage

From source file:org.mongojack.internal.stream.JacksonDBDecoder.java

@Override
public DBObject decode(InputStream in, DBCollection collection) throws IOException {
    JacksonDBObject<T> decoded = new JacksonDBObject<T>();
    decoded.setObject(/*from   w  w  w . j  a  v a  2  s .  c  o m*/
            (T) objectMapper.readValue(new DBDecoderBsonParser(new IOContext(new BufferRecycler(), in, false),
                    0, in, decoded, dbCollection, objectMapper), type));
    return decoded;
}

From source file:jp.opencollector.guacamole.auth.delegated.DelegatedAuthenticationProvider.java

private static JsonParser createJsonParser(InputStream is, Charset charset, ObjectCodec codec) {
    final IOContext ctxt = new IOContext(new BufferRecycler(), is, false);
    if (charset.equals(UTF_8)) {
        final byte[] buf = ctxt.allocReadIOBuffer();
        return new UTF8StreamJsonParser(ctxt, 0, is, codec,
                byteSymbolCanonicalizer.makeChild(JsonFactory.Feature.CANONICALIZE_FIELD_NAMES.getMask()), buf,
                0, 0, true);//w  ww . ja va2s  . c  o m
    } else {
        return new ReaderBasedJsonParser(ctxt, 0, new InputStreamReader(is, charset), codec,
                symbolCanonicalizer.makeChild(JsonFactory.Feature.CANONICALIZE_FIELD_NAMES.getMask()));
    }
}

From source file:org.elasticsearch.script.mustache.MustacheScriptEngineService.java

/**
 * Execute a compiled template object (as retrieved from the compile method)
 * and fill potential place holders with the variables given.
 *
 * @param template//from   w ww .jav  a2 s.  c  o m
 *            compiled template object.
 * @param vars
 *            map of variables to use during substitution.
 *
 * @return the processed string with all given variables substitued.
 * */
public Object execute(Object template, Map<String, Object> vars) {
    SegmentedStringWriter result = new SegmentedStringWriter(new BufferRecycler());
    ((Mustache) template).execute(result, vars);
    return result.getAndClear();
}