本文整理了Java中javax.json.Json.createReaderFactory()
方法的一些代码示例,展示了Json.createReaderFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.createReaderFactory()
方法的具体详情如下:
包路径:javax.json.Json
类名称:Json
方法名:createReaderFactory
[英]Creates a reader factory for creating JsonReader objects. The factory is configured with the specified map of provider specific configuration properties. Provider implementations should ignore any unsupported configuration properties specified in the map.
[中]创建用于创建JsonReader对象的读取器工厂。工厂使用特定于提供程序的配置属性的指定映射进行配置。提供程序实现应忽略映射中指定的任何不受支持的配置属性。
代码示例来源:origin: oracle/helidon
private static JsonReaderFactory readerFactory(Map<String, ?> jsonPConfig) {
return Json.createReaderFactory(jsonPConfig);
}
代码示例来源:origin: io.helidon.media.jsonp/helidon-media-jsonp-common
private static JsonReaderFactory readerFactory(Map<String, ?> jsonPConfig) {
return Json.createReaderFactory(jsonPConfig);
}
代码示例来源:origin: org.apache.johnzon/johnzon-jaxrs
public JsrMessageBodyReader() {
this(Json.createReaderFactory(Collections.<String, Object>emptyMap()), false);
}
代码示例来源:origin: org.apache.johnzon/johnzon-websocket
private static JsonReaderFactory newReadFactory() {
return Json.createReaderFactory(Collections.<String, Object>emptyMap());
}
代码示例来源:origin: apache/johnzon
public JsrMessageBodyReader() {
this(Json.createReaderFactory(Collections.<String, Object>emptyMap()), false);
}
代码示例来源:origin: apache/johnzon
private static JsonReaderFactory newReadFactory() {
return Json.createReaderFactory(Collections.<String, Object>emptyMap());
}
代码示例来源:origin: com.tradeshift.sdk/tradeshift-sdk-core
public MultiTypeResponseErrorReader() {
jsonParserFactory = Json.createReaderFactory(Collections.emptyMap());
xmlInputFactory = XMLInputFactory.newInstance();
}
代码示例来源:origin: dsukhoroslov/bagri
@Override
public void init(Properties properties) {
// process/convert any specific properties here
Map<String, Object> params = new HashMap<>();
for (Map.Entry prop: properties.entrySet()) {
//String name = (String) prop.getKey();
params.put((String) prop.getKey(), prop.getValue());
}
factory = Json.createReaderFactory(params);
}
代码示例来源:origin: net.shibboleth.idp/idp-consent
/** Constructor. */
public CollectionSerializer() {
generatorFactory = Json.createGeneratorFactory(null);
readerFactory = Json.createReaderFactory(null);
}
代码示例来源:origin: org.apache.sling/org.apache.sling.jcr.contentparser
public JsonContentParser(ParserOptions options) {
this.helper = new ParserHelper(options);
Map<String,Object> jsonReaderFactoryConfig = new HashMap<>();
// allow comments in JSON files?
if (options.getJsonParserFeatures().contains(JsonParserFeature.COMMENTS)) {
jsonReaderFactoryConfig.put("org.apache.johnzon.supports-comments", true);
}
jsonQuoteTickets = options.getJsonParserFeatures().contains(JsonParserFeature.QUOTE_TICK);
jsonReaderFactory = Json.createReaderFactory(jsonReaderFactoryConfig);
}
代码示例来源:origin: net.shibboleth.idp/idp-consent
/** Constructor. */
public ConsentSerializer() {
generatorFactory = Json.createGeneratorFactory(null);
readerFactory = Json.createReaderFactory(null);
symbolics = ImmutableBiMap.of();
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-extras
/**
* Creates a new instance using the provided configuration.
*
* @param config A map of provider-specific configuration properties. May be empty or {@code
* null}.
*/
public Jsr353JsonCodec(Map<String, ?> config) {
super(DataType.varchar(), JsonStructure.class);
readerFactory = Json.createReaderFactory(config);
writerFactory = Json.createWriterFactory(config);
}
代码示例来源:origin: eclipse/microprofile-conference
private final List<Speaker> parseSpeaker(URL speakerResource) {
try {
final JsonReaderFactory factory = Json.createReaderFactory(null);
final JsonReader reader = factory.createReader(speakerResource.openStream());
final JsonArray items = reader.readArray();
// parse session objects
final List<Speaker> speaker = new LinkedList<>();
for (final JsonValue item : items) {
final Speaker s = new Speaker((JsonObject) item);
s.setId(String.valueOf(this.speakerId.incrementAndGet()));
speaker.add(s);
}
return speaker;
} catch (Exception e) {
throw new RuntimeException("Failed to parse speaker.json");
}
}
}
代码示例来源:origin: net.shibboleth.idp/idp-authn-impl
/** Constructor. */
public DefaultAuthenticationResultSerializer() {
generatorFactory = Json.createGeneratorFactory(null);
readerFactory = Json.createReaderFactory(null);
principalSerializers = Collections.emptyList();
authnResultPrincipalSerializer = new AuthenticationResultPrincipalSerializer(this);
genericSerializer = new GenericPrincipalSerializer();
}
代码示例来源:origin: org.apache.sling/org.apache.sling.jcr.contentloader
@Override
public void parse(InputStream ins, ContentCreator contentCreator) throws IOException, RepositoryException {
try {
String jsonString = toString(ins).trim();
if (!jsonString.startsWith("{")) {
jsonString = "{" + jsonString + "}";
}
Map<String, Object> config = new HashMap<>();
config.put("org.apache.johnzon.supports-comments", true);
JsonObject json = Json.createReaderFactory(config).createReader(new StringReader(tickToDoubleQuote(jsonString))).readObject();
this.createNode(null, json, contentCreator);
} catch (JsonException je) {
throw (IOException) new IOException(je.getMessage()).initCause(je);
}
}
代码示例来源:origin: apache/johnzon
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
final JsonReaderFactory readerFactory = Json.createReaderFactory(Collections.<String, Object>emptyMap());
if (source.isFile()) {
generateFile(readerFactory, source);
} else {
final File[] children = source.listFiles(new FilenameFilter() {
@Override
public boolean accept(final File dir, final String name) {
return name.endsWith(".json");
}
});
if (children == null || children.length == 0) {
throw new MojoExecutionException("No json file found in " + source);
}
for (final File child : children) {
generateFile(readerFactory, child);
}
}
if (attach && project != null) {
project.addCompileSourceRoot(target.getAbsolutePath());
}
}
代码示例来源:origin: eclipse/microprofile-conference
public BootstrapData parse(final URL scheduleResource, final URL speakerResource) {
try {
final JsonReaderFactory factory = Json.createReaderFactory(null);
final JsonReader reader = factory.createReader(scheduleResource.openStream());
代码示例来源:origin: uk.ac.ncl.intbio/sbol-data-examples
private static DocumentRoot<QName> read(Reader stream) throws Exception
{
JsonReader reader = Json.createReaderFactory(Collections.<String, Object> emptyMap()).createReader(stream);
JsonIo jsonIo = new JsonIo();
IoReader<String> ioReader = jsonIo.createIoReader(reader.read());
DocumentRoot<String> root = ioReader.read();
return StringifyQName.string2qname.mapDR(root);
}
}
代码示例来源:origin: SynBioDex/libSBOLj
/**
* @param stream
* @return
* @throws SBOLValidationException if the following SBOL validation rule was violated: 10105.
*/
private static DocumentRoot<QName> readJSON(Reader stream) throws SBOLValidationException
{
JsonReader reader = Json.createReaderFactory(Collections.<String, Object> emptyMap()).createReader(stream);
JsonIo jsonIo = new JsonIo();
IoReader<String> ioReader = jsonIo.createIoReader(reader.read());
DocumentRoot<String> root;
try {
root = ioReader.read();
}
catch (CoreIoException e) {
throw new SBOLValidationException("sbol-10105",e);
}
return StringifyQName.string2qname.mapDR(root);
}
代码示例来源:origin: org.sbolstandard/libSBOLj
/**
* @param stream
* @return
* @throws SBOLValidationException if the following SBOL validation rule was violated: 10105.
*/
private static DocumentRoot<QName> readJSON(Reader stream) throws SBOLValidationException
{
JsonReader reader = Json.createReaderFactory(Collections.<String, Object> emptyMap()).createReader(stream);
JsonIo jsonIo = new JsonIo();
IoReader<String> ioReader = jsonIo.createIoReader(reader.read());
DocumentRoot<String> root;
try {
root = ioReader.read();
}
catch (CoreIoException e) {
throw new SBOLValidationException("sbol-10105",e);
}
return StringifyQName.string2qname.mapDR(root);
}
内容来源于网络,如有侵权,请联系作者删除!