All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jsoniter.fuzzy.MaybeStringShortDecoder Maven / Gradle / Ivy

Go to download

jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go

There is a newer version: 0.9.23
Show newest version
package com.jsoniter.fuzzy;

import com.jsoniter.CodegenAccess;
import com.jsoniter.JsonIterator;
import com.jsoniter.spi.Decoder;

import java.io.IOException;

public class MaybeStringShortDecoder extends Decoder.ShortDecoder {

    @Override
    public short decodeShort(JsonIterator iter) throws IOException {
        byte c = CodegenAccess.nextToken(iter);
        if (c != '"') {
            CodegenAccess.unreadByte(iter);
            return iter.readShort();
        }
        short val = iter.readShort();
        c = CodegenAccess.nextToken(iter);
        if (c != '"') {
            throw iter.reportError("StringShortDecoder", "expect \", but found: " + (char) c);
        }
        return val;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy