Package com.alibaba.fastjson.parser

Examples of com.alibaba.fastjson.parser.JSONScanner


        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
   
    public void test_next_5() throws Exception {
        String text = " \n\r\t\f\b 1";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.LITERAL_INT, lexer.token());
    }
View Full Code Here


        Assert.assertEquals(JSONToken.LITERAL_INT, lexer.token());
    }
   
    public void test_next_6() throws Exception {
        String text = "";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.EOF);
        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
View Full Code Here

        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
   
    public void test_next_7() throws Exception {
        String text = "{";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.EOF);
        Assert.assertEquals(JSONToken.LBRACE, lexer.token());
    }
View Full Code Here

        Assert.assertEquals(JSONToken.LBRACE, lexer.token());
    }
   
    public void test_next_8() throws Exception {
        String text = "\n\r\t\f\b :{";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextTokenWithColon(JSONToken.LBRACE);
        Assert.assertEquals(JSONToken.LBRACE, lexer.token());
    }
View Full Code Here

        Assert.assertEquals(JSONToken.LBRACE, lexer.token());
    }
   
    public void test_next_9() throws Exception {
        String text = "\n\r\t\f\b :[";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextTokenWithColon(JSONToken.LBRACE);
        Assert.assertEquals(JSONToken.LBRACKET, lexer.token());
    }
View Full Code Here

        Assert.assertEquals(JSONToken.LBRACKET, lexer.token());
    }
   
    public void test_next_10() throws Exception {
        String text = "\n\r\t\f\b :";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextTokenWithColon(JSONToken.LBRACE);
        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
View Full Code Here

        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
   
    public void test_next_11() throws Exception {
        String text = "\n\r\t\f\b :{";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextTokenWithColon(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.LBRACE, lexer.token());
    }
View Full Code Here

        Assert.assertEquals(JSONToken.LBRACE, lexer.token());
    }
   
    public void test_next_12() throws Exception {
        String text = "\n\r\t\f\b :";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextTokenWithColon(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
View Full Code Here

        lexer.nextTokenWithColon(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
    public void test_next_13() throws Exception {
        String text = "\n\r\t\f\b :\n\r\t\f\b ";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextTokenWithColon(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
View Full Code Here

    public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
        // "size":58982400,"format":"video/mpg4","uri":"http://javaone.com/keynote.mpg","title":"Javaone Keynote","width":640,"height":480,
        // "duration":18000000,"bitrate":262144,"persons":["Bill Gates","Steve Jobs"],"player":"JAVA"
       
        final JSONScanner lexer = (JSONScanner) parser.getLexer();

        String uri;
        String title; // Can be unset.
        int width;
        int height;
        String format;
        long duration;
        long size;
        int bitrate; // Can be unset.
        List<String> persons;
        Player player;
        String copyright; // Can be unset.
       
        int mark = lexer.getBufferPosition();
        char mark_ch = lexer.getCurrent();
        int mark_token = lexer.token();
       
        {
            size = lexer.scanFieldLong(size_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                lexer.reset(mark, mark_ch, mark_token);
                throw new UnsupportedOperationException();
            }
        }
        {
            format = lexer.scanFieldString(format_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                throw new UnsupportedOperationException();
            }
        }
        {
            uri = lexer.scanFieldString(uri_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                throw new UnsupportedOperationException();
            }
        }
        {
            title = lexer.scanFieldString(title_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                throw new UnsupportedOperationException();
            }
        }
        {
            width = lexer.scanFieldInt(width_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                throw new UnsupportedOperationException();
            }
        }
        {
            height = lexer.scanFieldInt(height_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                throw new UnsupportedOperationException();
            }
        }
        {
            duration = lexer.scanFieldLong(duration_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                throw new UnsupportedOperationException();
            }
        }
        {
            bitrate = lexer.scanFieldInt(bitrate_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                throw new UnsupportedOperationException();
            }
        }
        {
            persons = lexer.scanFieldStringArray(persons_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                throw new UnsupportedOperationException();
            }
        }
        {
            String value = lexer.scanFieldString(player_);
            if (lexer.matchStat == JSONScanner.NOT_MATCH) {
                throw new UnsupportedOperationException();
            }
            player = Player.valueOf(value);
        }
View Full Code Here

TOP

Related Classes of com.alibaba.fastjson.parser.JSONScanner

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.