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

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

Introduction

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

Prototype

@Override
    public void close() throws IOException 

Source Link

Usage

From source file:io.protostuff.SmileIOUtil.java

/**
 * Serializes the {@code message} into an {@link OutputStream} using the given {@code schema}.
 * <p>//from  ww w . j  a va 2s.c o  m
 * The {@link LinkedBuffer}'s internal byte array will be used as the primary buffer when writing the message.
 */
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema, boolean numeric,
        LinkedBuffer buffer) throws IOException {
    final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), out, false);

    final SmileGenerator generator = newSmileGenerator(out, buffer.buffer, 0, false, context);

    // final SmileGenerator generator = DEFAULT_SMILE_FACTORY.createJsonGenerator(out);
    try {
        JsonIOUtil.writeTo(generator, message, schema, numeric);
    } finally {
        generator.close();
    }
}

From source file:io.protostuff.SmileIOUtil.java

/**
 * Serializes the {@code messages} into the stream using the given schema.
 * <p>//www  .  j av a  2s . co m
 * The {@link LinkedBuffer}'s internal byte array will be used as the primary buffer when writing the message.
 */
public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema, boolean numeric,
        LinkedBuffer buffer) throws IOException {
    final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), out, false);

    final SmileGenerator generator = newSmileGenerator(out, buffer.buffer, 0, false, context);

    // final SmileGenerator generator = DEFAULT_SMILE_FACTORY.createJsonGenerator(out);
    try {
        JsonIOUtil.writeListTo(generator, messages, schema, numeric);
    } finally {
        generator.close();
    }
}

From source file:io.protostuff.SmileIOUtil.java

/**
 * Serializes the {@code message} into an {@link OutputStream} using the given {@code schema}.
 *//*from  w  w w.  j av  a  2  s  .  co  m*/
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema, boolean numeric)
        throws IOException {
    final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), out, false);

    final SmileGenerator generator = newSmileGenerator(out, context.allocWriteEncodingBuffer(), 0, true,
            context);

    // final SmileGenerator generator = DEFAULT_SMILE_FACTORY.createJsonGenerator(out);

    try {
        JsonIOUtil.writeTo(generator, message, schema, numeric);
    } finally {
        generator.close();
    }
}

From source file:io.protostuff.SmileIOUtil.java

/**
 * Serializes the {@code messages} into the stream using the given schema.
 *///  www .  j a v  a 2s.c o  m
public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema, boolean numeric)
        throws IOException {
    final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), out, false);

    final SmileGenerator generator = newSmileGenerator(out, context.allocWriteEncodingBuffer(), 0, true,
            context);

    // final SmileGenerator generator = DEFAULT_SMILE_FACTORY.createJsonGenerator(out);
    try {
        JsonIOUtil.writeListTo(generator, messages, schema, numeric);
    } finally {
        generator.close();
    }
}