Example usage for com.fasterxml.jackson.dataformat.smile SmileParser close

List of usage examples for com.fasterxml.jackson.dataformat.smile SmileParser close

Introduction

In this page you can find the example usage for com.fasterxml.jackson.dataformat.smile SmileParser close.

Prototype

@Override
    public void close() throws IOException 

Source Link

Usage

From source file:io.protostuff.SmileIOUtil.java

/**
 * Merges the {@code message} from the {@link InputStream} using the given {@code schema}.
 * <p>//from   ww w.j  ava 2s.  c  o  m
 * The {@link LinkedBuffer}'s internal byte array will be used when reading the message.
 */
public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema, boolean numeric,
        LinkedBuffer buffer) throws IOException {
    final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), in, false);
    final SmileParser parser = newSmileParser(in, buffer.buffer, 0, 0, false, context);

    // final SmileParser parser = DEFAULT_SMILE_FACTORY.createJsonParser(in);

    try {
        JsonIOUtil.mergeFrom(parser, message, schema, numeric);
    } finally {
        parser.close();
    }
}

From source file:io.protostuff.SmileIOUtil.java

/**
 * Parses the {@code messages} from the stream using the given {@code schema}.
 * <p>//from  ww w .  j  a v  a2  s .c o m
 * The {@link LinkedBuffer}'s internal byte array will be used when reading the message.
 */
public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, boolean numeric, LinkedBuffer buffer)
        throws IOException {
    final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), in, false);
    final SmileParser parser = newSmileParser(in, buffer.buffer, 0, 0, false, 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  ww.j a v a 2 s.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_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.SmileIOUtil.java

/**
 * Parses the {@code messages} from the stream using the given {@code schema}.
 */// www. j av a  2s  .c o  m
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} with the byte array using the given {@code schema}.
 *//*from  ww w.j ava 2s. c  o m*/
public static <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema,
        boolean numeric) throws IOException {
    final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), data, false);
    final SmileParser parser = newSmileParser(null, data, offset, offset + length, false, context);

    // final SmileParser parser = DEFAULT_SMILE_FACTORY.createJsonParser(data, offset, length);
    try {
        JsonIOUtil.mergeFrom(parser, message, schema, numeric);
    } finally {
        parser.close();
    }
}