Package org.codehaus.jackson.io

Examples of org.codehaus.jackson.io.IOContext


    request.getResponseContent().write(ByteBuffer.wrap(dataBytes));
  }

  protected JsonGenerator createJsonGenerator(ObjectCodec codec, Writer writer, boolean prettyPrint)
  {
    IOContext ioCtx = new IOContext(new BufferRecycler(), null, true);
    WriterBasedGenerator result = new WriterBasedGenerator(ioCtx, 0, codec, writer);
    result.configure(Feature.QUOTE_FIELD_NAMES, true);
    if (prettyPrint) result.useDefaultPrettyPrinter();

    return result;
View Full Code Here


    extends BaseTest
{
    public void testUtf8Issue462() throws Exception
    {
        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
        IOContext ioc = new IOContext(new BufferRecycler(), bytes, true);
        JsonGenerator gen = new Utf8Generator(ioc, 0, null, bytes);
        String str = "Natuurlijk is alles gelukt en weer een tevreden klant\uD83D\uDE04";
        int length = 4000 - 38;

        for (int i = 1; i <= length; ++i) {
View Full Code Here

        //assertEquals(0, v.getPatchLevel());
    }

    private IOContext getIOContext() {
        return new IOContext(new BufferRecycler(), null, false);
    }
View Full Code Here

     * Creates a smile pipe from a byte array.
     */
    public static Pipe newPipe(byte[] data, int offset, int length, 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);
       
        return JsonIOUtil.newPipe(parser, numeric);
View Full Code Here

    /**
     * Creates a smile pipe from an {@link InputStream}.
     */
    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);
    }
View Full Code Here

     */
    public static SmileParser newSmileParser(InputStream in, byte[] buf,
            int offset, int limit) throws IOException
    {
        return newSmileParser(in, buf, offset, limit, false,
                new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), in,
                        false));
    }
View Full Code Here

     * Creates a {@link SmileGenerator} for the outputstream with the supplied buf
     * {@code outBuffer} to use.
     */
    public static SmileGenerator newSmileGenerator(OutputStream out, byte[] buf)
    {
        return newSmileGenerator(out, buf, 0, false, new IOContext(
                DEFAULT_SMILE_FACTORY._getBufferRecycler(), out, false));
    }
View Full Code Here

     * Merges the {@code message} with the byte array using the given {@code schema}.
     */
    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);
View Full Code Here

     * given {@code schema}.
     */
    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
        {
View Full Code Here

     * 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);
       
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.io.IOContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.