Examples of BytesToNameCanonicalizer


Examples of com.fasterxml.jackson.core.sym.BytesToNameCanonicalizer

        if (enc == JsonEncoding.UTF8) {
            /* and without canonicalization, byte-based approach is not performance; just use std UTF-8 reader
             * (which is ok for larger input; not so hot for smaller; but this is not a common case)
             */
            if (canonicalize) {
                BytesToNameCanonicalizer can = rootByteSymbols.makeChild(canonicalize, intern);
                return new UTF8StreamJsonParser(_context, parserFeatures, _in, codec, can, _inputBuffer, _inputPtr, _inputEnd, _bufferRecyclable);
            }
        }
        return new ReaderBasedJsonParser(_context, parserFeatures, constructReader(), codec,
                rootCharSymbols.makeChild(canonicalize, intern));
View Full Code Here

Examples of com.fasterxml.jackson.core.sym.BytesToNameCanonicalizer

        if (enc == JsonEncoding.UTF8) {
            /* and without canonicalization, byte-based approach is not performance; just use std UTF-8 reader
             * (which is ok for larger input; not so hot for smaller; but this is not a common case)
             */
            if (canonicalize) {
                BytesToNameCanonicalizer can = rootByteSymbols.makeChild(canonicalize, intern);
                return new UTF8StreamJsonParser(_context, parserFeatures, _in, codec, can, _inputBuffer, _inputPtr, _inputEnd, _bufferRecyclable);
            }
        }
        return new ReaderBasedJsonParser(_context, parserFeatures, constructReader(), codec,
                rootCharSymbols.makeChild(canonicalize, intern));
View Full Code Here

