com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer Java Examples

The following examples show how to use com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UTF8StreamJsonParser.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public UTF8StreamJsonParser(IOContext ctxt, int features, InputStream in,
        ObjectCodec codec, ByteQuadsCanonicalizer sym,
        byte[] inputBuffer, int start, int end,
        boolean bufferRecyclable)
{
    super(ctxt, features);
    _inputStream = in;
    _objectCodec = codec;
    _symbols = sym;
    _inputBuffer = inputBuffer;
    _inputPtr = start;
    _inputEnd = end;
    _currInputRowStart = start;
    // If we have offset, need to omit that from byte offset, so:
    _currInputProcessed = -start;
    _bufferRecyclable = bufferRecyclable;
}
 
Example #2
Source File: ByteSourceJsonBootstrapper.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public JsonParser constructParser(int parserFeatures, ObjectCodec codec,
        ByteQuadsCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols,
        int factoryFeatures) throws IOException
{
    JsonEncoding enc = detectEncoding();

    if (enc == JsonEncoding.UTF8) {
        /* and without canonicalization, byte-based approach is not performant; 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 (JsonFactory.Feature.CANONICALIZE_FIELD_NAMES.enabledIn(factoryFeatures)) {
            ByteQuadsCanonicalizer can = rootByteSymbols.makeChild(factoryFeatures);
            return new UTF8StreamJsonParser(_context, parserFeatures, _in, codec, can,
                    _inputBuffer, _inputPtr, _inputEnd, _bufferRecyclable);
        }
    }
    return new ReaderBasedJsonParser(_context, parserFeatures, constructReader(), codec,
            rootCharSymbols.makeChild(factoryFeatures));
}
 
Example #3
Source File: UTF8StreamJsonParser.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public UTF8StreamJsonParser(IOContext ctxt, int features, InputStream in,
        ObjectCodec codec, ByteQuadsCanonicalizer sym,
        byte[] inputBuffer, int start, int end,
        boolean bufferRecyclable)
{
    super(ctxt, features);
    _inputStream = in;
    _objectCodec = codec;
    _symbols = sym;
    _inputBuffer = inputBuffer;
    _inputPtr = start;
    _inputEnd = end;
    _currInputRowStart = start;
    // If we have offset, need to omit that from byte offset, so:
    _currInputProcessed = -start;
    _bufferRecyclable = bufferRecyclable;
}
 
Example #4
Source File: ByteSourceJsonBootstrapper.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public JsonParser constructParser(int parserFeatures, ObjectCodec codec,
        ByteQuadsCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols,
        int factoryFeatures) throws IOException
{
    JsonEncoding enc = detectEncoding();

    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 (JsonFactory.Feature.CANONICALIZE_FIELD_NAMES.enabledIn(factoryFeatures)) {
            ByteQuadsCanonicalizer can = rootByteSymbols.makeChild(factoryFeatures);
            return new UTF8StreamJsonParser(_context, parserFeatures, _in, codec, can,
                    _inputBuffer, _inputPtr, _inputEnd, _bufferRecyclable);
        }
    }
    return new ReaderBasedJsonParser(_context, parserFeatures, constructReader(), codec,
            rootCharSymbols.makeChild(factoryFeatures));
}
 
Example #5
Source File: UTF8DataInputJsonParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public UTF8DataInputJsonParser(IOContext ctxt, int features, DataInput inputData,
        ObjectCodec codec, ByteQuadsCanonicalizer sym,
        int firstByte)
{
    super(ctxt, features);
    _objectCodec = codec;
    _symbols = sym;
    _inputData = inputData;
    _nextByte = firstByte;
}
 
Example #6
Source File: NonBlockingJsonParserBase.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public NonBlockingJsonParserBase(IOContext ctxt, int parserFeatures,
        ByteQuadsCanonicalizer sym)
{
    super(ctxt, parserFeatures);
    _symbols = sym;
    _currToken = null;
    _majorState = MAJOR_INITIAL;
    _majorStateAfterValue = MAJOR_ROOT;
}
 
Example #7
Source File: JsonFactory.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Optional factory method, expected to be overridden
 *
 * @since 2.8
 */
protected JsonParser _createParser(DataInput input, IOContext ctxt) throws IOException
{
    // 13-May-2016, tatu: Need to take care not to accidentally create JSON parser for
    //   non-JSON input.
    _requireJSONFactory("InputData source not (yet?) support for this format (%s)");
    // Also: while we can't do full bootstrapping (due to read-ahead limitations), should
    // at least handle possible UTF-8 BOM
    int firstByte = ByteSourceJsonBootstrapper.skipUTF8BOM(input);
    ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChild(_factoryFeatures);
    return new UTF8DataInputJsonParser(ctxt, _parserFeatures, input,
            _objectCodec, can, firstByte);
}
 
Example #8
Source File: NonBlockingJsonParser.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public NonBlockingJsonParser(IOContext ctxt, int parserFeatures,
        ByteQuadsCanonicalizer sym)
{
    super(ctxt, parserFeatures, sym);
}
 
Example #9
Source File: NonBlockingJsonParserBase.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
protected ByteQuadsCanonicalizer symbolTableForTests() {
    return _symbols;
}
 
Example #10
Source File: JsonIOUtils.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
/**
 * Needed by jackson's internal utf8 stream parser.
 */
public ByteQuadsCanonicalizer getRootByteSymbols() {
  return _byteSymbolCanonicalizer;
}
 
Example #11
Source File: SmileIOUtil.java    From protostuff with Apache License 2.0 4 votes vote down vote up
/**
 * Needed by jackson's internal utf8 stream parser.
 */
public ByteQuadsCanonicalizer getRootByteSymbols()
{
    return _byteSymbolCanonicalizer;
}
 
Example #12
Source File: JsonIOUtil.java    From protostuff with Apache License 2.0 4 votes vote down vote up
/**
 * Needed by jackson's internal utf8 strema parser.
 */
public ByteQuadsCanonicalizer getRootByteSymbols()
{
    return _byteSymbolCanonicalizer;
}
 
Example #13
Source File: JsonFactory.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Optional method for constructing parser for non-blocking parsing
 * via {@link com.fasterxml.jackson.core.async.ByteArrayFeeder}
 * interface (accessed using {@link JsonParser#getNonBlockingInputFeeder()}
 * from constructed instance).
 *<p>
 * If this factory does not support non-blocking parsing (either at all,
 * or from byte array),
 * will throw {@link UnsupportedOperationException}
 *
 * @since 2.9
 */
public JsonParser createNonBlockingByteArrayParser() throws IOException
{
    // 17-May-2017, tatu: Need to take care not to accidentally create JSON parser
    //   for non-JSON input:
    _requireJSONFactory("Non-blocking source not (yet?) support for this format (%s)");
    IOContext ctxt = _createContext(null, false);
    ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChild(_factoryFeatures);
    return new NonBlockingJsonParser(ctxt, _parserFeatures, can);
}