List of usage examples for com.fasterxml.jackson.core.io IOContext allocReadIOBuffer
public byte[] allocReadIOBuffer()
Note: the method can only be called once during its life cycle.
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 .j a va 2 s . 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:io.protostuff.SmileIOUtil.java
/** * Creates a smile pipe from an {@link InputStream}. *//*from ww w .ja va 2 s. c om*/ public static Pipe newPipe(InputStream in, boolean numeric) throws IOException { final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), in, false); final SmileParser parser = newSmileParser(in, context.allocReadIOBuffer(), 0, 0, true, context); return JsonIOUtil.newPipe(parser, numeric); // return JsonIOUtil.newPipe(DEFAULT_SMILE_FACTORY.createJsonParser(in), numeric); }
From source file:io.protostuff.SmileIOUtil.java
/** * Parses the {@code messages} from the stream using the given {@code schema}. *///from w ww . j a v a2s . c om public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, boolean numeric) throws IOException { final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), in, false); final SmileParser parser = newSmileParser(in, context.allocReadIOBuffer(), 0, 0, true, context); // final SmileParser parser = DEFAULT_SMILE_FACTORY.createJsonParser(in); try { return JsonIOUtil.parseListFrom(parser, schema, numeric); } finally { parser.close(); } }
From source file:io.protostuff.SmileIOUtil.java
/** * Merges the {@code message} from the {@link InputStream} using the given {@code schema}. *///from w w w . ja v a2s . c om public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema, boolean numeric) throws IOException { final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), in, false); final SmileParser parser = newSmileParser(in, context.allocReadIOBuffer(), 0, 0, true, context); // final SmileParser parser = DEFAULT_SMILE_FACTORY.createJsonParser(in); try { JsonIOUtil.mergeFrom(parser, message, schema, numeric); } finally { parser.close(); } }
From source file:io.protostuff.JsonIOUtil.java
/** * Creates a json pipe from an {@link InputStream}. *//*from w w w . j av a 2 s .co m*/ public static Pipe newPipe(InputStream in, boolean numeric) throws IOException { final IOContext context = new IOContext(DEFAULT_JSON_FACTORY._getBufferRecycler(), in, false); final JsonParser parser = newJsonParser(in, context.allocReadIOBuffer(), 0, 0, true, context); return newPipe(parser, numeric); }
From source file:io.protostuff.JsonIOUtil.java
/** * Parses the {@code messages} from the stream using the given {@code schema}. *//*from ww w. jav a 2 s .com*/ public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, boolean numeric) throws IOException { final IOContext context = new IOContext(DEFAULT_JSON_FACTORY._getBufferRecycler(), in, false); final JsonParser parser = newJsonParser(in, context.allocReadIOBuffer(), 0, 0, true, context); // final JsonParser parser = DEFAULT_JSON_FACTORY.createJsonParser(in); try { return parseListFrom(parser, schema, numeric); } finally { parser.close(); } }
From source file:io.protostuff.JsonIOUtil.java
/** * Merges the {@code message} from the {@link InputStream} using the given {@code schema}. *///from w ww. j a v a 2s. c o m public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema, boolean numeric) throws IOException { final IOContext context = new IOContext(DEFAULT_JSON_FACTORY._getBufferRecycler(), in, false); final JsonParser parser = newJsonParser(in, context.allocReadIOBuffer(), 0, 0, true, context); // final JsonParser parser = DEFAULT_JSON_FACTORY.createJsonParser(in); try { mergeFrom(parser, message, schema, numeric); } finally { parser.close(); } }