Example usage for com.fasterxml.jackson.databind MappingJsonFactory createParser

List of usage examples for com.fasterxml.jackson.databind MappingJsonFactory createParser

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind MappingJsonFactory createParser.

Prototype

@SuppressWarnings("resource")
public JsonParser createParser(File f) throws IOException, JsonParseException 

Source Link

Document

Method for constructing JSON parser instance to parse contents of specified file.

Usage

From source file:org.apache.metamodel.json.JsonDataContext.java

private DocumentSource createDocumentSource() {
    final InputStream inputStream = _resource.read();
    try {//from   w ww. ja  v  a2 s. com
        final MappingJsonFactory jsonFactory = new MappingJsonFactory();
        final JsonParser parser = jsonFactory.createParser(inputStream);
        logger.debug("Created JSON parser for resource: {}", _resource);

        return new JsonDocumentSource(parser, _resource.getName());
    } catch (Exception e) {
        FileHelper.safeClose(inputStream);
        throw new MetaModelException("Unexpected error while creating JSON parser", e);
    }
}

From source file:org.apache.arrow.vector.file.json.JsonFileReader.java

public JsonFileReader(File inputFile, BufferAllocator allocator) throws JsonParseException, IOException {
    super();//from ww w . ja  v a2  s .c  om
    this.inputFile = inputFile;
    this.allocator = allocator;
    MappingJsonFactory jsonFactory = new MappingJsonFactory();
    this.parser = jsonFactory.createParser(inputFile);
}

From source file:org.apache.arrow.vector.ipc.JsonFileReader.java

public JsonFileReader(File inputFile, BufferAllocator allocator) throws JsonParseException, IOException {
    super();//from w  w w .  j  a  v  a 2  s  .c om
    this.allocator = allocator;
    MappingJsonFactory jsonFactory = new MappingJsonFactory();
    this.parser = jsonFactory.createParser(inputFile);
    // Allow reading NaN for floating point values
    this.parser.configure(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS, true);
}