Example usage for com.fasterxml.jackson.core JsonGenerator flush

List of usage examples for com.fasterxml.jackson.core JsonGenerator flush

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core JsonGenerator flush.

Prototype

@Override
public abstract void flush() throws IOException;

Source Link

Document

Method called to flush any buffered content to the underlying target (output stream, writer), and to flush the target itself as well.

Usage

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testSafeUInt64Encode10() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.UINT64_SAFE.writeValue(10L, g);
    g.flush();
    assertEquals("10", out.toString());
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testFloat32EncodeNaN() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.FLOAT32.writeValue(Float.NaN, g);
    g.flush();
    assertEquals("\"NaN\"", out.toString());
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testFloat64EncodeNaN() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.FLOAT64.writeValue(Double.NaN, g);
    g.flush();
    assertEquals("\"NaN\"", out.toString());
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testInt64EncodeMinValue() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.INT64.writeValue(Long.MIN_VALUE, g);
    g.flush();
    assertEquals("-9223372036854775808", out.toString());
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testInt64EncodeMaxLong() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.INT64.writeValue(Long.MAX_VALUE, g);
    g.flush();
    assertEquals("9223372036854775807", out.toString());
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testUInt64EncodeMaxLong() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.UINT64.writeValue(Long.MAX_VALUE, g);
    g.flush();
    assertEquals("9223372036854775807", out.toString());
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testSafeInt64EncodeMinValue() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.INT64_SAFE.writeValue(Long.MIN_VALUE, g);
    g.flush();
    assertEquals("\"-9223372036854775808\"", out.toString());
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testSafeInt64EncodeMaxLong() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.INT64_SAFE.writeValue(Long.MAX_VALUE, g);
    g.flush();
    assertEquals("\"9223372036854775807\"", out.toString());
}

From source file:com.yahoo.yqlplus.engine.tools.YQLPlusRun.java

@Subscribe
public void event(Object event) throws IOException {
    JsonGenerator gen = factory.createGenerator(System.err);
    gen.writeStartObject();// w w w  .j  ava  2 s. c  om
    gen.writeStringField("type", event.getClass().getName());
    gen.writeFieldName("event");
    gen.writeObject(event);
    gen.writeEndObject();
    gen.flush();
    System.err.println();
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testSafeUInt64EncodeMaxLong() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.UINT64_SAFE.writeValue(Long.MAX_VALUE, g);
    g.flush();
    assertEquals("\"9223372036854775807\"", out.toString());
}