# Overview
This project contains core low-level incremental ("streaming") parser and generator abstractions used by
[Jackson Data Processor](https://github.com/FasterXML/jackson).
It also includes the default implementation of handler types (parser, generator) that handle JSON format.
The core abstractions are not JSON specific, although naming does contain 'JSON' in many places, due to historical reasons. Only packages that specifically contain word 'json' are JSON-specific.
This package is the base on which [Jackson data-binding](https://github.com/FasterXML/jackson-databind) package builds on.
It is licensed under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
Alternate data format implementations (like
[Smile (binary JSON)](https://github.com/FasterXML/jackson-dataformats-binary/tree/master/smile),
[XML](https://github.com/FasterXML/jackson-dataformat-xml),
[CSV](https://github.com/FasterXML/jackson-dataformats-text/tree/master/csv),
[Protobuf](https://github.com/FasterXML/jackson-dataformats-binary/tree/master/protobuf),
and [CBOR](https://github.com/FasterXML/jackson-dataformats-binary/tree/master/cbor))
also build on this base package, implementing the core interfaces,
making it possible to use standard [data-binding package](https://github.com/FasterXML/jackson-databind) regardless of underlying data format.
Project contains versions 2.0 and above: source code for earlier (1.x) versions can be found from
[Jackson-1](../../../jackson-1) github repo.
## Status
| Type | Status |
| ---- | ------ |
| Build (CI) | [![Build (github)](https://github.com/FasterXML/jackson-core/actions/workflows/main.yml/badge.svg)](https://github.com/FasterXML/jackson-core/actions/workflows/main.yml) |
| Artifact | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.core/jackson-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.core/jackson-core) |
| OSS Sponsorship | [![Tidelift](https://tidelift.com/badges/package/maven/com.fasterxml.jackson.core:jackson-core)](https://tidelift.com/subscription/pkg/maven-com-fasterxml-jackson-core-jackson-core?utm_source=maven-com-fasterxml-jackson-core-jackson-core&utm_medium=referral&utm_campaign=readme) |
| Javadocs | [![Javadoc](https://javadoc.io/badge/com.fasterxml.jackson.core/jackson-core.svg)](https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-core) |
| Code coverage (2.15) | [![codecov.io](https://codecov.io/github/FasterXML/jackson-core/coverage.svg?branch=2.15)](https://codecov.io/github/FasterXML/jackson-core?branch=2.15) |
| CodeQ (ClusterFuzz) | [![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/jackson-core.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:jackson-core) |
| OpenSSF Score | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/FasterXML/jackson-core/badge)](https://securityscorecards.dev/viewer/?uri=github.com/FasterXML/jackson-core) |
# Get it!
## Maven
Functionality of this package is contained in
Java package `com.fasterxml.jackson.core`.
To use the package, you need to use following Maven dependency:
```xml
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version.core}</version>
</dependency>
```
or download jars from Maven repository or links on [Wiki](../../wiki).
Core jar is a functional OSGi bundle, with proper import/export declarations.
Package has no external dependencies, except for testing (which uses `JUnit`).
## Non-Maven
For non-Maven use cases, you download jars from [Central Maven repository](https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/).
Core jar is also a functional OSGi bundle, with proper import/export declarations, so it can be use on OSGi container as is.
Jackson 2.10 and above include `module-info.class` definitions so the jar is also a proper Java module (JPMS).
Jackson 2.12 and above include additional Gradle 6 Module Metadata for version alignment with Gradle.
-----
# Use it!
## General
Usage typically starts with creation of a reusable (and thread-safe, once configured) `JsonFactory` instance:
```java
// Builder-style since 2.10:
JsonFactory factory = JsonFactory.builder()
// configure, if necessary:
.enable(JsonReadFeature.ALLOW_JAVA_COMMENTS)
.build();
// older 2.x mechanism, still supported for 2.x
JsonFactory factory = new JsonFactory();
// configure, if necessary:
factory.enable(JsonReadFeature.ALLOW_JAVA_COMMENTS);
```
Alternatively, you have an `ObjectMapper` (from [Jackson Databind package](https://github.com/FasterXML/jackson-databind)) handy; if so, you can do:
```java
JsonFactory factory = objectMapper.getFactory();
```
## Usage, simple reading
All reading is by using `JsonParser` (or its sub-classes, in case of data formats other than JSON),
instance of which is constructed by `JsonFactory`.
An example can be found from [Reading and Writing Event Streams](http://www.cowtowncoder.com/blog/archives/2009/01/entry_132.html)
## Usage, simple writing
All writing is by using `JsonGenerator` (or its sub-classes, in case of data formats other than JSON),
instance of which is constructed by `JsonFactory`:
An example can be found from [Reading and Writing Event Streams](http://www.cowtowncoder.com/blog/archives/2009/01/entry_132.html)
## Processing limits
Starting with [Jackson 2.15](https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.15), Jackson has configurable limits for some aspects of input decoding and output generation.
Implemented limits are:
* Length are expressed in input/output units -- `byte`s or `char`s -- depending on input source
* Defined as longest allowed length, but not necessarily imposed at 100% accuracy: that is, if maximum allowed length is specified as 1000 units, something with length of, say 1003 may not cause exception (but 1500 would typically do)
* Defined using new `StreamReadConstraints` / `StreamWriteConstraints` classes, configurable on per-`JsonFactory` basis
* Main focus is to reduce likelihood of excessive memory usage/retention and/or processing costs; not validation
### Input parsing limits
* Maximum Number token length (2.15+): (see https://github.com/FasterXML/jackson-core/issues/815)
* Default: Maximum 1000 for both integral and floating-point numbers.
* Maximum String value length (2.15+): (see https://github.com/FasterXML/jackson-core/issues/863)
* Default: 20_000_000 (20 million) (since 2.15.1; 2.15.0 had lower limit, 5 million)
* Maximum Input nesting depth (2.15+): (see https://github.com/FasterXML/jackson-core/pull/943)
* Default: 1000 levels
* Maximum Property name length (2.16+): (see https://github.com/FasterXML/jackson-core/issues/1047)
* Default: 50,000
* Maximum Document length (2.16+): (see https://github.com/FasterXML/jackson-core/issues/1046)
* Default: Unlimited (-1)
### Output generation limits
* Maximum Output nesting depth (2.16+): (see https://github.com/FasterXML/jackson-core/pull/1055)
* Default: 1000 levels
### Re-configuring limits
You can change per-factory limits as follows:
```java
JsonFactory f = JsonFactory.builder()
.streamReadConstraints(StreamReadConstraints.builder().maxDocumentLength(10_000_000L).build())
.streamReadConstraints(StreamReadConstraints.builder().maxNumberLength(250).build())
.streamWriteConstraints(StreamWriteConstraints.builder().maxNestingDepth(2000).build())
.build();
```
## Error Report Configuration
Starting with [Jackson 2.16](https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.16), Jackson offers configurable
behavior around error-reporting.
Currently supported configuration options are:
- `maxErrorTokenLength` : Maximum length of token to include in error messages (2.16+): (see [#1066](https://github.com/FasterXML/jackson-core/issues/1066))
- `maxRawContentLength` : Maximum length of raw c
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Jackson高性能的JSON处理 v2.16.1.zip (410个子文件)
mvnw.cmd 7KB
.gitattributes 95B
.gitignore 236B
说明.htm 4KB
index.html 332B
index.html 332B
index.html 332B
index.html 332B
index.html 332B
index.html 330B
index.html 330B
index.html 330B
index.html 330B
index.html 330B
index.html 330B
index.html 330B
index.html 330B
index.html 330B
index.html 330B
PackageVersion.java.in 583B
jackson-core-LICENSE 11KB
jackson-core-NOTICE 1KB
DoubleToDecimalChecker.java 761KB
UTF8StreamJsonParser.java 137KB
NonBlockingUtf8JsonParserBase.java 112KB
JsonGenerator.java 111KB
ReaderBasedJsonParser.java 107KB
UTF8DataInputJsonParser.java 105KB
JsonParser.java 99KB
JsonFactory.java 82KB
UTF8JsonGenerator.java 77KB
WriterBasedJsonGenerator.java 69KB
ParserBase.java 56KB
ByteQuadsCanonicalizer.java 50KB
MathUtils.java 50KB
FilteringParserDelegate.java 40KB
TextBuffer.java 39KB
NumberParsingTest.java 36KB
FilteringGeneratorDelegate.java 34KB
CharsToNameCanonicalizer.java 33KB
BasicParserFilteringTest.java 33KB
Base64Variant.java 31KB
BasicGeneratorFilteringTest.java 31KB
NonBlockingJsonParserBase.java 31KB
JsonPointer.java 29KB
SimpleParserTest.java 27KB
ParserMinimalBase.java 27KB
JsonStringEncoder.java 26KB
BaseTest.java 23KB
DoubleToDecimal.java 20KB
GeneratorBase.java 20KB
NextXxxAccessTest.java 20KB
StreamReadConstraints.java 20KB
FloatToDecimal.java 19KB
ByteSourceJsonBootstrapper.java 19KB
NumberInput.java 19KB
JsonGeneratorDelegate.java 18KB
NumberOutput.java 17KB
ContentReference.java 17KB
TokenFilter.java 16KB
Base64BinaryParsingTest.java 16KB
DefaultPrettyPrinter.java 16KB
IOContext.java 16KB
MathUtilsTest.java 16KB
AsyncNonStdParsingTest.java 15KB
TestDelegates.java 15KB
TestSymbolTables.java 15KB
GeneratorBasicTest.java 15KB
TokenStreamFactory.java 14KB
AsyncScalarArrayTest.java 14KB
GeneratorFeaturesTest.java 14KB
UTF8Writer.java 13KB
JsonParserDelegate.java 13KB
PointerFromContextTest.java 13KB
TSFBuilder.java 13KB
JsonFactoryTest.java 13KB
NumberCoercionTest.java 12KB
PrettyPrinterTest.java 12KB
AsyncNonStandardNumberParsingTest.java 12KB
ErrorReportConfigurationTest.java 12KB
CharTypes.java 12KB
AsyncNumberCoercionTest.java 12KB
TrailingCommasTest.java 12KB
TokenFilterContext.java 11KB
TreeNode.java 11KB
JsonStreamContext.java 11KB
RecyclerPool.java 11KB
ToDecimalChecker.java 11KB
CommentParsingTest.java 11KB
BoundsChecksWithGeneratorTest.java 10KB
StringGenerationFromReaderTest.java 10KB
TestJDKSerializability.java 10KB
JsonReadFeature.java 10KB
TestDefaultPrettyPrinter.java 10KB
StringGenerationTest.java 10KB
JsonLocation.java 10KB
NonStandardNumberParsingTest.java 10KB
LocationOffsetsTest.java 10KB
RawValueWithSurrogatesTest.java 10KB
NonStandardParserFeaturesTest.java 10KB
共 410 条
- 1
- 2
- 3
- 4
- 5
资源评论
芝麻粒儿
- 粉丝: 6w+
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功