use of com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer in project jackson-core by FasterXML.
the class JsonFactory method _createParser.
@Override
protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, DataInput input) throws IOException {
// 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(readCtxt, ioCtxt, readCtxt.getParserFeatures(_parserFeatures), input, can, firstByte);
}
use of com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer in project jackson-core by FasterXML.
the class JsonFactory method createNonBlockingByteArrayParser.
/*
/**********************************************************************
/* Parser factories, non-blocking (async) sources
/**********************************************************************
*/
@Override
public JsonParser createNonBlockingByteArrayParser(ObjectReadContext readCtxt) throws IOException {
IOContext ioCtxt = _createContext(null, false);
ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChild(_factoryFeatures);
return new NonBlockingJsonParser(readCtxt, ioCtxt, readCtxt.getParserFeatures(_parserFeatures), can);
}
use of com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer in project jackson-core by FasterXML.
the class UTF8DataInputJsonParserTest method test_handleAposThrowsIOException.
@Test
public void test_handleAposThrowsIOException() {
IOContext ioContext = new IOContext(new BufferRecycler(), this, false);
byte[] byteArray = new byte[7];
byteArray[0] = (byte) (-80);
InputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
ByteQuadsCanonicalizer byteQuadsCanonicalizer = ByteQuadsCanonicalizer.createRoot();
UTF8DataInputJsonParser uTF8DataInputJsonParser = new UTF8DataInputJsonParser(ObjectReadContext.empty(), ioContext, 3, dataInputStream, byteQuadsCanonicalizer, 1);
try {
uTF8DataInputJsonParser._handleApos();
fail("Expecting exception: IOException");
} catch (IOException e) {
assertEquals(JsonParser.class.getName(), e.getStackTrace()[0].getClassName());
}
}
use of com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer in project jackson-core by FasterXML.
the class UTF8DataInputJsonParserTest method test_parseAposNameThrowsEOFException.
@Test
public void test_parseAposNameThrowsEOFException() throws IOException {
IOContext ioContext = new IOContext(new BufferRecycler(), this, false);
byte[] byteArray = new byte[17];
byteArray[4] = (byte) 43;
InputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
ByteQuadsCanonicalizer byteQuadsCanonicalizer = ByteQuadsCanonicalizer.createRoot();
UTF8DataInputJsonParser uTF8DataInputJsonParser = new UTF8DataInputJsonParser(ObjectReadContext.empty(), ioContext, 42, dataInputStream, byteQuadsCanonicalizer, 0);
try {
uTF8DataInputJsonParser._parseAposName();
fail("Expecting exception: EOFException");
} catch (EOFException e) {
assertEquals(DataInputStream.class.getName(), e.getStackTrace()[0].getClassName());
}
}
use of com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer in project jackson-core by FasterXML.
the class UTF8DataInputJsonParserTest method test_parsePosNumber.
@Test
public void test_parsePosNumber() throws IOException {
byte[] byteArray = new byte[2];
byteArray[0] = (byte) 51;
byteArray[1] = (byte) 22;
IOContext ioContext = new IOContext(new BufferRecycler(), byteArray, false);
InputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
ByteQuadsCanonicalizer byteQuadsCanonicalizer = ByteQuadsCanonicalizer.createRoot();
DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
UTF8DataInputJsonParser uTF8DataInputJsonParser = new UTF8DataInputJsonParser(ObjectReadContext.empty(), ioContext, 1568, dataInputStream, byteQuadsCanonicalizer, 13);
JsonToken jsonToken = uTF8DataInputJsonParser._parsePosNumber(7);
assertEquals(7, jsonToken.id());
assertNull(jsonToken.asString());
}
Aggregations