Examples of com.fasterxml.jackson.core.sym.BytesToNameCanonicalizer

        if (enc == JsonEncoding.UTF8) {
            /* and without canonicalization, byte-based approach is not performance; just use std UTF-8 reader
             * (which is ok for larger input; not so hot for smaller; but this is not a common case)
             */
            if (canonicalize) {
                BytesToNameCanonicalizer can = rootByteSymbols.makeChild(canonicalize, intern);
                return new UTF8StreamJsonParser(_context, parserFeatures, _in, codec, can,
                        _inputBuffer, _inputPtr, _inputEnd, _bufferRecyclable);
            }
        }
        return new ReaderBasedJsonParser(_context, parserFeatures, constructReader(), codec,
View Full Code Here

Examples of com.fasterxml.jackson.core.sym.BytesToNameCanonicalizer

            ObjectCodec codec, BytesToNameCanonicalizer rootByteSymbols)
        throws IOException, JsonParseException
    {
        // Replace with non-deprecated method in 2.5; leave this for 2.4 for improved
        // backwards compatibility
        BytesToNameCanonicalizer can = rootByteSymbols.makeChild(true, internNames);
        // We just need a single byte to recognize possible "empty" document.
        ensureLoaded(1);
        CBORParser p = new CBORParser(_context, generalParserFeatures, formatFeatures,
                codec, can,
                _in, _inputBuffer, _inputPtr, _inputEnd, _bufferRecyclable);
View Full Code Here

Examples of com.fasterxml.jackson.core.sym.BytesToNameCanonicalizer

    public CBORParser constructParser(int generalParserFeatures, int formatFeatures,
            boolean internNames,
            ObjectCodec codec, BytesToNameCanonicalizer rootByteSymbols)
        throws IOException, JsonParseException
    {
        BytesToNameCanonicalizer can = rootByteSymbols.makeChild(true, internNames);
        // We just need a single byte to recognize possible "empty" document.
        ensureLoaded(1);
        CBORParser p = new CBORParser(_context, generalParserFeatures, formatFeatures,
                codec, can,
                _in, _inputBuffer, _inputPtr, _inputEnd, _bufferRecyclable);
View Full Code Here

Examples of com.fasterxml.jackson.core.sym.BytesToNameCanonicalizer

    public SmileParser constructParser(int generalParserFeatures, int smileFeatures,
            boolean internNames,
            ObjectCodec codec, BytesToNameCanonicalizer rootByteSymbols)
        throws IOException, JsonParseException
    {
        BytesToNameCanonicalizer can = rootByteSymbols.makeChild(true, internNames);
      // We just need a single byte, really, to know if it starts with header
      ensureLoaded(1);
        SmileParser p =  new SmileParser(_context, generalParserFeatures, smileFeatures,
            codec, can,
            _in, _inputBuffer, _inputPtr, _inputEnd, _bufferRecyclable);
View Full Code Here

Examples of org.codehaus.jackson.sym.BytesToNameCanonicalizer

        if (enc == JsonEncoding.UTF8) {
            /* and without canonicalization, byte-based approach is not performance; just use std UTF-8 reader
             * (which is ok for larger input; not so hot for smaller; but this is not a common case)
             */
            if (canonicalize) {
                BytesToNameCanonicalizer can = rootByteSymbols.makeChild(canonicalize, intern);
                return new Utf8StreamParser(_context, features, _in, codec, can, _inputBuffer, _inputPtr, _inputEnd, _bufferRecyclable);
            }
        }
        return new ReaderBasedParser(_context, features, constructReader(), codec, rootCharSymbols.makeChild(canonicalize, intern));
    }
View Full Code Here

Examples of org.codehaus.jackson.sym.BytesToNameCanonicalizer

        throws Exception
    {
        final int A_BYTES = 0x41414141; // "AAAA"
        final int B_BYTES = 0x42424242; // "BBBB"

        BytesToNameCanonicalizer nc = BytesToNameCanonicalizer.createRoot();
        assertNull(nc.findName(A_BYTES));
        assertNull(nc.findName(A_BYTES, B_BYTES));

        nc.addName("AAAA", new int[] { A_BYTES }, 1);
        Name n1 = nc.findName(A_BYTES);
        assertNotNull(n1);
        assertEquals("AAAA", n1.getName());
        nc.addName("AAAABBBB", new int[] { A_BYTES, B_BYTES }, 2);
        Name n2 = nc.findName(A_BYTES, B_BYTES);
        assertEquals("AAAABBBB", n2.getName());
        assertNotNull(n2);

        /* and let's then just exercise this method so it gets covered;
         * it's only used for debugging.
         */
        assertNotNull(nc.toString());
    }
View Full Code Here

Examples of org.codehaus.jackson.sym.BytesToNameCanonicalizer

        throws Exception
    {
        final int A_BYTES = 0x41414141; // "AAAA"
        final int B_BYTES = 0x42424242; // "BBBB"

        BytesToNameCanonicalizer nc = BytesToNameCanonicalizer.createRoot()
                .makeChild(true, true);
        assertNull(nc.findName(A_BYTES));
        assertNull(nc.findName(A_BYTES, B_BYTES));

        nc.addName("AAAA", new int[] { A_BYTES }, 1);
        Name n1 = nc.findName(A_BYTES);
        assertNotNull(n1);
        assertEquals("AAAA", n1.getName());
        nc.addName("AAAABBBB", new int[] { A_BYTES, B_BYTES }, 2);
        Name n2 = nc.findName(A_BYTES, B_BYTES);
        assertEquals("AAAABBBB", n2.getName());
        assertNotNull(n2);

        /* and let's then just exercise this method so it gets covered;
         * it's only used for debugging.
         */
        assertNotNull(nc.toString());
    }
View Full Code Here

Examples of org.codehaus.jackson.sym.BytesToNameCanonicalizer

        final String STR1 = "a";
   
      byte[] data = _smileDoc("{ "+quote(STR1)+":1, \"foobar\":2, \"longername\":3 }");
      SmileFactory f = new SmileFactory();
      SmileParser p = _smileParser(f, data);
      final BytesToNameCanonicalizer symbols1 = p._symbols;
      assertEquals(0, symbols1.size());
     
      assertEquals(JsonToken.START_OBJECT, p.nextToken());
      assertEquals(JsonToken.FIELD_NAME, p.nextToken());
      // field names are interned:
      assertSame(STR1, p.getCurrentName());
      assertEquals(1, symbols1.size());
      assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken());
      assertEquals(JsonToken.FIELD_NAME, p.nextToken());
      assertSame("foobar", p.getCurrentName());
      assertEquals(2, symbols1.size());
      assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken());
      assertEquals(JsonToken.FIELD_NAME, p.nextToken());
      assertSame("longername", p.getCurrentName());
      assertEquals(3, symbols1.size());
      assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken());
      assertEquals(JsonToken.END_OBJECT, p.nextToken());
      assertNull(p.nextToken());
      assertEquals(3, symbols1.size());
        p.close();

        // but let's verify that symbol table gets reused properly
      p = _smileParser(f, data);
      BytesToNameCanonicalizer symbols2 = p._symbols;
      // symbol tables are not reused, but contents are:
      assertNotSame(symbols1, symbols2);
      assertEquals(3, symbols2.size());

      assertEquals(JsonToken.START_OBJECT, p.nextToken());
      assertEquals(JsonToken.FIELD_NAME, p.nextToken());
      // field names are interned:
      assertSame(STR1, p.getCurrentName());
      assertEquals(3, symbols2.size());
      assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken());
      assertEquals(JsonToken.FIELD_NAME, p.nextToken());
      assertSame("foobar", p.getCurrentName());
      assertEquals(3, symbols2.size());
      assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken());
      assertEquals(JsonToken.FIELD_NAME, p.nextToken());
      assertSame("longername", p.getCurrentName());
      assertEquals(3, symbols2.size());
      assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken());
      assertEquals(JsonToken.END_OBJECT, p.nextToken());
      assertNull(p.nextToken());
      assertEquals(3, symbols2.size());
        p.close();

        assertEquals(3, symbols2.size());
      p.close();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.