From 4c0438513aad276cedab20c68e54506475d50dea Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Fri, 31 Dec 2021 14:29:28 -0800 Subject: [PATCH] Revert "Update Maven wrapper (#732)" This reverts commit 2510349474ccdcdb0b131afb0214f075c7b78279. --- .gitattributes | 3 - .github/workflows/main.yml | 5 +- .gitignore | 1 - .mvn/wrapper/maven-wrapper.jar | Bin 0 -> 50710 bytes .mvn/wrapper/maven-wrapper.properties | 20 +- README.md | 2 +- SECURITY.md | 22 - .../javadoc/3.0.2021-01/allclasses-frame.html | 143 - .../3.0.2021-01/allclasses-noframe.html | 143 - .../Base64Variant.PaddingReadBehaviour.html | 381 - .../fasterxml/jackson/core/Base64Variant.html | 1288 --- .../jackson/core/Base64Variants.html | 455 - .../fasterxml/jackson/core/FormatFeature.html | 206 - .../fasterxml/jackson/core/FormatSchema.html | 249 - .../jackson/core/JacksonException.html | 535 - .../fasterxml/jackson/core/JsonEncoding.html | 444 - .../jackson/core/JsonGenerationException.html | 444 - .../fasterxml/jackson/core/JsonGenerator.html | 3417 ------- .../fasterxml/jackson/core/JsonLocation.html | 613 -- .../jackson/core/JsonParseException.html | 468 - .../jackson/core/JsonParser.NumberType.html | 397 - .../fasterxml/jackson/core/JsonParser.html | 3318 ------ .../fasterxml/jackson/core/JsonPointer.html | 999 -- .../jackson/core/JsonProcessingException.html | 367 - .../com/fasterxml/jackson/core/JsonToken.html | 745 -- .../fasterxml/jackson/core/JsonTokenId.html | 498 - .../jackson/core/ObjectReadContext.Base.html | 541 - .../jackson/core/ObjectReadContext.html | 548 - .../jackson/core/ObjectWriteContext.Base.html | 570 -- .../jackson/core/ObjectWriteContext.html | 504 - .../fasterxml/jackson/core/PrettyPrinter.html | 599 -- .../jackson/core/SerializableString.html | 570 -- .../jackson/core/StreamReadCapability.html | 472 - .../jackson/core/StreamReadFeature.html | 535 - .../jackson/core/StreamWriteCapability.html | 444 - .../jackson/core/StreamWriteFeature.html | 579 -- .../jackson/core/TokenStreamContext.html | 865 -- .../core/TokenStreamFactory.Feature.html | 525 - .../core/TokenStreamFactory.TSFBuilder.html | 694 -- .../jackson/core/TokenStreamFactory.html | 2077 ---- .../com/fasterxml/jackson/core/TreeCodec.html | 341 - .../com/fasterxml/jackson/core/TreeNode.html | 726 -- .../com/fasterxml/jackson/core/Version.html | 600 -- .../com/fasterxml/jackson/core/Versioned.html | 244 - .../jackson/core/async/ByteArrayFeeder.html | 266 - .../jackson/core/async/ByteBufferFeeder.html | 254 - .../core/async/NonBlockingInputFeeder.html | 271 - .../core/async/class-use/ByteArrayFeeder.html | 218 - .../async/class-use/ByteBufferFeeder.html | 126 - .../class-use/NonBlockingInputFeeder.html | 263 - .../jackson/core/async/package-frame.html | 23 - .../jackson/core/async/package-summary.html | 180 - .../jackson/core/async/package-tree.html | 140 - .../jackson/core/async/package-use.html | 255 - .../jackson/core/base/BinaryTSFactory.html | 959 -- ...ecorableTSFactory.DecorableTSFBuilder.html | 421 - .../jackson/core/base/DecorableTSFactory.html | 557 - .../jackson/core/base/GeneratorBase.html | 1322 --- .../jackson/core/base/ParserBase.html | 1815 ---- .../jackson/core/base/ParserMinimalBase.html | 3205 ------ .../jackson/core/base/TextualTSFactory.html | 1058 -- .../core/base/class-use/BinaryTSFactory.html | 170 - ...ecorableTSFactory.DecorableTSFBuilder.html | 209 - .../base/class-use/DecorableTSFactory.html | 225 - .../core/base/class-use/GeneratorBase.html | 183 - .../core/base/class-use/ParserBase.html | 225 - .../base/class-use/ParserMinimalBase.html | 254 - .../core/base/class-use/TextualTSFactory.html | 199 - .../jackson/core/base/package-frame.html | 27 - .../jackson/core/base/package-summary.html | 207 - .../jackson/core/base/package-tree.html | 167 - .../jackson/core/base/package-use.html | 279 - .../Base64Variant.PaddingReadBehaviour.html | 200 - .../jackson/core/class-use/Base64Variant.html | 639 -- .../core/class-use/Base64Variants.html | 126 - .../jackson/core/class-use/FormatFeature.html | 236 - .../jackson/core/class-use/FormatSchema.html | 272 - .../core/class-use/JacksonException.html | 273 - .../jackson/core/class-use/JsonEncoding.html | 390 - .../class-use/JsonGenerationException.html | 280 - .../jackson/core/class-use/JsonGenerator.html | 916 -- .../jackson/core/class-use/JsonLocation.html | 419 - .../core/class-use/JsonParseException.html | 463 - .../core/class-use/JsonParser.NumberType.html | 250 - .../jackson/core/class-use/JsonParser.html | 1204 --- .../jackson/core/class-use/JsonPointer.html | 401 - .../class-use/JsonProcessingException.html | 337 - .../jackson/core/class-use/JsonToken.html | 1088 -- .../jackson/core/class-use/JsonTokenId.html | 126 - .../class-use/ObjectReadContext.Base.html | 174 - .../core/class-use/ObjectReadContext.html | 708 -- .../class-use/ObjectWriteContext.Base.html | 174 - .../core/class-use/ObjectWriteContext.html | 505 - .../jackson/core/class-use/PrettyPrinter.html | 332 - .../core/class-use/SerializableString.html | 627 -- .../core/class-use/StreamReadCapability.html | 290 - .../core/class-use/StreamReadFeature.html | 317 - .../core/class-use/StreamWriteCapability.html | 292 - .../core/class-use/StreamWriteFeature.html | 305 - .../core/class-use/TokenStreamContext.html | 374 - .../class-use/TokenStreamFactory.Feature.html | 209 - .../TokenStreamFactory.TSFBuilder.html | 279 - .../core/class-use/TokenStreamFactory.html | 336 - .../jackson/core/class-use/TreeCodec.html | 126 - .../jackson/core/class-use/TreeNode.html | 406 - .../jackson/core/class-use/Version.html | 314 - .../jackson/core/class-use/Versioned.html | 446 - .../core/exc/InputCoercionException.html | 499 - .../jackson/core/exc/StreamReadException.html | 586 -- .../exc/class-use/InputCoercionException.html | 204 - .../exc/class-use/StreamReadException.html | 258 - .../jackson/core/exc/package-frame.html | 22 - .../jackson/core/exc/package-summary.html | 167 - .../jackson/core/exc/package-tree.html | 163 - .../jackson/core/exc/package-use.html | 253 - .../filter/FilteringGeneratorDelegate.html | 2144 ---- .../core/filter/FilteringParserDelegate.html | 1212 --- .../core/filter/JsonPointerBasedFilter.html | 557 - .../core/filter/TokenFilter.Inclusion.html | 378 - .../jackson/core/filter/TokenFilter.html | 914 -- .../core/filter/TokenFilterContext.html | 851 -- .../class-use/FilteringGeneratorDelegate.html | 126 - .../class-use/FilteringParserDelegate.html | 126 - .../class-use/JsonPointerBasedFilter.html | 126 - .../class-use/TokenFilter.Inclusion.html | 218 - .../core/filter/class-use/TokenFilter.html | 368 - .../filter/class-use/TokenFilterContext.html | 277 - .../jackson/core/filter/package-frame.html | 29 - .../jackson/core/filter/package-summary.html | 194 - .../jackson/core/filter/package-tree.html | 178 - .../jackson/core/filter/package-use.html | 173 - .../fasterxml/jackson/core/io/CharTypes.html | 632 -- .../jackson/core/io/CharacterEscapes.html | 453 - .../jackson/core/io/DataOutputAsStream.html | 382 - .../fasterxml/jackson/core/io/IOContext.html | 849 -- .../jackson/core/io/InputDecorator.html | 427 - .../jackson/core/io/JsonEOFException.html | 414 - .../jackson/core/io/JsonStringEncoder.html | 359 - .../jackson/core/io/MergedStream.html | 465 - .../jackson/core/io/NumberInput.html | 555 - .../jackson/core/io/NumberOutput.html | 384 - .../jackson/core/io/OutputDecorator.html | 338 - .../core/io/SegmentedStringWriter.html | 506 - .../jackson/core/io/SerializedString.html | 807 -- .../jackson/core/io/UTF32Reader.html | 592 -- .../fasterxml/jackson/core/io/UTF8Writer.html | 521 - .../jackson/core/io/class-use/CharTypes.html | 126 - .../core/io/class-use/CharacterEscapes.html | 395 - .../core/io/class-use/DataOutputAsStream.html | 126 - .../jackson/core/io/class-use/IOContext.html | 725 -- .../core/io/class-use/InputDecorator.html | 210 - .../core/io/class-use/JsonEOFException.html | 126 - .../core/io/class-use/JsonStringEncoder.html | 169 - .../core/io/class-use/MergedStream.html | 126 - .../core/io/class-use/NumberInput.html | 126 - .../core/io/class-use/NumberOutput.html | 126 - .../core/io/class-use/OutputDecorator.html | 210 - .../io/class-use/SegmentedStringWriter.html | 126 - .../core/io/class-use/SerializedString.html | 203 - .../core/io/class-use/UTF32Reader.html | 126 - .../jackson/core/io/class-use/UTF8Writer.html | 126 - .../jackson/core/io/package-frame.html | 38 - .../jackson/core/io/package-summary.html | 247 - .../jackson/core/io/package-tree.html | 197 - .../jackson/core/io/package-use.html | 336 - .../core/json/ByteSourceJsonBootstrapper.html | 471 - .../jackson/core/json/DupDetector.html | 416 - .../jackson/core/json/JsonFactory.html | 1251 --- .../jackson/core/json/JsonFactoryBuilder.html | 755 -- .../jackson/core/json/JsonGeneratorBase.html | 990 -- .../jackson/core/json/JsonParserBase.html | 883 -- .../jackson/core/json/JsonReadContext.html | 736 -- .../jackson/core/json/JsonReadFeature.html | 704 -- .../jackson/core/json/JsonWriteContext.html | 780 -- .../jackson/core/json/JsonWriteFeature.html | 511 - .../jackson/core/json/PackageVersion.html | 331 - .../core/json/ReaderBasedJsonParser.html | 1936 ---- .../core/json/UTF8DataInputJsonParser.html | 1845 ---- .../jackson/core/json/UTF8JsonGenerator.html | 2258 ----- .../core/json/UTF8StreamJsonParser.html | 2336 ----- .../core/json/WriterBasedJsonGenerator.html | 2261 ----- .../json/async/NonBlockingJsonParser.html | 1228 --- .../json/async/NonBlockingJsonParserBase.html | 2565 ----- .../class-use/NonBlockingJsonParser.html | 126 - .../class-use/NonBlockingJsonParserBase.html | 170 - .../core/json/async/package-frame.html | 22 - .../core/json/async/package-summary.html | 165 - .../jackson/core/json/async/package-tree.html | 159 - .../jackson/core/json/async/package-use.html | 163 - .../class-use/ByteSourceJsonBootstrapper.html | 126 - .../core/json/class-use/DupDetector.html | 347 - .../core/json/class-use/JsonFactory.html | 193 - .../json/class-use/JsonFactoryBuilder.html | 274 - .../json/class-use/JsonGeneratorBase.html | 176 - .../core/json/class-use/JsonParserBase.html | 219 - .../core/json/class-use/JsonReadContext.html | 243 - .../core/json/class-use/JsonReadFeature.html | 230 - .../core/json/class-use/JsonWriteContext.html | 241 - .../core/json/class-use/JsonWriteFeature.html | 230 - .../core/json/class-use/PackageVersion.html | 126 - .../json/class-use/ReaderBasedJsonParser.html | 126 - .../class-use/UTF8DataInputJsonParser.html | 126 - .../json/class-use/UTF8JsonGenerator.html | 126 - .../json/class-use/UTF8StreamJsonParser.html | 126 - .../class-use/WriterBasedJsonGenerator.html | 126 - .../jackson/core/json/package-frame.html | 39 - .../jackson/core/json/package-summary.html | 277 - .../jackson/core/json/package-tree.html | 215 - .../jackson/core/json/package-use.html | 263 - .../fasterxml/jackson/core/package-frame.html | 64 - .../jackson/core/package-summary.html | 468 - .../fasterxml/jackson/core/package-tree.html | 213 - .../fasterxml/jackson/core/package-use.html | 1088 -- .../jackson/core/sym/BinaryNameMatcher.html | 632 -- .../core/sym/ByteQuadsCanonicalizer.html | 1038 -- .../core/sym/CharsToNameCanonicalizer.html | 874 -- .../jackson/core/sym/FieldNameMatcher.html | 620 -- .../jackson/core/sym/HashedMatcherBase.html | 469 - .../jackson/core/sym/SimpleNameMatcher.html | 502 - .../core/sym/class-use/BinaryNameMatcher.html | 180 - .../sym/class-use/ByteQuadsCanonicalizer.html | 348 - .../class-use/CharsToNameCanonicalizer.html | 282 - .../core/sym/class-use/FieldNameMatcher.html | 444 - .../core/sym/class-use/HashedMatcherBase.html | 196 - .../core/sym/class-use/SimpleNameMatcher.html | 209 - .../jackson/core/sym/package-frame.html | 26 - .../jackson/core/sym/package-summary.html | 195 - .../jackson/core/sym/package-tree.html | 150 - .../jackson/core/sym/package-use.html | 365 - .../jackson/core/tree/ArrayTreeNode.html | 200 - .../jackson/core/tree/ObjectTreeNode.html | 200 - .../core/tree/class-use/ArrayTreeNode.html | 194 - .../core/tree/class-use/ObjectTreeNode.html | 194 - .../jackson/core/tree/package-frame.html | 22 - .../jackson/core/tree/package-summary.html | 169 - .../jackson/core/tree/package-tree.html | 140 - .../jackson/core/tree/package-use.html | 174 - .../jackson/core/type/ResolvedType.html | 606 -- .../jackson/core/type/TypeReference.html | 359 - .../core/type/WritableTypeId.Inclusion.html | 460 - .../jackson/core/type/WritableTypeId.html | 520 - .../core/type/class-use/ResolvedType.html | 284 - .../core/type/class-use/TypeReference.html | 266 - .../class-use/WritableTypeId.Inclusion.html | 195 - .../core/type/class-use/WritableTypeId.html | 201 - .../jackson/core/type/package-frame.html | 27 - .../jackson/core/type/package-summary.html | 200 - .../jackson/core/type/package-tree.html | 153 - .../jackson/core/type/package-use.html | 287 - .../jackson/core/util/BufferRecycler.html | 680 -- .../jackson/core/util/BufferRecyclers.html | 387 - .../jackson/core/util/ByteArrayBuilder.html | 704 -- .../jackson/core/util/DefaultIndenter.html | 458 - ...faultPrettyPrinter.FixedSpaceIndenter.html | 339 - .../util/DefaultPrettyPrinter.Indenter.html | 260 - .../DefaultPrettyPrinter.NopIndenter.html | 333 - .../core/util/DefaultPrettyPrinter.html | 1088 -- .../jackson/core/util/Instantiatable.html | 249 - .../jackson/core/util/InternCache.html | 343 - .../jackson/core/util/JacksonFeature.html | 286 - .../jackson/core/util/JacksonFeatureSet.html | 458 - .../core/util/JsonGeneratorDelegate.html | 2958 ------ .../jackson/core/util/JsonParserDelegate.html | 3065 ------ .../jackson/core/util/JsonParserSequence.html | 756 -- .../core/util/JsonpCharacterEscapes.html | 375 - .../core/util/MinimalPrettyPrinter.html | 729 -- .../core/util/Named.StringAsNamed.html | 399 - .../fasterxml/jackson/core/util/Named.html | 267 - .../jackson/core/util/RequestPayload.html | 389 - .../jackson/core/util/Separators.html | 380 - .../core/util/SimpleTokenReadContext.html | 719 -- .../core/util/SimpleTokenWriteContext.html | 659 -- .../jackson/core/util/Snapshottable.html | 264 - .../jackson/core/util/TextBuffer.html | 894 -- .../jackson/core/util/VersionUtil.html | 358 - .../core/util/class-use/BufferRecycler.html | 288 - .../core/util/class-use/BufferRecyclers.html | 126 - .../core/util/class-use/ByteArrayBuilder.html | 263 - .../core/util/class-use/DefaultIndenter.html | 185 - ...faultPrettyPrinter.FixedSpaceIndenter.html | 168 - .../DefaultPrettyPrinter.Indenter.html | 231 - .../DefaultPrettyPrinter.NopIndenter.html | 191 - .../util/class-use/DefaultPrettyPrinter.html | 227 - .../core/util/class-use/Instantiatable.html | 171 - .../core/util/class-use/InternCache.html | 168 - .../core/util/class-use/JacksonFeature.html | 315 - .../util/class-use/JacksonFeatureSet.html | 341 - .../util/class-use/JsonGeneratorDelegate.html | 170 - .../util/class-use/JsonParserDelegate.html | 198 - .../util/class-use/JsonParserSequence.html | 173 - .../util/class-use/JsonpCharacterEscapes.html | 168 - .../util/class-use/MinimalPrettyPrinter.html | 168 - .../util/class-use/Named.StringAsNamed.html | 126 - .../jackson/core/util/class-use/Named.html | 338 - .../core/util/class-use/RequestPayload.html | 262 - .../core/util/class-use/Separators.html | 246 - .../class-use/SimpleTokenReadContext.html | 231 - .../class-use/SimpleTokenWriteContext.html | 226 - .../core/util/class-use/Snapshottable.html | 275 - .../core/util/class-use/TextBuffer.html | 223 - .../core/util/class-use/VersionUtil.html | 126 - .../jackson/core/util/package-frame.html | 49 - .../jackson/core/util/package-summary.html | 349 - .../jackson/core/util/package-tree.html | 201 - .../jackson/core/util/package-use.html | 574 -- docs/javadoc/3.0.2021-01/constant-values.html | 1473 --- docs/javadoc/3.0.2021-01/deprecated-list.html | 223 - docs/javadoc/3.0.2021-01/help-doc.html | 231 - docs/javadoc/3.0.2021-01/index-all.html | 9031 ----------------- docs/javadoc/3.0.2021-01/index.html | 76 - docs/javadoc/3.0.2021-01/javadoc.sh | 1 - docs/javadoc/3.0.2021-01/options | 28 - docs/javadoc/3.0.2021-01/overview-frame.html | 33 - .../javadoc/3.0.2021-01/overview-summary.html | 219 - docs/javadoc/3.0.2021-01/overview-tree.html | 407 - docs/javadoc/3.0.2021-01/package-list | 12 - docs/javadoc/3.0.2021-01/packages | 12 - docs/javadoc/3.0.2021-01/script.js | 30 - docs/javadoc/3.0.2021-01/serialized-form.html | 1013 -- docs/javadoc/3.0.2021-01/stylesheet.css | 574 -- mvnw | 18 +- mvnw.cmd | 30 +- pom.xml | 46 +- release-notes/CREDITS | 11 - release-notes/CREDITS-2.x | 4 - release-notes/VERSION | 41 - release-notes/VERSION-2.x | 5 - .../fasterxml/jackson/core/Base64Variant.java | 20 +- .../jackson/core/Base64Variants.java | 10 +- .../fasterxml/jackson/core/FormatFeature.java | 25 +- .../jackson/core/JacksonException.java | 123 +- .../fasterxml/jackson/core/JsonFactory.java | 2048 ++++ .../core/{json => }/JsonFactoryBuilder.java | 83 +- .../jackson/core/JsonGenerationException.java | 71 + .../fasterxml/jackson/core/JsonGenerator.java | 1809 +++- .../fasterxml/jackson/core/JsonLocation.java | 100 +- .../jackson/core/JsonParseException.java | 119 + .../fasterxml/jackson/core/JsonParser.java | 1788 +++- .../fasterxml/jackson/core/JsonPointer.java | 108 +- .../jackson/core/JsonProcessingException.java | 144 + ...eamContext.java => JsonStreamContext.java} | 114 +- .../com/fasterxml/jackson/core/JsonToken.java | 20 +- .../fasterxml/jackson/core/JsonTokenId.java | 6 +- .../{util => }/JsonpCharacterEscapes.java | 5 +- .../fasterxml/jackson/core/ObjectCodec.java | 279 + .../jackson/core/ObjectReadContext.java | 168 - .../jackson/core/ObjectWriteContext.java | 178 - .../fasterxml/jackson/core/PrettyPrinter.java | 106 +- .../jackson/core/SerializableString.java | 13 +- .../jackson/core/StreamReadFeature.java | 39 +- .../jackson/core/StreamWriteFeature.java | 49 +- .../fasterxml/jackson/core/TSFBuilder.java | 303 + .../jackson/core/TokenStreamFactory.java | 1353 +-- .../com/fasterxml/jackson/core/TreeCodec.java | 50 +- .../com/fasterxml/jackson/core/TreeNode.java | 162 +- .../com/fasterxml/jackson/core/Version.java | 33 +- .../jackson/core/async/ByteArrayFeeder.java | 8 +- .../jackson/core/async/ByteBufferFeeder.java | 9 +- .../jackson/core/async/package-info.java | 2 +- .../jackson/core/base/BinaryTSFactory.java | 250 - .../jackson/core/base/DecorableTSFactory.java | 209 - .../jackson/core/base/GeneratorBase.java | 411 +- .../jackson/core/base/ParserBase.java | 708 +- .../jackson/core/base/ParserMinimalBase.java | 641 +- .../jackson/core/base/TextualTSFactory.java | 347 - .../core/exc/InputCoercionException.java | 21 +- .../jackson/core/exc/StreamReadException.java | 84 +- .../core/exc/StreamWriteException.java | 31 +- .../jackson/core/exc/WrappedIOException.java | 54 - .../jackson/core/exc/package-info.java | 4 +- .../filter/FilteringGeneratorDelegate.java | 364 +- .../core/filter/FilteringParserDelegate.java | 308 +- .../jackson/core/filter/TokenFilter.java | 14 +- .../core/filter/TokenFilterContext.java | 108 +- .../core/format/DataFormatDetector.java | 228 + .../core/format/DataFormatMatcher.java | 139 + .../jackson/core/format/InputAccessor.java | 146 + .../jackson/core/format/MatchStrength.java | 62 + .../jackson/core/format/package-info.java | 6 + .../fasterxml/jackson/core/io/CharTypes.java | 17 +- .../jackson/core/io/ContentReference.java | 6 +- .../jackson/core/io/DataOutputAsStream.java | 6 +- .../fasterxml/jackson/core/io/IOContext.java | 43 +- .../jackson/core/io/InputDecorator.java | 33 +- .../JsonEOFException.java} | 20 +- .../jackson/core/io/JsonStringEncoder.java | 199 +- .../jackson/core/io/NumberInput.java | 28 +- .../jackson/core/io/NumberOutput.java | 75 +- .../jackson/core/io/OutputDecorator.java | 14 +- .../jackson/core/io/SerializedString.java | 36 +- .../jackson/core/io/UTF32Reader.java | 26 +- .../core/json/ByteSourceJsonBootstrapper.java | 323 +- .../jackson/core/json/DupDetector.java | 13 +- .../jackson/core/json/JsonFactory.java | 480 - .../jackson/core/json/JsonGeneratorBase.java | 284 - .../jackson/core/json/JsonGeneratorImpl.java | 251 + .../jackson/core/json/JsonParserBase.java | 396 - .../jackson/core/json/JsonReadContext.java | 84 +- .../jackson/core/json/JsonReadFeature.java | 57 +- .../jackson/core/json/JsonWriteContext.java | 125 +- .../jackson/core/json/JsonWriteFeature.java | 38 +- .../core/json/ReaderBasedJsonParser.java | 640 +- .../core/json/UTF8DataInputJsonParser.java | 576 +- .../jackson/core/json/UTF8JsonGenerator.java | 485 +- .../core/json/UTF8StreamJsonParser.java | 1093 +- .../core/json/WriterBasedJsonGenerator.java | 566 +- .../json/async/NonBlockingJsonParser.java | 341 +- .../json/async/NonBlockingJsonParserBase.java | 259 +- .../fasterxml/jackson/core/package-info.java | 13 +- .../jackson/core/sym/BinaryNameMatcher.java | 811 -- .../core/sym/ByteQuadsCanonicalizer.java | 38 +- .../core/sym/CharsToNameCanonicalizer.java | 48 +- .../jackson/core/sym/HashedMatcherBase.java | 134 - .../com/fasterxml/jackson/core/sym/Name.java | 51 + .../com/fasterxml/jackson/core/sym/Name1.java | 29 + .../com/fasterxml/jackson/core/sym/Name2.java | 32 + .../com/fasterxml/jackson/core/sym/Name3.java | 36 + .../com/fasterxml/jackson/core/sym/NameN.java | 100 + .../jackson/core/sym/PropertyNameMatcher.java | 197 - .../jackson/core/sym/SimpleNameMatcher.java | 124 - .../jackson/core/sym/package-info.java | 2 +- .../jackson/core/tree/ArrayTreeNode.java | 14 - .../jackson/core/tree/ObjectTreeNode.java | 14 - .../jackson/core/tree/package-info.java | 9 - .../jackson/core/type/ResolvedType.java | 42 +- .../jackson/core/util/BufferRecycler.java | 4 + .../jackson/core/util/BufferRecyclers.java | 86 + .../jackson/core/util/ByteArrayBuilder.java | 18 +- .../jackson/core/util/DefaultIndenter.java | 5 +- .../core/util/DefaultPrettyPrinter.java | 97 +- .../jackson/core/util/Instantiatable.java | 2 + .../jackson/core/util/JacksonFeature.java | 4 +- .../jackson/core/util/JacksonFeatureSet.java | 2 +- .../core/util/JsonGeneratorDelegate.java | 292 +- .../jackson/core/util/JsonParserDelegate.java | 258 +- .../jackson/core/util/JsonParserSequence.java | 67 +- .../core/util/MinimalPrettyPrinter.java | 40 +- .../fasterxml/jackson/core/util/Named.java | 44 - .../jackson/core/util/RequestPayload.java | 67 + .../jackson/core/util/Separators.java | 34 +- .../core/util/SimpleStreamReadContext.java | 213 - .../core/util/SimpleStreamWriteContext.java | 205 - .../jackson/core/util/Snapshottable.java | 37 - .../jackson/core/util/TextBuffer.java | 92 +- .../jackson/core/util/VersionUtil.java | 73 +- src/main/resources/META-INF/NOTICE | 4 +- .../com.fasterxml.jackson.core.JsonFactory | 1 + ....fasterxml.jackson.core.TokenStreamFactory | 1 - src/moditect/module-info.java | 13 +- .../jackson/core/Base64VariantTest.java | 112 - .../com/fasterxml/jackson/core/BaseTest.java | 213 +- .../core/JsonpCharacterEscapesTest.java | 2 - .../jackson/core/PointerFromContextTest.java | 204 +- .../core/{exc => }/TestExceptions.java | 54 +- ...yTest.java => TestJDKSerializability.java} | 38 +- .../jackson/core/TestJsonPointer.java | 25 - .../fasterxml/jackson/core/TestLocation.java | 24 +- .../fasterxml/jackson/core/TestVersions.java | 24 +- .../fasterxml/jackson/core/VersionTest.java | 29 +- .../jackson/core/async/AsyncTestBase.java | 14 +- .../core/base/FactoryBaseImplsTest.java | 150 - .../core/base64/Base64BinaryParsingTest.java | 71 +- .../core/base64/Base64GenerationTest.java | 23 +- .../filter/BasicGeneratorFilteringTest.java | 62 +- .../core/filter/BasicParserFilteringTest.java | 117 +- .../filter/GeneratorFiltering609Test.java | 16 +- .../JsonPointerGeneratorFilteringTest.java | 7 +- .../JsonPointerParserFilteringTest.java | 5 +- .../core/filter/ParserFiltering700Test.java | 19 +- .../core/format/DataFormatMatcherTest.java | 66 + .../core/format/TestJsonFormatDetection.java | 97 + .../core/fuzz/Fuzz32208UTF32ParseTest.java | 13 +- .../jackson/core/fuzz/Fuzz34435ParseTest.java | 9 +- .../core/io/TestJsonStringEncoder.java | 23 +- .../core/json/CustomQuoteCharTest.java | 2 +- .../json/GeneratorFailFromReaderTest.java | 58 +- .../jackson/core/json/GeneratorFailTest.java | 63 +- ...esTest.java => GeneratorFeaturesTest.java} | 185 +- .../jackson/core/json/JsonFactoryTest.java | 393 +- .../core/json/JsonParserClosedCaseTest.java | 14 +- .../core/json/JsonReadContextTest.java | 26 +- .../core/json/RawValueWithSurrogatesTest.java | 5 +- .../json/RequestPayloadOnExceptionTest.java | 144 + .../json/StringGenerationFromReaderTest.java | 27 +- .../core/json/StringGenerationTest.java | 16 +- .../jackson/core/json/TestCharEscaping.java | 27 +- .../jackson/core/json/TestCustomEscaping.java | 50 +- .../jackson/core/json/TestDecorators.java | 73 +- .../jackson/core/json/TestMaxErrorSize.java | 17 +- .../core/json/TestParserOverrides.java | 42 +- .../jackson/core/json/TestRootValues.java | 48 +- .../jackson/core/json/TestUnicode.java | 4 +- .../core/json/TestWithTonsaSymbols.java | 15 +- .../core/json/async/AsyncBinaryParseTest.java | 13 +- .../json/async/AsyncCharEscapingTest.java | 4 +- .../json/async/AsyncCommentParsingTest.java | 10 +- .../core/json/async/AsyncConcurrencyTest.java | 1 - .../core/json/async/AsyncFieldNamesTest.java | 9 +- .../json/async/AsyncInvalidCharsTest.java | 9 +- .../core/json/async/AsyncLocationTest.java | 27 +- .../async/AsyncMissingValuesInArrayTest.java | 14 +- .../async/AsyncMissingValuesInObjectTest.java | 40 +- .../core/json/async/AsyncNaNHandlingTest.java | 12 +- .../async/AsyncNonStdNumberHandlingTest.java | 37 +- .../json/async/AsyncNonStdParsingTest.java | 98 +- .../json/async/AsyncNumberCoercionTest.java | 18 +- .../core/json/async/AsyncParserNamesTest.java | 60 +- .../async/AsyncPointerFromContext563Test.java | 17 +- .../core/json/async/AsyncRootNumbersTest.java | 1 - .../core/json/async/AsyncRootValuesTest.java | 3 +- .../core/json/async/AsyncScalarArrayTest.java | 11 +- .../json/async/AsyncScopeMatchingTest.java | 44 +- .../json/async/AsyncSimpleNestedTest.java | 54 +- .../json/async/AsyncSimpleObjectTest.java | 44 +- .../core/json/async/AsyncStringArrayTest.java | 5 +- .../json/async/AsyncStringObjectTest.java | 13 +- .../core/json/async/AsyncTokenFilterTest.java | 52 +- .../json/async/AsyncUnicodeHandlingTest.java | 5 +- .../jackson/core/json/async/ConfigTest.java | 4 +- .../jackson/core/read/ArrayParsingTest.java | 126 +- .../jackson/core/read/CommentParsingTest.java | 55 +- .../jackson/core/read/DataInputTest.java | 3 +- .../read/LocationDuringReaderParsingTest.java | 6 +- .../read/LocationDuringStreamParsingTest.java | 6 +- .../core/read/LocationInArrayTest.java | 25 +- .../core/read/LocationInObjectTest.java | 73 +- .../core/read/LocationOffsets455Test.java | 8 +- .../core/read/LocationOffsetsTest.java | 73 +- .../jackson/core/read/NextNameParserTest.java | 22 +- .../core/read/NextNameWithMatcherTest.java | 107 - .../jackson/core/read/NextXxxAccessTest.java | 172 +- .../read/NonStandardAposQuotedNamesTest.java | 64 +- .../read/NonStandardNumberParsingTest.java | 14 +- ...ava => NonStandardParserFeaturesTest.java} | 43 +- .../read/NonStandardUnquotedNamesTest.java | 56 +- .../jackson/core/read/NumberCoercionTest.java | 16 +- .../jackson/core/read/NumberOverflowTest.java | 15 +- .../jackson/core/read/NumberParsingTest.java | 113 +- .../jackson/core/read/ParserClosingTest.java | 26 +- .../core/read/ParserDupHandlingTest.java | 42 +- .../core/read/ParserErrorHandlingTest.java | 31 +- .../ParserFeaturesTest.java} | 67 +- .../core/read/ParserLinefeedsTest.java | 10 +- .../core/read/ParserScopeMatchingTest.java | 57 +- .../jackson/core/read/ParserSequenceTest.java | 18 +- .../core/read/ParserSymbolHandlingTest.java | 13 +- .../core/read/ParserWithObjectsTest.java | 33 +- .../jackson/core/read/SimpleParserTest.java | 214 +- .../core/read/TrailingCommas616Test.java | 12 +- .../jackson/core/read/TrailingCommasTest.java | 46 +- .../jackson/core/read/UTF32ParseTest.java | 23 +- .../jackson/core/read/UTF8NamesParseTest.java | 24 +- .../jackson/core/sym/BinaryNameHashTest.java | 108 - .../core/sym/BinaryNameMatcherTest.java | 127 - .../jackson/core/sym/FieldMatchersTest.java | 150 - .../core/sym/SymbolTableMergingTest.java | 37 +- .../core/sym/SymbolsViaParserTest.java | 19 +- .../core/sym/TestByteBasedSymbols.java | 27 +- .../core/sym/TestHashCollisionChars.java | 14 +- .../jackson/core/sym/TestSymbolTables.java | 11 +- .../core/sym/TestSymbolsWithMediaItem.java | 13 +- .../jackson/core/sym/TextualNameHashTest.java | 92 - .../core/testsupport/AsyncReaderWrapper.java | 41 +- .../AsyncReaderWrapperForByteArray.java | 9 +- .../core/testsupport/MockDataInput.java | 5 +- .../jackson/core/type/TypeReferenceTest.java | 5 + .../core/util/ByteArrayBuilderTest.java | 44 +- .../core/util/JsonParserSequenceTest.java | 61 - .../jackson/core/util/RequestPayloadTest.java | 39 + .../jackson/core/util/SeparatorsTest.java | 16 +- .../core/util/TestDefaultPrettyPrinter.java | 54 +- .../jackson/core/util/TestDelegates.java | 211 +- .../jackson/core/util/TestNumberPrinting.java | 4 +- .../jackson/core/util/TestVersionUtil.java | 6 + .../core/write/ArrayGenerationTest.java | 36 +- .../jackson/core/write/ArrayWriteTest.java | 43 +- .../core/write/GeneratorBasicTest.java | 130 +- .../core/write/GeneratorCloseTest.java | 114 +- .../jackson/core/write/GeneratorCopyTest.java | 19 +- .../core/write/GeneratorDupHandlingTest.java | 79 +- .../jackson/core/write/GeneratorMiscTest.java | 101 +- .../jackson/core/write/ObjectWriteTest.java | 281 +- .../jackson/core/write/PrettyPrinterTest.java | 150 +- .../core/write/RawStringWriteTest.java | 49 +- .../core/write/SerializedStringWriteTest.java | 52 +- .../jackson/core/write/UTF8GeneratorTest.java | 29 +- .../jackson/core/write/WriteTypeIdTest.java | 49 +- .../failing/ParserErrorHandling105Test.java | 13 +- .../failing/ParserErrorHandling679Test.java | 6 +- .../failing/ParserFilterEmpty708Test.java | 5 +- .../jackson/failing/Surrogate223Test.java | 22 +- .../failing/async/AsyncTokenErrorTest.java | 36 +- .../filter/BasicParserFilteringTest.java | 30 +- src/test/java/perf/ConcurrencyReadTest.java | 80 + src/test/java/perf/EnumByBytesLookup.java | 173 + src/test/java/perf/ManualFuzzUTF32.java | 3 +- src/test/java/perf/ManualIntRead.java | 5 +- .../java/perf/ManualReadPerfWithMedia.java | 5 +- src/test/java/perf/ManualSmallTokenRead.java | 5 +- src/test/java/perf/MediaItem.java | 43 +- 600 files changed, 15940 insertions(+), 168579 deletions(-) create mode 100644 .mvn/wrapper/maven-wrapper.jar delete mode 100644 SECURITY.md delete mode 100644 docs/javadoc/3.0.2021-01/allclasses-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/allclasses-noframe.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variant.PaddingReadBehaviour.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variant.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variants.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/FormatFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/FormatSchema.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JacksonException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonEncoding.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonGenerationException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonGenerator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonLocation.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParseException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParser.NumberType.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonPointer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonProcessingException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonToken.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonTokenId.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectReadContext.Base.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectReadContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectWriteContext.Base.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectWriteContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/PrettyPrinter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/SerializableString.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamReadCapability.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamReadFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamWriteCapability.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamWriteFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.Feature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.TSFBuilder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TreeCodec.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TreeNode.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Version.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Versioned.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/ByteArrayFeeder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/ByteBufferFeeder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/NonBlockingInputFeeder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/ByteArrayFeeder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/ByteBufferFeeder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/NonBlockingInputFeeder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/BinaryTSFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/DecorableTSFactory.DecorableTSFBuilder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/DecorableTSFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/GeneratorBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/ParserBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/ParserMinimalBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/TextualTSFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/BinaryTSFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/DecorableTSFactory.DecorableTSFBuilder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/DecorableTSFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/GeneratorBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/ParserBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/ParserMinimalBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/TextualTSFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variant.PaddingReadBehaviour.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variant.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variants.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/FormatFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/FormatSchema.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JacksonException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonEncoding.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonGenerationException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonGenerator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonLocation.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParseException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParser.NumberType.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonPointer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonProcessingException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonToken.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonTokenId.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectReadContext.Base.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectReadContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectWriteContext.Base.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectWriteContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/PrettyPrinter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/SerializableString.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamReadCapability.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamReadFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamWriteCapability.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamWriteFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.Feature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.TSFBuilder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TreeCodec.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TreeNode.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Version.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Versioned.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/InputCoercionException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/StreamReadException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/class-use/InputCoercionException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/class-use/StreamReadException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/FilteringGeneratorDelegate.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/FilteringParserDelegate.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/JsonPointerBasedFilter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilter.Inclusion.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilterContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/FilteringGeneratorDelegate.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/FilteringParserDelegate.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/JsonPointerBasedFilter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilter.Inclusion.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilterContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/CharTypes.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/CharacterEscapes.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/DataOutputAsStream.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/IOContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/InputDecorator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/JsonEOFException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/JsonStringEncoder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/MergedStream.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/NumberInput.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/NumberOutput.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/OutputDecorator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/SegmentedStringWriter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/SerializedString.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/UTF32Reader.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/UTF8Writer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/CharTypes.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/CharacterEscapes.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/DataOutputAsStream.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/IOContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/InputDecorator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/JsonEOFException.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/JsonStringEncoder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/MergedStream.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/NumberInput.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/NumberOutput.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/OutputDecorator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/SegmentedStringWriter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/SerializedString.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/UTF32Reader.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/UTF8Writer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/DupDetector.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonFactoryBuilder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonGeneratorBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonParserBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonReadContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonReadFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonWriteContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonWriteFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/PackageVersion.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8JsonGenerator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/WriterBasedJsonGenerator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/NonBlockingJsonParserBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/class-use/NonBlockingJsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/class-use/NonBlockingJsonParserBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/ByteSourceJsonBootstrapper.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/DupDetector.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonFactory.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonFactoryBuilder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonGeneratorBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonParserBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonReadContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonReadFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonWriteContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonWriteFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/PackageVersion.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/ReaderBasedJsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8DataInputJsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8JsonGenerator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8StreamJsonParser.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/WriterBasedJsonGenerator.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/BinaryNameMatcher.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/ByteQuadsCanonicalizer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/CharsToNameCanonicalizer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/FieldNameMatcher.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/HashedMatcherBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/SimpleNameMatcher.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/BinaryNameMatcher.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/ByteQuadsCanonicalizer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/CharsToNameCanonicalizer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/FieldNameMatcher.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/HashedMatcherBase.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/SimpleNameMatcher.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/ArrayTreeNode.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/ObjectTreeNode.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/class-use/ArrayTreeNode.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/class-use/ObjectTreeNode.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/ResolvedType.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/TypeReference.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/WritableTypeId.Inclusion.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/WritableTypeId.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/ResolvedType.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/TypeReference.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/WritableTypeId.Inclusion.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/WritableTypeId.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/BufferRecycler.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/BufferRecyclers.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/ByteArrayBuilder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultIndenter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.FixedSpaceIndenter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.Indenter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.NopIndenter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Instantiatable.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/InternCache.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JacksonFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JacksonFeatureSet.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonGeneratorDelegate.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonParserDelegate.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonParserSequence.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonpCharacterEscapes.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/MinimalPrettyPrinter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Named.StringAsNamed.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Named.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/RequestPayload.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Separators.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/SimpleTokenReadContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/SimpleTokenWriteContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Snapshottable.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/TextBuffer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/VersionUtil.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/BufferRecycler.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/BufferRecyclers.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/ByteArrayBuilder.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultIndenter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.FixedSpaceIndenter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.Indenter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.NopIndenter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Instantiatable.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/InternCache.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JacksonFeature.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JacksonFeatureSet.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonGeneratorDelegate.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonParserDelegate.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonParserSequence.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonpCharacterEscapes.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/MinimalPrettyPrinter.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Named.StringAsNamed.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Named.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/RequestPayload.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Separators.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/SimpleTokenReadContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/SimpleTokenWriteContext.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Snapshottable.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/TextBuffer.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/VersionUtil.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-use.html delete mode 100644 docs/javadoc/3.0.2021-01/constant-values.html delete mode 100644 docs/javadoc/3.0.2021-01/deprecated-list.html delete mode 100644 docs/javadoc/3.0.2021-01/help-doc.html delete mode 100644 docs/javadoc/3.0.2021-01/index-all.html delete mode 100644 docs/javadoc/3.0.2021-01/index.html delete mode 100755 docs/javadoc/3.0.2021-01/javadoc.sh delete mode 100644 docs/javadoc/3.0.2021-01/options delete mode 100644 docs/javadoc/3.0.2021-01/overview-frame.html delete mode 100644 docs/javadoc/3.0.2021-01/overview-summary.html delete mode 100644 docs/javadoc/3.0.2021-01/overview-tree.html delete mode 100644 docs/javadoc/3.0.2021-01/package-list delete mode 100644 docs/javadoc/3.0.2021-01/packages delete mode 100644 docs/javadoc/3.0.2021-01/script.js delete mode 100644 docs/javadoc/3.0.2021-01/serialized-form.html delete mode 100644 docs/javadoc/3.0.2021-01/stylesheet.css delete mode 100644 release-notes/CREDITS delete mode 100644 release-notes/VERSION create mode 100644 src/main/java/com/fasterxml/jackson/core/JsonFactory.java rename src/main/java/com/fasterxml/jackson/core/{json => }/JsonFactoryBuilder.java (76%) create mode 100644 src/main/java/com/fasterxml/jackson/core/JsonGenerationException.java create mode 100644 src/main/java/com/fasterxml/jackson/core/JsonParseException.java create mode 100644 src/main/java/com/fasterxml/jackson/core/JsonProcessingException.java rename src/main/java/com/fasterxml/jackson/core/{TokenStreamContext.java => JsonStreamContext.java} (75%) rename src/main/java/com/fasterxml/jackson/core/{util => }/JsonpCharacterEscapes.java (93%) create mode 100644 src/main/java/com/fasterxml/jackson/core/ObjectCodec.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/ObjectReadContext.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/ObjectWriteContext.java create mode 100644 src/main/java/com/fasterxml/jackson/core/TSFBuilder.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/base/BinaryTSFactory.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/base/DecorableTSFactory.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/base/TextualTSFactory.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/exc/WrappedIOException.java create mode 100644 src/main/java/com/fasterxml/jackson/core/format/DataFormatDetector.java create mode 100644 src/main/java/com/fasterxml/jackson/core/format/DataFormatMatcher.java create mode 100644 src/main/java/com/fasterxml/jackson/core/format/InputAccessor.java create mode 100644 src/main/java/com/fasterxml/jackson/core/format/MatchStrength.java create mode 100644 src/main/java/com/fasterxml/jackson/core/format/package-info.java rename src/main/java/com/fasterxml/jackson/core/{exc/UnexpectedEndOfInputException.java => io/JsonEOFException.java} (53%) delete mode 100644 src/main/java/com/fasterxml/jackson/core/json/JsonFactory.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/json/JsonGeneratorBase.java create mode 100644 src/main/java/com/fasterxml/jackson/core/json/JsonGeneratorImpl.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/json/JsonParserBase.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/sym/BinaryNameMatcher.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/sym/HashedMatcherBase.java create mode 100644 src/main/java/com/fasterxml/jackson/core/sym/Name.java create mode 100644 src/main/java/com/fasterxml/jackson/core/sym/Name1.java create mode 100644 src/main/java/com/fasterxml/jackson/core/sym/Name2.java create mode 100644 src/main/java/com/fasterxml/jackson/core/sym/Name3.java create mode 100644 src/main/java/com/fasterxml/jackson/core/sym/NameN.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/sym/PropertyNameMatcher.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/sym/SimpleNameMatcher.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/tree/ArrayTreeNode.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/tree/ObjectTreeNode.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/tree/package-info.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/util/Named.java create mode 100644 src/main/java/com/fasterxml/jackson/core/util/RequestPayload.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/util/SimpleStreamReadContext.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/util/SimpleStreamWriteContext.java delete mode 100644 src/main/java/com/fasterxml/jackson/core/util/Snapshottable.java create mode 100644 src/main/resources/META-INF/services/com.fasterxml.jackson.core.JsonFactory delete mode 100644 src/main/resources/META-INF/services/com.fasterxml.jackson.core.TokenStreamFactory delete mode 100644 src/test/java/com/fasterxml/jackson/core/Base64VariantTest.java rename src/test/java/com/fasterxml/jackson/core/{exc => }/TestExceptions.java (71%) rename src/test/java/com/fasterxml/jackson/core/{CoreJDKSerializabilityTest.java => TestJDKSerializability.java} (79%) delete mode 100644 src/test/java/com/fasterxml/jackson/core/base/FactoryBaseImplsTest.java create mode 100644 src/test/java/com/fasterxml/jackson/core/format/DataFormatMatcherTest.java create mode 100644 src/test/java/com/fasterxml/jackson/core/format/TestJsonFormatDetection.java rename src/test/java/com/fasterxml/jackson/core/json/{StreamWriteFeaturesTest.java => GeneratorFeaturesTest.java} (59%) create mode 100644 src/test/java/com/fasterxml/jackson/core/json/RequestPayloadOnExceptionTest.java delete mode 100644 src/test/java/com/fasterxml/jackson/core/read/NextNameWithMatcherTest.java rename src/test/java/com/fasterxml/jackson/core/read/{NonStandardJsonReadFeaturesTest.java => NonStandardParserFeaturesTest.java} (89%) rename src/test/java/com/fasterxml/jackson/core/{json/JsonReadFeaturesTest.java => read/ParserFeaturesTest.java} (61%) delete mode 100644 src/test/java/com/fasterxml/jackson/core/sym/BinaryNameHashTest.java delete mode 100644 src/test/java/com/fasterxml/jackson/core/sym/BinaryNameMatcherTest.java delete mode 100644 src/test/java/com/fasterxml/jackson/core/sym/FieldMatchersTest.java delete mode 100644 src/test/java/com/fasterxml/jackson/core/sym/TextualNameHashTest.java delete mode 100644 src/test/java/com/fasterxml/jackson/core/util/JsonParserSequenceTest.java create mode 100644 src/test/java/com/fasterxml/jackson/core/util/RequestPayloadTest.java create mode 100644 src/test/java/perf/ConcurrencyReadTest.java create mode 100644 src/test/java/perf/EnumByBytesLookup.java diff --git a/.gitattributes b/.gitattributes index 2d21275f22..4cf2927d3a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,3 @@ # Do not merge `pom.xml` from older version, as it will typically conflict pom.xml merge=ours -.travis.yml merge=ours - -release/VERSION merge=ours diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3458c135f3..5094bb3d37 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,7 +4,6 @@ on: branches: - master - "3.0" - - "2.14" - "2.13" paths-ignore: - "README.md" @@ -13,7 +12,6 @@ on: branches: - master - "3.0" - - "2.14" - "2.13" paths-ignore: - "README.md" @@ -24,7 +22,8 @@ jobs: strategy: fail-fast: false matrix: - java_version: ['8', '11', '14'] + # Alas, as long as JDK6 is target, cannot run against 14+ + java_version: ['8', '11'] os: ['ubuntu-20.04'] env: JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" diff --git a/.gitignore b/.gitignore index 682be0f18a..79b52d6bad 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ syntax: glob # building /target -.mvn/wrapper/maven-wrapper.jar # Eclipse .classpath diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054 GIT binary patch literal 50710 zcmbTd1CVCTmM+|7+wQV$+qP}n>auOywyU~q+qUhh+uxis_~*a##hm*_WW?9E7Pb7N%LRFiwbEGCJ0XP=%-6oeT$XZcYgtzC2~q zk(K08IQL8oTl}>>+hE5YRgXTB@fZ4TH9>7=79e`%%tw*SQUa9~$xKD5rS!;ZG@ocK zQdcH}JX?W|0_Afv?y`-NgLum62B&WSD$-w;O6G0Sm;SMX65z)l%m1e-g8Q$QTI;(Q z+x$xth4KFvH@Bs6(zn!iF#nenk^Y^ce;XIItAoCsow38eq?Y-Auh!1in#Rt-_D>H^ z=EjbclGGGa6VnaMGmMLj`x3NcwA43Jb(0gzl;RUIRAUDcR1~99l2SAPkVhoRMMtN} zXvC<tOmX83grD8GSo_Lo?%lNfhD#EBgPo z*nf@ppMC#B!T)Ae0RG$mlJWmGl7CkuU~B8-==5i;rS;8i6rJ=PoQxf446XDX9g|c> zU64ePyMlsI^V5Jq5A+BPe#e73+kpc_r1tv#B)~EZ;7^67F0*QiYfrk0uVW;Qb=NsG zN>gsuCwvb?s-KQIppEaeXtEMdc9dy6Dfduz-tMTms+i01{eD9JE&h?Kht*$eOl#&L zJdM_-vXs(V#$Ed;5wyNWJdPNh+Z$+;$|%qR(t`4W@kDhd*{(7-33BOS6L$UPDeE_53j${QfKN-0v-HG z(QfyvFNbwPK%^!eIo4ac1;b>c0vyf9}Xby@YY!lkz-UvNp zwj#Gg|4B~?n?G^{;(W;|{SNoJbHTMpQJ*Wq5b{l9c8(%?Kd^1?H1om1de0Da9M;Q=n zUfn{f87iVb^>Exl*nZ0hs(Yt>&V9$Pg`zX`AI%`+0SWQ4Zc(8lUDcTluS z5a_KerZWe}a-MF9#Cd^fi!y3%@RFmg&~YnYZ6<=L`UJ0v={zr)>$A;x#MCHZy1st7 ztT+N07NR+vOwSV2pvWuN1%lO!K#Pj0Fr>Q~R40{bwdL%u9i`DSM4RdtEH#cW)6}+I-eE< z&tZs+(Ogu(H_;$a$!7w`MH0r%h&@KM+<>gJL@O~2K2?VrSYUBbhCn#yy?P)uF3qWU z0o09mIik+kvzV6w>vEZy@&Mr)SgxPzUiDA&%07m17udz9usD82afQEps3$pe!7fUf z0eiidkJ)m3qhOjVHC_M(RYCBO%CZKZXFb8}s0-+}@CIn&EF(rRWUX2g^yZCvl0bI} zbP;1S)iXnRC&}5-Tl(hASKqdSnO?ASGJ*MIhOXIblmEudj(M|W!+I3eDc}7t`^mtg z)PKlaXe(OH+q-)qcQ8a@!llRrpGI8DsjhoKvw9T;TEH&?s=LH0w$EzI>%u;oD@x83 zJL7+ncjI9nn!TlS_KYu5vn%f*@qa5F;| zEFxY&B?g=IVlaF3XNm_03PA)=3|{n-UCgJoTr;|;1AU9|kPE_if8!Zvb}0q$5okF$ zHaJdmO&gg!9oN|M{!qGE=tb|3pVQ8PbL$}e;NgXz<6ZEggI}wO@aBP**2Wo=yN#ZC z4G$m^yaM9g=|&!^ft8jOLuzc3Psca*;7`;gnHm}tS0%f4{|VGEwu45KptfNmwxlE~ z^=r30gi@?cOm8kAz!EylA4G~7kbEiRlRIzwrb~{_2(x^$-?|#e6Bi_**(vyr_~9Of z!n>Gqf+Qwiu!xhi9f53=PM3`3tNF}pCOiPU|H4;pzjcsqbwg*{{kyrTxk<;mx~(;; z1NMrpaQ`57yn34>Jo3b|HROE(UNcQash!0p2-!Cz;{IRv#Vp5!3o$P8!%SgV~k&Hnqhp`5eLjTcy93cK!3Hm-$`@yGnaE=?;*2uSpiZTs_dDd51U%i z{|Zd9ou-;laGS_x=O}a+ zB||za<795A?_~Q=r=coQ+ZK@@ zId~hWQL<%)fI_WDIX#=(WNl!Dm$a&ROfLTd&B$vatq!M-2Jcs;N2vps$b6P1(N}=oI3<3luMTmC|0*{ zm1w8bt7vgX($!0@V0A}XIK)w!AzUn7vH=pZEp0RU0p?}ch2XC-7r#LK&vyc2=-#Q2 z^L%8)JbbcZ%g0Du;|8=q8B>X=mIQirpE=&Ox{TiuNDnOPd-FLI^KfEF729!!0x#Es z@>3ursjFSpu%C-8WL^Zw!7a0O-#cnf`HjI+AjVCFitK}GXO`ME&on|^=~Zc}^LBp9 zj=-vlN;Uc;IDjtK38l7}5xxQF&sRtfn4^TNtnzXv4M{r&ek*(eNbIu!u$>Ed%` z5x7+&)2P&4>0J`N&ZP8$vcR+@FS0126s6+Jx_{{`3ZrIMwaJo6jdrRwE$>IU_JTZ} z(||hyyQ)4Z1@wSlT94(-QKqkAatMmkT7pCycEB1U8KQbFX&?%|4$yyxCtm3=W`$4fiG0WU3yI@c zx{wfmkZAYE_5M%4{J-ygbpH|(|GD$2f$3o_Vti#&zfSGZMQ5_f3xt6~+{RX=$H8at z?GFG1Tmp}}lmm-R->ve*Iv+XJ@58p|1_jRvfEgz$XozU8#iJS})UM6VNI!3RUU!{5 zXB(+Eqd-E;cHQ>)`h0(HO_zLmzR3Tu-UGp;08YntWwMY-9i^w_u#wR?JxR2bky5j9 z3Sl-dQQU$xrO0xa&>vsiK`QN<$Yd%YXXM7*WOhnRdSFt5$aJux8QceC?lA0_if|s> ze{ad*opH_kb%M&~(~&UcX0nFGq^MqjxW?HJIP462v9XG>j(5Gat_)#SiNfahq2Mz2 zU`4uV8m$S~o9(W>mu*=h%Gs(Wz+%>h;R9Sg)jZ$q8vT1HxX3iQnh6&2rJ1u|j>^Qf`A76K%_ubL`Zu?h4`b=IyL>1!=*%!_K)=XC z6d}4R5L+sI50Q4P3upXQ3Z!~1ZXLlh!^UNcK6#QpYt-YC=^H=EPg3)z*wXo*024Q4b2sBCG4I# zlTFFY=kQ>xvR+LsuDUAk)q%5pEcqr(O_|^spjhtpb1#aC& zghXzGkGDC_XDa%t(X`E+kvKQ4zrQ*uuQoj>7@@ykWvF332)RO?%AA&Fsn&MNzmFa$ zWk&&^=NNjxLjrli_8ESU)}U|N{%j&TQmvY~lk!~Jh}*=^INA~&QB9em!in_X%Rl1&Kd~Z(u z9mra#<@vZQlOY+JYUwCrgoea4C8^(xv4ceCXcejq84TQ#sF~IU2V}LKc~Xlr_P=ry zl&Hh0exdCbVd^NPCqNNlxM3vA13EI8XvZ1H9#bT7y*U8Y{H8nwGpOR!e!!}*g;mJ#}T{ekSb}5zIPmye*If(}}_=PcuAW#yidAa^9-`<8Gr0 z)Fz=NiZ{)HAvw{Pl5uu)?)&i&Us$Cx4gE}cIJ}B4Xz~-q7)R_%owbP!z_V2=Aq%Rj z{V;7#kV1dNT9-6R+H}}(ED*_!F=~uz>&nR3gb^Ce%+0s#u|vWl<~JD3MvS0T9thdF zioIG3c#Sdsv;LdtRv3ml7%o$6LTVL>(H`^@TNg`2KPIk*8-IB}X!MT0`hN9Ddf7yN z?J=GxPL!uJ7lqwowsl?iRrh@#5C$%E&h~Z>XQcvFC*5%0RN-Opq|=IwX(dq(*sjs+ zqy99+v~m|6T#zR*e1AVxZ8djd5>eIeCi(b8sUk)OGjAsKSOg^-ugwl2WSL@d#?mdl zib0v*{u-?cq}dDGyZ%$XRY=UkQwt2oGu`zQneZh$=^! zj;!pCBWQNtvAcwcWIBM2y9!*W|8LmQy$H~5BEx)78J`4Z0(FJO2P^!YyQU{*Al+fs z){!4JvT1iLrJ8aU3k0t|P}{RN)_^v%$$r;+p0DY7N8CXzmS*HB*=?qaaF9D@#_$SN zSz{moAK<*RH->%r7xX~9gVW$l7?b|_SYI)gcjf0VAUJ%FcQP(TpBs; zg$25D!Ry_`8xpS_OJdeo$qh#7U+cepZ??TII7_%AXsT$B z=e)Bx#v%J0j``00Zk5hsvv6%T^*xGNx%KN-=pocSoqE5_R)OK%-Pbu^1MNzfds)mL zxz^F4lDKV9D&lEY;I+A)ui{TznB*CE$=9(wgE{m}`^<--OzV-5V4X2w9j(_!+jpTr zJvD*y6;39&T+==$F&tsRKM_lqa1HC}aGL0o`%c9mO=fts?36@8MGm7Vi{Y z^<7m$(EtdSr#22<(rm_(l_(`j!*Pu~Y>>xc>I9M#DJYDJNHO&4=HM%YLIp?;iR&$m z#_$ZWYLfGLt5FJZhr3jpYb`*%9S!zCG6ivNHYzNHcI%khtgHBliM^Ou}ZVD7ehU9 zS+W@AV=?Ro!=%AJ>Kcy9aU3%VX3|XM_K0A+ZaknKDyIS3S-Hw1C7&BSW5)sqj5Ye_ z4OSW7Yu-;bCyYKHFUk}<*<(@TH?YZPHr~~Iy%9@GR2Yd}J2!N9K&CN7Eq{Ka!jdu; zQNB*Y;i(7)OxZK%IHGt#Rt?z`I|A{q_BmoF!f^G}XVeTbe1Wnzh%1g>j}>DqFf;Rp zz7>xIs12@Ke0gr+4-!pmFP84vCIaTjqFNg{V`5}Rdt~xE^I;Bxp4)|cs8=f)1YwHz zqI`G~s2~qqDV+h02b`PQpUE#^^Aq8l%y2|ByQeXSADg5*qMprEAE3WFg0Q39`O+i1 z!J@iV!`Y~C$wJ!5Z+j5$i<1`+@)tBG$JL=!*uk=2k;T<@{|s1$YL079FvK%mPhyHV zP8^KGZnp`(hVMZ;s=n~3r2y;LTwcJwoBW-(ndU-$03{RD zh+Qn$ja_Z^OuMf3Ub|JTY74s&Am*(n{J3~@#OJNYuEVVJd9*H%)oFoRBkySGm`hx! zT3tG|+aAkXcx-2Apy)h^BkOyFTWQVeZ%e2@;*0DtlG9I3Et=PKaPt&K zw?WI7S;P)TWED7aSH$3hL@Qde?H#tzo^<(o_sv_2ci<7M?F$|oCFWc?7@KBj-;N$P zB;q!8@bW-WJY9do&y|6~mEruZAVe$!?{)N9rZZxD-|oltkhW9~nR8bLBGXw<632!l z*TYQn^NnUy%Ds}$f^=yQ+BM-a5X4^GHF=%PDrRfm_uqC zh{sKwIu|O0&jWb27;wzg4w5uA@TO_j(1X?8E>5Zfma|Ly7Bklq|s z9)H`zoAGY3n-+&JPrT!>u^qg9Evx4y@GI4$n-Uk_5wttU1_t?6><>}cZ-U+&+~JE) zPlDbO_j;MoxdLzMd~Ew|1o^a5q_1R*JZ=#XXMzg?6Zy!^hop}qoLQlJ{(%!KYt`MK z8umEN@Z4w!2=q_oe=;QttPCQy3Nm4F@x>@v4sz_jo{4m*0r%J(w1cSo;D_hQtJs7W z><$QrmG^+<$4{d2bgGo&3-FV}avg9zI|Rr(k{wTyl3!M1q+a zD9W{pCd%il*j&Ft z5H$nENf>>k$;SONGW`qo6`&qKs*T z2^RS)pXk9b@(_Fw1bkb)-oqK|v}r$L!W&aXA>IpcdNZ_vWE#XO8X`#Yp1+?RshVcd zknG%rPd*4ECEI0wD#@d+3NbHKxl}n^Sgkx==Iu%}HvNliOqVBqG?P2va zQ;kRJ$J6j;+wP9cS za#m;#GUT!qAV%+rdWolk+)6kkz4@Yh5LXP+LSvo9_T+MmiaP-eq6_k;)i6_@WSJ zlT@wK$zqHu<83U2V*yJ|XJU4farT#pAA&@qu)(PO^8PxEmPD4;Txpio+2)#!9 z>&=i7*#tc0`?!==vk>s7V+PL#S1;PwSY?NIXN2=Gu89x(cToFm))7L;< z+bhAbVD*bD=}iU`+PU+SBobTQ%S!=VL!>q$rfWsaaV}Smz>lO9JXT#`CcH_mRCSf4%YQAw`$^yY z3Y*^Nzk_g$xn7a_NO(2Eb*I=^;4f!Ra#Oo~LLjlcjke*k*o$~U#0ZXOQ5@HQ&T46l z7504MUgZkz2gNP1QFN8Y?nSEnEai^Rgyvl}xZfMUV6QrJcXp;jKGqB=D*tj{8(_pV zqyB*DK$2lgYGejmJUW)*s_Cv65sFf&pb(Yz8oWgDtQ0~k^0-wdF|tj}MOXaN@ydF8 zNr={U?=;&Z?wr^VC+`)S2xl}QFagy;$mG=TUs7Vi2wws5zEke4hTa2)>O0U?$WYsZ z<8bN2bB_N4AWd%+kncgknZ&}bM~eDtj#C5uRkp21hWW5gxWvc6b*4+dn<{c?w9Rmf zIVZKsPl{W2vQAlYO3yh}-{Os=YBnL8?uN5(RqfQ=-1cOiUnJu>KcLA*tQK3FU`_bM zM^T28w;nAj5EdAXFi&Kk1Nnl2)D!M{@+D-}bIEe+Lc4{s;YJc-{F#``iS2uk;2!Zp zF9#myUmO!wCeJIoi^A+T^e~20c+c2C}XltaR!|U-HfDA=^xF97ev}$l6#oY z&-&T{egB)&aV$3_aVA51XGiU07$s9vubh_kQG?F$FycvS6|IO!6q zq^>9|3U^*!X_C~SxX&pqUkUjz%!j=VlXDo$!2VLH!rKj@61mDpSr~7B2yy{>X~_nc zRI+7g2V&k zd**H++P9dg!-AOs3;GM`(g<+GRV$+&DdMVpUxY9I1@uK28$az=6oaa+PutlO9?6#? zf-OsgT>^@8KK>ggkUQRPPgC7zjKFR5spqQb3ojCHzj^(UH~v+!y*`Smv)VpVoPwa6 zWG18WJaPKMi*F6Zdk*kU^`i~NNTfn3BkJniC`yN98L-Awd)Z&mY? zprBW$!qL-OL7h@O#kvYnLsfff@kDIegt~?{-*5A7JrA;#TmTe?jICJqhub-G@e??D zqiV#g{)M!kW1-4SDel7TO{;@*h2=_76g3NUD@|c*WO#>MfYq6_YVUP+&8e4|%4T`w zXzhmVNziAHazWO2qXcaOu@R1MrPP{t)`N)}-1&~mq=ZH=w=;-E$IOk=y$dOls{6sRR`I5>|X zpq~XYW4sd;J^6OwOf**J>a7u$S>WTFPRkjY;BfVgQst)u4aMLR1|6%)CB^18XCz+r ztkYQ}G43j~Q&1em(_EkMv0|WEiKu;z2zhb(L%$F&xWwzOmk;VLBYAZ8lOCziNoPw1 zv2BOyXA`A8z^WH!nXhKXM`t0;6D*-uGds3TYGrm8SPnJJOQ^fJU#}@aIy@MYWz**H zvkp?7I5PE{$$|~{-ZaFxr6ZolP^nL##mHOErB^AqJqn^hFA=)HWj!m3WDaHW$C)i^ z9@6G$SzB=>jbe>4kqr#sF7#K}W*Cg-5y6kun3u&0L7BpXF9=#7IN8FOjWrWwUBZiU zT_se3ih-GBKx+Uw0N|CwP3D@-C=5(9T#BH@M`F2!Goiqx+Js5xC92|Sy0%WWWp={$(am!#l~f^W_oz78HX<0X#7 zp)p1u~M*o9W@O8P{0Qkg@Wa# z2{Heb&oX^CQSZWSFBXKOfE|tsAm#^U-WkDnU;IowZ`Ok4!mwHwH=s|AqZ^YD4!5!@ zPxJj+Bd-q6w_YG`z_+r;S86zwXb+EO&qogOq8h-Ect5(M2+>(O7n7)^dP*ws_3U6v zVsh)sk^@*c>)3EML|0<-YROho{lz@Nd4;R9gL{9|64xVL`n!m$-Jjrx?-Bacp!=^5 z1^T^eB{_)Y<9)y{-4Rz@9_>;_7h;5D+@QcbF4Wv7hu)s0&==&6u)33 zHRj+&Woq-vDvjwJCYES@$C4{$?f$Ibi4G()UeN11rgjF+^;YE^5nYprYoJNoudNj= zm1pXSeG64dcWHObUetodRn1Fw|1nI$D9z}dVEYT0lQnsf_E1x2vBLql7NrHH!n&Sq z6lc*mvU=WS6=v9Lrl}&zRiu_6u;6g%_DU{9b+R z#YHqX7`m9eydf?KlKu6Sb%j$%_jmydig`B*TN`cZL-g!R)iE?+Q5oOqBFKhx z%MW>BC^(F_JuG(ayE(MT{S3eI{cKiwOtPwLc0XO*{*|(JOx;uQOfq@lp_^cZo=FZj z4#}@e@dJ>Bn%2`2_WPeSN7si^{U#H=7N4o%Dq3NdGybrZgEU$oSm$hC)uNDC_M9xc zGzwh5Sg?mpBIE8lT2XsqTt3j3?We8}3bzLBTQd639vyg^$0#1epq8snlDJP2(BF)K zSx30RM+{f+b$g{9usIL8H!hCO117Xgv}ttPJm9wVRjPk;ePH@zxv%j9k5`TzdXLeT zFgFX`V7cYIcBls5WN0Pf6SMBN+;CrQ(|EsFd*xtwr#$R{Z9FP`OWtyNsq#mCgZ7+P z^Yn$haBJ)r96{ZJd8vlMl?IBxrgh=fdq_NF!1{jARCVz>jNdC)H^wfy?R94#MPdUjcYX>#wEx+LB#P-#4S-%YH>t-j+w zOFTI8gX$ard6fAh&g=u&56%3^-6E2tpk*wx3HSCQ+t7+*iOs zPk5ysqE}i*cQocFvA68xHfL|iX(C4h*67@3|5Qwle(8wT&!&{8*{f%0(5gH+m>$tq zp;AqrP7?XTEooYG1Dzfxc>W%*CyL16q|fQ0_jp%%Bk^k!i#Nbi(N9&T>#M{gez_Ws zYK=l}adalV(nH}I_!hNeb;tQFk3BHX7N}}R8%pek^E`X}%ou=cx8InPU1EE0|Hen- zyw8MoJqB5=)Z%JXlrdTXAE)eqLAdVE-=>wGHrkRet}>3Yu^lt$Kzu%$3#(ioY}@Gu zjk3BZuQH&~7H+C*uX^4}F*|P89JX;Hg2U!pt>rDi(n(Qe-c}tzb0#6_ItoR0->LSt zR~UT<-|@TO%O`M+_e_J4wx7^)5_%%u+J=yF_S#2Xd?C;Ss3N7KY^#-vx+|;bJX&8r zD?|MetfhdC;^2WG`7MCgs>TKKN=^=!x&Q~BzmQio_^l~LboTNT=I zC5pme^P@ER``p$2md9>4!K#vV-Fc1an7pl>_|&>aqP}+zqR?+~Z;f2^`a+-!Te%V? z;H2SbF>jP^GE(R1@%C==XQ@J=G9lKX+Z<@5}PO(EYkJh=GCv#)Nj{DkWJM2}F&oAZ6xu8&g7pn1ps2U5srwQ7CAK zN&*~@t{`31lUf`O;2w^)M3B@o)_mbRu{-`PrfNpF!R^q>yTR&ETS7^-b2*{-tZAZz zw@q5x9B5V8Qd7dZ!Ai$9hk%Q!wqbE1F1c96&zwBBaRW}(^axoPpN^4Aw}&a5dMe+*Gomky_l^54*rzXro$ z>LL)U5Ry>~FJi=*{JDc)_**c)-&faPz`6v`YU3HQa}pLtb5K)u%K+BOqXP0)rj5Au$zB zW1?vr?mDv7Fsxtsr+S6ucp2l#(4dnr9sD*v+@*>g#M4b|U?~s93>Pg{{a5|rm2xfI z`>E}?9S@|IoUX{Q1zjm5YJT|3S>&09D}|2~BiMo=z4YEjXlWh)V&qs;*C{`UMxp$9 zX)QB?G$fPD6z5_pNs>Jeh{^&U^)Wbr?2D6-q?)`*1k@!UvwQgl8eG$r+)NnFoT)L6 zg7lEh+E6J17krfYJCSjWzm67hEth24pomhz71|Qodn#oAILN)*Vwu2qpJirG)4Wnv}9GWOFrQg%Je+gNrPl8mw7ykE8{ z=|B4+uwC&bpp%eFcRU6{mxRV32VeH8XxX>v$du<$(DfinaaWxP<+Y97Z#n#U~V zVEu-GoPD=9$}P;xv+S~Ob#mmi$JQmE;Iz4(){y*9pFyW-jjgdk#oG$fl4o9E8bo|L zWjo4l%n51@Kz-n%zeSCD`uB?T%FVk+KBI}=ve zvlcS#wt`U6wrJo}6I6Rwb=1GzZfwE=I&Ne@p7*pH84XShXYJRgvK)UjQL%R9Zbm(m zxzTQsLTON$WO7vM)*vl%Pc0JH7WhP;$z@j=y#avW4X8iqy6mEYr@-}PW?H)xfP6fQ z&tI$F{NNct4rRMSHhaelo<5kTYq+(?pY)Ieh8*sa83EQfMrFupMM@nfEV@EmdHUv9 z35uzIrIuo4#WnF^_jcpC@uNNaYTQ~uZWOE6P@LFT^1@$o&q+9Qr8YR+ObBkpP9=F+$s5+B!mX2~T zAuQ6RenX?O{IlLMl1%)OK{S7oL}X%;!XUxU~xJN8xk z`xywS*naF(J#?vOpB(K=o~lE;m$zhgPWDB@=p#dQIW>xe_p1OLoWInJRKbEuoncf; zmS1!u-ycc1qWnDg5Nk2D)BY%jmOwCLC+Ny>`f&UxFowIsHnOXfR^S;&F(KXd{ODlm z$6#1ccqt-HIH9)|@fHnrKudu!6B$_R{fbCIkSIb#aUN|3RM>zuO>dpMbROZ`^hvS@ z$FU-;e4W}!ubzKrU@R*dW*($tFZ>}dd*4_mv)#O>X{U@zSzQt*83l9mI zI$8O<5AIDx`wo0}f2fsPC_l>ONx_`E7kdXu{YIZbp1$(^oBAH({T~&oQ&1{X951QW zmhHUxd)t%GQ9#ak5fTjk-cahWC;>^Rg7(`TVlvy0W@Y!Jc%QL3Ozu# zDPIqBCy&T2PWBj+d-JA-pxZlM=9ja2ce|3B(^VCF+a*MMp`(rH>Rt6W1$;r{n1(VK zLs>UtkT43LR2G$AOYHVailiqk7naz2yZGLo*xQs!T9VN5Q>eE(w zw$4&)&6xIV$IO^>1N-jrEUg>O8G4^@y+-hQv6@OmF@gy^nL_n1P1-Rtyy$Bl;|VcV zF=p*&41-qI5gG9UhKmmnjs932!6hceXa#-qfK;3d*a{)BrwNFeKU|ge?N!;zk+kB! zMD_uHJR#%b54c2tr~uGPLTRLg$`fupo}cRJeTwK;~}A>(Acy4k-Xk&Aa1&eWYS1ULWUj@fhBiWY$pdfy+F z@G{OG{*v*mYtH3OdUjwEr6%_ZPZ3P{@rfbNPQG!BZ7lRyC^xlMpWH`@YRar`tr}d> z#wz87t?#2FsH-jM6m{U=gp6WPrZ%*w0bFm(T#7m#v^;f%Z!kCeB5oiF`W33W5Srdt zdU?YeOdPG@98H7NpI{(uN{FJdu14r(URPH^F6tOpXuhU7T9a{3G3_#Ldfx_nT(Hec zo<1dyhsVsTw;ZkVcJ_0-h-T3G1W@q)_Q30LNv)W?FbMH+XJ* zy=$@39Op|kZv`Rt>X`zg&at(?PO^I=X8d9&myFEx#S`dYTg1W+iE?vt#b47QwoHI9 zNP+|3WjtXo{u}VG(lLUaW0&@yD|O?4TS4dfJI`HC-^q;M(b3r2;7|FONXphw-%7~* z&;2!X17|05+kZOpQ3~3!Nb>O94b&ZSs%p)TK)n3m=4eiblVtSx@KNFgBY_xV6ts;NF;GcGxMP8OKV^h6LmSb2E#Qnw ze!6Mnz7>lE9u{AgQ~8u2zM8CYD5US8dMDX-5iMlgpE9m*s+Lh~A#P1er*rF}GHV3h z=`STo?kIXw8I<`W0^*@mB1$}pj60R{aJ7>C2m=oghKyxMbFNq#EVLgP0cH3q7H z%0?L93-z6|+jiN|@v>ix?tRBU(v-4RV`}cQH*fp|)vd3)8i9hJ3hkuh^8dz{F5-~_ zUUr1T3cP%cCaTooM8dj|4*M=e6flH0&8ve32Q)0dyisl))XkZ7Wg~N}6y`+Qi2l+e zUd#F!nJp{#KIjbQdI`%oZ`?h=5G^kZ_uN`<(`3;a!~EMsWV|j-o>c?x#;zR2ktiB! z);5rrHl?GPtr6-o!tYd|uK;Vbsp4P{v_4??=^a>>U4_aUXPWQ$FPLE4PK$T^3Gkf$ zHo&9$U&G`d(Os6xt1r?sg14n)G8HNyWa^q8#nf0lbr4A-Fi;q6t-`pAx1T*$eKM*$ z|CX|gDrk#&1}>5H+`EjV$9Bm)Njw&7-ZR{1!CJTaXuP!$Pcg69`{w5BRHysB$(tWUes@@6aM69kb|Lx$%BRY^-o6bjH#0!7b;5~{6J+jKxU!Kmi# zndh@+?}WKSRY2gZ?Q`{(Uj|kb1%VWmRryOH0T)f3cKtG4oIF=F7RaRnH0Rc_&372={_3lRNsr95%ZO{IX{p@YJ^EI%+gvvKes5cY+PE@unghjdY5#9A!G z70u6}?zmd?v+{`vCu-53_v5@z)X{oPC@P)iA3jK$`r zSA2a7&!^zmUiZ82R2=1cumBQwOJUPz5Ay`RLfY(EiwKkrx%@YN^^XuET;tE zmr-6~I7j!R!KrHu5CWGSChO6deaLWa*9LLJbcAJsFd%Dy>a!>J`N)Z&oiU4OEP-!Ti^_!p}O?7`}i7Lsf$-gBkuY*`Zb z7=!nTT;5z$_5$=J=Ko+Cp|Q0J=%oFr>hBgnL3!tvFoLNhf#D0O=X^h+x08iB;@8pXdRHxX}6R4k@i6%vmsQwu^5z zk1ip`#^N)^#Lg#HOW3sPI33xqFB4#bOPVnY%d6prwxf;Y-w9{ky4{O6&94Ra8VN@K zb-lY;&`HtxW@sF!doT5T$2&lIvJpbKGMuDAFM#!QPXW87>}=Q4J3JeXlwHys?!1^#37q_k?N@+u&Ns20pEoBeZC*np;i;M{2C0Z4_br2gsh6eL z#8`#sn41+$iD?^GL%5?cbRcaa-Nx0vE(D=*WY%rXy3B%gNz0l?#noGJGP728RMY#q z=2&aJf@DcR?QbMmN)ItUe+VM_U!ryqA@1VVt$^*xYt~-qvW!J4Tp<-3>jT=7Zow5M z8mSKp0v4b%a8bxFr>3MwZHSWD73D@+$5?nZAqGM#>H@`)mIeC#->B)P8T$zh-Pxnc z8)~Zx?TWF4(YfKuF3WN_ckpCe5;x4V4AA3(i$pm|78{%!q?|~*eH0f=?j6i)n~Hso zmTo>vqEtB)`%hP55INf7HM@taH)v`Fw40Ayc*R!T?O{ziUpYmP)AH`euTK!zg9*6Z z!>M=$3pd0!&TzU=hc_@@^Yd3eUQpX4-33}b{?~5t5lgW=ldJ@dUAH%`l5US1y_`40 zs(X`Qk}vvMDYYq+@Rm+~IyCX;iD~pMgq^KY)T*aBz@DYEB={PxA>)mI6tM*sx-DmGQHEaHwRrAmNjO!ZLHO4b;;5mf@zzlPhkP($JeZGE7 z?^XN}Gf_feGoG~BjUgVa*)O`>lX=$BSR2)uD<9 z>o^|nb1^oVDhQbfW>>!;8-7<}nL6L^V*4pB=>wwW+RXAeRvKED(n1;R`A6v$6gy0I(;Vf?!4;&sgn7F%LpM}6PQ?0%2Z@b{It<(G1CZ|>913E0nR2r^Pa*Bp z@tFGi*CQ~@Yc-?{cwu1 zsilf=k^+Qs>&WZG(3WDixisHpR>`+ihiRwkL(3T|=xsoNP*@XX3BU8hr57l3k;pni zI``=3Nl4xh4oDj<%>Q1zYXHr%Xg_xrK3Nq?vKX3|^Hb(Bj+lONTz>4yhU-UdXt2>j z<>S4NB&!iE+ao{0Tx^N*^|EZU;0kJkx@zh}S^P{ieQjGl468CbC`SWnwLRYYiStXm zOxt~Rb3D{dz=nHMcY)#r^kF8|q8KZHVb9FCX2m^X*(|L9FZg!5a7((!J8%MjT$#Fs)M1Pb zq6hBGp%O1A+&%2>l0mpaIzbo&jc^!oN^3zxap3V2dNj3x<=TwZ&0eKX5PIso9j1;e zwUg+C&}FJ`k(M|%%}p=6RPUq4sT3-Y;k-<68ciZ~_j|bt>&9ZLHNVrp#+pk}XvM{8 z`?k}o-!if>hVlCP9j%&WI2V`5SW)BCeR5>MQhF)po=p~AYN%cNa_BbV6EEh_kk^@a zD>4&>uCGCUmyA-c)%DIcF4R6!>?6T~Mj_m{Hpq`*(wj>foHL;;%;?(((YOxGt)Bhx zuS+K{{CUsaC++%}S6~CJ=|vr(iIs-je)e9uJEU8ZJAz)w166q)R^2XI?@E2vUQ!R% zn@dxS!JcOimXkWJBz8Y?2JKQr>`~SmE2F2SL38$SyR1^yqj8_mkBp)o$@+3BQ~Mid z9U$XVqxX3P=XCKj0*W>}L0~Em`(vG<>srF8+*kPrw z20{z(=^w+ybdGe~Oo_i|hYJ@kZl*(9sHw#Chi&OIc?w`nBODp?ia$uF%Hs(X>xm?j zqZQ`Ybf@g#wli`!-al~3GWiE$K+LCe=Ndi!#CVjzUZ z!sD2O*;d28zkl))m)YN7HDi^z5IuNo3^w(zy8 zszJG#mp#Cj)Q@E@r-=NP2FVxxEAeOI2e=|KshybNB6HgE^(r>HD{*}S}mO>LuRGJT{*tfTzw_#+er-0${}%YPe@CMJ1Ng#j#)i)SnY@ss3gL;g zg2D~#Kpdfu#G;q1qz_TwSz1VJT(b3zby$Vk&;Y#1(A)|xj`_?i5YQ;TR%jice5E;0 zYHg;`zS5{S*9xI6o^j>rE8Ua*XhIw{_-*&@(R|C(am8__>+Ws&Q^ymy*X4~hR2b5r zm^p3sw}yv=tdyncy_Ui7{BQS732et~Z_@{-IhHDXAV`(Wlay<#hb>%H%WDi+K$862nA@BDtM#UCKMu+kM`!JHyWSi?&)A7_ z3{cyNG%a~nnH_!+;g&JxEMAmh-Z}rC!o7>OVzW&PoMyTA_g{hqXG)SLraA^OP**<7 zjWbr7z!o2n3hnx7A=2O=WL;`@9N{vQIM@&|G-ljrPvIuJHYtss0Er0fT5cMXNUf1B z7FAwBDixt0X7C3S)mPe5g`YtME23wAnbU)+AtV}z+e8G;0BP=bI;?(#|Ep!vVfDbK zvx+|CKF>yt0hWQ3drchU#XBU+HiuG*V^snFAPUp-5<#R&BUAzoB!aZ+e*KIxa26V}s6?nBK(U-7REa573wg-jqCg>H8~>O{ z*C0JL-?X-k_y%hpUFL?I>0WV{oV`Nb)nZbJG01R~AG>flIJf)3O*oB2i8~;!P?Wo_ z0|QEB*fifiL6E6%>tlAYHm2cjTFE@*<);#>689Z6S#BySQ@VTMhf9vYQyLeDg1*F} zjq>i1*x>5|CGKN{l9br3kB0EHY|k4{%^t7-uhjd#NVipUZa=EUuE5kS1_~qYX?>hJ z$}!jc9$O$>J&wnu0SgfYods^z?J4X;X7c77Me0kS-dO_VUQ39T(Kv(Y#s}Qqz-0AH z^?WRL(4RzpkD+T5FG_0NyPq-a-B7A5LHOCqwObRJi&oRi(<;OuIN7SV5PeHU$<@Zh zPozEV`dYmu0Z&Tqd>t>8JVde9#Pt+l95iHe$4Xwfy1AhI zDM4XJ;bBTTvRFtW>E+GzkN)9k!hA5z;xUOL2 zq4}zn-DP{qc^i|Y%rvi|^5k-*8;JZ~9a;>-+q_EOX+p1Wz;>i7c}M6Nv`^NY&{J-> z`(mzDJDM}QPu5i44**2Qbo(XzZ-ZDu%6vm8w@DUarqXj41VqP~ zs&4Y8F^Waik3y1fQo`bVUH;b=!^QrWb)3Gl=QVKr+6sxc=ygauUG|cm?|X=;Q)kQ8 zM(xrICifa2p``I7>g2R~?a{hmw@{!NS5`VhH8+;cV(F>B94M*S;5#O`YzZH1Z%yD? zZ61w(M`#aS-*~Fj;x|J!KM|^o;MI#Xkh0ULJcA?o4u~f%Z^16ViA27FxU5GM*rKq( z7cS~MrZ=f>_OWx8j#-Q3%!aEU2hVuTu(7`TQk-Bi6*!<}0WQi;_FpO;fhpL4`DcWp zGOw9vx0N~6#}lz(r+dxIGZM3ah-8qrqMmeRh%{z@dbUD2w15*_4P?I~UZr^anP}DB zU9CCrNiy9I3~d#&!$DX9e?A});BjBtQ7oGAyoI$8YQrkLBIH@2;lt4E^)|d6Jwj}z z&2_E}Y;H#6I4<10d_&P0{4|EUacwFHauvrjAnAm6yeR#}f}Rk27CN)vhgRqEyPMMS7zvunj2?`f;%?alsJ+-K+IzjJx>h8 zu~m_y$!J5RWAh|C<6+uiCNsOKu)E72M3xKK(a9Okw3e_*O&}7llNV!=P87VM2DkAk zci!YXS2&=P0}Hx|wwSc9JP%m8dMJA*q&VFB0yMI@5vWoAGraygwn){R+Cj6B1a2Px z5)u(K5{+;z2n*_XD!+Auv#LJEM)(~Hx{$Yb^ldQmcYF2zNH1V30*)CN_|1$v2|`LnFUT$%-tO0Eg|c5$BB~yDfzS zcOXJ$wpzVK0MfTjBJ0b$r#_OvAJ3WRt+YOLlJPYMx~qp>^$$$h#bc|`g0pF-Ao43? z>*A+8lx>}L{p(Tni2Vvk)dtzg$hUKjSjXRagj)$h#8=KV>5s)J4vGtRn5kP|AXIz! zPgbbVxW{2o4s-UM;c#We8P&mPN|DW7_uLF!a|^0S=wr6Esx9Z$2|c1?GaupU6$tb| zY_KU`(_29O_%k(;>^|6*pZURH3`@%EuKS;Ns z1lujmf;r{qAN&Q0&m{wJSZ8MeE7RM5+Sq;ul_ z`+ADrd_Um+G37js6tKsArNB}n{p*zTUxQr>3@wA;{EUbjNjlNd6$Mx zg0|MyU)v`sa~tEY5$en7^PkC=S<2@!nEdG6L=h(vT__0F=S8Y&eM=hal#7eM(o^Lu z2?^;05&|CNliYrq6gUv;|i!(W{0N)LWd*@{2q*u)}u*> z7MQgk6t9OqqXMln?zoMAJcc zMKaof_Up})q#DzdF?w^%tTI7STI^@8=Wk#enR*)&%8yje>+tKvUYbW8UAPg55xb70 zEn5&Ba~NmOJlgI#iS8W3-@N%>V!#z-ZRwfPO1)dQdQkaHsiqG|~we2ALqG7Ruup(DqSOft2RFg_X%3w?6VqvV1uzX_@F(diNVp z4{I|}35=11u$;?|JFBEE*gb;T`dy+8gWJ9~pNsecrO`t#V9jW-6mnfO@ff9od}b(3s4>p0i30gbGIv~1@a^F2kl7YO;DxmF3? zWi-RoXhzRJV0&XE@ACc?+@6?)LQ2XNm4KfalMtsc%4!Fn0rl zpHTrHwR>t>7W?t!Yc{*-^xN%9P0cs0kr=`?bQ5T*oOo&VRRu+1chM!qj%2I!@+1XF z4GWJ=7ix9;Wa@xoZ0RP`NCWw0*8247Y4jIZ>GEW7zuoCFXl6xIvz$ezsWgKdVMBH> z{o!A7f;R-@eK9Vj7R40xx)T<2$?F2E<>Jy3F;;=Yt}WE59J!1WN367 zA^6pu_zLoZIf*x031CcwotS{L8bJE(<_F%j_KJ2P_IusaZXwN$&^t716W{M6X2r_~ zaiMwdISX7Y&Qi&Uh0upS3TyEIXNDICQlT5fHXC`aji-c{U(J@qh-mWl-uMN|T&435 z5)a1dvB|oe%b2mefc=Vpm0C%IUYYh7HI*;3UdgNIz}R##(#{(_>82|zB0L*1i4B5j-xi9O4x10rs_J6*gdRBX=@VJ+==sWb&_Qc6tSOowM{BX@(zawtjl zdU!F4OYw2@Tk1L^%~JCwb|e#3CC>srRHQ*(N%!7$Mu_sKh@|*XtR>)BmWw!;8-mq7 zBBnbjwx8Kyv|hd*`5}84flTHR1Y@@uqjG`UG+jN_YK&RYTt7DVwfEDXDW4U+iO{>K zw1hr{_XE*S*K9TzzUlJH2rh^hUm2v7_XjwTuYap|>zeEDY$HOq3X4Tz^X}E9z)x4F zs+T?Ed+Hj<#jY-`Va~fT2C$=qFT-5q$@p9~0{G&eeL~tiIAHXA!f6C(rAlS^)&k<- zXU|ZVs}XQ>s5iONo~t!XXZgtaP$Iau;JT%h)>}v54yut~pykaNye4axEK#5@?TSsQ zE;Jvf9I$GVb|S`7$pG)4vgo9NXsKr?u=F!GnA%VS2z$@Z(!MR9?EPcAqi5ft)Iz6sNl`%kj+_H-X`R<>BFrBW=fSlD|{`D%@Rcbu2?%>t7i34k?Ujb)2@J-`j#4 zLK<69qcUuniIan-$A1+fR=?@+thwDIXtF1Tks@Br-xY zfB+zblrR(ke`U;6U~-;p1Kg8Lh6v~LjW@9l2P6s+?$2!ZRPX`(ZkRGe7~q(4&gEi<$ch`5kQ?*1=GSqkeV z{SA1EaW_A!t{@^UY2D^YO0(H@+kFVzZaAh0_`A`f(}G~EP~?B|%gtxu&g%^x{EYSz zk+T;_c@d;+n@$<>V%P=nk36?L!}?*=vK4>nJSm+1%a}9UlmTJTrfX4{Lb7smNQn@T zw9p2%(Zjl^bWGo1;DuMHN(djsEm)P8mEC2sL@KyPjwD@d%QnZ$ zMJ3cnn!_!iP{MzWk%PI&D?m?C(y2d|2VChluN^yHya(b`h>~GkI1y;}O_E57zOs!{ zt2C@M$^PR2U#(dZmA-sNreB@z-yb0Bf7j*yONhZG=onhx>t4)RB`r6&TP$n zgmN*)eCqvgriBO-abHQ8ECN0bw?z5Bxpx z=jF@?zFdVn?@gD5egM4o$m`}lV(CWrOKKq(sv*`mNcHcvw&Xryfw<{ch{O&qc#WCTXX6=#{MV@q#iHYba!OUY+MGeNTjP%Fj!WgM&`&RlI^=AWTOqy-o zHo9YFt!gQ*p7{Fl86>#-JLZo(b^O`LdFK~OsZBRR@6P?ad^Ujbqm_j^XycM4ZHFyg ziUbIFW#2tj`65~#2V!4z7DM8Z;fG0|APaQ{a2VNYpNotB7eZ5kp+tPDz&Lqs0j%Y4tA*URpcfi z_M(FD=fRGdqf430j}1z`O0I=;tLu81bwJXdYiN7_&a-?ly|-j*+=--XGvCq#32Gh(=|qj5F?kmihk{%M&$}udW5)DHK zF_>}5R8&&API}o0osZJRL3n~>76nUZ&L&iy^s>PMnNcYZ|9*1$v-bzbT3rpWsJ+y{ zPrg>5Zlery96Um?lc6L|)}&{992{_$J&=4%nRp9BAC6!IB=A&=tF>r8S*O-=!G(_( zwXbX_rGZgeiK*&n5E;f=k{ktyA1(;x_kiMEt0*gpp_4&(twlS2e5C?NoD{n>X2AT# zY@Zp?#!b1zNq96MQqeO*M1MMBin5v#RH52&Xd~DO6-BZLnA6xO1$sou(YJ1Dlc{WF zVa%2DyYm`V#81jP@70IJ;DX@y*iUt$MLm)ByAD$eUuji|5{ptFYq(q)mE(5bOpxjM z^Q`AHWq44SG3`_LxC9fwR)XRVIp=B%<(-lOC3jI#bb@dK(*vjom!=t|#<@dZql%>O z15y^{4tQoeW9Lu%G&V$90x6F)xN6y_oIn;!Q zs)8jT$;&;u%Y>=T3hg34A-+Y*na=|glcStr5D;&5*t5*DmD~x;zQAV5{}Ya`?RRGa zT*t9@$a~!co;pD^!J5bo?lDOWFx%)Y=-fJ+PDGc0>;=q=s?P4aHForSB+)v0WY2JH z?*`O;RHum6j%#LG)Vu#ciO#+jRC3!>T(9fr+XE7T2B7Z|0nR5jw@WG)kDDzTJ=o4~ zUpeyt7}_nd`t}j9BKqryOha{34erm)RmST)_9Aw)@ zHbiyg5n&E{_CQR@h<}34d7WM{s{%5wdty1l+KX8*?+-YkNK2Be*6&jc>@{Fd;Ps|| z26LqdI3#9le?;}risDq$K5G3yoqK}C^@-8z^wj%tdgw-6@F#Ju{Sg7+y)L?)U$ez> zoOaP$UFZ?y5BiFycir*pnaAaY+|%1%8&|(@VB)zweR%?IidwJyK5J!STzw&2RFx zZV@qeaCB01Hu#U9|1#=Msc8Pgz5P*4Lrp!Q+~(G!OiNR{qa7|r^H?FC6gVhkk3y7=uW#Sh;&>78bZ}aK*C#NH$9rX@M3f{nckYI+5QG?Aj1DM)@~z_ zw!UAD@gedTlePB*%4+55naJ8ak_;))#S;4ji!LOqY5VRI){GMwHR~}6t4g>5C_#U# ztYC!tjKjrKvRy=GAsJVK++~$|+s!w9z3H4G^mACv=EErXNSmH7qN}%PKcN|8%9=i)qS5+$L zu&ya~HW%RMVJi4T^pv?>mw*Gf<)-7gf#Qj|e#w2|v4#t!%Jk{&xlf;$_?jW*n!Pyx zkG$<18kiLOAUPuFfyu-EfWX%4jYnjBYc~~*9JEz6oa)_R|8wjZA|RNrAp%}14L7fW zi7A5Wym*K+V8pkqqO-X#3ft{0qs?KVt^)?kS>AicmeO&q+~J~ zp0YJ_P~_a8j= zsAs~G=8F=M{4GZL{|B__UorX@MRNQLn?*_gym4aW(~+i13knnk1P=khoC-ViMZk+x zLW(l}oAg1H`dU+Fv**;qw|ANDSRs>cGqL!Yw^`; zv;{E&8CNJcc)GHzTYM}f&NPw<6j{C3gaeelU#y!M)w-utYEHOCCJo|Vgp7K6C_$14 zqIrLUB0bsgz^D%V%fbo2f9#yb#CntTX?55Xy|Kps&Xek*4_r=KDZ z+`TQuv|$l}MWLzA5Ay6Cvsa^7xvwXpy?`w(6vx4XJ zWuf1bVSb#U8{xlY4+wlZ$9jjPk)X_;NFMqdgq>m&W=!KtP+6NL57`AMljW+es zzqjUjgz;V*kktJI?!NOg^s_)ph45>4UDA!Vo0hn>KZ+h-3=?Y3*R=#!fOX zP$Y~+14$f66ix?UWB_6r#fMcC^~X4R-<&OD1CSDNuX~y^YwJ>sW0j`T<2+3F9>cLo z#!j57$ll2K9(%$4>eA7(>FJX5e)pR5&EZK!IMQzOfik#FU*o*LGz~7u(8}XzIQRy- z!U7AlMTIe|DgQFmc%cHy_9^{o`eD%ja_L>ckU6$O4*U**o5uR7`FzqkU8k4gxtI=o z^P^oGFPm5jwZMI{;nH}$?p@uV8FT4r=|#GziKXK07bHJLtK}X%I0TON$uj(iJ`SY^ zc$b2CoxCQ>7LH@nxcdW&_C#fMYBtTxcg46dL{vf%EFCZ~eErMvZq&Z%Lhumnkn^4A zsx$ay(FnN7kYah}tZ@0?-0Niroa~13`?hVi6`ndno`G+E8;$<6^gsE-K3)TxyoJ4M zb6pj5=I8^FD5H@`^V#Qb2^0cx7wUz&cruA5g>6>qR5)O^t1(-qqP&1g=qvY#s&{bx zq8Hc%LsbK1*%n|Y=FfojpE;w~)G0-X4i*K3{o|J7`krhIOd*c*$y{WIKz2n2*EXEH zT{oml3Th5k*vkswuFXdGDlcLj15Nec5pFfZ*0?XHaF_lVuiB%Pv&p7z)%38}%$Gup zVTa~C8=cw%6BKn_|4E?bPNW4PT7}jZQLhDJhvf4z;~L)506IE0 zX!tWXX(QOQPRj-p80QG79t8T2^az4Zp2hOHziQlvT!|H)jv{Ixodabzv6lBj)6WRB z{)Kg@$~~(7$-az?lw$4@L%I&DI0Lo)PEJJziWP33a3azb?jyXt1v0N>2kxwA6b%l> zZqRpAo)Npi&loWbjFWtEV)783BbeIAhqyuc+~>i7aQ8shIXt)bjCWT6$~ro^>99G} z2XfmT0(|l!)XJb^E!#3z4oEGIsL(xd; zYX1`1I(cG|u#4R4T&C|m*9KB1`UzKvho5R@1eYtUL9B72{i(ir&ls8g!pD ztR|25xGaF!4z5M+U@@lQf(12?xGy`!|3E}7pI$k`jOIFjiDr{tqf0va&3pOn6Pu)% z@xtG2zjYuJXrV)DUrIF*y<1O1<$#54kZ#2;=X51J^F#0nZ0(;S$OZDt_U2bx{RZ=Q zMMdd$fH|!s{ zXq#l;{`xfV`gp&C>A`WrQU?d{!Ey5(1u*VLJt>i27aZ-^&2IIk=zP5p+{$q(K?2(b z8?9h)kvj9SF!Dr zoyF}?V|9;6abHxWk2cEvGs$-}Pg}D+ZzgkaN&$Snp%;5m%zh1E#?Wac-}x?BYlGN#U#Mek*}kek#I9XaHt?mz3*fDrRTQ#&#~xyeqJk1QJ~E$7qsw6 z?sV;|?*=-{M<1+hXoj?@-$y+(^BJ1H~wQ9G8C0#^aEAyhDduNX@haoa=PuPp zYsGv8UBfQaRHgBgLjmP^eh>fLMeh{8ic)?xz?#3kX-D#Z{;W#cd_`9OMFIaJg-=t`_3*!YDgtNQ2+QUEAJB9M{~AvT$H`E)IKmCR21H532+ata8_i_MR@ z2Xj<3w<`isF~Ah$W{|9;51ub*f4#9ziKrOR&jM{x7I_7()O@`F*5o$KtZ?fxU~g`t zUovNEVKYn$U~VX8eR)qb`7;D8pn*Pp$(otYTqL)5KH$lUS-jf}PGBjy$weoceAcPp z&5ZYB$r&P$MN{0H0AxCe4Qmd3T%M*5d4i%#!nmBCN-WU-4m4Tjxn-%j3HagwTxCZ9 z)j5vO-C7%s%D!&UfO>bi2oXiCw<-w{vVTK^rVbv#W=WjdADJy8$khnU!`ZWCIU`># zyjc^1W~pcu>@lDZ{zr6gv%)2X4n27~Ve+cQqcND%0?IFSP4sH#yIaXXYAq^z3|cg` z`I3$m%jra>e2W-=DiD@84T!cb%||k)nPmEE09NC%@PS_OLhkrX*U!cgD*;;&gIaA(DyVT4QD+q_xu z>r`tg{hiGY&DvD-)B*h+YEd+Zn)WylQl}<4>(_NlsKXCRV;a)Rcw!wtelM2_rWX`j zTh5A|i6=2BA(iMCnj_fob@*eA;V?oa4Z1kRBGaU07O70fb6-qmA$Hg$ps@^ka1=RO zTbE_2#)1bndC3VuK@e!Sftxq4=Uux}fDxXE#Q5_x=E1h>T5`DPHz zbH<_OjWx$wy7=%0!mo*qH*7N4tySm+R0~(rbus`7;+wGh;C0O%x~fEMkt!eV>U$`i z5>Q(o z=t$gPjgGh0&I7KY#k50V7DJRX<%^X z>6+ebc9efB3@eE2Tr){;?_w`vhgF>`-GDY(YkR{9RH(MiCnyRtd!LxXJ75z+?2 zGi@m^+2hKJ5sB1@Xi@s_@p_Kwbc<*LQ_`mr^Y%j}(sV_$`J(?_FWP)4NW*BIL~sR>t6 zM;qTJZ~GoY36&{h-Pf}L#y2UtR}>ZaI%A6VkU>vG4~}9^i$5WP2Tj?Cc}5oQxe2=q z8BeLa$hwCg_psjZyC2+?yX4*hJ58Wu^w9}}7X*+i5Rjqu5^@GzXiw#SUir1G1`jY% zOL=GE_ENYxhcyUrEt9XlMNP6kx6h&%6^u3@zB8KUCAa18T(R2J`%JjWZ z!{7cXaEW+Qu*iJPu+m>QqW}Lo$4Z+!I)0JNzZ&_M%=|B1yejFRM04bGAvu{=lNPd+ zJRI^DRQ(?FcVUD+bgEcAi@o(msqys9RTCG#)TjI!9~3-dc`>gW;HSJuQvH~d`MQs86R$|SKXHh zqS9Qy)u;T`>>a!$LuaE2keJV%;8g)tr&Nnc;EkvA-RanHXsy)D@XN0a>h}z2j81R; zsUNJf&g&rKpuD0WD@=dDrPHdBoK42WoBU|nMo17o(5^;M|dB4?|FsAGVrSyWcI`+FVw^vTVC`y}f(BwJl zrw3Sp151^9=}B})6@H*i4-dIN_o^br+BkcLa^H56|^2XsT0dESw2 zMX>(KqNl=x2K5=zIKg}2JpGAZu{I_IO}0$EQ5P{4zol**PCt3F4`GX}2@vr8#Y)~J zKb)gJeHcFnR@4SSh%b;c%J`l=W*40UPjF#q{<}ywv-=vHRFmDjv)NtmC zQx9qm)d%0zH&qG7AFa3VAU1S^(n8VFTC~Hb+HjYMjX8r#&_0MzlNR*mnLH5hi}`@{ zK$8qiDDvS_(L9_2vHgzEQ${DYSE;DqB!g*jhJghE&=LTnbgl&Xepo<*uRtV{2wDHN z)l;Kg$TA>Y|K8Lc&LjWGj<+bp4Hiye_@BfU(y#nF{fpR&|Ltbye?e^j0}8JC4#xi% zv29ZR%8%hk=3ZDvO-@1u8KmQ@6p%E|dlHuy#H1&MiC<*$YdLkHmR#F3ae;bKd;@*i z2_VfELG=B}JMLCO-6UQy^>RDE%K4b>c%9ki`f~Z2Qu8hO7C#t%Aeg8E%+}6P7Twtg z-)dj(w}_zFK&86KR@q9MHicUAucLVshUdmz_2@32(V`y3`&Kf8Q2I)+!n0mR=rrDU zXvv^$ho;yh*kNqJ#r1}b0|i|xRUF6;lhx$M*uG3SNLUTC@|htC z-=fsw^F%$qqz4%QdjBrS+ov}Qv!z00E+JWas>p?z@=t!WWU3K*?Z(0meTuTOC7OTx zU|kFLE0bLZ+WGcL$u4E}5dB0g`h|uwv3=H6f+{5z9oLv-=Q45+n~V4WwgO=CabjM% zBAN+RjM65(-}>Q2V#i1Na@a0`08g&y;W#@sBiX6Tpy8r}*+{RnyGUT`?XeHSqo#|J z^ww~c;ou|iyzpErDtlVU=`8N7JSu>4M z_pr9=tX0edVn9B}YFO2y(88j#S{w%E8vVOpAboK*27a7e4Ekjt0)hIX99*1oE;vex z7#%jhY=bPijA=Ce@9rRO(Vl_vnd00!^TAc<+wVvRM9{;hP*rqEL_(RzfK$er_^SN; z)1a8vo8~Dr5?;0X0J62Cusw$A*c^Sx1)dom`-)Pl7hsW4i(r*^Mw`z5K>!2ixB_mu z*Ddqjh}zceRFdmuX1akM1$3>G=#~|y?eYv(e-`Qy?bRHIq=fMaN~fB zUa6I8Rt=)jnplP>yuS+P&PxeWpJ#1$F`iqRl|jF$WL_aZFZl@kLo&d$VJtu&w?Q0O zzuXK>6gmygq(yXJy0C1SL}T8AplK|AGNUOhzlGeK_oo|haD@)5PxF}rV+5`-w{Aag zus45t=FU*{LguJ11Sr-28EZkq;!mJO7AQGih1L4rEyUmp>B!%X0YemsrV3QFvlgt* z5kwlPzaiJ+kZ^PMd-RRbl(Y?F*m`4*UIhIuf#8q>H_M=fM*L_Op-<_r zBZagV=4B|EW+KTja?srADTZXCd3Yv%^Chfpi)cg{ED${SI>InNpRj5!euKv?=Xn92 zsS&FH(*w`qLIy$doc>RE&A5R?u zzkl1sxX|{*fLpXvIW>9d<$ePROttn3oc6R!sN{&Y+>Jr@yeQN$sFR z;w6A<2-0%UA?c8Qf;sX7>>uKRBv3Ni)E9pI{uVzX|6Bb0U)`lhLE3hK58ivfRs1}d zNjlGK0hdq0qjV@q1qI%ZFMLgcpWSY~mB^LK)4GZ^h_@H+3?dAe_a~k*;9P_d7%NEFP6+ zgV(oGr*?W(ql?6SQ~`lUsjLb%MbfC4V$)1E0Y_b|OIYxz4?O|!kRb?BGrgiH5+(>s zoqM}v*;OBfg-D1l`M6T6{K`LG+0dJ1)!??G5g(2*vlNkm%Q(MPABT$r13q?|+kL4- zf)Mi5r$sn;u41aK(K#!m+goyd$c!KPl~-&-({j#D4^7hQkV3W|&>l_b!}!z?4($OA z5IrkfuT#F&S1(`?modY&I40%gtroig{YMvF{K{>5u^I51k8RriGd${z)=5k2tG zM|&Bp5kDTfb#vfuTTd?)a=>bX=lokw^y9+2LS?kwHQIWI~pYgy7 zb?A-RKVm_vM5!9?C%qYdfRAw& zAU7`up~%g=p@}pg#b7E)BFYx3g%(J36Nw(Dij!b>cMl@CSNbrW!DBDbTD4OXk!G4x zi}JBKc8HBYx$J~31PXH+4^x|UxK~(<@I;^3pWN$E=sYma@JP|8YL`L(zI6Y#c%Q{6 z*APf`DU$S4pr#_!60BH$FGViP14iJmbrzSrOkR;f3YZa{#E7Wpd@^4E-zH8EgPc-# zKWFPvh%WbqU_%ZEt`=Q?odKHc7@SUmY{GK`?40VuL~o)bS|is$Hn=<=KGHOsEC5tB zFb|q}gGlL97NUf$G$>^1b^3E18PZ~Pm9kX%*ftnolljiEt@2#F2R5ah$zbXd%V_Ev zyDd{1o_uuoBga$fB@Fw!V5F3jIr=a-ykqrK?WWZ#a(bglI_-8pq74RK*KfQ z0~Dzus7_l;pMJYf>Bk`)`S8gF!To-BdMnVw5M-pyu+aCiC5dwNH|6fgRsIKZcF&)g zr}1|?VOp}I3)IR@m1&HX1~#wsS!4iYqES zK}4J{Ei>;e3>LB#Oly>EZkW14^@YmpbgxCDi#0RgdM${&wxR+LiX}B+iRioOB0(pDKpVEI;ND?wNx>%e|m{RsqR_{(nmQ z3ZS}@t!p4a(BKx_-CYwrcyJ5u1TO9bcXti$8sy>xcLKqKCc#~UOZYD{llKTSFEjJ~ zyNWt>tLU}*>^`TvPxtP%F`ZJQw@W0^>x;!^@?k_)9#bF$j0)S3;mH-IR5y82l|%=F z2lR8zhP?XNP-ucZZ6A+o$xOyF!w;RaLHGh57GZ|TCXhJqY~GCh)aXEV$1O&$c}La1 zjuJxkY9SM4av^Hb;i7efiYaMwI%jGy`3NdY)+mcJhF(3XEiSlU3c|jMBi|;m-c?~T z+x0_@;SxcoY=(6xNgO$bBt~Pj8`-<1S|;Bsjrzw3@zSjt^JC3X3*$HI79i~!$RmTz zsblZsLYs7L$|=1CB$8qS!tXrWs!F@BVuh?kN(PvE5Av-*r^iYu+L^j^m9JG^#=m>@ z=1soa)H*w6KzoR$B8mBCXoU;f5^bVuwQ3~2LKg!yxomG1#XPmn(?YH@E~_ED+W6mxs%x{%Z<$pW`~ON1~2XjP5v(0{C{+6Dm$00tsd3w=f=ZENy zOgb-=f}|Hb*LQ$YdWg<(u7x3`PKF)B7ZfZ6;1FrNM63 z?O6tE%EiU@6%rVuwIQjvGtOofZBGZT1Sh(xLIYt9c4VI8`!=UJd2BfLjdRI#SbVAX ziT(f*RI^T!IL5Ac>ql7uduF#nuCRJ1)2bdvAyMxp-5^Ww5p#X{rb5)(X|fEhDHHW{ zw(Lfc$g;+Q`B0AiPGtmK%*aWfQQ$d!*U<|-@n2HZvCWSiw^I>#vh+LyC;aaVWGbmkENr z&kl*8o^_FW$T?rDYLO1Pyi%>@&kJKQoH2E0F`HjcN}Zlnx1ddoDA>G4Xu_jyp6vuT zPvC}pT&Owx+qB`zUeR|4G;OH(<<^_bzkjln0k40t`PQxc$7h(T8Ya~X+9gDc8Z9{Z z&y0RAU}#_kQGrM;__MK9vwIwK^aoqFhk~dK!ARf1zJqHMxF2?7-8|~yoO@_~Ed;_wvT%Vs{9RK$6uUQ|&@#6vyBsFK9eZW1Ft#D2)VpQRwpR(;x^ zdoTgMqfF9iBl%{`QDv7B0~8{8`8k`C4@cbZAXBu00v#kYl!#_Wug{)2PwD5cNp?K^ z9+|d-4z|gZ!L{57>!Ogfbzchm>J1)Y%?NThxIS8frAw@z>Zb9v%3_3~F@<=LG%r*U zaTov}{{^z~SeX!qgSYow`_5)ij*QtGp4lvF`aIGQ>@3ZTkDmsl#@^5*NGjOuu82}o zzLF~Q9SW+mP=>88%eSA1W4_W7-Q>rdq^?t=m6}^tDPaBRGFLg%ak93W!kOp#EO{6& zP%}Iff5HZQ9VW$~+9r=|Quj#z*=YwcnssS~9|ub2>v|u1JXP47vZ1&L1O%Z1DsOrDfSIMHU{VT>&>H=9}G3i@2rP+rx@eU@uE8rJNec zij~#FmuEBj03F1~ct@C@$>y)zB+tVyjV3*n`mtAhIM0$58vM9jOQC}JJOem|EpwqeMuYPxu3sv}oMS?S#o6GGK@8PN59)m&K4Dc&X% z(;XL_kKeYkafzS3Wn5DD>Yiw{LACy_#jY4op(>9q>>-*9@C0M+=b#bknAWZ37^(Ij zq>H%<@>o4a#6NydoF{_M4i4zB_KG)#PSye9bk0Ou8h%1Dtl7Q_y#7*n%g)?m>xF~( zjqvOwC;*qvN_3(*a+w2|ao0D?@okOvg8JskUw(l7n`0fncglavwKd?~l_ryKJ^Ky! zKCHkIC-o7%fFvPa$)YNh022lakMar^dgL=t#@XLyNHHw!b?%WlM)R@^!)I!smZL@k zBi=6wE5)2v&!UNV(&)oOYW(6Qa!nUjDKKBf-~Da=#^HE4(@mWk)LPvhyN3i4goB$3K8iV7uh zsv+a?#c4&NWeK(3AH;ETrMOIFgu{_@%XRwCZ;L=^8Ts)hix4Pf3yJRQ<8xb^CkdmC z?c_gB)XmRsk`9ch#tx4*hO=#qS7={~Vb4*tTf<5P%*-XMfUUYkI9T1cEF;ObfxxI-yNuA=I$dCtz3ey znVkctYD*`fUuZ(57+^B*R=Q}~{1z#2!ca?)+YsRQb+lt^LmEvZt_`=j^wqig+wz@n@ z`LIMQJT3bxMzuKg8EGBU+Q-6cs5(@5W?N>JpZL{$9VF)veF`L5%DSYTNQEypW%6$u zm_~}T{HeHj1bAlKl8ii92l9~$dm=UM21kLemA&b$;^!wB7#IKWGnF$TVq!!lBlG4 z{?Rjz?P(uvid+|i$VH?`-C&Gcb3{(~Vpg`w+O);Wk1|Mrjxrht0GfRUnZqz2MhrXa zqgVC9nemD5)H$to=~hp)c=l9?#~Z_7i~=U-`FZxb-|TR9@YCxx;Zjo-WpMNOn2)z) zFPGGVl%3N$f`gp$gPnWC+f4(rmts%fidpo^BJx72zAd7|*Xi{2VXmbOm)1`w^tm9% znM=0Fg4bDxH5PxPEm{P3#A(mxqlM7SIARP?|2&+c7qmU8kP&iApzL|F>Dz)Ixp_`O zP%xrP1M6@oYhgo$ZWwrAsYLa4 z|I;DAvJxno9HkQrhLPQk-8}=De{9U3U%)dJ$955?_AOms!9gia%)0E$Mp}$+0er@< zq7J&_SzvShM?e%V?_zUu{niL@gt5UFOjFJUJ}L?$f%eU%jUSoujr{^O=?=^{19`ON zlRIy8Uo_nqcPa6@yyz`CM?pMJ^^SN^Fqtt`GQ8Q#W4kE7`V9^LT}j#pMChl!j#g#J zr-=CCaV%xyFeQ9SK+mG(cTwW*)xa(eK;_Z(jy)woZp~> zA(4}-&VH+TEeLzPTqw&FOoK(ZjD~m{KW05fiGLe@E3Z2`rLukIDahE*`u!ubU)9`o zn^-lyht#E#-dt~S>}4y$-mSbR8{T@}22cn^refuQ08NjLOv?JiEWjyOnzk<^R5%gO zhUH_B{oz~u#IYwVnUg8?3P*#DqD8#X;%q%HY**=I>>-S|!X*-!x1{^l#OnR56O>iD zc;i;KS+t$koh)E3)w0OjWJl_aW2;xF=9D9Kr>)(5}4FqUbk# zI#$N8o0w;IChL49m9CJTzoC!|u{Ljd%ECgBOf$}&jA^$(V#P#~)`&g`H8E{uv52pp zwto`xUL-L&WTAVREEm$0g_gYPL(^vHq(*t1WCH_6alhkeW&GCZ3hL)|{O-jiFOBrF z!EW=Jej|dqQitT6!B-7&io2K)WIm~Q)v@yq%U|VpV+I?{y0@Yd%n8~-NuuM*pM~KA z85YB};IS~M(c<}4Hxx>qRK0cdl&e?t253N%vefkgds>Ubn8X}j6Vpgs>a#nFq$osY z1ZRwLqFv=+BTb=i%D2Wv>_yE0z}+niZ4?rE|*a3d7^kndWGwnFqt+iZ(7+aln<}jzbAQ(#Z2SS}3S$%Bd}^ zc9ghB%O)Z_mTZMRC&H#)I#fiLuIkGa^`4e~9oM5zKPx?zjkC&Xy0~r{;S?FS%c7w< zWbMpzc(xSw?9tGxG~_l}Acq}zjt5ClaB7-!vzqnlrX;}$#+PyQ9oU)_DfePh2E1<7 ztok6g6K^k^DuHR*iJ?jw?bs_whk|bx`dxu^nC6#e{1*m~z1eq7m}Cf$*^Eua(oi_I zAL+3opNhJteu&mWQ@kQWPucmiP)4|nFG`b2tpC;h{-PI@`+h?9v=9mn|0R-n8#t=+Z*FD(c5 zjj79Jxkgck*DV=wpFgRZuwr%}KTm+dx?RT@aUHJdaX-ODh~gByS?WGx&czAkvkg;x zrf92l8$Or_zOwJVwh>5rB`Q5_5}ef6DjS*$x30nZbuO3dijS*wvNEqTY5p1_A0gWr znH<(Qvb!os14|R)n2Ost>jS2;d1zyLHu`Svm|&dZD+PpP{Bh>U&`Md;gRl64q;>{8MJJM$?UNUd`aC>BiLe>*{ zJY15->yW+<3rLgYeTruFDtk1ovU<$(_y7#HgUq>)r0{^}Xbth}V#6?%5jeFYt;SG^ z3qF)=uWRU;Jj)Q}cpY8-H+l_n$2$6{ZR?&*IGr{>ek!69ZH0ZoJ*Ji+ezzlJ^%qL3 zO5a`6gwFw(moEzqxh=yJ9M1FTn!eo&qD#y5AZXErHs%22?A+JmS&GIolml!)rZTnUDM3YgzYfT#;OXn)`PWv3Ta z!-i|-Wojv*k&bC}_JJDjiAK(Ba|YZgUI{f}TdEOFT2+}nPmttytw7j%@bQZDV1vvj z^rp{gRkCDmYJHGrE1~e~AE!-&6B6`7UxVQuvRrfdFkGX8H~SNP_X4EodVd;lXd^>eV1jN+Tt4}Rsn)R0LxBz0c=NXU|pUe!MQQFkGBWbR3&(jLm z%RSLc#p}5_dO{GD=DEFr=Fc% z85CBF>*t!6ugI?soX(*JNxBp+-DdZ4X0LldiK}+WWGvXV(C(Ht|!3$psR=&c*HIM=BmX;pRIpz@Ale{9dhGe(U2|Giv;# zOc|;?p67J=Q(kamB*aus=|XP|m{jN^6@V*Bpm?ye56Njh#vyJqE=DweC;?Rv7faX~ zde03n^I~0B2vUmr;w^X37tVxUK?4}ifsSH5_kpKZIzpYu0;Kv}SBGfI2AKNp+VN#z`nI{UNDRbo-wqa4NEls zICRJpu)??cj^*WcZ^MAv+;bDbh~gpN$1Cor<{Y2oyIDws^JsfW^5AL$azE(T0p&pP z1Mv~6Q44R&RHoH95&OuGx2srIr<@zYJTOMKiVs;Bx3py89I87LOb@%mr`0)#;7_~Z zzcZj8?w=)>%5@HoCHE_&hnu(n_yQ-L(~VjpjjkbT7e)Dk5??fApg(d>vwLRJ-x{um z*Nt?DqTSxh_MIyogY!vf1mU1`Gld-&L)*43f6dilz`Q@HEz;+>MDDYv9u!s;WXeao zUq=TaL$P*IFgJzrGc>j1dDOd zed+=ZBo?w4mr$2)Ya}?vedDopomhW1`#P<%YOJ_j=WwClX0xJH-f@s?^tmzs_j7t!k zK@j^zS0Q|mM4tVP5Ram$VbS6|YDY&y?Q1r1joe9dj08#CM{RSMTU}(RCh`hp_Rkl- zGd|Cv~G@F{DLhCizAm9AN!^{rNs8hu!G@8RpnGx7e`-+K$ffN<0qjR zGq^$dj_Tv!n*?zOSyk5skI7JVKJ)3jysnjIu-@VSzQiP8r6MzudCU=~?v-U8yzo^7 zGf~SUTvEp+S*!X9uX!sq=o}lH;r{pzk~M*VA(uyQ`3C8!{C;)&6)95fv(cK!%Cuz$ z_Zal57H6kPN>25KNiI6z6F)jzEkh#%OqU#-__Xzy)KyH};81#N6OfX$$IXWzOn`Q& z4f$Z1t>)8&8PcYfEwY5UadU1yg+U*(1m2ZlHoC-!2?gB!!fLhmTl))D@dhvkx#+Yj z1O=LV{(T%{^IeCuFK>%QR!VZ4GnO5tK8a+thWE zg4VytZrwcS?7^ zuZfhYnB8dwd%VLO?DK7pV5Wi<(`~DYqOXn8#jUIL^)12*Dbhk4GmL_E2`WX&iT16o zk(t|hok(Y|v-wzn?4x34T)|+SfZP>fiq!><*%vnxGN~ypST-FtC+@TPv*vYv@iU!_ z@2gf|PrgQ?Ktf*9^CnJ(x*CtZVB8!OBfg0%!wL;Z8(tYYre0vcnPGlyCc$V(Ipl*P z_(J!a=o@vp^%Efme!K74(Ke7A>Y}|sxV+JL^aYa{~m%5#$$+R1? zGaQhZTTX!#s#=Xtpegqero$RNt&`4xn3g$)=y*;=N=Qai)}~`xtxI_N*#MMCIq#HFifT zz(-*m;pVH&+4bixL&Bbg)W5FN^bH87pAHp)zPkWNMfTFqS=l~AC$3FX3kQUSh_C?-ZftyClgM)o_D7cX$RGlEYblux0jv5 zTr|i-I3@ZPCGheCl~BGhImF)K4!9@?pC(gi3ozX=a!|r1)LFxy_8c&wY0<^{2cm|P zv6Y`QktY*;I)IUd5y3ne1CqpVanlY45z8hf4&$EUBnucDj16pDa4&GI&TArYhf*xh zdj>*%APH8(h~c>o@l#%T>R$e>rwVx_WUB|~V`p^JHsg*y12lzj&zF}w6W09HwB2yb z%Q~`es&(;7#*DUC_w-Dmt7|$*?TA_m;zB+-u{2;Bg{O}nV7G_@7~<)Bv8fH^G$XG8$(&{A zwXJK5LRK%M34(t$&NI~MHT{UQ9qN-V_yn|%PqC81EIiSzmMM=2zb`mIwiP_b)x+2M z7Gd`83h79j#SItpQ}luuf2uOU`my_rY5T{6P#BNlb%h%<#MZb=m@y5aW;#o1^2Z)SWo+b`y0gV^iRcZtz5!-05vF z7wNo=hc6h4hc&s@uL^jqRvD6thVYtbErDK9k!;+a0xoE0WL7zLixjn5;$fXvT=O3I zT6jI&^A7k6R{&5#lVjz#8%_RiAa2{di{`kx79K+j72$H(!ass|B%@l%KeeKchYLe_ z>!(JC2fxsv>XVen+Y42GeYPxMWqm`6F$(E<6^s|g(slNk!lL*6v^W2>f6hh^mE$s= z3D$)}{V5(Qm&A6bp%2Q}*GZ5Qrf}n7*Hr51?bJOyA-?B4vg6y_EX<*-e20h{=0Mxs zbuQGZ$fLyO5v$nQ&^kuH+mNq9O#MWSfThtH|0q1i!NrWj^S}_P;Q1OkYLW6U^?_7G zx2wg?CULj7))QU(n{$0JE%1t2dWrMi2g-Os{v|8^wK{@qlj%+1b^?NI z$}l2tjp0g>K3O+p%yK<9!XqmQ?E9>z&(|^Pi~aSRwI5x$jaA62GFz9%fmO3t3a>cq zK8Xbv=5Ps~4mKN5+Eqw12(!PEyedFXv~VLxMB~HwT1Vfo51pQ#D8e$e4pFZ{&RC2P z5gTIzl{3!&(tor^BwZfR8j4k{7Rq#`riKXP2O-Bh66#WWK2w=z;iD9GLl+3 zpHIaI4#lQ&S-xBK8PiQ%dwOh?%BO~DCo06pN7<^dnZCN@NzY{_Z1>rrB0U|nC&+!2 z2y!oBcTd2;@lzyk(B=TkyZ)zy0deK05*Q0zk+o$@nun`VI1Er7pjq>8V zNmlW{p7S^Btgb(TA}jL(uR>`0w8gHP^T~Sh5Tkip^spk4SBAhC{TZU}_Z)UJw-}zm zPq{KBm!k)?P{`-(9?LFt&YN4s%SIZ-9lJ!Ws~B%exHOeVFk3~}HewnnH(d)qkLQ_d z6h>O)pEE{vbOVw}E+jdYC^wM+AAhaI(YAibUc@B#_mDss0Ji&BK{WG`4 zOk>vSNq(Bq2IB@s>>Rxm6Wv?h;ZXkpb1l8u|+_qXWdC*jjcPCixq;!%BVPSp#hP zqo`%cNf&YoQXHC$D=D45RiT|5ngPlh?0T~?lUf*O)){K@*Kbh?3RW1j9-T?%lDk@y z4+~?wKI%Y!-=O|_IuKz|=)F;V7ps=5@g)RrE;;tvM$gUhG>jHcw2Hr@fS+k^Zr~>G z^JvPrZc}_&d_kEsqAEMTMJw!!CBw)u&ZVzmq+ZworuaE&TT>$pYsd9|g9O^0orAe8 z221?Va!l1|Y5X1Y?{G7rt1sX#qFA^?RLG^VjoxPf63;AS=_mVDfGJKg73L zsGdnTUD40y(>S##2l|W2Cy!H(@@5KBa(#gs`vlz}Y~$ot5VsqPQ{{YtjYFvIumZzt zA{CcxZLJR|4#{j7k~Tu*jkwz8QA|5G1$Cl895R`Zyp;irp1{KN){kB30O8P1W5;@bG znvX74roeMmQlUi=v9Y%(wl$ZC#9tKNFpvi3!C}f1m6Ct|l2g%psc{TJp)@yu)*e2> z((p0Fg*8gJ!|3WZke9;Z{8}&NRkv7iP=#_y-F}x^y?2m%-D_aj^)f04%mneyjo_;) z6qc_Zu$q37d~X``*eP~Q>I2gg%rrV8v=kDfpp$=%Vj}hF)^dsSWygoN(A$g*E=Do6FX?&(@F#7pbiJ`;c0c@Ul zDqW_90Wm#5f2L<(Lf3)3TeXtI7nhYwRm(F;*r_G6K@OPW4H(Y3O5SjUzBC}u3d|eQ8*8d@?;zUPE+i#QNMn=r(ap?2SH@vo*m z3HJ%XuG_S6;QbWy-l%qU;8x;>z>4pMW7>R}J%QLf%@1BY(4f_1iixd-6GlO7Vp*yU zp{VU^3?s?90i=!#>H`lxT!q8rk>W_$2~kbpz7eV{3wR|8E=8**5?qn8#n`*(bt1xRQrdGxyx2y%B$qmw#>ZV$c7%cO#%JM1lY$Y0q?Yuo> ze9KdJoiM)RH*SB%^;TAdX-zEjA7@%y=!0=Zg%iWK7jVI9b&Dk}0$Af&08KHo+ zOwDhFvA(E|ER%a^cdh@^wLUlmIv6?_3=BvX8jKk92L=Y}7Jf5OGMfh` zBdR1wFCi-i5@`9km{isRb0O%TX+f~)KNaEz{rXQa89`YIF;EN&gN)cigu6mNh>?Cm zAO&Im2flv6D{jwm+y<%WsPe4!89n~KN|7}Cb{Z;XweER73r}Qp2 zz}WP4j}U0&(uD&9yGy6`!+_v-S(yG*iytsTR#x_Rc>=6u^vnRDnf1gP{#2>`ffrAC% zTZ5WQ@hAK;P;>kX{D)mIXe4%a5p=LO1xXH@8T?mz7Q@d)$3pL{{B!2{-v70L*o1AO+|n5beiw~ zk@(>m?T3{2k2c;NWc^`4@P&Z?BjxXJ@;x1qhn)9Mn*IFdt_J-dIqx5#d`NfyfX~m( zIS~5)MfZ2Uy?_4W`47i}u0ZgPh<{D|w_d#;D}Q&U$Q-G}xM1A@1f{#%A$jh6Qp&0hQ<0bPOM z-{1Wm&p%%#eb_?x7i;bol EfAhh=DF6Tf literal 0 HcmV?d00001 diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 8c79a83ae4..642d572ce9 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,18 +1,2 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/README.md b/README.md index 4b9f9a4726..a48768de8e 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Project contains versions 2.0 and above: source code for earlier (1.x) versions | 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 (3.0) | [![codecov.io](https://codecov.io/github/FasterXML/jackson-core/coverage.svg?branch=master)](https://codecov.io/github/FasterXML/jackson-core?branch=master) | +| Code coverage (2.13) | [![codecov.io](https://codecov.io/github/FasterXML/jackson-core/coverage.svg?branch=2.13)](https://codecov.io/github/FasterXML/jackson-core?branch=2.13) | | CodeQ (LGTM.com) | [![LGTM alerts](https://img.shields.io/lgtm/alerts/g/FasterXML/jackson-core.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/FasterXML/jackson-core/alerts/) [![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/FasterXML/jackson-core.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/FasterXML/jackson-core/context:java) | | 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) | diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index a358795c05..0000000000 --- a/SECURITY.md +++ /dev/null @@ -1,22 +0,0 @@ -# Security Policy - -Last Updated: 2019-11-26 - -## Supported Versions - -Current status of open branches, with new releases, can be found from [Jackson Releases](https://github.com/FasterXML/jackson/wiki/Jackson-Releases) -wiki page - -## Reporting a Vulnerability - -The recommended mechanism for reporting possible security vulnerabilities follows -so-called "Coordinated Disclosure Plan" (see [definition of DCP](https://vuls.cert.org/confluence/display/Wiki/Coordinated+Vulnerability+Disclosure+Guidance) -for general idea). The first step is to file a [Tidelift security contact](https://tidelift.com/security): -Tidelift will route all reports via their system to maintainers of relevant package(s), and start the -process that will evaluate concern and issue possible fixes, send update notices and so on. -Note that you do not need to be a Tidelift subscriber to file a security contact. - -Alternatively you may also report possible vulnerabilities to `info` at fasterxml dot com -mailing address. Note that filing an issue to go with report is fine, but if you do that please -DO NOT include details of security problem in the issue but only in email contact. -This is important to give us time to provide a patch, if necessary, for the problem. diff --git a/docs/javadoc/3.0.2021-01/allclasses-frame.html b/docs/javadoc/3.0.2021-01/allclasses-frame.html deleted file mode 100644 index 59adc8af9e..0000000000 --- a/docs/javadoc/3.0.2021-01/allclasses-frame.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - -All Classes (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

All Classes

-
- -
- - diff --git a/docs/javadoc/3.0.2021-01/allclasses-noframe.html b/docs/javadoc/3.0.2021-01/allclasses-noframe.html deleted file mode 100644 index 543c6649a7..0000000000 --- a/docs/javadoc/3.0.2021-01/allclasses-noframe.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - -All Classes (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

All Classes

-
- -
- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variant.PaddingReadBehaviour.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variant.PaddingReadBehaviour.html deleted file mode 100644 index 449cd15cc6..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variant.PaddingReadBehaviour.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - -Base64Variant.PaddingReadBehaviour (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Enum Base64Variant.PaddingReadBehaviour

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        PADDING_FORBIDDEN

        -
        public static final Base64Variant.PaddingReadBehaviour PADDING_FORBIDDEN
        -
        Padding is not allowed in Base64 content being read (finding something - that looks like padding at the end of content results in an exception)
        -
      • -
      - - - -
        -
      • -

        PADDING_REQUIRED

        -
        public static final Base64Variant.PaddingReadBehaviour PADDING_REQUIRED
        -
        Padding is required in Base64 content being read - (missing padding for incomplete ending quartet results in an exception)
        -
      • -
      - - - -
        -
      • -

        PADDING_ALLOWED

        -
        public static final Base64Variant.PaddingReadBehaviour PADDING_ALLOWED
        -
        Padding is allowed but not required in Base64 content being read: no - exception thrown based on existence or absence, as long as proper - padding characters are used.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static Base64Variant.PaddingReadBehaviour[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (Base64Variant.PaddingReadBehaviour c : Base64Variant.PaddingReadBehaviour.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static Base64Variant.PaddingReadBehaviour valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variant.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variant.html deleted file mode 100644 index 6a04a64883..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variant.html +++ /dev/null @@ -1,1288 +0,0 @@ - - - - - - -Base64Variant (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class Base64Variant

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Named, Serializable
    -
    -
    -
    -
    public final class Base64Variant
    -extends Object
    -implements Named, Serializable
    -
    Class used to define specific details of which - variant of Base64 encoding/decoding is to be used. Although there is - somewhat standard basic version (so-called "MIME Base64"), other variants - exists, see Base64 Wikipedia entry for details.
    -
    -
    Author:
    -
    Tatu Saloranta
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        PADDING_CHAR_NONE

        -
        protected static final char PADDING_CHAR_NONE
        -
        Placeholder used by "no padding" variant, to be used when a character - value is needed.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        BASE64_VALUE_INVALID

        -
        public static final int BASE64_VALUE_INVALID
        -
        Marker used to denote ascii characters that do not correspond - to a 6-bit value (in this variant), and is not used as a padding - character.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        BASE64_VALUE_PADDING

        -
        public static final int BASE64_VALUE_PADDING
        -
        Marker used to denote ascii character (in decoding table) that - is the padding character using this variant (if any).
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Base64Variant

        -
        public Base64Variant(String name,
        -                     String base64Alphabet,
        -                     boolean writePadding,
        -                     char paddingChar,
        -                     int maxLineLength)
        -
      • -
      - - - -
        -
      • -

        Base64Variant

        -
        public Base64Variant(Base64Variant base,
        -                     String name,
        -                     int maxLineLength)
        -
        "Copy constructor" that can be used when the base alphabet is identical - to one used by another variant except for the maximum line length - (and obviously, name).
        -
        -
        Parameters:
        -
        base - Variant to use for settings not specific by other parameters
        -
        name - Name of this variant
        -
        maxLineLength - Maximum length (in characters) of lines to output before - using linefeed
        -
        -
      • -
      - - - -
        -
      • -

        Base64Variant

        -
        public Base64Variant(Base64Variant base,
        -                     String name,
        -                     boolean writePadding,
        -                     char paddingChar,
        -                     int maxLineLength)
        -
        "Copy constructor" that can be used when the base alphabet is identical - to one used by another variant, but other details (padding, maximum - line length) differ
        -
        -
        Parameters:
        -
        base - Variant to use for settings not specific by other parameters
        -
        name - Name of this variant
        -
        writePadding - Whether variant will use padding when encoding
        -
        paddingChar - Padding character used for encoding, excepted on reading, if any
        -
        maxLineLength - Maximum length (in characters) of lines to output before - using linefeed
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        withPaddingAllowed

        -
        public Base64Variant withPaddingAllowed()
        -
        -
        Returns:
        -
        Base64Variant which does not require padding on read
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        withPaddingRequired

        -
        public Base64Variant withPaddingRequired()
        -
        -
        Returns:
        -
        Base64Variant which requires padding on read
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        withPaddingForbidden

        -
        public Base64Variant withPaddingForbidden()
        -
        -
        Returns:
        -
        Base64Variant which does not accept padding on read
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        withReadPadding

        -
        public Base64Variant withReadPadding(Base64Variant.PaddingReadBehaviour readPadding)
        -
        -
        Parameters:
        -
        readPadding - Padding read behavior desired
        -
        Returns:
        -
        Instance with desired padding read behavior setting (this - if already has setting; new instance otherwise)
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        withWritePadding

        -
        public Base64Variant withWritePadding(boolean writePadding)
        -
        -
        Parameters:
        -
        writePadding - Determines if padding is output on write or not
        -
        Returns:
        -
        Base64Variant which writes padding or not depending on writePadding
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        readResolve

        -
        protected Object readResolve()
        -
      • -
      - - - -
        -
      • -

        getName

        -
        public String getName()
        -
        -
        Specified by:
        -
        getName in interface Named
        -
        -
      • -
      - - - -
        -
      • -

        usesPadding

        -
        public boolean usesPadding()
        -
        -
        Returns:
        -
        True if this Base64 encoding will write padding on output - (note: before Jackson 2.12 also dictated whether padding was accepted on read)
        -
        -
      • -
      - - - -
        -
      • -

        requiresPaddingOnRead

        -
        public boolean requiresPaddingOnRead()
        -
        -
        Returns:
        -
        True if this variant requires padding on content decoded; false if not.
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        acceptsPaddingOnRead

        -
        public boolean acceptsPaddingOnRead()
        -
        -
        Returns:
        -
        True if this variant accepts padding on content decoded; false if not.
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        usesPaddingChar

        -
        public boolean usesPaddingChar(char c)
        -
      • -
      - - - -
        -
      • -

        usesPaddingChar

        -
        public boolean usesPaddingChar(int ch)
        -
      • -
      - - - -
        -
      • -

        paddingReadBehaviour

        -
        public Base64Variant.PaddingReadBehaviour paddingReadBehaviour()
        -
        -
        Returns:
        -
        Indicator on how this Base64 encoding will handle possible padding - in content when reading.
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        getPaddingChar

        -
        public char getPaddingChar()
        -
      • -
      - - - -
        -
      • -

        getPaddingByte

        -
        public byte getPaddingByte()
        -
      • -
      - - - -
        -
      • -

        getMaxLineLength

        -
        public int getMaxLineLength()
        -
      • -
      - - - -
        -
      • -

        decodeBase64Char

        -
        public int decodeBase64Char(char c)
        -
        -
        Parameters:
        -
        c - Character to decode
        -
        Returns:
        -
        6-bit decoded value, if valid character;
        -
        -
      • -
      - - - -
        -
      • -

        decodeBase64Char

        -
        public int decodeBase64Char(int ch)
        -
      • -
      - - - -
        -
      • -

        decodeBase64Byte

        -
        public int decodeBase64Byte(byte b)
        -
      • -
      - - - -
        -
      • -

        encodeBase64BitsAsChar

        -
        public char encodeBase64BitsAsChar(int value)
        -
      • -
      - - - -
        -
      • -

        encodeBase64Chunk

        -
        public int encodeBase64Chunk(int b24,
        -                             char[] buffer,
        -                             int outPtr)
        -
        Method that encodes given right-aligned (LSB) 24-bit value - into 4 base64 characters, stored in given result buffer. - Caller must ensure there is sufficient space for 4 encoded characters - at specified position.
        -
        -
        Parameters:
        -
        b24 - 3-byte value to encode
        -
        buffer - Output buffer to append characters to
        -
        outPtr - Starting position within buffer to append encoded characters
        -
        Returns:
        -
        Pointer in output buffer after appending 4 encoded characters
        -
        -
      • -
      - - - -
        -
      • -

        encodeBase64Chunk

        -
        public void encodeBase64Chunk(StringBuilder sb,
        -                              int b24)
        -
      • -
      - - - -
        -
      • -

        encodeBase64Partial

        -
        public int encodeBase64Partial(int bits,
        -                               int outputBytes,
        -                               char[] buffer,
        -                               int outPtr)
        -
        Method that outputs partial chunk (which only encodes one - or two bytes of data). Data given is still aligned same as if - it as full data; that is, missing data is at the "right end" - (LSB) of int.
        -
        -
        Parameters:
        -
        bits - 24-bit chunk containing 1 or 2 bytes to encode
        -
        outputBytes - Number of input bytes to encode (either 1 or 2)
        -
        buffer - Output buffer to append characters to
        -
        outPtr - Starting position within buffer to append encoded characters
        -
        Returns:
        -
        Pointer in output buffer after appending encoded characters (2, 3 or 4)
        -
        -
      • -
      - - - -
        -
      • -

        encodeBase64Partial

        -
        public void encodeBase64Partial(StringBuilder sb,
        -                                int bits,
        -                                int outputBytes)
        -
      • -
      - - - -
        -
      • -

        encodeBase64BitsAsByte

        -
        public byte encodeBase64BitsAsByte(int value)
        -
      • -
      - - - -
        -
      • -

        encodeBase64Chunk

        -
        public int encodeBase64Chunk(int b24,
        -                             byte[] buffer,
        -                             int outPtr)
        -
        Method that encodes given right-aligned (LSB) 24-bit value - into 4 base64 bytes (ascii), stored in given result buffer.
        -
        -
        Parameters:
        -
        b24 - 3-byte value to encode
        -
        buffer - Output buffer to append characters (as bytes) to
        -
        outPtr - Starting position within buffer to append encoded characters
        -
        Returns:
        -
        Pointer in output buffer after appending 4 encoded characters
        -
        -
      • -
      - - - -
        -
      • -

        encodeBase64Partial

        -
        public int encodeBase64Partial(int bits,
        -                               int outputBytes,
        -                               byte[] buffer,
        -                               int outPtr)
        -
        Method that outputs partial chunk (which only encodes one - or two bytes of data). Data given is still aligned same as if - it as full data; that is, missing data is at the "right end" - (LSB) of int.
        -
        -
        Parameters:
        -
        bits - 24-bit chunk containing 1 or 2 bytes to encode
        -
        outputBytes - Number of input bytes to encode (either 1 or 2)
        -
        buffer - Output buffer to append characters to
        -
        outPtr - Starting position within buffer to append encoded characters
        -
        Returns:
        -
        Pointer in output buffer after appending encoded characters (2, 3 or 4)
        -
        -
      • -
      - - - -
        -
      • -

        encode

        -
        public String encode(byte[] input)
        -
        Convenience method for converting given byte array as base64 encoded - String using this variant's settings. - Resulting value is "raw", that is, not enclosed in double-quotes.
        -
        -
        Parameters:
        -
        input - Byte array to encode
        -
        Returns:
        -
        Base64 encoded String of encoded input bytes, not surrounded by quotes
        -
        -
      • -
      - - - -
        -
      • -

        encode

        -
        public String encode(byte[] input,
        -                     boolean addQuotes)
        -
        Convenience method for converting given byte array as base64 encoded String - using this variant's settings, optionally enclosed in double-quotes. - Linefeeds added, if needed, are expressed as 2-character JSON (and Java source) - escape sequence of backslash + `n`.
        -
        -
        Parameters:
        -
        input - Byte array to encode
        -
        addQuotes - Whether to surround resulting value in double quotes or not
        -
        Returns:
        -
        Base64 encoded String of encoded input bytes, possibly - surrounded by quotes (if addQuotes enabled)
        -
        -
      • -
      - - - -
        -
      • -

        encode

        -
        public String encode(byte[] input,
        -                     boolean addQuotes,
        -                     String linefeed)
        -
        Convenience method for converting given byte array as base64 encoded String - using this variant's settings, optionally enclosed in double-quotes. - Linefeed character to use is passed explicitly.
        -
        -
        Parameters:
        -
        input - Byte array to encode
        -
        addQuotes - Whether to surround resulting value in double quotes or not
        -
        linefeed - Linefeed to use for encoded content
        -
        Returns:
        -
        Base64 encoded String of encoded input bytes
        -
        -
      • -
      - - - -
        -
      • -

        decode

        -
        public byte[] decode(String input)
        -              throws IllegalArgumentException
        -
        Convenience method for decoding contents of a Base64-encoded String, - using this variant's settings.
        -
        -
        Parameters:
        -
        input - Base64-encoded input String to decode
        -
        Returns:
        -
        Byte array of decoded contents
        -
        Throws:
        -
        IllegalArgumentException - if input is not valid base64 encoded data
        -
        -
      • -
      - - - -
        -
      • -

        decode

        -
        public void decode(String str,
        -                   ByteArrayBuilder builder)
        -            throws IllegalArgumentException
        -
        Convenience method for decoding contents of a Base64-encoded String, - using this variant's settings - and appending decoded binary data using provided ByteArrayBuilder. -

        - NOTE: builder will NOT be reset before decoding (nor cleared afterwards); - assumption is that caller will ensure it is given in proper state, and - used as appropriate afterwards.

        -
        -
        Parameters:
        -
        str - Input to decode
        -
        builder - Builder used for assembling decoded content
        -
        Throws:
        -
        IllegalArgumentException - if input is not valid base64 encoded data
        -
        -
      • -
      - - - - - - - -
        -
      • -

        equals

        -
        public boolean equals(Object o)
        -
        -
        Overrides:
        -
        equals in class Object
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class Object
        -
        -
      • -
      - - - -
        -
      • -

        _reportInvalidBase64

        -
        protected void _reportInvalidBase64(char ch,
        -                                    int bindex,
        -                                    String msg)
        -                             throws IllegalArgumentException
        -
        -
        Parameters:
        -
        ch - Character to report on
        -
        bindex - Relative index within base64 character unit; between 0 - and 3 (as unit has exactly 4 characters)
        -
        msg - Base message to use for exception
        -
        Throws:
        -
        IllegalArgumentException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        unexpectedPaddingMessage

        -
        protected String unexpectedPaddingMessage()
        -
        Helper method that will construct a message to use in exceptions for cases where input ends - prematurely in place where padding is not expected.
        -
        -
        Returns:
        -
        Exception message for indicating "unexpected padding" case
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        missingPaddingMessage

        -
        public String missingPaddingMessage()
        -
        Helper method that will construct a message to use in exceptions for cases where input ends - prematurely in place where padding would be expected.
        -
        -
        Returns:
        -
        Exception message for indicating "missing padding" case
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variants.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variants.html deleted file mode 100644 index 23f49e37e9..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Base64Variants.html +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - -Base64Variants (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class Base64Variants

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        MIME

        -
        public static final Base64Variant MIME
        -
        This variant is what most people would think of "the standard" - Base64 encoding. -

        - See wikipedia Base64 entry for details. -

        - Note that although this can be thought of as the standard variant, - it is not the default for Jackson: no-linefeeds alternative - is instead used because of JSON requirement of escaping all linefeeds. -

        - Writes padding on output; requires padding when reading (may change later with a call to Base64Variant.withWritePadding(boolean))

        -
      • -
      - - - -
        -
      • -

        MIME_NO_LINEFEEDS

        -
        public static final Base64Variant MIME_NO_LINEFEEDS
        -
        Slightly non-standard modification of MIME which does not - use linefeeds (max line length set to infinite). Useful when linefeeds - wouldn't work well (possibly in attributes), or for minor space savings - (save 1 linefeed per 76 data chars, ie. ~1.4% savings). -

        - Writes padding on output; requires padding when reading (may change later with a call to Base64Variant.withWritePadding(boolean))

        -
      • -
      - - - -
        -
      • -

        PEM

        -
        public static final Base64Variant PEM
        -
        This variant is the one that predates MIME: it is otherwise - identical, except that it mandates shorter line length. -

        - Writes padding on output; requires padding when reading (may change later with a call to Base64Variant.withWritePadding(boolean))

        -
      • -
      - - - -
        -
      • -

        MODIFIED_FOR_URL

        -
        public static final Base64Variant MODIFIED_FOR_URL
        -
        This non-standard variant is usually used when encoded data needs to be - passed via URLs (such as part of GET request). It differs from the - base MIME variant in multiple ways. - First, no padding is used: this also means that it generally can not - be written in multiple separate but adjacent chunks (which would not - be the usual use case in any case). Also, no linefeeds are used (max - line length set to infinite). And finally, two characters (plus and - slash) that would need quoting in URLs are replaced with more - optimal alternatives (hyphen and underscore, respectively). -

        - Does not write padding on output; does not accept padding when reading (may change later with a call to Base64Variant.withWritePadding(boolean))

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Base64Variants

        -
        public Base64Variants()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getDefaultVariant

        -
        public static Base64Variant getDefaultVariant()
        -
        Method used to get the default variant -- MIME_NO_LINEFEEDS -- for cases - where caller does not explicitly specify the variant. - We will prefer no-linefeed version because linefeeds in JSON values - must be escaped, making linefeed-containing variants sub-optimal.
        -
        -
        Returns:
        -
        Default variant (MIME_NO_LINEFEEDS)
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static Base64Variant valueOf(String name)
        -                             throws IllegalArgumentException
        -
        Lookup method for finding one of standard variants by name. - If name does not match any of standard variant names, - a IllegalArgumentException is thrown.
        -
        -
        Parameters:
        -
        name - Name of base64 variant to return
        -
        Returns:
        -
        Standard base64 variant that matches given name
        -
        Throws:
        -
        IllegalArgumentException - if no standard variant with given name exists
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/FormatFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/FormatFeature.html deleted file mode 100644 index 8bef819daf..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/FormatFeature.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - -FormatFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface FormatFeature

-
-
-
-
    -
  • -
    -
    All Superinterfaces:
    -
    JacksonFeature
    -
    -
    -
    All Known Implementing Classes:
    -
    JsonReadFeature, JsonWriteFeature
    -
    -
    -
    -
    public interface FormatFeature
    -extends JacksonFeature
    -
    Marker interface that is to be implemented by data format - specific features. - Interface used since Java Enums can not extend classes or other Enums, but - they can implement interfaces; and as such we may be able to use limited - amount of generic functionality. -

    - At this point this type is more of an extra marker feature, as its core API is now - defined in more general JacksonFeature.

    -
  • -
-
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/FormatSchema.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/FormatSchema.html deleted file mode 100644 index 439df52b0a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/FormatSchema.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - -FormatSchema (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface FormatSchema

-
-
-
-
    -
  • -
    -
    -
    public interface FormatSchema
    -
    Simple tag interface used to mark schema objects that are used by some - JsonParser and JsonGenerator implementations to further - specify structure of expected format. - Basic JSON-based parsers and generators do not use schemas, but some data - formats (like many binary data formats like Thrift, protobuf) mandate - use of schemas. -

    - Since there is little commonality between schemas for different data formats, - this interface does not define much meaningful functionality for accessing - schema details; rather, specific parser and generator implementations need - to cast to schema implementations they use. This marker interface is mostly - used for tagging "some kind of schema" -- instead of passing opaque - Object -- for documentation purposes.

    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      StringgetSchemaType() -
      Method that can be used to get an identifier that can be used for diagnostics - purposes, to indicate what kind of data format this schema is used for: typically - it is a short name of format itself, but it can also contain additional information - in cases where data format supports multiple types of schemas.
      -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getSchemaType

        -
        String getSchemaType()
        -
        Method that can be used to get an identifier that can be used for diagnostics - purposes, to indicate what kind of data format this schema is used for: typically - it is a short name of format itself, but it can also contain additional information - in cases where data format supports multiple types of schemas.
        -
        -
        Returns:
        -
        Logical name of schema type
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JacksonException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JacksonException.html deleted file mode 100644 index 32475b1a1f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JacksonException.html +++ /dev/null @@ -1,535 +0,0 @@ - - - - - - -JacksonException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class JacksonException

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JacksonException

        -
        protected JacksonException(String msg)
        -
      • -
      - - - -
        -
      • -

        JacksonException

        -
        protected JacksonException(Throwable t)
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        clearLocation

        -
        public JacksonException clearLocation()
        -
        Method that allows to remove context information from this exception's message. - Useful when you are parsing security-sensitive data and don't want original data excerpts - to be present in Jackson parser error messages.
        -
        -
        Returns:
        -
        This exception instance to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        getLocation

        -
        public JsonLocation getLocation()
        -
        Accessor for location information related to position within input - or output (depending on operation), if available; if not available - may return JsonLocation.NA (but never null). -

        - Accuracy of location information depends on backend (format) as well - as (in some cases) operation being performed.

        -
        -
        Returns:
        -
        Location in input or output that triggered the problem reported, if - available; null otherwise.
        -
        -
      • -
      - - - -
        -
      • -

        getOriginalMessage

        -
        public String getOriginalMessage()
        -
        Method that allows accessing the original "message" argument, - without additional decorations (like location information) - that overridden getMessage() adds.
        -
        -
        Returns:
        -
        Original, unmodified message argument used to construct - this exception instance
        -
        -
      • -
      - - - -
        -
      • -

        getProcessor

        -
        public Object getProcessor()
        -
        Method that allows accessing underlying processor that triggered - this exception; typically either JsonParser or JsonGenerator - for exceptions that originate from streaming API, but other abstractions - when thrown by databinding. -

        - Note that it is possible that `null` may be returned if code throwing - exception either has no access to processor; or has not been retrofitted - to set it; this means that caller needs to take care to check for nulls. - Subtypes override this method with co-variant return type, for more - type-safe access.

        -
        -
        Returns:
        -
        Originating processor, if available; null if not.
        -
        -
      • -
      - - - -
        -
      • -

        getMessageSuffix

        -
        protected String getMessageSuffix()
        -
        Accessor that sub-classes can override to append additional - information right after the main message, but before - source location information.
        -
        -
        Returns:
        -
        Message suffix configured, if any; null if none
        -
        -
      • -
      - - - -
        -
      • -

        getMessage

        -
        public String getMessage()
        -
        Default method overridden so that we can add location information
        -
        -
        Overrides:
        -
        getMessage in class Throwable
        -
        Returns:
        -
        Message constructed based on possible optional prefix; explicit - message passed to constructor as well trailing location description - (separate from message by linefeed)
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonEncoding.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonEncoding.html deleted file mode 100644 index 8a4c2448b5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonEncoding.html +++ /dev/null @@ -1,444 +0,0 @@ - - - - - - -JsonEncoding (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Enum JsonEncoding

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable, Comparable<JsonEncoding>
    -
    -
    -
    -
    public enum JsonEncoding
    -extends Enum<JsonEncoding>
    -
    Enumeration that defines legal encodings that can be used - for JSON content, based on list of allowed encodings from - JSON specification. -

    - Note: if application want to explicitly disregard Encoding - limitations (to read in JSON encoded using an encoding not - listed as allowed), they can use Reader / - Writer instances as input

    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static JsonEncoding[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (JsonEncoding c : JsonEncoding.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static JsonEncoding valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        getJavaName

        -
        public String getJavaName()
        -
        Method for accessing encoding name that JDK will support.
        -
        -
        Returns:
        -
        Matching encoding name that JDK will support.
        -
        -
      • -
      - - - -
        -
      • -

        isBigEndian

        -
        public boolean isBigEndian()
        -
        Whether encoding is big-endian (if encoding supports such - notion). If no such distinction is made (as is the case for - UTF8), return value is undefined.
        -
        -
        Returns:
        -
        True for big-endian encodings; false for little-endian - (or if not applicable)
        -
        -
      • -
      - - - -
        -
      • -

        bits

        -
        public int bits()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonGenerationException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonGenerationException.html deleted file mode 100644 index 8a9d058013..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonGenerationException.html +++ /dev/null @@ -1,444 +0,0 @@ - - - - - - -JsonGenerationException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class JsonGenerationException

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public class JsonGenerationException
    -extends JsonProcessingException
    -
    Exception type for exceptions during JSON writing, such as trying - to output content in wrong context (non-matching end-array or end-object, - for example).
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - - - - - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getProcessor

        -
        public JsonGenerator getProcessor()
        -
        Description copied from class: JacksonException
        -
        Method that allows accessing underlying processor that triggered - this exception; typically either JsonParser or JsonGenerator - for exceptions that originate from streaming API, but other abstractions - when thrown by databinding. -

        - Note that it is possible that `null` may be returned if code throwing - exception either has no access to processor; or has not been retrofitted - to set it; this means that caller needs to take care to check for nulls. - Subtypes override this method with co-variant return type, for more - type-safe access.

        -
        -
        Overrides:
        -
        getProcessor in class JacksonException
        -
        Returns:
        -
        Originating processor, if available; null if not.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonGenerator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonGenerator.html deleted file mode 100644 index 6b605bde65..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonGenerator.html +++ /dev/null @@ -1,3417 +0,0 @@ - - - - - - -JsonGenerator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class JsonGenerator

-
-
- -
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ModifierConstructor and Description
      protected JsonGenerator() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and TypeMethod and Description
      protected void_copyCurrentContents(JsonParser p) 
      protected <T> T_reportError(String msg) -
      Helper method used for constructing and throwing - JsonGenerationException with given base message.
      -
      protected <T> T_reportUnsupportedOperation() 
      protected void_throwInternal() 
      protected void_verifyOffsets(int arrayLength, - int offset, - int length) 
      booleancanOmitFields() -
      Introspection method to call to check whether it is ok to omit - writing of Object fields or not.
      -
      booleancanWriteBinaryNatively() -
      Introspection method that may be called to see if the underlying - data format supports "native" binary data; that is, an efficient - output of binary content without encoding.
      -
      booleancanWriteFormattedNumbers() -
      Introspection method to call to check whether it is possible - to write numbers using writeNumber(java.lang.String) - using possible custom format, or not.
      -
      booleancanWriteObjectId() -
      Introspection method that may be called to see if the underlying - data format supports some kind of Object Ids natively (many do not; - for example, JSON doesn't).
      -
      booleancanWriteTypeId() -
      Introspection method that may be called to see if the underlying - data format supports some kind of Type Ids natively (many do not; - for example, JSON doesn't).
      -
      abstract voidclose() -
      Method called to close this generator, so that no more content - can be written.
      -
      abstract JsonGeneratorconfigure(StreamWriteFeature f, - boolean state) -
      Method for enabling or disabling specified feature: - check StreamWriteFeature for list of available features.
      -
      voidcopyCurrentEvent(JsonParser p) -
      Method for copying contents of the current event that - the given parser instance points to.
      -
      voidcopyCurrentStructure(JsonParser p) -
      Method for copying contents of the current event - and following events that it encloses - the given parser instance points to.
      -
      abstract voidflush() -
      Method called to flush any buffered content to the underlying - target (output stream, writer), and to flush the target itself - as well.
      -
      CharacterEscapesgetCharacterEscapes() -
      Method for accessing custom escapes generator uses for JsonGenerators - it creates.
      -
      abstract ObjectgetCurrentValue() -
      Helper method, usually equivalent to: - - getOutputContext().getCurrentValue(); -
      -
      intgetHighestNonEscapedChar() -
      Accessor method for testing what is the highest unescaped character - configured for this generator.
      -
      abstract ObjectWriteContextgetObjectWriteContext() -
      Accessor for context object provided by higher-level databinding - functionality (or, in some cases, simple placeholder of the same) - that allows some level of interaction including ability to trigger - serialization of Object values through generator instance.
      -
      abstract intgetOutputBuffered() -
      Method for verifying amount of content that is buffered by generator - but not yet flushed to the underlying target (stream, writer), - in units (byte, char) that the generator implementation uses for buffering; - or -1 if this information is not available.
      -
      abstract TokenStreamContextgetOutputContext() -
      Accessor for context object that provides information about low-level - logical position withing output token stream.
      -
      abstract ObjectgetOutputTarget() -
      Method that can be used to get access to object that is used - as target for generated output; this is usually either - OutputStream or Writer, depending on what - generator was constructed with.
      -
      FormatSchemagetSchema() -
      Method for accessing Schema that this generator uses, if any.
      -
      abstract JacksonFeatureSet<StreamWriteCapability>getWriteCapabilities() -
      Accessor for getting metadata on capabilities of this generator, based on - underlying data format being read (directly or indirectly).
      -
      abstract booleanisClosed() -
      Method that can be called to determine whether this generator - is closed or not.
      -
      abstract booleanisEnabled(StreamWriteFeature f) -
      Method for checking whether given feature is enabled.
      -
      JsonGeneratorsetCharacterEscapes(CharacterEscapes esc) -
      Method for defining custom escapes factory uses for JsonGenerators - it creates.
      -
      abstract voidsetCurrentValue(Object v) -
      Helper method, usually equivalent to: - - getOutputContext().setCurrentValue(v); - - used to assign "current value" for the current context of this generator.
      -
      JsonGeneratorsetHighestNonEscapedChar(int charCode) -
      Method that can be called to request that generator escapes - all character codes above specified code point (if positive value); - or, to not escape any characters except for ones that must be - escaped for the data format (if -1).
      -
      abstract intstreamWriteFeatures() -
      Bulk access method for getting state of all standard (format-agnostic) - StreamWriteFeatures.
      -
      abstract Versionversion() -
      Accessor for finding out version of the bundle that provided this generator instance.
      -
      voidwriteArray(double[] array, - int offset, - int length) -
      Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_FLOAT, JsonToken.END_ARRAY)
      -
      voidwriteArray(int[] array, - int offset, - int length) -
      Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_INT, JsonToken.END_ARRAY)
      -
      voidwriteArray(long[] array, - int offset, - int length) -
      Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_INT, JsonToken.END_ARRAY)
      -
      voidwriteArray(String[] array, - int offset, - int length) -
      Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_STRING, JsonToken.END_ARRAY)
      -
      voidwriteArrayFieldStart(String fieldName) -
      Convenience method for outputting a field entry ("member") - (that will contain a JSON Array value), and the START_ARRAY marker.
      -
      abstract voidwriteBinary(Base64Variant bv, - byte[] data, - int offset, - int len) -
      Method that will output given chunk of binary data as base64 - encoded, as a complete String value (surrounded by double quotes).
      -
      abstract intwriteBinary(Base64Variant bv, - InputStream data, - int dataLength) -
      Method similar to writeBinary(Base64Variant,byte[],int,int), - but where input is provided through a stream, allowing for incremental - writes without holding the whole input in memory.
      -
      voidwriteBinary(byte[] data) -
      Similar to writeBinary(Base64Variant,byte[],int,int), - but assumes default to using the Jackson default Base64 variant - (which is Base64Variants.MIME_NO_LINEFEEDS).
      -
      voidwriteBinary(byte[] data, - int offset, - int len) -
      Similar to writeBinary(Base64Variant,byte[],int,int), - but default to using the Jackson default Base64 variant - (which is Base64Variants.MIME_NO_LINEFEEDS).
      -
      intwriteBinary(InputStream data, - int dataLength) -
      Similar to writeBinary(Base64Variant,InputStream,int), - but assumes default to using the Jackson default Base64 variant - (which is Base64Variants.MIME_NO_LINEFEEDS).
      -
      voidwriteBinaryField(String fieldName, - byte[] data) -
      Convenience method for outputting a field entry ("member") - that contains specified data in base64-encoded form.
      -
      abstract voidwriteBoolean(boolean state) -
      Method for outputting literal JSON boolean value (one of - Strings 'true' and 'false').
      -
      voidwriteBooleanField(String fieldName, - boolean value) -
      Convenience method for outputting a field entry ("member") - that has a boolean value.
      -
      voidwriteEmbeddedObject(Object object) -
      Method that can be called on backends that support passing opaque native - values that some data formats support; not used with JSON backend, - more common with binary formats.
      -
      abstract voidwriteEndArray() -
      Method for writing closing marker of a JSON Array value - (character ']'; plus possible white space decoration - if pretty-printing is enabled).
      -
      abstract voidwriteEndObject() -
      Method for writing closing marker of an Object value - (character '}'; plus possible white space decoration - if pretty-printing is enabled).
      -
      abstract voidwriteFieldId(long id) -
      Alternative to writeFieldName(String) that may be used - in cases where property key is of numeric type; either where - underlying format supports such notion (some binary formats do, - unlike JSON), or for convenient conversion into String presentation.
      -
      abstract voidwriteFieldName(SerializableString name) -
      Method similar to writeFieldName(String), main difference - being that it may perform better as some of processing (such as - quoting of certain characters, or encoding into external encoding - if supported by generator) can be done just once and reused for - later calls.
      -
      abstract voidwriteFieldName(String name) -
      Method for writing a field name (JSON String surrounded by - double quotes: syntactically identical to a JSON String value), - possibly decorated by white space if pretty-printing is enabled.
      -
      abstract voidwriteNull() -
      Method for outputting literal JSON null value.
      -
      voidwriteNullField(String fieldName) -
      Convenience method for outputting a field entry ("member") - that has JSON literal value null.
      -
      abstract voidwriteNumber(BigDecimal v) -
      Method for outputting indicate JSON numeric value.
      -
      abstract voidwriteNumber(BigInteger v) -
      Method for outputting given value as JSON number.
      -
      voidwriteNumber(char[] encodedValueBuffer, - int offset, - int len) -
      Overloaded version of writeNumber(String) with same semantics - but possibly more efficient operation.
      -
      abstract voidwriteNumber(double v) -
      Method for outputting indicate JSON numeric value.
      -
      abstract voidwriteNumber(float v) -
      Method for outputting indicate JSON numeric value.
      -
      abstract voidwriteNumber(int v) -
      Method for outputting given value as JSON number.
      -
      abstract voidwriteNumber(long v) -
      Method for outputting given value as JSON number.
      -
      abstract voidwriteNumber(short v) -
      Method for outputting given value as JSON number.
      -
      abstract voidwriteNumber(String encodedValue) -
      Write method that can be used for custom numeric types that can - not be (easily?) converted to "standard" Java number types.
      -
      voidwriteNumberField(String fieldName, - BigDecimal value) -
      Convenience method for outputting a field entry ("member") - that has the specified numeric value.
      -
      voidwriteNumberField(String fieldName, - BigInteger value) -
      Convenience method for outputting a field entry ("member") - that has the specified numeric value.
      -
      voidwriteNumberField(String fieldName, - double value) -
      Convenience method for outputting a field entry ("member") - that has the specified numeric value.
      -
      voidwriteNumberField(String fieldName, - float value) -
      Convenience method for outputting a field entry ("member") - that has the specified numeric value.
      -
      voidwriteNumberField(String fieldName, - int value) -
      Convenience method for outputting a field entry ("member") - that has the specified numeric value.
      -
      voidwriteNumberField(String fieldName, - long value) -
      Convenience method for outputting a field entry ("member") - that has the specified numeric value.
      -
      voidwriteNumberField(String fieldName, - short value) -
      Convenience method for outputting a field entry ("member") - that has the specified numeric value.
      -
      abstract voidwriteObject(Object pojo) -
      Method for writing given Java object (POJO) as tokens into - stream this generator manages.
      -
      voidwriteObjectField(String fieldName, - Object pojo) -
      Convenience method for outputting a field entry ("member") - that has contents of specific Java object as its value.
      -
      voidwriteObjectFieldStart(String fieldName) -
      Convenience method for outputting a field entry ("member") - (that will contain an Object value), and the START_OBJECT marker.
      -
      voidwriteObjectId(Object id) -
      Method that can be called to output so-called native Object Id.
      -
      voidwriteObjectRef(Object referenced) -
      Method that can be called to output references to native Object Ids.
      -
      voidwriteOmittedField(String fieldName) -
      Method called to indicate that a property in this position was - skipped.
      -
      abstract voidwriteRaw(char c) -
      Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
      -
      abstract voidwriteRaw(char[] buffer, - int offset, - int len) -
      Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
      -
      voidwriteRaw(SerializableString raw) -
      Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
      -
      abstract voidwriteRaw(String text) -
      Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
      -
      abstract voidwriteRaw(String text, - int offset, - int len) -
      Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
      -
      abstract voidwriteRawUTF8String(byte[] buffer, - int offset, - int len) -
      Method similar to writeString(String) but that takes as - its input a UTF-8 encoded String that is to be output as-is, without additional - escaping (type of which depends on data format; backslashes for JSON).
      -
      abstract voidwriteRawValue(char[] text, - int offset, - int len) 
      voidwriteRawValue(SerializableString raw) -
      Method similar to writeRawValue(String), but potentially more - efficient as it may be able to use pre-encoded content (similar to - writeRaw(SerializableString).
      -
      abstract voidwriteRawValue(String text) -
      Method that will force generator to copy - input text verbatim without any modifications, but assuming - it must constitute a single legal JSON value (number, string, - boolean, null, Array or List).
      -
      abstract voidwriteRawValue(String text, - int offset, - int len) 
      abstract voidwriteStartArray() -
      Method for writing starting marker of a Array value - (for JSON this is character '['; plus possible white space decoration - if pretty-printing is enabled).
      -
      abstract voidwriteStartArray(Object currentValue) -
      Method for writing start marker of an Array value, similar - to writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any); - null may be passed if not known or not applicable.
      -
      abstract voidwriteStartArray(Object currentValue, - int size) -
      Method for writing start marker of an Array value, similar - to writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any) - and how many elements will be written for the array before calling - writeEndArray().
      -
      abstract voidwriteStartObject() -
      Method for writing starting marker of an Object value - (character '{'; plus possible white space decoration - if pretty-printing is enabled).
      -
      abstract voidwriteStartObject(Object currentValue) -
      Method for writing starting marker of an Object value - to represent the given Java Object value.
      -
      abstract voidwriteStartObject(Object forValue, - int size) -
      Method for writing starting marker of an Object value - to represent the given Java Object value.
      -
      abstract voidwriteString(char[] buffer, - int offset, - int len) -
      Method for outputting a String value.
      -
      voidwriteString(Reader reader, - int len) -
      Method for outputting a String value.
      -
      abstract voidwriteString(SerializableString value) -
      Method similar to writeString(String), but that takes - SerializableString which can make this potentially - more efficient to call as generator may be able to reuse - quoted and/or encoded representation.
      -
      abstract voidwriteString(String value) -
      Method for outputting a String value.
      -
      voidwriteStringField(String fieldName, - String value) -
      Convenience method for outputting a field entry ("member") - that has a String value.
      -
      abstract voidwriteTree(TreeNode rootNode) -
      Method for writing given JSON tree (expressed as a tree - where given TreeNode is the root) using this generator.
      -
      voidwriteTypeId(Object id) -
      Method that can be called to output so-called native Type Id.
      -
      WritableTypeIdwriteTypePrefix(WritableTypeId typeIdDef) -
      Replacement method for writeTypeId(Object) which is called - regardless of whether format has native type ids.
      -
      WritableTypeIdwriteTypeSuffix(WritableTypeId typeIdDef) 
      abstract voidwriteUTF8String(byte[] buffer, - int offset, - int len) -
      Method similar to writeString(String) but that takes as its input - a UTF-8 encoded String which has not been escaped using whatever - escaping scheme data format requires (for JSON that is backslash-escaping - for control characters and double-quotes; for other formats something else).
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonGenerator

        -
        protected JsonGenerator()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        version

        -
        public abstract Version version()
        -
        Accessor for finding out version of the bundle that provided this generator instance.
        -
        -
        Specified by:
        -
        version in interface Versioned
        -
        Returns:
        -
        Version of the component
        -
        -
      • -
      - - - -
        -
      • -

        getOutputContext

        -
        public abstract TokenStreamContext getOutputContext()
        -
        Accessor for context object that provides information about low-level - logical position withing output token stream.
        -
        -
        Returns:
        -
        Stream output context (TokenStreamContext) associated with this generator
        -
        -
      • -
      - - - -
        -
      • -

        getObjectWriteContext

        -
        public abstract ObjectWriteContext getObjectWriteContext()
        -
        Accessor for context object provided by higher-level databinding - functionality (or, in some cases, simple placeholder of the same) - that allows some level of interaction including ability to trigger - serialization of Object values through generator instance.
        -
        -
        Returns:
        -
        Object write context (ObjectWriteContext) associated with this generator
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        getOutputTarget

        -
        public abstract Object getOutputTarget()
        -
        Method that can be used to get access to object that is used - as target for generated output; this is usually either - OutputStream or Writer, depending on what - generator was constructed with. - Note that returned value may be null in some cases; including - case where implementation does not want to exposed raw - source to caller. - In cases where output has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of generator and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Returns:
        -
        Output target this generator was configured with
        -
        -
      • -
      - - - -
        -
      • -

        getOutputBuffered

        -
        public abstract int getOutputBuffered()
        -
        Method for verifying amount of content that is buffered by generator - but not yet flushed to the underlying target (stream, writer), - in units (byte, char) that the generator implementation uses for buffering; - or -1 if this information is not available. - Unit used is often the same as the unit of underlying target (that is, - byte for OutputStream, - char for Writer), - but may differ if buffering is done before encoding. - Default JSON-backed implementations do use matching units.
        -
        -
        Returns:
        -
        Amount of content buffered in internal units, if amount known and - accessible; -1 if not accessible.
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentValue

        -
        public abstract Object getCurrentValue()
        -
        Helper method, usually equivalent to: - - getOutputContext().getCurrentValue(); - -

        - Note that "current value" is NOT populated (or used) by Streaming generator; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Returns:
        -
        "Current value" for the current context this generator has
        -
        -
      • -
      - - - -
        -
      • -

        setCurrentValue

        -
        public abstract void setCurrentValue(Object v)
        -
        Helper method, usually equivalent to: - - getOutputContext().setCurrentValue(v); - - used to assign "current value" for the current context of this generator. - It is usually assigned and used by higher level data-binding functionality - (instead of streaming parsers/generators) but is stored at streaming level.
        -
        -
        Parameters:
        -
        v - "Current value" to assign to the current output context of this generator
        -
        -
      • -
      - - - -
        -
      • -

        configure

        -
        public abstract JsonGenerator configure(StreamWriteFeature f,
        -                                        boolean state)
        -
        Method for enabling or disabling specified feature: - check StreamWriteFeature for list of available features. -

        - NOTE: mostly left in 3.0 just to support disabling of - StreamWriteFeature.AUTO_CLOSE_CONTENT.

        -
        -
        Parameters:
        -
        f - Feature to enable or disable
        -
        state - Whether to enable the feature (true) or disable (false)
        -
        Returns:
        -
        This generator, to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        isEnabled

        -
        public abstract boolean isEnabled(StreamWriteFeature f)
        -
        Method for checking whether given feature is enabled. - Check StreamWriteFeature for list of available features.
        -
        -
        Parameters:
        -
        f - Feature to check
        -
        Returns:
        -
        True if feature is enabled; false if not
        -
        -
      • -
      - - - -
        -
      • -

        streamWriteFeatures

        -
        public abstract int streamWriteFeatures()
        -
        Bulk access method for getting state of all standard (format-agnostic) - StreamWriteFeatures.
        -
        -
        Returns:
        -
        Bit mask that defines current states of all standard StreamWriteFeatures.
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        getSchema

        -
        public FormatSchema getSchema()
        -
        Method for accessing Schema that this generator uses, if any. - Default implementation returns null.
        -
        -
        Returns:
        -
        FormatSchema this generator is configured to use, if any; null if none
        -
        -
      • -
      - - - -
        -
      • -

        setHighestNonEscapedChar

        -
        public JsonGenerator setHighestNonEscapedChar(int charCode)
        -
        Method that can be called to request that generator escapes - all character codes above specified code point (if positive value); - or, to not escape any characters except for ones that must be - escaped for the data format (if -1). - To force escaping of all non-ASCII characters, for example, - this method would be called with value of 127. -

        - Note that generators are NOT required to support setting of value - higher than 127, because there are other ways to affect quoting - (or lack thereof) of character codes between 0 and 127. - Not all generators support concept of escaping, either; if so, - calling this method will have no effect. -

        - Default implementation does nothing; sub-classes need to redefine - it according to rules of supported data format.

        -
        -
        Parameters:
        -
        charCode - Either -1 to indicate that no additional escaping - is to be done; or highest code point not to escape (meaning higher - ones will be), if positive value.
        -
        Returns:
        -
        This generator, to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        getHighestNonEscapedChar

        -
        public int getHighestNonEscapedChar()
        -
        Accessor method for testing what is the highest unescaped character - configured for this generator. This may be either positive value - (when escaping configuration has been set and is in effect), or - 0 to indicate that no additional escaping is in effect. - Some generators may not support additional escaping: for example, - generators for binary formats that do not use escaping should - simply return 0.
        -
        -
        Returns:
        -
        Currently active limitation for highest non-escaped character, - if defined; or 0 to indicate no additional escaping is performed.
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterEscapes

        -
        public CharacterEscapes getCharacterEscapes()
        -
        Method for accessing custom escapes generator uses for JsonGenerators - it creates.
        -
        -
        Returns:
        -
        CharacterEscapes this generator is configured to use, if any; null if none
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterEscapes

        -
        public JsonGenerator setCharacterEscapes(CharacterEscapes esc)
        -
        Method for defining custom escapes factory uses for JsonGenerators - it creates. -

        - Default implementation does nothing and simply returns this instance.

        -
        -
        Parameters:
        -
        esc - CharacterEscapes to configure this generator to use, if any; null if none
        -
        Returns:
        -
        This generator, to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        canWriteObjectId

        -
        public boolean canWriteObjectId()
        -
        Introspection method that may be called to see if the underlying - data format supports some kind of Object Ids natively (many do not; - for example, JSON doesn't). - This method must be called prior to calling - writeObjectId(java.lang.Object) or writeObjectRef(java.lang.Object). -

        - Default implementation returns false; overridden by data formats - that do support native Object Ids. Caller is expected to either - use a non-native notation (explicit property or such), or fail, - in case it can not use native object ids.

        -
        -
        Returns:
        -
        True if this generator is capable of writing "native" Object Ids - (which is typically determined by capabilities of the underlying format), - false if not
        -
        -
      • -
      - - - -
        -
      • -

        canWriteTypeId

        -
        public boolean canWriteTypeId()
        -
        Introspection method that may be called to see if the underlying - data format supports some kind of Type Ids natively (many do not; - for example, JSON doesn't). - This method must be called prior to calling - writeTypeId(java.lang.Object). -

        - Default implementation returns false; overridden by data formats - that do support native Type Ids. Caller is expected to either - use a non-native notation (explicit property or such), or fail, - in case it can not use native type ids.

        -
        -
        Returns:
        -
        True if this generator is capable of writing "native" Type Ids - (which is typically determined by capabilities of the underlying format), - false if not
        -
        -
      • -
      - - - -
        -
      • -

        canWriteBinaryNatively

        -
        public boolean canWriteBinaryNatively()
        -
        Introspection method that may be called to see if the underlying - data format supports "native" binary data; that is, an efficient - output of binary content without encoding. -

        - Default implementation returns false; overridden by data formats - that do support native binary content.

        -
        -
        Returns:
        -
        True if this generator is capable of writing "raw" Binary - Content - (this is typically determined by capabilities of the underlying format); - false if not
        -
        -
      • -
      - - - -
        -
      • -

        canOmitFields

        -
        public boolean canOmitFields()
        -
        Introspection method to call to check whether it is ok to omit - writing of Object fields or not. Most formats do allow omission, - but certain positional formats (such as CSV) require output of - placeholders, even if no real values are to be emitted.
        -
        -
        Returns:
        -
        True if this generator is allowed to only write values - of some Object fields and omit the rest; false if not
        -
        -
      • -
      - - - -
        -
      • -

        canWriteFormattedNumbers

        -
        public boolean canWriteFormattedNumbers()
        -
        Introspection method to call to check whether it is possible - to write numbers using writeNumber(java.lang.String) - using possible custom format, or not. Typically textual formats - allow this (and JSON specifically does), whereas binary formats - do not allow this (except by writing them as Strings). - Usual reason for calling this method is to check whether custom - formatting of numbers may be applied by higher-level code (databinding) - or not.
        -
        -
        Returns:
        -
        True if this generator is capable of writing "formatted" - numbers (and if so, need to be passed using - writeNumber(String), that is, passed as String); - false if not
        -
        -
      • -
      - - - -
        -
      • -

        getWriteCapabilities

        -
        public abstract JacksonFeatureSet<StreamWriteCapability> getWriteCapabilities()
        -
        Accessor for getting metadata on capabilities of this generator, based on - underlying data format being read (directly or indirectly).
        -
        -
        Returns:
        -
        Set of read capabilities for content to generate via this generator
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public abstract void writeStartArray()
        -                              throws IOException
        -
        Method for writing starting marker of a Array value - (for JSON this is character '['; plus possible white space decoration - if pretty-printing is enabled). -

        - Array values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public abstract void writeStartArray(Object currentValue)
        -                              throws IOException
        -
        Method for writing start marker of an Array value, similar - to writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any); - null may be passed if not known or not applicable. - This value is accessible from context as "current value"
        -
        -
        Parameters:
        -
        currentValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public abstract void writeStartArray(Object currentValue,
        -                                     int size)
        -                              throws IOException
        -
        Method for writing start marker of an Array value, similar - to writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any) - and how many elements will be written for the array before calling - writeEndArray().
        -
        -
        Parameters:
        -
        currentValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        size - Number of elements this Array will have: actual - number of values written (before matching call to - writeEndArray() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndArray

        -
        public abstract void writeEndArray()
        -                            throws IOException
        -
        Method for writing closing marker of a JSON Array value - (character ']'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Array.

        -
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public abstract void writeStartObject()
        -                               throws IOException
        -
        Method for writing starting marker of an Object value - (character '{'; plus possible white space decoration - if pretty-printing is enabled). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public abstract void writeStartObject(Object currentValue)
        -                               throws IOException
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Parameters:
        -
        currentValue - Java Object that Object being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public abstract void writeStartObject(Object forValue,
        -                                      int size)
        -                               throws IOException
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. - In addition, caller knows number of key/value pairs ("properties") - that will get written for the Object value: this is relevant for - some format backends (but not, as an example, for JSON). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Parameters:
        -
        forValue - Object value to be written (assigned as "current value" for - the Object context that gets created)
        -
        size - Number of key/value pairs this Object will have: actual - number of entries written (before matching call to - writeEndObject() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndObject

        -
        public abstract void writeEndObject()
        -                             throws IOException
        -
        Method for writing closing marker of an Object value - (character '}'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Object, and the last written event was either a - complete value, or START-OBJECT marker (see JSON specification - for more details).

        -
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public abstract void writeFieldName(String name)
        -                             throws IOException
        -
        Method for writing a field name (JSON String surrounded by - double quotes: syntactically identical to a JSON String value), - possibly decorated by white space if pretty-printing is enabled. -

        - Field names can only be written in Object context (check out - JSON specification for details), when field name is expected - (field names alternate with values).

        -
        -
        Parameters:
        -
        name - Field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public abstract void writeFieldName(SerializableString name)
        -                             throws IOException
        -
        Method similar to writeFieldName(String), main difference - being that it may perform better as some of processing (such as - quoting of certain characters, or encoding into external encoding - if supported by generator) can be done just once and reused for - later calls. -

        - Default implementation simple uses unprocessed name container in - serialized String; implementations are strongly encouraged to make - use of more efficient methods argument object has.

        -
        -
        Parameters:
        -
        name - Pre-encoded field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldId

        -
        public abstract void writeFieldId(long id)
        -                           throws IOException
        -
        Alternative to writeFieldName(String) that may be used - in cases where property key is of numeric type; either where - underlying format supports such notion (some binary formats do, - unlike JSON), or for convenient conversion into String presentation. - Default implementation will simply convert id into String - and call writeFieldName(String).
        -
        -
        Parameters:
        -
        id - Field id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArray

        -
        public void writeArray(int[] array,
        -                       int offset,
        -                       int length)
        -                throws IOException
        -
        Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_INT, JsonToken.END_ARRAY)
        -
        -
        Parameters:
        -
        array - Array that contains values to write
        -
        offset - Offset of the first element to write, within array
        -
        length - Number of elements in array to write, from `offset` to `offset + len - 1`
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArray

        -
        public void writeArray(long[] array,
        -                       int offset,
        -                       int length)
        -                throws IOException
        -
        Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_INT, JsonToken.END_ARRAY)
        -
        -
        Parameters:
        -
        array - Array that contains values to write
        -
        offset - Offset of the first element to write, within array
        -
        length - Number of elements in array to write, from `offset` to `offset + len - 1`
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArray

        -
        public void writeArray(double[] array,
        -                       int offset,
        -                       int length)
        -                throws IOException
        -
        Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_FLOAT, JsonToken.END_ARRAY)
        -
        -
        Parameters:
        -
        array - Array that contains values to write
        -
        offset - Offset of the first element to write, within array
        -
        length - Number of elements in array to write, from `offset` to `offset + len - 1`
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArray

        -
        public void writeArray(String[] array,
        -                       int offset,
        -                       int length)
        -                throws IOException
        -
        Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_STRING, JsonToken.END_ARRAY)
        -
        -
        Parameters:
        -
        array - Array that contains values to write
        -
        offset - Offset of the first element to write, within array
        -
        length - Number of elements in array to write, from `offset` to `offset + len - 1`
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public abstract void writeString(String value)
        -                          throws IOException
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Parameters:
        -
        value - String value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(Reader reader,
        -                        int len)
        -                 throws IOException
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification. - If len is < 0, then write all contents of the reader. - Otherwise, write only len characters. -

        - Note: actual length of content available may exceed len but - can not be less than it: if not enough content available, a - JsonGenerationException will be thrown.

        -
        -
        Parameters:
        -
        reader - Reader to use for reading Text value to write
        -
        len - Maximum Length of Text value to read (in chars, non-negative) - if known; -1 to indicate "read and write it all"
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer; or if length (len) is specified but - reader does not provide enough content
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public abstract void writeString(char[] buffer,
        -                                 int offset,
        -                                 int len)
        -                          throws IOException
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Parameters:
        -
        buffer - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first character of String value to write
        -
        len - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public abstract void writeString(SerializableString value)
        -                          throws IOException
        -
        Method similar to writeString(String), but that takes - SerializableString which can make this potentially - more efficient to call as generator may be able to reuse - quoted and/or encoded representation. -

        - Default implementation just calls writeString(String); - sub-classes should override it with more efficient implementation - if possible.

        -
        -
        Parameters:
        -
        value - Pre-encoded String value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRawUTF8String

        -
        public abstract void writeRawUTF8String(byte[] buffer,
        -                                        int offset,
        -                                        int len)
        -                                 throws IOException
        -
        Method similar to writeString(String) but that takes as - its input a UTF-8 encoded String that is to be output as-is, without additional - escaping (type of which depends on data format; backslashes for JSON). - However, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - If so, implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Parameters:
        -
        buffer - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        len - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeUTF8String

        -
        public abstract void writeUTF8String(byte[] buffer,
        -                                     int offset,
        -                                     int len)
        -                              throws IOException
        -
        Method similar to writeString(String) but that takes as its input - a UTF-8 encoded String which has not been escaped using whatever - escaping scheme data format requires (for JSON that is backslash-escaping - for control characters and double-quotes; for other formats something else). - This means that textual JSON backends need to check if value needs - JSON escaping, but otherwise can just be copied as is to output. - Also, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - In this case - generator implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Parameters:
        -
        buffer - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        len - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public abstract void writeRaw(String text)
        -                       throws IOException
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Parameters:
        -
        text - Textual contents to include as-is in output.
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public abstract void writeRaw(String text,
        -                              int offset,
        -                              int len)
        -                       throws IOException
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Parameters:
        -
        text - String that has contents to include as-is in output
        -
        offset - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public abstract void writeRaw(char[] buffer,
        -                              int offset,
        -                              int len)
        -                       throws IOException
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Parameters:
        -
        buffer - Buffer that has contents to include as-is in output
        -
        offset - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public abstract void writeRaw(char c)
        -                       throws IOException
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Parameters:
        -
        c - Character to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(SerializableString raw)
        -              throws IOException
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException. -

        - The default implementation delegates to writeRaw(String); - other backends that support raw inclusion of text are encouraged - to implement it in more efficient manner (especially if they - use UTF-8 encoding).

        -
        -
        Parameters:
        -
        raw - Pre-encoded textual contents to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRawValue

        -
        public abstract void writeRawValue(String text)
        -                            throws IOException
        -
        Method that will force generator to copy - input text verbatim without any modifications, but assuming - it must constitute a single legal JSON value (number, string, - boolean, null, Array or List). Assuming this, proper separators - are added if and as needed (comma or colon), and generator - state updated to reflect this.
        -
        -
        Parameters:
        -
        text - Textual contents to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRawValue

        -
        public abstract void writeRawValue(String text,
        -                                   int offset,
        -                                   int len)
        -                            throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeRawValue

        -
        public abstract void writeRawValue(char[] text,
        -                                   int offset,
        -                                   int len)
        -                            throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeBinary

        -
        public abstract void writeBinary(Base64Variant bv,
        -                                 byte[] data,
        -                                 int offset,
        -                                 int len)
        -                          throws IOException
        -
        Method that will output given chunk of binary data as base64 - encoded, as a complete String value (surrounded by double quotes). - This method defaults -

        - Note: because JSON Strings can not contain unescaped linefeeds, - if linefeeds are included (as per last argument), they must be - escaped. This adds overhead for decoding without improving - readability. - Alternatively if linefeeds are not included, - resulting String value may violate the requirement of base64 - RFC which mandates line-length of 76 characters and use of - linefeeds. However, all JsonParser implementations - are required to accept such "long line base64"; as do - typical production-level base64 decoders.

        -
        -
        Parameters:
        -
        bv - Base64 variant to use: defines details such as - whether padding is used (and if so, using which character); - what is the maximum line length before adding linefeed, - and also the underlying alphabet to use.
        -
        data - Buffer that contains binary data to write
        -
        offset - Offset in data of the first byte of data to write
        -
        len - Length of data to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public void writeBinary(byte[] data,
        -                        int offset,
        -                        int len)
        -                 throws IOException
        -
        Similar to writeBinary(Base64Variant,byte[],int,int), - but default to using the Jackson default Base64 variant - (which is Base64Variants.MIME_NO_LINEFEEDS).
        -
        -
        Parameters:
        -
        data - Buffer that contains binary data to write
        -
        offset - Offset in data of the first byte of data to write
        -
        len - Length of data to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public void writeBinary(byte[] data)
        -                 throws IOException
        -
        Similar to writeBinary(Base64Variant,byte[],int,int), - but assumes default to using the Jackson default Base64 variant - (which is Base64Variants.MIME_NO_LINEFEEDS). Also - assumes that whole byte array is to be output.
        -
        -
        Parameters:
        -
        data - Buffer that contains binary data to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public int writeBinary(InputStream data,
        -                       int dataLength)
        -                throws IOException
        -
        Similar to writeBinary(Base64Variant,InputStream,int), - but assumes default to using the Jackson default Base64 variant - (which is Base64Variants.MIME_NO_LINEFEEDS).
        -
        -
        Parameters:
        -
        data - InputStream to use for reading binary data to write. - Will not be closed after successful write operation
        -
        dataLength - (optional) number of bytes that will be available; - or -1 to be indicate it is not known. Note that implementations - need not support cases where length is not known in advance; this - depends on underlying data format: JSON output does NOT require length, - other formats may
        -
        Returns:
        -
        Number of bytes actually written
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public abstract int writeBinary(Base64Variant bv,
        -                                InputStream data,
        -                                int dataLength)
        -                         throws IOException
        -
        Method similar to writeBinary(Base64Variant,byte[],int,int), - but where input is provided through a stream, allowing for incremental - writes without holding the whole input in memory.
        -
        -
        Parameters:
        -
        bv - Base64 variant to use
        -
        data - InputStream to use for reading binary data to write. - Will not be closed after successful write operation
        -
        dataLength - (optional) number of bytes that will be available; - or -1 to be indicate it is not known. - If a positive length is given, data MUST provide at least - that many bytes: if not, an exception will be thrown. - Note that implementations - need not support cases where length is not known in advance; this - depends on underlying data format: JSON output does NOT require length, - other formats may.
        -
        Returns:
        -
        Number of bytes read from data and written as binary payload
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public abstract void writeNumber(short v)
        -                          throws IOException
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public abstract void writeNumber(int v)
        -                          throws IOException
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public abstract void writeNumber(long v)
        -                          throws IOException
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public abstract void writeNumber(BigInteger v)
        -                          throws IOException
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public abstract void writeNumber(double v)
        -                          throws IOException
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public abstract void writeNumber(float v)
        -                          throws IOException
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public abstract void writeNumber(BigDecimal v)
        -                          throws IOException
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public abstract void writeNumber(String encodedValue)
        -                          throws IOException
        -
        Write method that can be used for custom numeric types that can - not be (easily?) converted to "standard" Java number types. - Because numbers are not surrounded by double quotes, regular - writeString(java.lang.String) method can not be used; nor - writeRaw(java.lang.String) because that does not properly handle - value separators needed in Array or Object contexts. -

        - Note: because of lack of type safety, some generator - implementations may not be able to implement this - method. For example, if a binary JSON format is used, - it may require type information for encoding; similarly - for generator-wrappers around Java objects or JSON nodes. - If implementation does not implement this method, - it needs to throw UnsupportedOperationException.

        -
        -
        Parameters:
        -
        encodedValue - Textual (possibly format) number representation to write
        -
        Throws:
        -
        UnsupportedOperationException - If underlying data format does not - support numbers serialized textually AND if generator is not allowed - to just output a String instead (Schema-based formats may require actual - number, for example)
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(char[] encodedValueBuffer,
        -                        int offset,
        -                        int len)
        -                 throws IOException
        -
        Overloaded version of writeNumber(String) with same semantics - but possibly more efficient operation.
        -
        -
        Parameters:
        -
        encodedValueBuffer - Buffer that contains the textual number representation to write
        -
        offset - Offset of the first character of value to write
        -
        len - Length of the value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBoolean

        -
        public abstract void writeBoolean(boolean state)
        -                           throws IOException
        -
        Method for outputting literal JSON boolean value (one of - Strings 'true' and 'false'). - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Parameters:
        -
        state - Boolean value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNull

        -
        public abstract void writeNull()
        -                        throws IOException
        -
        Method for outputting literal JSON null value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEmbeddedObject

        -
        public void writeEmbeddedObject(Object object)
        -                         throws IOException
        -
        Method that can be called on backends that support passing opaque native - values that some data formats support; not used with JSON backend, - more common with binary formats. -

        - NOTE: this is NOT the method to call for serializing regular POJOs, - see writeObject(java.lang.Object) instead.

        -
        -
        Parameters:
        -
        object - Native format-specific value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectId

        -
        public void writeObjectId(Object id)
        -                   throws IOException
        -
        Method that can be called to output so-called native Object Id. - Note that it may only be called after ensuring this is legal - (with canWriteObjectId()), as not all data formats - have native type id support; and some may only allow them in - certain positions or locations.
        -
        -
        Parameters:
        -
        id - Native Object Id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        JsonGenerationException - if Object ID output is not allowed - (either at all, or specifically in this position in output)
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectRef

        -
        public void writeObjectRef(Object referenced)
        -                    throws IOException
        -
        Method that can be called to output references to native Object Ids. - Note that it may only be called after ensuring this is legal - (with canWriteObjectId()), as not all data formats - have native type id support; and some may only allow them in - certain positions or locations. - If output is not allowed by the data format in this position, - a JsonGenerationException will be thrown.
        -
        -
        Parameters:
        -
        referenced - Referenced value, for which Object Id is expected to be written
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        JsonGenerationException - if Object ID output is not allowed - (either at all, or specifically in this position in output)
        -
        -
      • -
      - - - -
        -
      • -

        writeTypeId

        -
        public void writeTypeId(Object id)
        -                 throws IOException
        -
        Method that can be called to output so-called native Type Id. - Note that it may only be called after ensuring this is legal - (with canWriteTypeId()), as not all data formats - have native type id support; and some may only allow them in - certain positions or locations. - If output is not allowed by the data format in this position, - a JsonGenerationException will be thrown.
        -
        -
        Parameters:
        -
        id - Native Type Id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeTypePrefix

        -
        public WritableTypeId writeTypePrefix(WritableTypeId typeIdDef)
        -                               throws IOException
        -
        Replacement method for writeTypeId(Object) which is called - regardless of whether format has native type ids. If it does have native - type ids, those are to be used (if configuration allows this), if not, - structural type id inclusion is to be used. For JSON, for example, no - native type ids exist and structural inclusion is always used. -

        - NOTE: databind may choose to skip calling this method for some special cases - (and instead included type id via regular write methods and/or writeTypeId(java.lang.Object) - -- this is discouraged, but not illegal, and may be necessary as a work-around - in some cases.

        -
        -
        Parameters:
        -
        typeIdDef - Full Type Id definition
        -
        Returns:
        -
        WritableTypeId for caller to retain and pass to matching - writeTypeSuffix(com.fasterxml.jackson.core.type.WritableTypeId) call
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeObject

        -
        public abstract void writeObject(Object pojo)
        -                          throws IOException
        -
        Method for writing given Java object (POJO) as tokens into - stream this generator manages. - This is done by delegating call to - ObjectWriteContext.writeValue(JsonGenerator, Object).
        -
        -
        Parameters:
        -
        pojo - General POJO value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeBinaryField

        -
        public final void writeBinaryField(String fieldName,
        -                                   byte[] data)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that contains specified data in base64-encoded form. - Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeBinary(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of Object field to write
        -
        data - Binary value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBooleanField

        -
        public final void writeBooleanField(String fieldName,
        -                                    boolean value)
        -                             throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has a boolean value. Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeBoolean(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of Object field to write
        -
        value - Boolean value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNullField

        -
        public final void writeNullField(String fieldName)
        -                          throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has JSON literal value null. Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeNull();
        -
        -
        -
        Parameters:
        -
        fieldName - Name of the null-valued field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStringField

        -
        public final void writeStringField(String fieldName,
        -                                   String value)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has a String value. Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeString(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of the field to write
        -
        value - String value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumberField

        -
        public final void writeNumberField(String fieldName,
        -                                   short value)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has the specified numeric value. Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeNumber(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of the field to write
        -
        value - Numeric value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumberField

        -
        public final void writeNumberField(String fieldName,
        -                                   int value)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has the specified numeric value. Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeNumber(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of the field to write
        -
        value - Numeric value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumberField

        -
        public final void writeNumberField(String fieldName,
        -                                   long value)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has the specified numeric value. Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeNumber(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of the field to write
        -
        value - Numeric value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumberField

        -
        public final void writeNumberField(String fieldName,
        -                                   BigInteger value)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has the specified numeric value. Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeNumber(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of the field to write
        -
        value - Numeric value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumberField

        -
        public final void writeNumberField(String fieldName,
        -                                   float value)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has the specified numeric value. Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeNumber(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of the field to write
        -
        value - Numeric value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumberField

        -
        public final void writeNumberField(String fieldName,
        -                                   double value)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has the specified numeric value. Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeNumber(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of the field to write
        -
        value - Numeric value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumberField

        -
        public final void writeNumberField(String fieldName,
        -                                   BigDecimal value)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has the specified numeric value. - Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeNumber(value);
        -
        -
        -
        Parameters:
        -
        fieldName - Name of the field to write
        -
        value - Numeric value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArrayFieldStart

        -
        public final void writeArrayFieldStart(String fieldName)
        -                                throws IOException
        -
        Convenience method for outputting a field entry ("member") - (that will contain a JSON Array value), and the START_ARRAY marker. - Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeStartArray();
        -
        -

        - Note: caller still has to take care to close the array - (by calling {#link #writeEndArray}) after writing all values - of the value Array.

        -
        -
        Parameters:
        -
        fieldName - Name of the Array field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectFieldStart

        -
        public final void writeObjectFieldStart(String fieldName)
        -                                 throws IOException
        -
        Convenience method for outputting a field entry ("member") - (that will contain an Object value), and the START_OBJECT marker. - Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeStartObject();
        -
        -

        - Note: caller still has to take care to close the Object - (by calling {#link #writeEndObject}) after writing all - entries of the value Object.

        -
        -
        Parameters:
        -
        fieldName - Name of the Object field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectField

        -
        public final void writeObjectField(String fieldName,
        -                                   Object pojo)
        -                            throws IOException
        -
        Convenience method for outputting a field entry ("member") - that has contents of specific Java object as its value. - Equivalent to: -
        -  writeFieldName(fieldName);
        -  writeObject(pojo);
        -
        -

        - NOTE: see writeObject(Object) for details on how POJO value actually - gets written (uses delegation)

        -
        -
        Parameters:
        -
        fieldName - Name of the field to write
        -
        pojo - POJO value of the field to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeOmittedField

        -
        public void writeOmittedField(String fieldName)
        -                       throws IOException
        -
        Method called to indicate that a property in this position was - skipped. It is usually only called for generators that return - false from canOmitFields(). -

        - Default implementation does nothing.

        -
        -
        Parameters:
        -
        fieldName - Name of the field that is being omitted
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        copyCurrentEvent

        -
        public void copyCurrentEvent(JsonParser p)
        -                      throws IOException
        -
        Method for copying contents of the current event that - the given parser instance points to. - Note that the method will not copy any other events, - such as events contained within JSON Array or Object structures. -

        - Calling this method will not advance the given - parser, although it may cause parser to internally process - more data (if it lazy loads contents of value events, for example)

        -
        -
        Parameters:
        -
        p - Parser that points to the event to copy
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        copyCurrentStructure

        -
        public void copyCurrentStructure(JsonParser p)
        -                          throws IOException
        -
        Method for copying contents of the current event - and following events that it encloses - the given parser instance points to. -

        - So what constitutes enclosing? Here is the list of - events that have associated enclosed events that will - get copied: -

          -
        • JsonToken.START_OBJECT: - all events up to and including matching (closing) - JsonToken.END_OBJECT will be copied -
        • -
        • JsonToken.START_ARRAY - all events up to and including matching (closing) - JsonToken.END_ARRAY will be copied -
        • -
        • JsonToken.FIELD_NAME the logical value (which - can consist of a single scalar value; or a sequence of related - events for structured types (JSON Arrays, Objects)) will - be copied along with the name itself. So essentially the - whole field entry (name and value) will be copied. -
        • -
        -

        - After calling this method, parser will point to the - last event that was copied. This will either be - the event parser already pointed to (if there were no - enclosed events), or the last enclosed event copied.

        -
        -
        Parameters:
        -
        p - Parser that points to the value to copy
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        flush

        -
        public abstract void flush()
        -                    throws IOException
        -
        Method called to flush any buffered content to the underlying - target (output stream, writer), and to flush the target itself - as well.
        -
        -
        Specified by:
        -
        flush in interface Flushable
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public abstract boolean isClosed()
        -
        Method that can be called to determine whether this generator - is closed or not. If it is closed, no more output can be done.
        -
        -
        Returns:
        -
        True if this generator has been closed; false if not
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public abstract void close()
        -                    throws IOException
        -
        Method called to close this generator, so that no more content - can be written. -

        - Whether the underlying target (stream, writer) gets closed depends - on whether this generator either manages the target (i.e. is the - only one with access to the target -- case if caller passes a - reference to the resource such as File, but not stream); or - has feature StreamWriteFeature.AUTO_CLOSE_TARGET enabled. - If either of above is true, the target is also closed. Otherwise - (not managing, feature not enabled), target is not closed.

        -
        -
        Specified by:
        -
        close in interface Closeable
        -
        Specified by:
        -
        close in interface AutoCloseable
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        _reportError

        -
        protected <T> T _reportError(String msg)
        -                      throws JsonGenerationException
        -
        Helper method used for constructing and throwing - JsonGenerationException with given base message. -

        - Note that sub-classes may override this method to add more detail - or use a JsonGenerationException sub-class.

        -
        -
        Type Parameters:
        -
        T - Bogus type parameter to "return anything" so that compiler - won't complain when chaining calls
        -
        Parameters:
        -
        msg - Message to construct exception with
        -
        Returns:
        -
        Does not return at all as exception is always thrown, but nominally returns "anything"
        -
        Throws:
        -
        JsonGenerationException - that was constructed with given message
        -
        -
      • -
      - - - -
        -
      • -

        _throwInternal

        -
        protected void _throwInternal()
        -
      • -
      - - - -
        -
      • -

        _reportUnsupportedOperation

        -
        protected <T> T _reportUnsupportedOperation()
        -
      • -
      - - - -
        -
      • -

        _verifyOffsets

        -
        protected final void _verifyOffsets(int arrayLength,
        -                                    int offset,
        -                                    int length)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonLocation.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonLocation.html deleted file mode 100644 index c1145b6af9..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonLocation.html +++ /dev/null @@ -1,613 +0,0 @@ - - - - - - -JsonLocation (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class JsonLocation

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public class JsonLocation
    -extends Object
    -implements Serializable
    -
    Object that encapsulates Location information used for reporting - parsing (or potentially generation) errors, as well as current location - within input streams.
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        MAX_CONTENT_SNIPPET

        -
        public static final int MAX_CONTENT_SNIPPET
        -
        Include at most first 500 characters/bytes from contents; should be enough - to give context, but not cause unfortunate side effects in things like - logs.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        NA

        -
        public static final JsonLocation NA
        -
        Shared immutable "N/A location" that can be returned to indicate - that no location information is available.
        -
      • -
      - - - -
        -
      • -

        _totalBytes

        -
        protected final long _totalBytes
        -
      • -
      - - - -
        -
      • -

        _totalChars

        -
        protected final long _totalChars
        -
      • -
      - - - -
        -
      • -

        _lineNr

        -
        protected final int _lineNr
        -
      • -
      - - - -
        -
      • -

        _columnNr

        -
        protected final int _columnNr
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonLocation

        -
        public JsonLocation(Object srcRef,
        -                    long totalChars,
        -                    int lineNr,
        -                    int colNr)
        -
      • -
      - - - -
        -
      • -

        JsonLocation

        -
        public JsonLocation(Object sourceRef,
        -                    long totalBytes,
        -                    long totalChars,
        -                    int lineNr,
        -                    int columnNr)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getSourceRef

        -
        public Object getSourceRef()
        -
        Reference to the original resource being read, if one available. - For example, when a parser has been constructed by passing - a File instance, this method would return - that File. Will return null if no such reference is available, - for example when InputStream was used to - construct the parser instance.
        -
        -
        Returns:
        -
        Source reference this location was constructed with, if any; null if none
        -
        -
      • -
      - - - -
        -
      • -

        getLineNr

        -
        public int getLineNr()
        -
        -
        Returns:
        -
        Line number of the location (1-based)
        -
        -
      • -
      - - - -
        -
      • -

        getColumnNr

        -
        public int getColumnNr()
        -
        -
        Returns:
        -
        Column number of the location (1-based)
        -
        -
      • -
      - - - -
        -
      • -

        getCharOffset

        -
        public long getCharOffset()
        -
        -
        Returns:
        -
        Character offset within underlying stream, reader or writer, - if available; -1 if not.
        -
        -
      • -
      - - - -
        -
      • -

        getByteOffset

        -
        public long getByteOffset()
        -
        -
        Returns:
        -
        Byte offset within underlying stream, reader or writer, - if available; -1 if not.
        -
        -
      • -
      - - - -
        -
      • -

        sourceDescription

        -
        public String sourceDescription()
        -
        Accessor for getting a textual description of source reference - (Object returned by getSourceRef()), as included in - description returned by toString(). -

        - NOTE: not added as a "getter" to prevent it from getting serialized.

        -
        -
        Returns:
        -
        Description of the source reference (see getSourceRef()
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class Object
        -
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public boolean equals(Object other)
        -
        -
        Overrides:
        -
        equals in class Object
        -
        -
      • -
      - - - - - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParseException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParseException.html deleted file mode 100644 index c619268502..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParseException.html +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - -JsonParseException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class JsonParseException

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    Direct Known Subclasses:
    -
    JsonEOFException
    -
    -
    -
    -
    public class JsonParseException
    -extends StreamReadException
    -
    Exception type for parsing problems, used when non-well-formed content - (content that does not conform to JSON syntax as per specification) - is encountered.
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        withRequestPayload

        -
        public JsonParseException withRequestPayload(RequestPayload payload)
        -
        Fluent method that may be used to assign payload to this exception, - to let recipient access it for diagnostics purposes. -

        - NOTE: `this` instance is modified and no new instance is constructed.

        -
        -
        Specified by:
        -
        withRequestPayload in class StreamReadException
        -
        Parameters:
        -
        payload - Payload to assign to this exception
        -
        Returns:
        -
        This exception instance to allow call chaining
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParser.NumberType.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParser.NumberType.html deleted file mode 100644 index 95de770e23..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParser.NumberType.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - - -JsonParser.NumberType (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Enum JsonParser.NumberType

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static JsonParser.NumberType[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (JsonParser.NumberType c : JsonParser.NumberType.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static JsonParser.NumberType valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParser.html deleted file mode 100644 index 6d087748c1..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonParser.html +++ /dev/null @@ -1,3318 +0,0 @@ - - - - - - -JsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class JsonParser

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        _requestPayload

        -
        protected transient RequestPayload _requestPayload
        -
        Optional container that holds the request payload which will be displayed on JSON parsing error.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonParser

        -
        protected JsonParser()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        version

        -
        public abstract Version version()
        -
        Accessor for getting version of the core package, given a parser instance. - Left for sub-classes to implement.
        -
        -
        Specified by:
        -
        version in interface Versioned
        -
        Returns:
        -
        Version of the component
        -
        -
      • -
      - - - -
        -
      • -

        getParsingContext

        -
        public abstract TokenStreamContext getParsingContext()
        -
        Method that can be used to access current parsing context reader - is in. There are 3 different types: root, array and object contexts, - with slightly different available information. Contexts are - hierarchically nested, and can be used for example for figuring - out part of the input document that correspond to specific - array or object (for highlighting purposes, or error reporting). - Contexts can also be used for simple xpath-like matching of - input, if so desired.
        -
        -
        Returns:
        -
        Stream output context (TokenStreamContext) associated with this parser
        -
        -
      • -
      - - - -
        -
      • -

        getObjectReadContext

        -
        public abstract ObjectReadContext getObjectReadContext()
        -
        Accessor for context object provided by higher level data-binding - functionality (or, in some cases, simple placeholder of the same) - that allows some level of interaction including ability to trigger - deserialization of Object values through generator instance. -

        - Context object is used by parser to implement some methods, - like readValueAs(...)

        -
        -
        Returns:
        -
        Object write context (ObjectReadContext) associated with this parser
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        getTokenLocation

        -
        public abstract JsonLocation getTokenLocation()
        -
        Method that return the starting location of the current - token; that is, position of the first character from input - that starts the current token. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Returns:
        -
        Starting location of the token parser currently points to
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentLocation

        -
        public abstract JsonLocation getCurrentLocation()
        -
        Method that returns location of the last processed character; - usually for error reporting purposes. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - report specific boundary locations (start or end locations of tokens) - and others only return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Returns:
        -
        Location of the last processed input unit (byte or character)
        -
        -
      • -
      - - - -
        -
      • -

        getInputSource

        -
        public abstract Object getInputSource()
        -
        Method that can be used to get access to object that is used - to access input being parsed; this is usually either - InputStream or Reader, depending on what - parser was constructed with. - Note that returned value may be null in some cases; including - case where parser implementation does not want to exposed raw - source to caller. - In cases where input has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of parser and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Returns:
        -
        Input source this parser was configured with
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentValue

        -
        public abstract Object getCurrentValue()
        -
        Helper method, usually equivalent to: - - getParsingContext().getCurrentValue(); - -

        - Note that "current value" is NOT populated (or used) by Streaming parser; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Returns:
        -
        "Current value" for the current input context this parser has
        -
        -
      • -
      - - - -
        -
      • -

        setCurrentValue

        -
        public abstract void setCurrentValue(Object v)
        -
        Helper method, usually equivalent to: - - getParsingContext().setCurrentValue(v); -
        -
        -
        Parameters:
        -
        v - "Current value" to assign to the current input context of this parser
        -
        -
      • -
      - - - -
        -
      • -

        setRequestPayloadOnError

        -
        public void setRequestPayloadOnError(RequestPayload payload)
        -
        Sets the payload to be passed if JsonParseException is thrown.
        -
        -
        Parameters:
        -
        payload - to assign
        -
        -
      • -
      - - - -
        -
      • -

        setRequestPayloadOnError

        -
        public void setRequestPayloadOnError(byte[] payload,
        -                                     Charset charset)
        -
        Sets the byte[] request payload and the charset needed to decode it
        -
        -
        Parameters:
        -
        payload - Payload to pass
        -
        charset - Character encoding for (lazily) decoding payload
        -
        -
      • -
      - - - -
        -
      • -

        setRequestPayloadOnError

        -
        public void setRequestPayloadOnError(String payload)
        -
        Sets the String request payload
        -
        -
        Parameters:
        -
        payload - to assign
        -
        -
      • -
      - - - -
        -
      • -

        getSchema

        -
        public FormatSchema getSchema()
        -
        Method for accessing Schema that this parser uses, if any. - Default implementation returns null.
        -
        -
        Returns:
        -
        FormatSchema assigned to this parser, if any; null if none
        -
        -
      • -
      - - - -
        -
      • -

        canParseAsync

        -
        public boolean canParseAsync()
        -
        Method that can be called to determine if this parser instance - uses non-blocking ("asynchronous") input access for decoding or not. - Access mode is determined by earlier calls via JsonFactory; - it may not be changed after construction. -

        - If non-blocking decoding is true, it is possible to call - getNonBlockingInputFeeder() to obtain object to use - for feeding input; otherwise (false returned) - input is read by blocking.

        -
        -
        Returns:
        -
        True if this is a non-blocking ("asynchronous") parser
        -
        -
      • -
      - - - -
        -
      • -

        getNonBlockingInputFeeder

        -
        public NonBlockingInputFeeder getNonBlockingInputFeeder()
        -
        Method that will either return a feeder instance (if parser uses - non-blocking, aka asynchronous access); or null for - parsers that use blocking I/O.
        -
        -
        Returns:
        -
        Input feeder to use with non-blocking (async) parsing
        -
        -
      • -
      - - - -
        -
      • -

        getReadCapabilities

        -
        public JacksonFeatureSet<StreamReadCapability> getReadCapabilities()
        -
        Accessor for getting metadata on capabilities of this parser, based on - underlying data format being read (directly or indirectly).
        -
        -
        Returns:
        -
        Set of read capabilities for content to read via this parser
        -
        Since:
        -
        2.12
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public abstract void close()
        -                    throws IOException
        -
        Closes the parser so that no further iteration or data access - can be made; will also close the underlying input source - if parser either owns the input source, or feature - StreamReadFeature.AUTO_CLOSE_SOURCE is enabled. - Whether parser owns the input source depends on factory - method that was used to construct instance (so check - JsonFactory for details, - but the general - idea is that if caller passes in closable resource (such - as InputStream or Reader) parser does NOT - own the source; but if it passes a reference (such as - File or URL and creates - stream or reader it does own them.
        -
        -
        Specified by:
        -
        close in interface Closeable
        -
        Specified by:
        -
        close in interface AutoCloseable
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public abstract boolean isClosed()
        -
        Method that can be called to determine whether this parser - is closed or not. If it is closed, no new tokens can be - retrieved by calling nextToken() (and the underlying - stream may be closed). Closing may be due to an explicit - call to close() or because parser has encountered - end of input.
        -
        -
        Returns:
        -
        True if this parser instance has been closed
        -
        -
      • -
      - - - -
        -
      • -

        releaseBuffered

        -
        public int releaseBuffered(OutputStream out)
        -                    throws IOException
        -
        Method that can be called to push back any content that - has been read but not consumed by the parser. This is usually - done after reading all content of interest using parser. - Content is released by writing it to given stream if possible; - if underlying input is byte-based it can released, if not (char-based) - it can not.
        -
        -
        Parameters:
        -
        out - OutputStream to which buffered, undecoded content is written to
        -
        Returns:
        -
        -1 if the underlying content source is not byte based - (that is, input can not be sent to OutputStream; - otherwise number of bytes released (0 if there was nothing to release)
        -
        Throws:
        -
        IOException - if write to stream threw exception
        -
        -
      • -
      - - - -
        -
      • -

        releaseBuffered

        -
        public int releaseBuffered(Writer w)
        -                    throws IOException
        -
        Method that can be called to push back any content that - has been read but not consumed by the parser. - This is usually - done after reading all content of interest using parser. - Content is released by writing it to given writer if possible; - if underlying input is char-based it can released, if not (byte-based) - it can not.
        -
        -
        Parameters:
        -
        w - Writer to which buffered but unprocessed content is written to
        -
        Returns:
        -
        -1 if the underlying content source is not char-based - (that is, input can not be sent to Writer; - otherwise number of chars released (0 if there was nothing to release)
        -
        Throws:
        -
        IOException - if write using Writer threw exception
        -
        -
      • -
      - - - -
        -
      • -

        enable

        -
        public abstract JsonParser enable(StreamReadFeature f)
        -
        Method for enabling specified parser feature - (check StreamReadFeature for list of features)
        -
        -
        Parameters:
        -
        f - Feature to enable
        -
        Returns:
        -
        This parser, to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        disable

        -
        public abstract JsonParser disable(StreamReadFeature f)
        -
        Method for disabling specified feature - (check StreamReadFeature for list of features)
        -
        -
        Parameters:
        -
        f - Feature to disable
        -
        Returns:
        -
        This parser, to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        isEnabled

        -
        public abstract boolean isEnabled(StreamReadFeature f)
        -
        Method for checking whether specified StreamReadFeature is enabled.
        -
        -
        Parameters:
        -
        f - Feature to check
        -
        Returns:
        -
        True if feature is enabled; false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        streamReadFeatures

        -
        public abstract int streamReadFeatures()
        -
        Bulk access method for getting state of all standard StreamReadFeatures.
        -
        -
        Returns:
        -
        Bit mask that defines current states of all standard StreamReadFeatures.
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        nextToken

        -
        public abstract JsonToken nextToken()
        -                             throws IOException
        -
        Main iteration method, which will advance stream enough - to determine type of the next token, if any. If none - remaining (stream has no content other than possible - white space before ending), null will be returned.
        -
        -
        Returns:
        -
        Next token from the stream, if any found, or null - to indicate end-of-input
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextValue

        -
        public abstract JsonToken nextValue()
        -                             throws IOException
        -
        Iteration method that will advance stream enough - to determine type of the next token that is a value type - (including JSON Array and Object start/end markers). - Or put another way, nextToken() will be called once, - and if JsonToken.FIELD_NAME is returned, another - time to get the value for the field. - Method is most useful for iterating over value entries - of JSON objects; field name will still be available - by calling currentName() when parser points to - the value.
        -
        -
        Returns:
        -
        Next non-field-name token from the stream, if any found, - or null to indicate end-of-input (or, for non-blocking - parsers, JsonToken.NOT_AVAILABLE if no tokens were - available yet)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        skipChildren

        -
        public abstract JsonParser skipChildren()
        -                                 throws IOException
        -
        Method that will skip all child tokens of an array or - object token that the parser currently points to, - iff stream points to - JsonToken.START_OBJECT or JsonToken.START_ARRAY. - If not, it will do nothing. - After skipping, stream will point to matching - JsonToken.END_OBJECT or JsonToken.END_ARRAY - (possibly skipping nested pairs of START/END OBJECT/ARRAY tokens - as well as value tokens). - The idea is that after calling this method, application - will call nextToken() to point to the next - available token, if any.
        -
        -
        Returns:
        -
        This parser, to allow call chaining
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        finishToken

        -
        public abstract void finishToken()
        -                          throws IOException
        -
        Method that may be used to force full handling of the current token - so that even if lazy processing is enabled, the whole contents are - read for possible retrieval. This is usually used to ensure that - the token end location is available, as well as token contents - (similar to what calling, say getTextCharacters(), would - achieve). -

        - Note that for many dataformat implementations this method - will not do anything; this is the default implementation unless - overridden by sub-classes.

        -
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextFieldName

        -
        public abstract String nextFieldName()
        -                              throws IOException
        -
        Method that fetches next token (as if calling nextToken()) and - verifies whether it is JsonToken.FIELD_NAME; if it is, - returns same as currentName(), otherwise null.
        -
        -
        Returns:
        -
        Name of the the JsonToken.FIELD_NAME parser advanced to, if any; - null if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextFieldName

        -
        public abstract boolean nextFieldName(SerializableString str)
        -                               throws IOException
        -
        Method that fetches next token (as if calling nextToken()) and - verifies whether it is JsonToken.FIELD_NAME with specified name - and returns result of that comparison. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName());
        -
        - but may be faster for parser to verify, and can therefore be used if caller - expects to get such a property name from input next.
        -
        -
        Parameters:
        -
        str - Property name to compare next token to (if next token is - JsonToken.FIELD_NAME)
        -
        Returns:
        -
        True if parser advanced to JsonToken.FIELD_NAME with - specified name; false otherwise (different token or non-matching name)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextFieldName

        -
        public abstract int nextFieldName(FieldNameMatcher matcher)
        -                           throws IOException
        -
        Method that tries to match next token from stream as JsonToken.FIELD_NAME, - and if so, further match it to one of pre-specified (field) names. - If match succeeds, field index (non-negative `int`) is returned; otherwise one of - marker constants from FieldNameMatcher.
        -
        -
        Parameters:
        -
        matcher - Matcher that will handle actual matching
        -
        Returns:
        -
        Index of the matched field name, if non-negative, or a negative error - code otherwise (see FieldNameMatcher for details)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        currentFieldName

        -
        public abstract int currentFieldName(FieldNameMatcher matcher)
        -                              throws IOException
        -
        Method that verifies that the current token (see currentToken() is - JsonToken.FIELD_NAME and if so, further match it to one of pre-specified (field) names. - If match succeeds, field index (non-negative `int`) is returned; otherwise one of - marker constants from FieldNameMatcher.
        -
        -
        Parameters:
        -
        matcher - Matcher that will handle actual matching
        -
        Returns:
        -
        Index of the matched field name, if non-negative, or a negative error - code otherwise (see FieldNameMatcher for details)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        nextTextValue

        -
        public String nextTextValue()
        -                     throws IOException
        -
        Method that fetches next token (as if calling nextToken()) and - if it is JsonToken.VALUE_STRING returns contained String value; - otherwise returns null. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_STRING) ? getText() : null;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a String value next from input.
        -
        -
        Returns:
        -
        Text value of the JsonToken.VALUE_STRING token parser advanced - to; or null if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextIntValue

        -
        public int nextIntValue(int defaultValue)
        -                 throws IOException
        -
        Method that fetches next token (as if calling nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 32-bit int value; - otherwise returns specified default value - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get an int value next from input. -

        - NOTE: value checks are performed similar to getIntValue()

        -
        -
        Parameters:
        -
        defaultValue - Value to return if next token is NOT of type JsonToken.VALUE_NUMBER_INT
        -
        Returns:
        -
        Integer (int) value of the JsonToken.VALUE_NUMBER_INT token parser advanced - to; or defaultValue if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        InputCoercionException - if integer number does not fit in Java int
        -
        -
      • -
      - - - -
        -
      • -

        nextLongValue

        -
        public long nextLongValue(long defaultValue)
        -                   throws IOException
        -
        Method that fetches next token (as if calling nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 64-bit long value; - otherwise returns specified default value - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a long value next from input. -

        - NOTE: value checks are performed similar to getLongValue()

        -
        -
        Parameters:
        -
        defaultValue - Value to return if next token is NOT of type JsonToken.VALUE_NUMBER_INT
        -
        Returns:
        -
        long value of the JsonToken.VALUE_NUMBER_INT token parser advanced - to; or defaultValue if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        InputCoercionException - if integer number does not fit in Java long
        -
        -
      • -
      - - - -
        -
      • -

        nextBooleanValue

        -
        public Boolean nextBooleanValue()
        -                         throws IOException
        -
        Method that fetches next token (as if calling nextToken()) and - if it is JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE - returns matching Boolean value; otherwise return null. - It is functionally equivalent to: -
        -  JsonToken t = nextToken();
        -  if (t == JsonToken.VALUE_TRUE) return Boolean.TRUE;
        -  if (t == JsonToken.VALUE_FALSE) return Boolean.FALSE;
        -  return null;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a Boolean value next from input.
        -
        -
        Returns:
        -
        Boolean value of the JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE - token parser advanced to; or null if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        currentToken

        -
        public abstract JsonToken currentToken()
        -
        Accessor to find which token parser currently points to, if any; - null will be returned if none. - If return value is non-null, data associated with the token - is available via other accessor methods.
        -
        -
        Returns:
        -
        Type of the token this parser currently points to, - if any: null before any tokens have been read, and - after end-of-input has been encountered, as well as - if the current token has been explicitly cleared.
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentToken

        -
        @Deprecated
        -public JsonToken getCurrentToken()
        -
        Deprecated. Since 3.0 use currentToken() instead.
        -
        -
        Returns:
        -
        Type of the token this parser currently points to
        -
        -
      • -
      - - - -
        -
      • -

        currentTokenId

        -
        public abstract int currentTokenId()
        -
        Method similar to currentToken() but that returns an - int instead of JsonToken (enum value). -

        - Use of int directly is typically more efficient on switch statements, - so this method may be useful when building low-overhead codecs. - Note, however, that effect may not be big enough to matter: make sure - to profile performance before deciding to use this method.

        -
        -
        Returns:
        -
        int matching one of constants from JsonTokenId.
        -
        -
      • -
      - - - -
        -
      • -

        hasCurrentToken

        -
        public abstract boolean hasCurrentToken()
        -
        Method for checking whether parser currently points to - a token (and data for that token is available). - Equivalent to check for parser.getCurrentToken() != null.
        -
        -
        Returns:
        -
        True if the parser just returned a valid - token via nextToken(); false otherwise (parser - was just constructed, encountered end-of-input - and returned null from nextToken(), or the token - has been consumed)
        -
        -
      • -
      - - - -
        -
      • -

        hasTokenId

        -
        public abstract boolean hasTokenId(int id)
        -
        Method that is functionally equivalent to: - - return currentTokenId() == id - - but may be more efficiently implemented. -

        - Note that no traversal or conversion is performed; so in some - cases calling method like isExpectedStartArrayToken() - is necessary instead.

        -
        -
        Parameters:
        -
        id - Token id to match (from (@link JsonTokenId})
        -
        Returns:
        -
        True if the parser current points to specified token
        -
        -
      • -
      - - - -
        -
      • -

        hasToken

        -
        public abstract boolean hasToken(JsonToken t)
        -
        Method that is functionally equivalent to: - - return currentToken() == t - - but may be more efficiently implemented. -

        - Note that no traversal or conversion is performed; so in some - cases calling method like isExpectedStartArrayToken() - is necessary instead.

        -
        -
        Parameters:
        -
        t - Token to match
        -
        Returns:
        -
        True if the parser current points to specified token
        -
        -
      • -
      - - - -
        -
      • -

        isExpectedStartArrayToken

        -
        public abstract boolean isExpectedStartArrayToken()
        -
        Specialized accessor that can be used to verify that the current - token indicates start array (usually meaning that current token - is JsonToken.START_ARRAY) when start array is expected. - For some specialized parsers this can return true for other cases - as well; this is usually done to emulate arrays in cases underlying - format is ambiguous (XML, for example, has no format-level difference - between Objects and Arrays; it just has elements). -

        - Default implementation is equivalent to: -

        -   currentToken() == JsonToken.START_ARRAY
        -
        - but may be overridden by custom parser implementations.
        -
        -
        Returns:
        -
        True if the current token can be considered as a - start-array marker (such JsonToken.START_ARRAY); - false if not
        -
        -
      • -
      - - - - - - - -
        -
      • -

        isExpectedNumberIntToken

        -
        public abstract boolean isExpectedNumberIntToken()
        -
        Similar to isExpectedStartArrayToken(), but checks whether stream - currently points to JsonToken.VALUE_NUMBER_INT. -

        - The initial use case is for XML backend to efficiently (attempt to) coerce - textual content into numbers.

        -
        -
        Returns:
        -
        True if the current token can be considered as a - start-array marker (such JsonToken.VALUE_NUMBER_INT); - false if not
        -
        -
      • -
      - - - -
        -
      • -

        isNaN

        -
        public abstract boolean isNaN()
        -                       throws IOException
        -
        Access for checking whether current token is a numeric value token, but - one that is of "not-a-number" (NaN) variety (including both "NaN" AND - positive/negative infinity!): not supported by all formats, - but often supported for JsonToken.VALUE_NUMBER_FLOAT. - NOTE: roughly equivalent to calling !Double.isFinite() - on value you would get from calling getDoubleValue().
        -
        -
        Returns:
        -
        True if the current token is of type JsonToken.VALUE_NUMBER_FLOAT - but represents a "Not a Number"; false for other tokens and regular - floating-point numbers
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        clearCurrentToken

        -
        public abstract void clearCurrentToken()
        -
        Method called to "consume" the current token by effectively - removing it so that hasCurrentToken() returns false, and - currentToken() null). - Cleared token value can still be accessed by calling - getLastClearedToken() (if absolutely needed), but - usually isn't. -

        - Method was added to be used by the optional data binder, since - it has to be able to consume last token used for binding (so that - it will not be used again).

        -
      • -
      - - - -
        -
      • -

        getLastClearedToken

        -
        public abstract JsonToken getLastClearedToken()
        -
        Method that can be called to get the last token that was - cleared using clearCurrentToken(). This is not necessarily - the latest token read. - Will return null if no tokens have been cleared, - or if parser has been closed.
        -
        -
        Returns:
        -
        Last cleared token, if any; null otherwise
        -
        -
      • -
      - - - -
        -
      • -

        currentName

        -
        public abstract String currentName()
        -                            throws IOException
        -
        Method that can be called to get the name associated with - the current token: for JsonToken.FIELD_NAMEs it will - be the same as what getText() returns; - for field values it will be the preceding field name; - and for others (array values, root-level values) null.
        -
        -
        Returns:
        -
        Name of the current field in the parsing context
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getText

        -
        public abstract String getText()
        -                        throws IOException
        -
        Method for accessing textual representation of the current token; - if no current token (before first call to nextToken(), or - after encountering end-of-input), returns null. - Method can be called for any token type.
        -
        -
        Returns:
        -
        Textual value associated with the current token (one returned - by nextToken() or other iteration methods)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public int getText(Writer writer)
        -            throws IOException,
        -                   UnsupportedOperationException
        -
        Method to read the textual representation of the current token in chunks and - pass it to the given Writer. - Conceptually same as calling: -
        -  writer.write(parser.getText());
        -
        - but should typically be more efficient as longer content does need to - be combined into a single String to return, and write - can occur directly from intermediate buffers Jackson uses.
        -
        -
        Parameters:
        -
        writer - Writer to write textual content to
        -
        Returns:
        -
        The number of characters written to the Writer
        -
        Throws:
        -
        IOException - for low-level read issues or writes using passed - writer, or - JsonParseException for decoding problems
        -
        UnsupportedOperationException
        -
        -
      • -
      - - - -
        -
      • -

        getTextCharacters

        -
        public abstract char[] getTextCharacters()
        -                                  throws IOException
        -
        Method similar to getText(), but that will return - underlying (unmodifiable) character array that contains - textual value, instead of constructing a String object - to contain this information. - Note, however, that: -
          -
        • Textual contents are not guaranteed to start at - index 0 (rather, call getTextOffset()) to - know the actual offset -
        • -
        • Length of textual contents may be less than the - length of returned buffer: call getTextLength() - for actual length of returned content. -
        • -
        -

        - Note that caller MUST NOT modify the returned - character array in any way -- doing so may corrupt - current parser state and render parser instance useless. -

        - The only reason to call this method (over getText()) - is to avoid construction of a String object (which - will make a copy of contents).

        -
        -
        Returns:
        -
        Buffer that contains the current textual value (but not necessarily - at offset 0, and not necessarily until the end of buffer)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getTextLength

        -
        public abstract int getTextLength()
        -                           throws IOException
        -
        Accessor used with getTextCharacters(), to know length - of String stored in returned buffer.
        -
        -
        Returns:
        -
        Number of characters within buffer returned - by getTextCharacters() that are part of - textual content of the current token.
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getTextOffset

        -
        public abstract int getTextOffset()
        -                           throws IOException
        -
        Accessor used with getTextCharacters(), to know offset - of the first text content character within buffer.
        -
        -
        Returns:
        -
        Offset of the first character within buffer returned - by getTextCharacters() that is part of - textual content of the current token.
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        hasTextCharacters

        -
        public abstract boolean hasTextCharacters()
        -
        Method that can be used to determine whether calling of - getTextCharacters() would be the most efficient - way to access textual content for the event parser currently - points to. -

        - Default implementation simply returns false since only actual - implementation class has knowledge of its internal buffering - state. - Implementations are strongly encouraged to properly override - this method, to allow efficient copying of content by other - code.

        -
        -
        Returns:
        -
        True if parser currently has character array that can - be efficiently returned via getTextCharacters(); false - means that it may or may not exist
        -
        -
      • -
      - - - -
        -
      • -

        getNumberValue

        -
        public abstract Number getNumberValue()
        -                               throws IOException
        -
        Generic number value accessor method that will work for - all kinds of numeric values. It will return the optimal - (simplest/smallest possible) wrapper object that can - express the numeric value just parsed.
        -
        -
        Returns:
        -
        Numeric value of the current token in its most optimal - representation
        -
        Throws:
        -
        IOException - Problem with access: JsonParseException if - the current token is not numeric, or if decoding of the value fails - (invalid format for numbers); plain IOException if underlying - content read fails (possible if values are extracted lazily)
        -
        -
      • -
      - - - -
        -
      • -

        getNumberValueExact

        -
        public abstract Number getNumberValueExact()
        -                                    throws IOException
        -
        Method similar to getNumberValue() with the difference that - for floating-point numbers value returned may be BigDecimal - if the underlying format does not store floating-point numbers using - native representation: for example, textual formats represent numbers - as Strings (which are 10-based), and conversion to Double - is potentially lossy operation. -

        - Default implementation simply returns getNumberValue()

        -
        -
        Returns:
        -
        Numeric value of the current token using most accurate representation
        -
        Throws:
        -
        IOException - Problem with access: JsonParseException if - the current token is not numeric, or if decoding of the value fails - (invalid format for numbers); plain IOException if underlying - content read fails (possible if values are extracted lazily)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getByteValue

        -
        public abstract byte getByteValue()
        -                           throws IOException
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java byte primitive type. - Note that in addition to "natural" input range of [-128, 127], - this also allows "unsigned 8-bit byte" values [128, 255]: - but for this range value will be translated by truncation, leading - to sign change. -

        - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling getDoubleValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the resulting integer value falls outside range of - [-128, 255], - a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Returns:
        -
        Current number value as byte (if numeric token within - range of [-128, 255]); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getShortValue

        -
        public abstract short getShortValue()
        -                             throws IOException
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java short primitive type. - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling getDoubleValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the resulting integer value falls outside range of - Java short, a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Returns:
        -
        Current number value as short (if numeric token within - Java 16-bit signed short range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getIntValue

        -
        public abstract int getIntValue()
        -                         throws IOException
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java int primitive type. - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling getDoubleValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the resulting integer value falls outside range of - Java int, a InputCoercionException - may be thrown to indicate numeric overflow/underflow.

        -
        -
        Returns:
        -
        Current number value as int (if numeric token within - Java 32-bit signed int range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getLongValue

        -
        public abstract long getLongValue()
        -                           throws IOException
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a Java long primitive type. - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling getDoubleValue() - and then casting to int; except for possible overflow/underflow - exception. -

        - Note: if the token is an integer, but its value falls - outside of range of Java long, a InputCoercionException - may be thrown to indicate numeric overflow/underflow.

        -
        -
        Returns:
        -
        Current number value as long (if numeric token within - Java 32-bit signed long range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getFloatValue

        -
        public abstract float getFloatValue()
        -                             throws IOException
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_FLOAT and - it can be expressed as a Java float primitive type. - It can also be called for JsonToken.VALUE_NUMBER_INT; - if so, it is equivalent to calling getLongValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the value falls - outside of range of Java float, a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Returns:
        -
        Current number value as float (if numeric token within - Java float range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getDoubleValue

        -
        public abstract double getDoubleValue()
        -                               throws IOException
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_FLOAT and - it can be expressed as a Java double primitive type. - It can also be called for JsonToken.VALUE_NUMBER_INT; - if so, it is equivalent to calling getLongValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the value falls - outside of range of Java double, a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Returns:
        -
        Current number value as double (if numeric token within - Java double range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getEmbeddedObject

        -
        public Object getEmbeddedObject()
        -                         throws IOException
        -
        Accessor that can be called if (and only if) the current token - is JsonToken.VALUE_EMBEDDED_OBJECT. For other token types, - null is returned. -

        - Note: only some specialized parser implementations support - embedding of objects (usually ones that are facades on top - of non-streaming sources, such as object trees). One exception - is access to binary content (whether via base64 encoding or not) - which typically is accessible using this method, as well as - getBinaryValue().

        -
        -
        Returns:
        -
        Embedded value (usually of "native" type supported by format) - for the current token, if any; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryValue

        -
        public abstract byte[] getBinaryValue(Base64Variant bv)
        -                               throws IOException
        -
        Method that can be used to read (and consume -- results - may not be accessible using other methods after the call) - base64-encoded binary data - included in the current textual JSON value. - It works similar to getting String value via getText() - and decoding result (except for decoding part), - but should be significantly more performant. -

        - Note that non-decoded textual contents of the current token - are not guaranteed to be accessible after this method - is called. Current implementation, for example, clears up - textual content during decoding. - Decoded binary content, however, will be retained until - parser is advanced to the next event.

        -
        -
        Parameters:
        -
        bv - Expected variant of base64 encoded - content (see Base64Variants for definitions - of "standard" variants).
        -
        Returns:
        -
        Decoded binary data
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        readBinaryValue

        -
        public int readBinaryValue(OutputStream out)
        -                    throws IOException
        -
        Method that can be used as an alternative to getBinaryValue(), - especially when value can be large. The main difference (beyond method - of returning content using OutputStream instead of as byte array) - is that content will NOT remain accessible after method returns: any content - processed will be consumed and is not buffered in any way. If caller needs - buffering, it has to implement it.
        -
        -
        Parameters:
        -
        out - Output stream to use for passing decoded binary data
        -
        Returns:
        -
        Number of bytes that were decoded and written via OutputStream
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt()
        -                  throws IOException
        -
        Method that will try to convert value of current token to a - Java int value. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - default value of 0 will be returned; no exceptions are thrown.

        -
        -
        Returns:
        -
        int value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt(int def)
        -                  throws IOException
        -
        Method that will try to convert value of current token to a - int. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - specified def will be returned; no exceptions are thrown.

        -
        -
        Parameters:
        -
        def - Default value to return if conversion to int is not possible
        -
        Returns:
        -
        int value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsLong

        -
        public long getValueAsLong()
        -                    throws IOException
        -
        Method that will try to convert value of current token to a - long. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to a long (including structured type - markers like start/end Object/Array) - default value of 0L will be returned; no exceptions are thrown.

        -
        -
        Returns:
        -
        long value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsLong

        -
        public long getValueAsLong(long def)
        -                    throws IOException
        -
        Method that will try to convert value of current token to a - long. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to a long (including structured type - markers like start/end Object/Array) - specified def will be returned; no exceptions are thrown.

        -
        -
        Parameters:
        -
        def - Default value to return if conversion to long is not possible
        -
        Returns:
        -
        long value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsDouble

        -
        public double getValueAsDouble()
        -                        throws IOException
        -
        Method that will try to convert value of current token to a Java - double. - Numbers are coerced using default Java rules; booleans convert to 0.0 (false) - and 1.0 (true), and Strings are parsed using default Java language floating - point parsing rules. -

        - If representation can not be converted to a double (including structured types - like Objects and Arrays), - default value of 0.0 will be returned; no exceptions are thrown.

        -
        -
        Returns:
        -
        double value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsDouble

        -
        public double getValueAsDouble(double def)
        -                        throws IOException
        -
        Method that will try to convert value of current token to a - Java double. - Numbers are coerced using default Java rules; booleans convert to 0.0 (false) - and 1.0 (true), and Strings are parsed using default Java language floating - point parsing rules. -

        - If representation can not be converted to a double (including structured types - like Objects and Arrays), - specified def will be returned; no exceptions are thrown.

        -
        -
        Parameters:
        -
        def - Default value to return if conversion to double is not possible
        -
        Returns:
        -
        double value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsBoolean

        -
        public boolean getValueAsBoolean()
        -                          throws IOException
        -
        Method that will try to convert value of current token to a - boolean. - JSON booleans map naturally; integer numbers other than 0 map to true, and - 0 maps to false - and Strings 'true' and 'false' map to corresponding values. -

        - If representation can not be converted to a boolean value (including structured types - like Objects and Arrays), - default value of false will be returned; no exceptions are thrown.

        -
        -
        Returns:
        -
        boolean value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsBoolean

        -
        public boolean getValueAsBoolean(boolean def)
        -                          throws IOException
        -
        Method that will try to convert value of current token to a - boolean. - JSON booleans map naturally; integer numbers other than 0 map to true, and - 0 maps to false - and Strings 'true' and 'false' map to corresponding values. -

        - If representation can not be converted to a boolean value (including structured types - like Objects and Arrays), - specified def will be returned; no exceptions are thrown.

        -
        -
        Parameters:
        -
        def - Default value to return if conversion to boolean is not possible
        -
        Returns:
        -
        boolean value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString()
        -                        throws IOException
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), default value of - null will be returned; no exceptions are thrown.
        -
        -
        Returns:
        -
        String value current token is converted to, if possible; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public abstract String getValueAsString(String def)
        -                                 throws IOException
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), specified default value - will be returned; no exceptions are thrown.
        -
        -
        Parameters:
        -
        def - Default value to return if conversion to String is not possible
        -
        Returns:
        -
        String value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        canReadObjectId

        -
        public boolean canReadObjectId()
        -
        Introspection method that may be called to see if the underlying - data format supports some kind of Object Ids natively (many do not; - for example, JSON doesn't). -

        - Default implementation returns true; overridden by data formats - that do support native Object Ids. Caller is expected to either - use a non-native notation (explicit property or such), or fail, - in case it can not use native object ids.

        -
        -
        Returns:
        -
        True if the format being read supports native Object Ids; - false if not
        -
        -
      • -
      - - - -
        -
      • -

        canReadTypeId

        -
        public boolean canReadTypeId()
        -
        Introspection method that may be called to see if the underlying - data format supports some kind of Type Ids natively (many do not; - for example, JSON doesn't). -

        - Default implementation returns true; overridden by data formats - that do support native Type Ids. Caller is expected to either - use a non-native notation (explicit property or such), or fail, - in case it can not use native type ids.

        -
        -
        Returns:
        -
        True if the format being read supports native Type Ids; - false if not
        -
        -
      • -
      - - - -
        -
      • -

        getObjectId

        -
        public Object getObjectId()
        -                   throws IOException
        -
        Method that can be called to check whether current token - (one that was just read) has an associated Object id, and if - so, return it. - Note that while typically caller should check with canReadObjectId() - first, it is not illegal to call this method even if that method returns - true; but if so, it will return null. This may be used to simplify calling - code. -

        - Default implementation will simply return null.

        -
        -
        Returns:
        -
        Native Object id associated with the current token, if any; null if none
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getTypeId

        -
        public Object getTypeId()
        -                 throws IOException
        -
        Method that can be called to check whether current token - (one that was just read) has an associated type id, and if - so, return it. - Note that while typically caller should check with canReadTypeId() - first, it is not illegal to call this method even if that method returns - true; but if so, it will return null. This may be used to simplify calling - code. -

        - Default implementation will simply return null.

        -
        -
        Returns:
        -
        Native Type Id associated with the current token, if any; null if none
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        readValueAs

        -
        public abstract <T> T readValueAs(Class<T> valueType)
        -                           throws IOException
        -
        Method to deserialize stream content into a non-container - type (it can be an array type, however): typically a bean, array - or a wrapper type (like Boolean). -
        - Note: method can only be called if the parser has - been constructed with a linkage to - ObjectReadContext; this is true if constructed by - databinding layer above, or by factory method that takes in - context object. -

        - This method may advance the event stream, for structured values - the current token will be the closing end marker (END_ARRAY, - END_OBJECT) of the bound structure. For non-structured values - (and for JsonToken.VALUE_EMBEDDED_OBJECT) - stream is not advanced. -

        - Note: this method should NOT be used if the result type is a - container (Collection or Map. - The reason is that due to type erasure, key and value types - can not be introspected when using this method.

        -
        -
        Type Parameters:
        -
        T - Nominal type parameter to specify expected node type to - reduce need to cast result value
        -
        Parameters:
        -
        valueType - Type to bind content to
        -
        Returns:
        -
        Java value read from content
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or decoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        readValueAs

        -
        public abstract <T> T readValueAs(TypeReference<T> valueTypeRef)
        -                           throws IOException
        -
        Method to deserialize stream content into a Java type, reference - to which is passed as argument. Type is passed using so-called - "super type token" - and specifically needs to be used if the root type is a - parameterized (generic) container type. -
        - Note: method can only be called if the parser has - been constructed with a linkage to - ObjectReadContext; this is true if constructed by - databinding layer above, or by factory method that takes in - context object. -

        - This method may advance the event stream, for structured types - the current token will be the closing end marker (END_ARRAY, - END_OBJECT) of the bound structure. For non-structured types - (and for JsonToken.VALUE_EMBEDDED_OBJECT) - stream is not advanced.

        -
        -
        Type Parameters:
        -
        T - Nominal type parameter to specify expected node type to - reduce need to cast result value
        -
        Parameters:
        -
        valueTypeRef - Type to bind content to
        -
        Returns:
        -
        Java value read from content
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or decoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        readValueAsTree

        -
        public abstract <T extends TreeNode> T readValueAsTree()
        -                                                throws IOException
        -
        Method to deserialize stream content into equivalent "tree model", - represented by root TreeNode of resulting model. - For Array values it will an array node (with child nodes), - for Object values object node (with child nodes), and for other types - matching leaf node type. Empty or whitespace documents are null. -
        - Note: method can only be called if the parser has - been constructed with a linkage to - ObjectReadContext; this is true if constructed by - databinding layer above, or by factory method that takes in - context object.
        -
        -
        Type Parameters:
        -
        T - Nominal type parameter for result node type (to reduce need for casting)
        -
        Returns:
        -
        root of the document, or null if empty or whitespace.
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or decoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        _reportUnsupportedOperation

        -
        protected void _reportUnsupportedOperation()
        -
        Helper method to call for operations that are not supported by - parser implementation.
        -
      • -
      - - - - - - - - - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonPointer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonPointer.html deleted file mode 100644 index b71b97b1e3..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonPointer.html +++ /dev/null @@ -1,999 +0,0 @@ - - - - - - -JsonPointer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class JsonPointer

-
-
- -
-
    -
  • -
    -
    -
    public class JsonPointer
    -extends Object
    -
    Implementation of - JSON Pointer - specification. - Pointer instances can be used to locate logical JSON nodes for things like - tree traversal (see TreeNode.at(com.fasterxml.jackson.core.JsonPointer)). -

    - Instances are fully immutable and can be cached, shared between threads.

    -
    -
    Author:
    -
    Tatu Saloranta
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        SEPARATOR

        -
        public static final char SEPARATOR
        -
        Character used to separate segments.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        EMPTY

        -
        protected static final JsonPointer EMPTY
        -
        Marker instance used to represent segment that matches current - node or position (that is, returns true for - matches()).
        -
      • -
      - - - -
        -
      • -

        _nextSegment

        -
        protected final JsonPointer _nextSegment
        -
        Reference to rest of the pointer beyond currently matching - segment (if any); null if this pointer refers to the matching - segment.
        -
      • -
      - - - -
        -
      • -

        _head

        -
        protected volatile JsonPointer _head
        -
        Reference from currently matching segment (if any) to node - before leaf. - Lazily constructed if/as needed. -

        - NOTE: we'll use `volatile` here assuming that this is unlikely to - become a performance bottleneck. If it becomes one we can probably - just drop it and things still should work (despite warnings as per JMM - regarding visibility (and lack thereof) of unguarded changes).

        -
        -
        Since:
        -
        2.5
        -
        -
      • -
      - - - -
        -
      • -

        _asString

        -
        protected final String _asString
        -
        We will retain representation of the pointer, as a String, - so that toString() should be as efficient as possible.
        -
      • -
      - - - -
        -
      • -

        _matchingPropertyName

        -
        protected final String _matchingPropertyName
        -
      • -
      - - - -
        -
      • -

        _matchingElementIndex

        -
        protected final int _matchingElementIndex
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonPointer

        -
        protected JsonPointer()
        -
        Constructor used for creating "empty" instance, used to represent - state that matches current node.
        -
      • -
      - - - - - - - -
        -
      • -

        JsonPointer

        -
        protected JsonPointer(String fullString,
        -                      String segment,
        -                      int matchIndex,
        -                      JsonPointer next)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        compile

        -
        public static JsonPointer compile(String expr)
        -                           throws IllegalArgumentException
        -
        Factory method that parses given input and construct matching pointer - instance, if it represents a valid JSON Pointer: if not, a - IllegalArgumentException is thrown.
        -
        -
        Parameters:
        -
        expr - Pointer expression to compile
        -
        Returns:
        -
        Compiled JsonPointer path expression
        -
        Throws:
        -
        IllegalArgumentException - Thrown if the input does not present a valid JSON Pointer - expression: currently the only such expression is one that does NOT start with - a slash ('/').
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static JsonPointer valueOf(String expr)
        -
        Alias for compile(java.lang.String); added to make instances automatically - deserializable by Jackson databind.
        -
        -
        Parameters:
        -
        expr - Pointer expression to compile
        -
        Returns:
        -
        Compiled JsonPointer path expression
        -
        -
      • -
      - - - -
        -
      • -

        empty

        -
        public static JsonPointer empty()
        -
        Accessor for an "empty" expression, that is, one you can get by - calling compile(java.lang.String) with "" (empty String). -

        - NOTE: this is different from expression for "/" which would - instead match Object node property with empty String ("") as name.

        -
        -
        Returns:
        -
        "Empty" pointer expression instance that matches given root value
        -
        Since:
        -
        2.10
        -
        -
      • -
      - - - -
        -
      • -

        forPath

        -
        public static JsonPointer forPath(TokenStreamContext context,
        -                                  boolean includeRoot)
        -
        Factory method that will construct a pointer instance that describes - path to location given TokenStreamContext points to.
        -
        -
        Parameters:
        -
        context - Context to build pointer expression fot
        -
        includeRoot - Whether to include number offset for virtual "root context" or not.
        -
        Returns:
        -
        JsonPointer path to location of given context
        -
        -
      • -
      - - - -
        -
      • -

        matches

        -
        public boolean matches()
        -
      • -
      - - - -
        -
      • -

        getMatchingProperty

        -
        public String getMatchingProperty()
        -
      • -
      - - - -
        -
      • -

        getMatchingIndex

        -
        public int getMatchingIndex()
        -
      • -
      - - - -
        -
      • -

        mayMatchProperty

        -
        public boolean mayMatchProperty()
        -
        -
        Returns:
        -
        True if the root selector matches property name (that is, could - match field value of JSON Object node)
        -
        -
      • -
      - - - -
        -
      • -

        mayMatchElement

        -
        public boolean mayMatchElement()
        -
        -
        Returns:
        -
        True if the root selector matches element index (that is, could - match an element of JSON Array node)
        -
        -
      • -
      - - - -
        -
      • -

        last

        -
        public JsonPointer last()
        -
        -
        Returns:
        -
        the leaf of current JSON Pointer expression: leaf is the last - non-null segment of current JSON Pointer.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JsonPointer append(JsonPointer tail)
        -
        Mutant factory method that will return -
          -
        • `tail` if `this` instance is "empty" pointer, OR -
        • -
        • `this` instance if `tail` is "empty" pointer, OR -
        • -
        • Newly constructed JsonPointer instance that starts with all segments - of `this`, followed by all segments of `tail`. -
        • -
        -
        -
        Parameters:
        -
        tail - JsonPointer instance to append to this one, to create a new pointer instance
        -
        Returns:
        -
        Either `this` instance, `tail`, or a newly created combination, as per description above.
        -
        -
      • -
      - - - -
        -
      • -

        matchesProperty

        -
        public boolean matchesProperty(String name)
        -
        Method that may be called to see if the pointer head (first segment) - would match property (of a JSON Object) with given name.
        -
        -
        Parameters:
        -
        name - Name of Object property to match
        -
        Returns:
        -
        True if the pointer head matches specified property name
        -
        Since:
        -
        2.5
        -
        -
      • -
      - - - -
        -
      • -

        matchProperty

        -
        public JsonPointer matchProperty(String name)
        -
        Method that may be called to check whether the pointer head (first segment) - matches specified Object property (by name) and if so, return - JsonPointer that represents rest of the path after match. - If there is no match, null is returned.
        -
        -
        Parameters:
        -
        name - Name of Object property to match
        -
        Returns:
        -
        Remaining path after matching specified property, if there is match; - null otherwise
        -
        -
      • -
      - - - -
        -
      • -

        matchesElement

        -
        public boolean matchesElement(int index)
        -
        Method that may be called to see if the pointer would match - Array element (of a JSON Array) with given index.
        -
        -
        Parameters:
        -
        index - Index of Array element to match
        -
        Returns:
        -
        True if the pointer head matches specified Array index
        -
        Since:
        -
        2.5
        -
        -
      • -
      - - - -
        -
      • -

        matchElement

        -
        public JsonPointer matchElement(int index)
        -
        Method that may be called to check whether the pointer head (first segment) - matches specified Array index and if so, return - JsonPointer that represents rest of the path after match. - If there is no match, null is returned.
        -
        -
        Parameters:
        -
        index - Index of Array element to match
        -
        Returns:
        -
        Remaining path after matching specified index, if there is match; - null otherwise
        -
        Since:
        -
        2.6
        -
        -
      • -
      - - - -
        -
      • -

        tail

        -
        public JsonPointer tail()
        -
        Accessor for getting a "sub-pointer" (or sub-path), instance where current segment - has been removed and pointer includes rest of the segments. - For example, for JSON Pointer "/root/branch/leaf", this method would - return pointer "/branch/leaf". - For matching state (last segment), will return null. -

        - Note that this is a very cheap method to call as it simply returns "next" segment - (which has been constructed when pointer instance was constructed).

        -
        -
        Returns:
        -
        Tail of this pointer, if it has any; null if this pointer only - has the current segment
        -
        -
      • -
      - - - -
        -
      • -

        head

        -
        public JsonPointer head()
        -
        Accessor for getting a pointer instance that is identical to this - instance except that the last segment has been dropped. - For example, for JSON Pointer "/root/branch/leaf", this method would - return pointer "/root/branch" (compared to tail() that - would return "/branch/leaf"). -

        - Note that whereas tail() is a very cheap operation to call (as "tail" already - exists for single-linked forward direction), this method has to fully - construct a new instance by traversing the chain of segments.

        -
        -
        Returns:
        -
        Pointer expression that contains same segments as this one, except for - the last segment.
        -
        Since:
        -
        2.5
        -
        -
      • -
      - - - - - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class Object
        -
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public boolean equals(Object o)
        -
        -
        Overrides:
        -
        equals in class Object
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _parseQuotedTail

        -
        protected static JsonPointer _parseQuotedTail(String input,
        -                                              int i)
        -
        Method called to parse tail of pointer path, when a potentially - escaped character has been seen.
        -
        -
        Parameters:
        -
        input - Full input for the tail being parsed
        -
        i - Offset to character after tilde
        -
        Returns:
        -
        Pointer instance constructed
        -
        -
      • -
      - - - -
        -
      • -

        _constructHead

        -
        protected JsonPointer _constructHead()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonProcessingException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonProcessingException.html deleted file mode 100644 index 9b0ad6ca13..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonProcessingException.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - -JsonProcessingException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class JsonProcessingException

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - - - - - -
        -
      • -

        JsonProcessingException

        -
        protected JsonProcessingException(String msg)
        -
      • -
      - - - -
        -
      • -

        JsonProcessingException

        -
        protected JsonProcessingException(String msg,
        -                                  JsonLocation loc)
        -
      • -
      - - - -
        -
      • -

        JsonProcessingException

        -
        protected JsonProcessingException(String msg,
        -                                  Throwable rootCause)
        -
      • -
      - - - -
        -
      • -

        JsonProcessingException

        -
        protected JsonProcessingException(Throwable rootCause)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonToken.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonToken.html deleted file mode 100644 index f02ebf088f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonToken.html +++ /dev/null @@ -1,745 +0,0 @@ - - - - - - -JsonToken (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Enum JsonToken

-
-
- -
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Enum Constants 
      Enum Constant and Description
      END_ARRAY -
      END_ARRAY is returned when encountering ']' - which signals ending of an Array value
      -
      END_OBJECT -
      END_OBJECT is returned when encountering '}' - which signals ending of an Object value
      -
      FIELD_NAME -
      FIELD_NAME is returned when a String token is encountered - as a field name (same lexical value, different function)
      -
      NOT_AVAILABLE -
      NOT_AVAILABLE can be returned if JsonParser - implementation can not currently return the requested - token (usually next one), or even if any will be - available, but that may be able to determine this in - future.
      -
      START_ARRAY -
      START_ARRAY is returned when encountering '[' - which signals starting of an Array value
      -
      START_OBJECT -
      START_OBJECT is returned when encountering '{' - which signals starting of an Object value.
      -
      VALUE_EMBEDDED_OBJECT -
      Placeholder token returned when the input source has a concept - of embedded Object that are not accessible as usual structure - (of starting with START_OBJECT, having values, ending with - END_OBJECT), but as "raw" objects.
      -
      VALUE_FALSE -
      VALUE_FALSE is returned when encountering literal "false" in - value context
      -
      VALUE_NULL -
      VALUE_NULL is returned when encountering literal "null" in - value context
      -
      VALUE_NUMBER_FLOAT -
      VALUE_NUMBER_FLOAT is returned when a numeric token other - than integer is encountered: that is, a number that does - have floating point or exponent marker in it, in addition - to one or more digits (or, for non-textual formats, - has internal floating-point representation).
      -
      VALUE_NUMBER_INT -
      VALUE_NUMBER_INT is returned when an integer numeric token is - encountered in value context: that is, a number that does - not have floating point or exponent marker in it (consists - only of an optional sign, followed by one or more digits; - or, for binary formats, is indicated as integral number - by internal representation).
      -
      VALUE_STRING -
      VALUE_STRING is returned when a String token is encountered - in value context (array element, field value, or root-level - stand-alone value)
      -
      VALUE_TRUE -
      VALUE_TRUE is returned when encountering literal "true" in - value context
      -
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        NOT_AVAILABLE

        -
        public static final JsonToken NOT_AVAILABLE
        -
        NOT_AVAILABLE can be returned if JsonParser - implementation can not currently return the requested - token (usually next one), or even if any will be - available, but that may be able to determine this in - future. This is the case with non-blocking parsers -- - they can not block to wait for more data to parse and - must return something.
        -
      • -
      - - - -
        -
      • -

        START_OBJECT

        -
        public static final JsonToken START_OBJECT
        -
        START_OBJECT is returned when encountering '{' - which signals starting of an Object value.
        -
      • -
      - - - -
        -
      • -

        END_OBJECT

        -
        public static final JsonToken END_OBJECT
        -
        END_OBJECT is returned when encountering '}' - which signals ending of an Object value
        -
      • -
      - - - -
        -
      • -

        START_ARRAY

        -
        public static final JsonToken START_ARRAY
        -
        START_ARRAY is returned when encountering '[' - which signals starting of an Array value
        -
      • -
      - - - -
        -
      • -

        END_ARRAY

        -
        public static final JsonToken END_ARRAY
        -
        END_ARRAY is returned when encountering ']' - which signals ending of an Array value
        -
      • -
      - - - -
        -
      • -

        FIELD_NAME

        -
        public static final JsonToken FIELD_NAME
        -
        FIELD_NAME is returned when a String token is encountered - as a field name (same lexical value, different function)
        -
      • -
      - - - -
        -
      • -

        VALUE_EMBEDDED_OBJECT

        -
        public static final JsonToken VALUE_EMBEDDED_OBJECT
        -
        Placeholder token returned when the input source has a concept - of embedded Object that are not accessible as usual structure - (of starting with START_OBJECT, having values, ending with - END_OBJECT), but as "raw" objects. -

        - Note: this token is never returned by regular JSON readers, but - only by readers that expose other kinds of source (like - JsonNode-based JSON trees, Maps, Lists and such).

        -
      • -
      - - - -
        -
      • -

        VALUE_STRING

        -
        public static final JsonToken VALUE_STRING
        -
        VALUE_STRING is returned when a String token is encountered - in value context (array element, field value, or root-level - stand-alone value)
        -
      • -
      - - - -
        -
      • -

        VALUE_NUMBER_INT

        -
        public static final JsonToken VALUE_NUMBER_INT
        -
        VALUE_NUMBER_INT is returned when an integer numeric token is - encountered in value context: that is, a number that does - not have floating point or exponent marker in it (consists - only of an optional sign, followed by one or more digits; - or, for binary formats, is indicated as integral number - by internal representation).
        -
      • -
      - - - -
        -
      • -

        VALUE_NUMBER_FLOAT

        -
        public static final JsonToken VALUE_NUMBER_FLOAT
        -
        VALUE_NUMBER_FLOAT is returned when a numeric token other - than integer is encountered: that is, a number that does - have floating point or exponent marker in it, in addition - to one or more digits (or, for non-textual formats, - has internal floating-point representation).
        -
      • -
      - - - -
        -
      • -

        VALUE_TRUE

        -
        public static final JsonToken VALUE_TRUE
        -
        VALUE_TRUE is returned when encountering literal "true" in - value context
        -
      • -
      - - - -
        -
      • -

        VALUE_FALSE

        -
        public static final JsonToken VALUE_FALSE
        -
        VALUE_FALSE is returned when encountering literal "false" in - value context
        -
      • -
      - - - -
        -
      • -

        VALUE_NULL

        -
        public static final JsonToken VALUE_NULL
        -
        VALUE_NULL is returned when encountering literal "null" in - value context
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static JsonToken[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (JsonToken c : JsonToken.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static JsonToken valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        id

        -
        public final int id()
        -
      • -
      - - - -
        -
      • -

        asString

        -
        public final String asString()
        -
      • -
      - - - -
        -
      • -

        asCharArray

        -
        public final char[] asCharArray()
        -
      • -
      - - - -
        -
      • -

        asByteArray

        -
        public final byte[] asByteArray()
        -
      • -
      - - - -
        -
      • -

        isNumeric

        -
        public final boolean isNumeric()
        -
        -
        Returns:
        -
        True if this token is VALUE_NUMBER_INT or VALUE_NUMBER_FLOAT, - false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        isStructStart

        -
        public final boolean isStructStart()
        -
        Accessor that is functionally equivalent to: - - this == JsonToken.START_OBJECT || this == JsonToken.START_ARRAY -
        -
        -
        Returns:
        -
        True if this token is START_OBJECT or START_ARRAY, - false otherwise
        -
        Since:
        -
        2.3
        -
        -
      • -
      - - - -
        -
      • -

        isStructEnd

        -
        public final boolean isStructEnd()
        -
        Accessor that is functionally equivalent to: - - this == JsonToken.END_OBJECT || this == JsonToken.END_ARRAY -
        -
        -
        Returns:
        -
        True if this token is END_OBJECT or END_ARRAY, - false otherwise
        -
        Since:
        -
        2.3
        -
        -
      • -
      - - - -
        -
      • -

        isScalarValue

        -
        public final boolean isScalarValue()
        -
        Method that can be used to check whether this token represents - a valid non-structured value. This means all VALUE_xxx tokens; - excluding START_xxx and END_xxx tokens as well - FIELD_NAME.
        -
        -
        Returns:
        -
        True if this token is a scalar value token (one of - VALUE_xxx tokens), false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        isBoolean

        -
        public final boolean isBoolean()
        -
        -
        Returns:
        -
        True if this token is VALUE_TRUE or VALUE_FALSE, - false otherwise
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonTokenId.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonTokenId.html deleted file mode 100644 index 417036acb0..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/JsonTokenId.html +++ /dev/null @@ -1,498 +0,0 @@ - - - - - - -JsonTokenId (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface JsonTokenId

-
-
-
-
    -
  • -
    -
    -
    public interface JsonTokenId
    -
    Interface defined to contain ids accessible with JsonToken.id(). - Needed because it is impossible to define these constants in - JsonToken itself, as static constants (oddity of how Enums - are implemented by JVM).
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectReadContext.Base.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectReadContext.Base.html deleted file mode 100644 index d381fd8c49..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectReadContext.Base.html +++ /dev/null @@ -1,541 +0,0 @@ - - - - - - -ObjectReadContext.Base (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class ObjectReadContext.Base

-
-
- -
- -
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectReadContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectReadContext.html deleted file mode 100644 index 31c6d69f95..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectReadContext.html +++ /dev/null @@ -1,548 +0,0 @@ - - - - - - -ObjectReadContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface ObjectReadContext

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    ObjectReadContext.Base
    -
    -
    -
    -
    public interface ObjectReadContext
    -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during read (token stream to Object deserialization) process. - Access is mostly needed during construction of - JsonParser instances by TokenStreamFactory.
    -
    -
    Since:
    -
    3.0
    -
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectWriteContext.Base.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectWriteContext.Base.html deleted file mode 100644 index 42a687e7a1..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectWriteContext.Base.html +++ /dev/null @@ -1,570 +0,0 @@ - - - - - - -ObjectWriteContext.Base (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class ObjectWriteContext.Base

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.ObjectWriteContext.Base
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectWriteContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectWriteContext.html deleted file mode 100644 index 7eaf75fa02..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/ObjectWriteContext.html +++ /dev/null @@ -1,504 +0,0 @@ - - - - - - -ObjectWriteContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface ObjectWriteContext

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    ObjectWriteContext.Base
    -
    -
    -
    -
    public interface ObjectWriteContext
    -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during write (Object to token stream serialization) process. - Access is mostly needed during construction of - JsonGenerator instances by TokenStreamFactory.
    -
    -
    Since:
    -
    3.0
    -
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/PrettyPrinter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/PrettyPrinter.html deleted file mode 100644 index 79be8df6db..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/PrettyPrinter.html +++ /dev/null @@ -1,599 +0,0 @@ - - - - - - -PrettyPrinter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface PrettyPrinter

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    DefaultPrettyPrinter, MinimalPrettyPrinter
    -
    -
    -
    -
    public interface PrettyPrinter
    -
    Interface for objects that implement pretty printer functionality, such - as indentation. - Pretty printers are used to add white space in output JSON content, - to make results more human readable. Usually this means things like adding - linefeeds and indentation. -

    - Note: stateful implementations MUST implement - Instantiatable interface, - to allow for constructing per-generation instances and avoid - state corruption. - Stateless implementations need not do this; but those are less common.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        DEFAULT_SEPARATORS

        -
        static final Separators DEFAULT_SEPARATORS
        -
      • -
      - - - -
        -
      • -

        DEFAULT_ROOT_VALUE_SEPARATOR

        -
        static final SerializedString DEFAULT_ROOT_VALUE_SEPARATOR
        -
        Default String used for separating root values is single space.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        writeRootValueSeparator

        -
        void writeRootValueSeparator(JsonGenerator gen)
        -                      throws IOException
        -
        Method called after a root-level value has been completely - output, and before another value is to be output. -

        - Default handling (without pretty-printing) will output a space, to - allow values to be parsed correctly. Pretty-printer is - to output some other suitable and nice-looking separator - (tab(s), space(s), linefeed(s) or any combination thereof).

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        void writeStartObject(JsonGenerator gen)
        -               throws IOException
        -
        Method called when an Object value is to be output, before - any fields are output. -

        - Default handling (without pretty-printing) will output - the opening curly bracket. - Pretty-printer is - to output a curly bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndObject

        -
        void writeEndObject(JsonGenerator gen,
        -                    int nrOfEntries)
        -             throws IOException
        -
        Method called after an Object value has been completely output - (minus closing curly bracket). -

        - Default handling (without pretty-printing) will output - the closing curly bracket. - Pretty-printer is - to output a curly bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        nrOfEntries - Number of direct members of the Object that - have been output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectEntrySeparator

        -
        void writeObjectEntrySeparator(JsonGenerator gen)
        -                        throws IOException
        -
        Method called after an Object entry (field:value) has been completely - output, and before another value is to be output. -

        - Default handling (without pretty-printing) will output a single - comma to separate the two. Pretty-printer is - to output a comma as well, but can surround that with other - (white-space) decoration.

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectFieldValueSeparator

        -
        void writeObjectFieldValueSeparator(JsonGenerator gen)
        -                             throws IOException
        -
        Method called after an object field has been output, but - before the value is output. -

        - Default handling (without pretty-printing) will output a single - colon to separate the two. Pretty-printer is - to output a colon as well, but can surround that with other - (white-space) decoration.

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        void writeStartArray(JsonGenerator gen)
        -              throws IOException
        -
        Method called when an Array value is to be output, before - any member/child values are output. -

        - Default handling (without pretty-printing) will output - the opening bracket. - Pretty-printer is - to output a bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndArray

        -
        void writeEndArray(JsonGenerator gen,
        -                   int nrOfValues)
        -            throws IOException
        -
        Method called after an Array value has been completely output - (minus closing bracket). -

        - Default handling (without pretty-printing) will output - the closing bracket. - Pretty-printer is - to output a bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        nrOfValues - Number of direct members of the array that - have been output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArrayValueSeparator

        -
        void writeArrayValueSeparator(JsonGenerator gen)
        -                       throws IOException
        -
        Method called after an array value has been completely - output, and before another value is to be output. -

        - Default handling (without pretty-printing) will output a single - comma to separate the two. Pretty-printer is - to output a comma as well, but can surround that with other - (white-space) decoration.

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        beforeArrayValues

        -
        void beforeArrayValues(JsonGenerator gen)
        -                throws IOException
        -
        Method called after array start marker has been output, - and right before the first value is to be output. - It is not called for arrays with no values. -

        - Default handling does not output anything, but pretty-printer - is free to add any white space decoration.

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        beforeObjectEntries

        -
        void beforeObjectEntries(JsonGenerator gen)
        -                  throws IOException
        -
        Method called after object start marker has been output, - and right before the field name of the first entry is - to be output. - It is not called for objects without entries. -

        - Default handling does not output anything, but pretty-printer - is free to add any white space decoration.

        -
        -
        Parameters:
        -
        gen - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/SerializableString.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/SerializableString.html deleted file mode 100644 index ac8edb5194..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/SerializableString.html +++ /dev/null @@ -1,570 +0,0 @@ - - - - - - -SerializableString (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface SerializableString

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    SerializedString
    -
    -
    -
    -
    public interface SerializableString
    -
    Interface that defines how Jackson package can interact with efficient - pre-serialized or lazily-serialized and reused String representations. - Typically implementations store possible serialized version(s) so that - serialization of String can be done more efficiently, especially when - used multiple times. -

    - Note that "quoted" in methods means quoting of 'special' characters using - JSON backlash notation (and not use of actual double quotes).

    -
    -
    See Also:
    -
    SerializedString
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      intappendQuoted(char[] buffer, - int offset) -
      Method that will append quoted characters of this String into given - buffer.
      -
      intappendQuotedUTF8(byte[] buffer, - int offset) -
      Method that will append quoted UTF-8 bytes of this String into given - buffer, if there is enough room; if not, returns -1.
      -
      intappendUnquoted(char[] buffer, - int offset) -
      Method that will append unquoted characters of this String into given - buffer.
      -
      intappendUnquotedUTF8(byte[] buffer, - int offset) -
      Method that will append unquoted ('raw') UTF-8 bytes of this String into given - buffer.
      -
      char[]asQuotedChars() 
      byte[]asQuotedUTF8() -
      Returns UTF-8 encoded version of JSON-quoted String.
      -
      byte[]asUnquotedUTF8() -
      Returns UTF-8 encoded version of unquoted String.
      -
      intcharLength() -
      Returns length of the (unquoted) String as characters.
      -
      StringgetValue() -
      Returns unquoted String that this object represents (and offers - serialized forms for)
      -
      intputQuotedUTF8(ByteBuffer buffer) -
      Method for appending JSON-escaped UTF-8 encoded String value into given - ByteBuffer, if it fits.
      -
      intputUnquotedUTF8(ByteBuffer buffer) -
      Method for appending unquoted ('raw') UTF-8 encoded String value into given - ByteBuffer, if it fits.
      -
      intwriteQuotedUTF8(OutputStream out) -
      Method for writing JSON-escaped UTF-8 encoded String value using given - OutputStream.
      -
      intwriteUnquotedUTF8(OutputStream out) -
      Method for writing unescaped UTF-8 encoded String value using given - OutputStream.
      -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getValue

        -
        String getValue()
        -
        Returns unquoted String that this object represents (and offers - serialized forms for)
        -
        -
        Returns:
        -
        Unquoted String
        -
        -
      • -
      - - - -
        -
      • -

        charLength

        -
        int charLength()
        -
        Returns length of the (unquoted) String as characters. - Functionally equivalent to: -
        -   getValue().length();
        -
        -
        -
        Returns:
        -
        Length of the String in characters
        -
        -
      • -
      - - - -
        -
      • -

        asQuotedChars

        -
        char[] asQuotedChars()
        -
      • -
      - - - -
        -
      • -

        asUnquotedUTF8

        -
        byte[] asUnquotedUTF8()
        -
        Returns UTF-8 encoded version of unquoted String. - Functionally equivalent to (but more efficient than): -
        - getValue().getBytes("UTF-8");
        -
        -
        -
        Returns:
        -
        UTF-8 encoded version of String, without any escaping
        -
        -
      • -
      - - - -
        -
      • -

        asQuotedUTF8

        -
        byte[] asQuotedUTF8()
        -
        Returns UTF-8 encoded version of JSON-quoted String. - Functionally equivalent to (but more efficient than): -
        - new String(asQuotedChars()).getBytes("UTF-8");
        -
        -
        -
        Returns:
        -
        UTF-8 encoded version of JSON-escaped String
        -
        -
      • -
      - - - -
        -
      • -

        appendQuotedUTF8

        -
        int appendQuotedUTF8(byte[] buffer,
        -                     int offset)
        -
        Method that will append quoted UTF-8 bytes of this String into given - buffer, if there is enough room; if not, returns -1. - Functionally equivalent to: -
        -  byte[] bytes = str.asQuotedUTF8();
        -  System.arraycopy(bytes, 0, buffer, offset, bytes.length);
        -  return bytes.length;
        -
        -
        -
        Parameters:
        -
        buffer - Buffer to append JSON-escaped String into
        -
        offset - Offset in buffer to append String at
        -
        Returns:
        -
        Number of bytes appended, if successful, otherwise -1
        -
        -
      • -
      - - - -
        -
      • -

        appendQuoted

        -
        int appendQuoted(char[] buffer,
        -                 int offset)
        -
        Method that will append quoted characters of this String into given - buffer. Functionally equivalent to: -
        -  char[] ch = str.asQuotedChars();
        -  System.arraycopy(ch, 0, buffer, offset, ch.length);
        -  return ch.length;
        -
        -
        -
        Parameters:
        -
        buffer - Buffer to append JSON-escaped String into
        -
        offset - Offset in buffer to append String at
        -
        Returns:
        -
        Number of characters appended, if successful, otherwise -1
        -
        -
      • -
      - - - -
        -
      • -

        appendUnquotedUTF8

        -
        int appendUnquotedUTF8(byte[] buffer,
        -                       int offset)
        -
        Method that will append unquoted ('raw') UTF-8 bytes of this String into given - buffer. Functionally equivalent to: -
        -  byte[] bytes = str.asUnquotedUTF8();
        -  System.arraycopy(bytes, 0, buffer, offset, bytes.length);
        -  return bytes.length;
        -
        -
        -
        Parameters:
        -
        buffer - Buffer to append literal (unescaped) String into
        -
        offset - Offset in buffer to append String at
        -
        Returns:
        -
        Number of bytes appended, if successful, otherwise -1
        -
        -
      • -
      - - - -
        -
      • -

        appendUnquoted

        -
        int appendUnquoted(char[] buffer,
        -                   int offset)
        -
        Method that will append unquoted characters of this String into given - buffer. Functionally equivalent to: -
        -  char[] ch = str.getValue().toCharArray();
        -  System.arraycopy(bytes, 0, buffer, offset, ch.length);
        -  return ch.length;
        -
        -
        -
        Parameters:
        -
        buffer - Buffer to append literal (unescaped) String into
        -
        offset - Offset in buffer to append String at
        -
        Returns:
        -
        Number of characters appended, if successful, otherwise -1
        -
        -
      • -
      - - - -
        -
      • -

        writeQuotedUTF8

        -
        int writeQuotedUTF8(OutputStream out)
        -             throws IOException
        -
        Method for writing JSON-escaped UTF-8 encoded String value using given - OutputStream.
        -
        -
        Parameters:
        -
        out - OutputStream to write String into
        -
        Returns:
        -
        Number of bytes written
        -
        Throws:
        -
        IOException - if underlying stream write fails
        -
        -
      • -
      - - - -
        -
      • -

        writeUnquotedUTF8

        -
        int writeUnquotedUTF8(OutputStream out)
        -               throws IOException
        -
        Method for writing unescaped UTF-8 encoded String value using given - OutputStream.
        -
        -
        Parameters:
        -
        out - OutputStream to write String into
        -
        Returns:
        -
        Number of bytes written
        -
        Throws:
        -
        IOException - if underlying stream write fails
        -
        -
      • -
      - - - -
        -
      • -

        putQuotedUTF8

        -
        int putQuotedUTF8(ByteBuffer buffer)
        -           throws IOException
        -
        Method for appending JSON-escaped UTF-8 encoded String value into given - ByteBuffer, if it fits.
        -
        -
        Parameters:
        -
        buffer - ByteBuffer to append String into
        -
        Returns:
        -
        Number of bytes put, if contents fit, otherwise -1
        -
        Throws:
        -
        IOException - if underlying buffer append operation fails
        -
        -
      • -
      - - - -
        -
      • -

        putUnquotedUTF8

        -
        int putUnquotedUTF8(ByteBuffer buffer)
        -             throws IOException
        -
        Method for appending unquoted ('raw') UTF-8 encoded String value into given - ByteBuffer, if it fits.
        -
        -
        Parameters:
        -
        buffer - ByteBuffer to append String into
        -
        Returns:
        -
        Number of bytes put, if contents fit, otherwise -1
        -
        Throws:
        -
        IOException - if underlying buffer append operation fails
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamReadCapability.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamReadCapability.html deleted file mode 100644 index 2606aad04e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamReadCapability.html +++ /dev/null @@ -1,472 +0,0 @@ - - - - - - -StreamReadCapability (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Enum StreamReadCapability

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    JacksonFeature, Serializable, Comparable<StreamReadCapability>
    -
    -
    -
    -
    public enum StreamReadCapability
    -extends Enum<StreamReadCapability>
    -implements JacksonFeature
    -
    Set of on/off capabilities that a JsonParser for given format - (or in case of buffering, original format) has. - Used in some cases to adjust aspects of things like content conversions, - coercions and validation by format-agnostic functionality. - Specific or expected usage documented by individual capability entry - Javadocs.
    -
    -
    Since:
    -
    2.12
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        DUPLICATE_PROPERTIES

        -
        public static final StreamReadCapability DUPLICATE_PROPERTIES
        -
        Capability that indicates that data format can expose multiple properties - with same name ("duplicates") within one Object context. - This is usually not enabled, except for formats like xml that - have content model that does not map cleanly to JSON-based token stream. -

        - Capability may be used for allowing secondary mapping of such duplicates - in case of using Tree Model (see TreeNode), or "untyped" databinding - (mapping content as generic Object). -

        - Capability is currently only enabled for XML format backend.

        -
      • -
      - - - -
        -
      • -

        SCALARS_AS_OBJECTS

        -
        public static final StreamReadCapability SCALARS_AS_OBJECTS
        -
        Capability that indicates that data format may in some cases expose Scalar values - (whether typed or untyped) as Object values. There are additional access methods - at databind level: this capability may be used to decide whether to attempt to - use such methods especially in potentially ambiguous cases. -

        - Capability is currently only enabled for XML format backend.

        -
      • -
      - - - -
        -
      • -

        UNTYPED_SCALARS

        -
        public static final StreamReadCapability UNTYPED_SCALARS
        -
        Capability that indicates that data format only exposed "untyped" scalars: that is, - instead of Number, Boolean and String types all scalar values are reported as - text (JsonToken.VALUE_STRING) - unless some sort of coercion is implied by caller. -

        - This capability is true for many textual formats like CSV, Properties and XML.

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static StreamReadCapability[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (StreamReadCapability c : StreamReadCapability.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static StreamReadCapability valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        enabledByDefault

        -
        public boolean enabledByDefault()
        -
        Description copied from interface: JacksonFeature
        -
        Accessor for checking whether this feature is enabled by default.
        -
        -
        Specified by:
        -
        enabledByDefault in interface JacksonFeature
        -
        Returns:
        -
        Whether this instance is enabled by default or not
        -
        -
      • -
      - - - -
        -
      • -

        enabledIn

        -
        public boolean enabledIn(int flags)
        -
        Description copied from interface: JacksonFeature
        -
        Convenience method for checking whether feature is enabled in given bitmask.
        -
        -
        Specified by:
        -
        enabledIn in interface JacksonFeature
        -
        Parameters:
        -
        flags - Bit field that contains a set of enabled features of this type
        -
        Returns:
        -
        True if this feature is enabled in passed bit field
        -
        -
      • -
      - - - -
        -
      • -

        getMask

        -
        public int getMask()
        -
        Description copied from interface: JacksonFeature
        -
        Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
        -
        -
        Specified by:
        -
        getMask in interface JacksonFeature
        -
        Returns:
        -
        Bit mask of this feature
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamReadFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamReadFeature.html deleted file mode 100644 index 2fef32c759..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamReadFeature.html +++ /dev/null @@ -1,535 +0,0 @@ - - - - - - -StreamReadFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Enum StreamReadFeature

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        AUTO_CLOSE_SOURCE

        -
        public static final StreamReadFeature AUTO_CLOSE_SOURCE
        -
        Feature that determines whether parser will automatically - close underlying input source that is NOT owned by the - parser. If disabled, calling application has to separately - close the underlying InputStream and Reader - instances used to create the parser. If enabled, parser - will handle closing, as long as parser itself gets closed: - this happens when end-of-input is encountered, or parser - is closed by a call to JsonParser.close(). -

        - Feature is enabled by default.

        -
      • -
      - - - -
        -
      • -

        STRICT_DUPLICATE_DETECTION

        -
        public static final StreamReadFeature STRICT_DUPLICATE_DETECTION
        -
        Feature that determines whether JsonParser will explicitly - check that no duplicate JSON Object field names are encountered. - If enabled, parser will check all names within context and report - duplicates by throwing a JsonParseException; if disabled, - parser will not do such checking. Assumption in latter case is - that caller takes care of handling duplicates at a higher level: - data-binding, for example, has features to specify detection to - be done there. -

        - Note that enabling this feature will incur performance overhead - due to having to store and check additional information: this typically - adds 20-30% to execution time for basic parsing.

        -
      • -
      - - - -
        -
      • -

        IGNORE_UNDEFINED

        -
        public static final StreamReadFeature IGNORE_UNDEFINED
        -
        Feature that determines what to do if the underlying data format requires knowledge - of all properties to decode (usually via a Schema), and if no definition is - found for a property that input content contains. - Typically most textual data formats do NOT require schema information (although - some do, such as CSV), whereas many binary data formats do require definitions - (such as Avro, protobuf), although not all (Smile, CBOR, BSON and MessagePack do not). - Further note that some formats that do require schema information will not be able - to ignore undefined properties: for example, Avro is fully positional and there is - no possibility of undefined data. This leaves formats like Protobuf that have identifiers - that may or may not map; and as such Protobuf format does make use of this feature. -

        - Note that support for this feature is implemented by individual data format - module, if (and only if) it makes sense for the format in question. For JSON, - for example, this feature has no effect as properties need not be pre-defined. -

        - Feature is disabled by default, meaning that if the underlying data format - requires knowledge of all properties to output, attempts to read an unknown - property will result in a JsonProcessingException

        -
      • -
      - - - -
        -
      • -

        INCLUDE_SOURCE_IN_LOCATION

        -
        public static final StreamReadFeature INCLUDE_SOURCE_IN_LOCATION
        -
        Feature that determines whether JsonLocation instances should be constructed - with reference to source or not. If source reference is included, its type and contents - are included when `toString()` method is called (most notably when printing out parse - exception with that location information). If feature is disabled, no source reference - is passed and source is only indicated as "UNKNOWN". -

        - Most common reason for disabling this feature is to avoid leaking - internal information; this may be done for security reasons. - Note that even if source reference is included, only parts of contents are usually - printed, and not the whole contents. Further, many source reference types can not - necessarily access contents (like streams), so only type is indicated, not contents. -

        - Feature is enabled by default, meaning that "source reference" information is passed - and some or all of the source content may be included in JsonLocation information - constructed either when requested explicitly, or when needed for an exception.

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static StreamReadFeature[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (StreamReadFeature c : StreamReadFeature.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static StreamReadFeature valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        collectDefaults

        -
        public static int collectDefaults()
        -
        Method that calculates bit set (flags) of all features that - are enabled by default.
        -
        -
        Returns:
        -
        Bit mask of all features that are enabled by default
        -
        -
      • -
      - - - -
        -
      • -

        enabledByDefault

        -
        public boolean enabledByDefault()
        -
        Description copied from interface: JacksonFeature
        -
        Accessor for checking whether this feature is enabled by default.
        -
        -
        Specified by:
        -
        enabledByDefault in interface JacksonFeature
        -
        Returns:
        -
        Whether this instance is enabled by default or not
        -
        -
      • -
      - - - -
        -
      • -

        enabledIn

        -
        public boolean enabledIn(int flags)
        -
        Description copied from interface: JacksonFeature
        -
        Convenience method for checking whether feature is enabled in given bitmask.
        -
        -
        Specified by:
        -
        enabledIn in interface JacksonFeature
        -
        Parameters:
        -
        flags - Bit field that contains a set of enabled features of this type
        -
        Returns:
        -
        True if this feature is enabled in passed bit field
        -
        -
      • -
      - - - -
        -
      • -

        getMask

        -
        public int getMask()
        -
        Description copied from interface: JacksonFeature
        -
        Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
        -
        -
        Specified by:
        -
        getMask in interface JacksonFeature
        -
        Returns:
        -
        Bit mask of this feature
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamWriteCapability.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamWriteCapability.html deleted file mode 100644 index cc865664e2..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamWriteCapability.html +++ /dev/null @@ -1,444 +0,0 @@ - - - - - - -StreamWriteCapability (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Enum StreamWriteCapability

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    JacksonFeature, Serializable, Comparable<StreamWriteCapability>
    -
    -
    -
    -
    public enum StreamWriteCapability
    -extends Enum<StreamWriteCapability>
    -implements JacksonFeature
    -
    Set of on/off capabilities that a JsonGenerator for given format - (or in case of buffering, original format) has. - Used in some cases to adjust aspects of things like content conversions and - coercions by format-agnostic functionality. - Specific or expected usage documented by individual capability entry Javadocs.
    -
    -
    Since:
    -
    2.12
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        CAN_WRITE_BINARY_NATIVELY

        -
        public static final StreamWriteCapability CAN_WRITE_BINARY_NATIVELY
        -
        Capability that indicates that the data format is able to express binary - data natively, without using textual encoding like Base64. -

        - Capability is currently enabled for all binary formats and none of textual - formats.

        -
      • -
      - - - -
        -
      • -

        CAN_WRITE_FORMATTED_NUMBERS

        -
        public static final StreamWriteCapability CAN_WRITE_FORMATTED_NUMBERS
        -
        Capability that indicates that the data format is able to write - "formatted numbers": that is, output of numbers is done as Strings - and caller is allowed to pass in logical number values as Strings. -

        - Capability is currently enabled for most textual formats and none of binary - formats.

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static StreamWriteCapability[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (StreamWriteCapability c : StreamWriteCapability.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static StreamWriteCapability valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        enabledByDefault

        -
        public boolean enabledByDefault()
        -
        Description copied from interface: JacksonFeature
        -
        Accessor for checking whether this feature is enabled by default.
        -
        -
        Specified by:
        -
        enabledByDefault in interface JacksonFeature
        -
        Returns:
        -
        Whether this instance is enabled by default or not
        -
        -
      • -
      - - - -
        -
      • -

        enabledIn

        -
        public boolean enabledIn(int flags)
        -
        Description copied from interface: JacksonFeature
        -
        Convenience method for checking whether feature is enabled in given bitmask.
        -
        -
        Specified by:
        -
        enabledIn in interface JacksonFeature
        -
        Parameters:
        -
        flags - Bit field that contains a set of enabled features of this type
        -
        Returns:
        -
        True if this feature is enabled in passed bit field
        -
        -
      • -
      - - - -
        -
      • -

        getMask

        -
        public int getMask()
        -
        Description copied from interface: JacksonFeature
        -
        Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
        -
        -
        Specified by:
        -
        getMask in interface JacksonFeature
        -
        Returns:
        -
        Bit mask of this feature
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamWriteFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamWriteFeature.html deleted file mode 100644 index 03328e7fc8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/StreamWriteFeature.html +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - -StreamWriteFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Enum StreamWriteFeature

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        AUTO_CLOSE_TARGET

        -
        public static final StreamWriteFeature AUTO_CLOSE_TARGET
        -
        Feature that determines whether generator will automatically - close underlying output target that is NOT owned by the - generator. - If disabled, calling application has to separately - close the underlying OutputStream and Writer - instances used to create the generator. If enabled, generator - will handle closing, as long as generator itself gets closed: - this happens when end-of-input is encountered, or generator - is closed by a call to JsonGenerator.close(). -

        - Feature is enabled by default.

        -
      • -
      - - - -
        -
      • -

        AUTO_CLOSE_CONTENT

        -
        public static final StreamWriteFeature AUTO_CLOSE_CONTENT
        -
        Feature that determines what happens when the generator is - closed while there are still unmatched - JsonToken.START_ARRAY or JsonToken.START_OBJECT - entries in output content. If enabled, such Array(s) and/or - Object(s) are automatically closed; if disabled, nothing - specific is done. -

        - Feature is enabled by default.

        -
      • -
      - - - -
        -
      • -

        FLUSH_PASSED_TO_STREAM

        -
        public static final StreamWriteFeature FLUSH_PASSED_TO_STREAM
        -
        Feature that specifies that calls to JsonGenerator.flush() will cause - matching flush() to underlying OutputStream - or Writer; if disabled this will not be done. - Main reason to disable this feature is to prevent flushing at - generator level, if it is not possible to prevent method being - called by other code (like ObjectMapper or third - party libraries). -

        - Feature is enabled by default.

        -
      • -
      - - - -
        -
      • -

        WRITE_BIGDECIMAL_AS_PLAIN

        -
        public static final StreamWriteFeature WRITE_BIGDECIMAL_AS_PLAIN
        -
        Feature that determines whether BigDecimal entries are - serialized using BigDecimal.toPlainString() to prevent - values to be written using scientific notation. -

        - NOTE: only affects generators that serialize BigDecimals - using textual representation (textual formats but potentially some binary - formats). -

        - Feature is disabled by default, so default output mode is used; this generally - depends on how BigDecimal has been created.

        -
      • -
      - - - -
        -
      • -

        STRICT_DUPLICATE_DETECTION

        -
        public static final StreamWriteFeature STRICT_DUPLICATE_DETECTION
        -
        Feature that determines whether JsonGenerator will explicitly - check that no duplicate JSON Object field names are written. - If enabled, generator will check all names within context and report - duplicates by throwing a JsonGenerationException; if disabled, - no such checking will be done. Assumption in latter case is - that caller takes care of not trying to write duplicate names. -

        - Note that enabling this feature will incur performance overhead - due to having to store and check additional information. -

        - Feature is disabled by default.

        -
      • -
      - - - -
        -
      • -

        IGNORE_UNKNOWN

        -
        public static final StreamWriteFeature IGNORE_UNKNOWN
        -
        Feature that determines what to do if the underlying data format requires knowledge - of all properties to output, and if no definition is found for a property that - caller tries to write. If enabled, such properties will be quietly ignored; - if disabled, a JsonProcessingException will be thrown to indicate the - problem. - Typically most textual data formats do NOT require schema information (although - some do, such as CSV), whereas many binary data formats do require definitions - (such as Avro, protobuf), although not all (Smile, CBOR, BSON and MessagePack do not). -

        - Note that support for this feature is implemented by individual data format - module, if (and only if) it makes sense for the format in question. For JSON, - for example, this feature has no effect as properties need not be pre-defined. -

        - Feature is disabled by default, meaning that if the underlying data format - requires knowledge of all properties to output, attempts to write an unknown - property will result in a JsonProcessingException

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static StreamWriteFeature[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (StreamWriteFeature c : StreamWriteFeature.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static StreamWriteFeature valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        collectDefaults

        -
        public static int collectDefaults()
        -
        Method that calculates bit set (flags) of all features that - are enabled by default.
        -
        -
        Returns:
        -
        Bit mask of all features that are enabled by default
        -
        -
      • -
      - - - -
        -
      • -

        enabledByDefault

        -
        public boolean enabledByDefault()
        -
        Description copied from interface: JacksonFeature
        -
        Accessor for checking whether this feature is enabled by default.
        -
        -
        Specified by:
        -
        enabledByDefault in interface JacksonFeature
        -
        Returns:
        -
        Whether this instance is enabled by default or not
        -
        -
      • -
      - - - -
        -
      • -

        enabledIn

        -
        public boolean enabledIn(int flags)
        -
        Description copied from interface: JacksonFeature
        -
        Convenience method for checking whether feature is enabled in given bitmask.
        -
        -
        Specified by:
        -
        enabledIn in interface JacksonFeature
        -
        Parameters:
        -
        flags - Bit field that contains a set of enabled features of this type
        -
        Returns:
        -
        True if this feature is enabled in passed bit field
        -
        -
      • -
      - - - -
        -
      • -

        getMask

        -
        public int getMask()
        -
        Description copied from interface: JacksonFeature
        -
        Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
        -
        -
        Specified by:
        -
        getMask in interface JacksonFeature
        -
        Returns:
        -
        Bit mask of this feature
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamContext.html deleted file mode 100644 index 97c3f00514..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamContext.html +++ /dev/null @@ -1,865 +0,0 @@ - - - - - - -TokenStreamContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class TokenStreamContext

-
-
- -
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    JsonReadContext, JsonWriteContext, SimpleTokenReadContext, SimpleTokenWriteContext, TokenFilterContext
    -
    -
    -
    -
    public abstract class TokenStreamContext
    -extends Object
    -
    Shared base class for streaming processing contexts used during - reading and writing of token streams using Streaming API. - This context is also exposed to applications: - context object can be used by applications to get an idea of - relative position of the parser/generator within content - being processed. This allows for some contextual processing: for - example, output within Array context can differ from that of - Object context. Perhaps more importantly context is hierarchic so - that enclosing contexts can be inspected as well. All levels - also include information about current property name (for Objects) - and element index (for Arrays). -

    - NOTE: In jackson 2.x this class was named JsonStreamContext

    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      protected int_index -
      Index of the currently processed entry.
      -
      protected int_type -
      Indicates logical type of context as one of TYPE_xxx consants.
      -
      static intTYPE_ARRAY -
      Indicator for "Array" context.
      -
      static intTYPE_OBJECT -
      Indicator for "Object" context.
      -
      static intTYPE_ROOT -
      Indicator for "Root Value" context (has not parent)
      -
      -
    • -
    - - - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethod and Description
      abstract StringcurrentName() -
      Method for accessing name associated with the current location.
      -
      intgetCurrentIndex() 
      StringgetCurrentName() -
      Deprecated.  -
      Since 3.0 use currentName() instead
      -
      -
      ObjectgetCurrentValue() -
      Method for accessing currently active value being used by data-binding - (as the source of streaming data to write, or destination of data being - read), at this level in hierarchy.
      -
      intgetEntryCount() 
      abstract TokenStreamContextgetParent() -
      Accessor for finding parent context of this context; will - return null for root context.
      -
      JsonLocationgetStartLocation(Object srcRef) -
      Optional method that may be used to access starting location of this context: - for example, in case of JSON `Object` context, offset at which `[` token was - read or written.
      -
      booleanhasCurrentIndex() -
      Method that may be called to verify whether this context has valid index: - will return `false` before the first entry of Object context or before - first element of Array context; otherwise returns `true`.
      -
      booleanhasCurrentName() 
      booleanhasPathSegment() -
      Method that may be called to check if this context is either: - - Object, with at least one entry written (partially or completely) - - Array, with at least one entry written (partially or completely) - - - and if so, return `true`; otherwise return `false`.
      -
      booleaninArray() -
      Method that returns true if this context is an Array context; - that is, content is being read from or written to a JSON Array.
      -
      booleaninObject() -
      Method that returns true if this context is an Object context; - that is, content is being read from or written to a JSON Object.
      -
      booleaninRoot() -
      Method that returns true if this context is a Root context; - that is, content is being read from or written to without - enclosing array or object structure.
      -
      JsonPointerpathAsPointer() -
      Factory method for constructing a JsonPointer that points to the current - location within the stream that this context is for, excluding information about - "root context" (only relevant for multi-root-value cases)
      -
      JsonPointerpathAsPointer(boolean includeRoot) -
      Factory method for constructing a JsonPointer that points to the current - location within the stream that this context is for, optionally including - "root value index"
      -
      voidsetCurrentValue(Object v) -
      Method to call to pass value to be returned via getCurrentValue(); typically - called indirectly through JsonParser.setCurrentValue(java.lang.Object) - or JsonGenerator.setCurrentValue(java.lang.Object)).
      -
      StringtoString() -
      Overridden to provide developer readable "JsonPath" representation - of the context.
      -
      StringtypeDesc() -
      Method for accessing simple type description of current context; - either ROOT (for root-level values), OBJECT (for field names and - values of JSON Objects) or ARRAY (for values of JSON Arrays)
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        TYPE_ROOT

        -
        public static final int TYPE_ROOT
        -
        Indicator for "Root Value" context (has not parent)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        TYPE_ARRAY

        -
        public static final int TYPE_ARRAY
        -
        Indicator for "Array" context.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        TYPE_OBJECT

        -
        public static final int TYPE_OBJECT
        -
        Indicator for "Object" context.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        _type

        -
        protected int _type
        -
        Indicates logical type of context as one of TYPE_xxx consants.
        -
      • -
      - - - -
        -
      • -

        _index

        -
        protected int _index
        -
        Index of the currently processed entry. Starts with -1 to signal - that no entries have been started, and gets advanced each - time a new entry is started, either by encountering an expected - separator, or with new values if no separators are expected - (the case for root context).
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TokenStreamContext

        -
        protected TokenStreamContext()
        -
      • -
      - - - -
        -
      • -

        TokenStreamContext

        -
        protected TokenStreamContext(TokenStreamContext base)
        -
        Copy constructor used by sub-classes for creating copies for buffering.
        -
        -
        Parameters:
        -
        base - Context instance to copy type and index from
        -
        -
      • -
      - - - -
        -
      • -

        TokenStreamContext

        -
        protected TokenStreamContext(int type,
        -                             int index)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getParent

        -
        public abstract TokenStreamContext getParent()
        -
        Accessor for finding parent context of this context; will - return null for root context.
        -
        -
        Returns:
        -
        Parent context of this context, if any; null for Root contexts
        -
        -
      • -
      - - - -
        -
      • -

        inArray

        -
        public final boolean inArray()
        -
        Method that returns true if this context is an Array context; - that is, content is being read from or written to a JSON Array.
        -
        -
        Returns:
        -
        True if this context represents an Array; false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        inRoot

        -
        public final boolean inRoot()
        -
        Method that returns true if this context is a Root context; - that is, content is being read from or written to without - enclosing array or object structure.
        -
        -
        Returns:
        -
        True if this context represents a sequence of Root values; false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        inObject

        -
        public final boolean inObject()
        -
        Method that returns true if this context is an Object context; - that is, content is being read from or written to a JSON Object.
        -
        -
        Returns:
        -
        True if this context represents an Object; false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        typeDesc

        -
        public String typeDesc()
        -
        Method for accessing simple type description of current context; - either ROOT (for root-level values), OBJECT (for field names and - values of JSON Objects) or ARRAY (for values of JSON Arrays)
        -
        -
        Returns:
        -
        Type description String
        -
        -
      • -
      - - - -
        -
      • -

        getEntryCount

        -
        public final int getEntryCount()
        -
        -
        Returns:
        -
        Number of entries that are complete and started.
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentIndex

        -
        public final int getCurrentIndex()
        -
        -
        Returns:
        -
        Index of the currently processed entry, if any
        -
        -
      • -
      - - - -
        -
      • -

        hasCurrentIndex

        -
        public boolean hasCurrentIndex()
        -
        Method that may be called to verify whether this context has valid index: - will return `false` before the first entry of Object context or before - first element of Array context; otherwise returns `true`.
        -
        -
        Returns:
        -
        True if this context has value index to access, false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        hasPathSegment

        -
        public boolean hasPathSegment()
        -
        Method that may be called to check if this context is either: -
          -
        • Object, with at least one entry written (partially or completely) -
        • -
        • Array, with at least one entry written (partially or completely) -
        • -
        - and if so, return `true`; otherwise return `false`. Latter case includes - Root context (always), and Object/Array contexts before any entries/elements - have been read or written. -

        - Method is mostly used to determine whether this context should be used for - constructing JsonPointer

        -
        -
        Returns:
        -
        True if this context has value path segment to access, false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        currentName

        -
        public abstract String currentName()
        -
        Method for accessing name associated with the current location. - Non-null for FIELD_NAME and value events that directly - follow field names; null for root level and array values.
        -
        -
        Returns:
        -
        Current field name within context, if any; null if none
        -
        -
      • -
      - - - - - - - -
        -
      • -

        hasCurrentName

        -
        public boolean hasCurrentName()
        -
      • -
      - - - -
        -
      • -

        getCurrentValue

        -
        public Object getCurrentValue()
        -
        Method for accessing currently active value being used by data-binding - (as the source of streaming data to write, or destination of data being - read), at this level in hierarchy. -

        - Note that "current value" is NOT populated (or used) by Streaming parser or generator; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Returns:
        -
        Currently active value, if one has been assigned.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        pathAsPointer

        -
        public JsonPointer pathAsPointer()
        -
        Factory method for constructing a JsonPointer that points to the current - location within the stream that this context is for, excluding information about - "root context" (only relevant for multi-root-value cases)
        -
        -
        Returns:
        -
        Pointer instance constructed
        -
        -
      • -
      - - - -
        -
      • -

        pathAsPointer

        -
        public JsonPointer pathAsPointer(boolean includeRoot)
        -
        Factory method for constructing a JsonPointer that points to the current - location within the stream that this context is for, optionally including - "root value index"
        -
        -
        Parameters:
        -
        includeRoot - Whether root-value offset is included as the first segment or not
        -
        Returns:
        -
        Pointer instance constructed
        -
        -
      • -
      - - - -
        -
      • -

        getStartLocation

        -
        public JsonLocation getStartLocation(Object srcRef)
        -
        Optional method that may be used to access starting location of this context: - for example, in case of JSON `Object` context, offset at which `[` token was - read or written. Often used for error reporting purposes. - Implementations that do not keep track of such location are expected to return - JsonLocation.NA; this is what the default implementation does. -

        - NOTE: demoted from JsonReadContext in 2.9, to allow use for - "non-standard" read contexts.

        -
        -
        Parameters:
        -
        srcRef - Source reference needed to construct location instance
        -
        Returns:
        -
        Location pointing to the point where the context - start marker was found (or written); never `null`.
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public String toString()
        -
        Overridden to provide developer readable "JsonPath" representation - of the context.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        Returns:
        -
        Simple developer-readable description this context layer - (note: NOT constructed with parents, unlike pathAsPointer())
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.Feature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.Feature.html deleted file mode 100644 index d6a7aaf83b..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.Feature.html +++ /dev/null @@ -1,525 +0,0 @@ - - - - - - -TokenStreamFactory.Feature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Enum TokenStreamFactory.Feature

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        INTERN_FIELD_NAMES

        -
        public static final TokenStreamFactory.Feature INTERN_FIELD_NAMES
        -
        Feature that determines whether JSON object field names are - to be canonicalized using String.intern() or not: - if enabled, all field names will be intern()ed (and caller - can count on this being true for all such names); if disabled, - no intern()ing is done. There may still be basic - canonicalization (that is, same String will be used to represent - all identical object property names for a single document). -

        - Note: this setting only has effect if - CANONICALIZE_FIELD_NAMES is true -- otherwise no - canonicalization of any sort is done. -

        - This setting is disabled by default since 3.0 (was enabled in 1.x and 2.x)

        -
      • -
      - - - -
        -
      • -

        CANONICALIZE_FIELD_NAMES

        -
        public static final TokenStreamFactory.Feature CANONICALIZE_FIELD_NAMES
        -
        Feature that determines whether JSON object field names are - to be canonicalized (details of how canonicalization is done - then further specified by - INTERN_FIELD_NAMES). -

        - This setting is enabled by default.

        -
      • -
      - - - -
        -
      • -

        FAIL_ON_SYMBOL_HASH_OVERFLOW

        -
        public static final TokenStreamFactory.Feature FAIL_ON_SYMBOL_HASH_OVERFLOW
        -
        Feature that determines what happens if we encounter a case in symbol - handling where number of hash collisions exceeds a safety threshold - -- which almost certainly means a denial-of-service attack via generated - duplicate hash codes. - If feature is enabled, an IllegalStateException is - thrown to indicate the suspected denial-of-service attack; if disabled, processing continues but - canonicalization (and thereby intern()ing) is disabled) as protective - measure. -

        - This setting is enabled by default.

        -
      • -
      - - - -
        -
      • -

        USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING

        -
        public static final TokenStreamFactory.Feature USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING
        -
        Feature that determines whether we will use BufferRecycler with - ThreadLocal and SoftReference, for efficient reuse of - underlying input/output buffers. - This usually makes sense on normal J2SE/J2EE server-side processing; - but may not make sense on platforms where SoftReference handling - is broken (like Android), or if there are retention issues due to - ThreadLocal (see - Issue #189 - for a possible case) -

        - This setting is enabled by default.

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static TokenStreamFactory.Feature[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (TokenStreamFactory.Feature c : TokenStreamFactory.Feature.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static TokenStreamFactory.Feature valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        collectDefaults

        -
        public static int collectDefaults()
        -
        Method that calculates bit set (flags) of all features that - are enabled by default.
        -
      • -
      - - - -
        -
      • -

        enabledByDefault

        -
        public boolean enabledByDefault()
        -
        Description copied from interface: JacksonFeature
        -
        Accessor for checking whether this feature is enabled by default.
        -
        -
        Specified by:
        -
        enabledByDefault in interface JacksonFeature
        -
        Returns:
        -
        Whether this instance is enabled by default or not
        -
        -
      • -
      - - - -
        -
      • -

        enabledIn

        -
        public boolean enabledIn(int flags)
        -
        Description copied from interface: JacksonFeature
        -
        Convenience method for checking whether feature is enabled in given bitmask.
        -
        -
        Specified by:
        -
        enabledIn in interface JacksonFeature
        -
        Parameters:
        -
        flags - Bit field that contains a set of enabled features of this type
        -
        Returns:
        -
        True if this feature is enabled in passed bit field
        -
        -
      • -
      - - - -
        -
      • -

        getMask

        -
        public int getMask()
        -
        Description copied from interface: JacksonFeature
        -
        Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
        -
        -
        Specified by:
        -
        getMask in interface JacksonFeature
        -
        Returns:
        -
        Bit mask of this feature
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.TSFBuilder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.TSFBuilder.html deleted file mode 100644 index 8bdc6e2324..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.TSFBuilder.html +++ /dev/null @@ -1,694 +0,0 @@ - - - - - - -TokenStreamFactory.TSFBuilder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class TokenStreamFactory.TSFBuilder<F extends TokenStreamFactory,B extends TokenStreamFactory.TSFBuilder<F,B>>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder<F,B>
    • -
    -
  • -
-
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    DecorableTSFactory.DecorableTSFBuilder
    -
    -
    -
    Enclosing class:
    -
    TokenStreamFactory
    -
    -
    -
    -
    public abstract static class TokenStreamFactory.TSFBuilder<F extends TokenStreamFactory,B extends TokenStreamFactory.TSFBuilder<F,B>>
    -extends Object
    -
    Since factory instances are immutable, a Builder class is needed for creating - configurations for differently configured factory instances.
    -
    -
    Since:
    -
    3.0
    -
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.html deleted file mode 100644 index 7e72bb3b8d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TokenStreamFactory.html +++ /dev/null @@ -1,2077 +0,0 @@ - - - - - - -TokenStreamFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class TokenStreamFactory

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Snapshottable<TokenStreamFactory>, Versioned, Serializable
    -
    -
    -
    Direct Known Subclasses:
    -
    DecorableTSFactory
    -
    -
    -
    -
    public abstract class TokenStreamFactory
    -extends Object
    -implements Versioned, Serializable, Snapshottable<TokenStreamFactory>
    -
    The main factory class of Jackson streaming package, used to configure and - construct token reader (aka parser, JsonParser) - and token writer (aka generator, JsonGenerator) - instances. -

    - Factory instances are thread-safe and reusable after configuration - (if any). Typically applications and services use only a single - globally shared factory instance, unless they need differently - configured factories. Factory reuse is important if efficiency matters; - most recycling of expensive construct is done on per-factory basis. -

    - Creation of a factory instance is a light-weight operation.

    -
    -
    Since:
    -
    3.0 (refactored out of JsonFactory)
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        EMPTY_WRITE_CONTEXT

        -
        public static final ObjectWriteContext EMPTY_WRITE_CONTEXT
        -
        Shareable stateles "empty" ObjectWriteContext Object, passed in - cases where caller had not passed actual context -- "null object" of sort.
        -
      • -
      - - - -
        -
      • -

        DEFAULT_FACTORY_FEATURE_FLAGS

        -
        protected static final int DEFAULT_FACTORY_FEATURE_FLAGS
        -
        Bitfield (set of flags) of all factory features that are enabled by default.
        -
      • -
      - - - -
        -
      • -

        DEFAULT_STREAM_READ_FEATURE_FLAGS

        -
        protected static final int DEFAULT_STREAM_READ_FEATURE_FLAGS
        -
        Bitfield (set of flags) of all parser features that are enabled - by default.
        -
      • -
      - - - -
        -
      • -

        DEFAULT_STREAM_WRITE_FEATURE_FLAGS

        -
        protected static final int DEFAULT_STREAM_WRITE_FEATURE_FLAGS
        -
        Bitfield (set of flags) of all generator features that are enabled - by default.
        -
      • -
      - - - -
        -
      • -

        _factoryFeatures

        -
        protected final int _factoryFeatures
        -
        Currently enabled TokenStreamFactory.Features features as a bitmask.
        -
      • -
      - - - -
        -
      • -

        _streamReadFeatures

        -
        protected final int _streamReadFeatures
        -
        Currently enabled StreamReadFeatures as a bitmask.
        -
      • -
      - - - -
        -
      • -

        _streamWriteFeatures

        -
        protected final int _streamWriteFeatures
        -
        Currently enabled StreamWriteFeatures as a bitmask.
        -
      • -
      - - - -
        -
      • -

        _formatReadFeatures

        -
        protected final int _formatReadFeatures
        -
        Set of format-specific read features enabled, as bitmask.
        -
      • -
      - - - -
        -
      • -

        _formatWriteFeatures

        -
        protected final int _formatWriteFeatures
        -
        Set of format-specific write features enabled, as bitmask.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TokenStreamFactory

        -
        protected TokenStreamFactory(int formatReadFeatures,
        -                             int formatWriteFeatures)
        -
        Default constructor used to create factory instances. - Creation of a factory instance is a light-weight operation, - but it is still a good idea to reuse limited number of - factory instances (and quite often just a single instance): - factories are used as context for storing some reused - processing objects (such as symbol tables parsers use) - and this reuse only works within context of a single - factory instance.
        -
      • -
      - - - -
        -
      • -

        TokenStreamFactory

        -
        protected TokenStreamFactory(TokenStreamFactory.TSFBuilder<?,?> baseBuilder)
        -
        Constructors used by TokenStreamFactory.TSFBuilder for instantiation. Base builder is - passed as-is to try to make interface between base types and implementations - less likely to change (given that sub-classing is a fragile way to do it): - if and when new general-purpose properties are added, implementation classes - do not have to use different constructors.
        -
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        TokenStreamFactory

        -
        protected TokenStreamFactory(TokenStreamFactory src)
        -
        Constructor used if a snapshot is created, or possibly for sub-classing or - wrapping (delegating)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        copy

        -
        public abstract TokenStreamFactory copy()
        -
        Method similar to snapshot(), but one that forces creation of actual - new copy that does NOT share any state, even non-visible to calling code, - such as symbol table reuse. -

        - Implementation should be functionally equivalent to -

        -    factoryInstance.rebuild().build();
        -
        -
      • -
      - - - -
        -
      • -

        snapshot

        -
        public abstract TokenStreamFactory snapshot()
        -
        Method for constructing a new TokenStreamFactory that has - the same settings as this instance, but is otherwise - independent (i.e. nothing is actually shared, symbol tables - are separate). -

        - Although assumption is that all factories are immutable -- and that we could - usually simply return `this` -- method is left unimplemented at this level - to make implementors aware of requirement to consider immutability.

        -
        -
        Specified by:
        -
        snapshot in interface Snapshottable<TokenStreamFactory>
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        rebuild

        -
        public abstract TokenStreamFactory.TSFBuilder<?,?> rebuild()
        -
        Method that can be used to create differently configured stream factories.
        -
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        requiresPropertyOrdering

        -
        public boolean requiresPropertyOrdering()
        -
        Introspection method that higher-level functionality may call - to see whether underlying data format requires a stable ordering - of object properties or not. - This is usually used for determining - whether to force a stable ordering (like alphabetic ordering by name) - if no ordering if explicitly specified.
        -
        -
        Returns:
        -
        Whether format supported by this factory - requires Object properties to be ordered.
        -
        -
      • -
      - - - -
        -
      • -

        canHandleBinaryNatively

        -
        public abstract boolean canHandleBinaryNatively()
        -
        Introspection method that higher-level functionality may call - to see whether underlying data format can read and write binary - data natively; that is, embedded it as-is without using encodings - such as Base64.
        -
        -
        Returns:
        -
        Whether format supported by this factory - supports native binary content
        -
        -
      • -
      - - - -
        -
      • -

        canParseAsync

        -
        public abstract boolean canParseAsync()
        -
        Introspection method that can be used to check whether this - factory can create non-blocking parsers: parsers that do not - use blocking I/O abstractions but instead use a - NonBlockingInputFeeder.
        -
        -
        Returns:
        -
        Whether this factory supports non-blocking ("async") parsing or - not (and consequently whether createNonBlockingXxx() method(s) work)
        -
        -
      • -
      - - - -
        -
      • -

        getFormatReadFeatureType

        -
        public Class<? extends FormatFeature> getFormatReadFeatureType()
        -
        Method for accessing kind of FormatFeature that a parser - JsonParser produced by this factory would accept, if any; - null returned if none.
        -
        -
        Returns:
        -
        Type of format-specific stream read features, if any; null if none
        -
        -
      • -
      - - - -
        -
      • -

        getFormatWriteFeatureType

        -
        public Class<? extends FormatFeature> getFormatWriteFeatureType()
        -
        Method for accessing kind of FormatFeature that a parser - JsonGenerator produced by this factory would accept, if any; - null returned if none.
        -
        -
        Returns:
        -
        Type of format-specific stream read features, if any; null if none
        -
        -
      • -
      - - - -
        -
      • -

        canUseSchema

        -
        public abstract boolean canUseSchema(FormatSchema schema)
        -
        Method that can be used to quickly check whether given schema - is something that parsers and/or generators constructed by this - factory could use. Note that this means possible use, at the level - of data format (i.e. schema is for same data format as parsers and - generators this factory constructs); individual schema instances - may have further usage restrictions.
        -
        -
        Parameters:
        -
        schema - Schema instance to check
        -
        Returns:
        -
        Whether parsers and generators constructed by this factory - can use specified format schema instance
        -
        -
      • -
      - - - -
        -
      • -

        getFormatName

        -
        public abstract String getFormatName()
        -
        Method that returns short textual id identifying format - this factory supports.
        -
        -
        Returns:
        -
        Name of the format handled by parsers, generators this factory creates
        -
        -
      • -
      - - - -
        -
      • -

        version

        -
        public abstract Version version()
        -
        Description copied from interface: Versioned
        -
        Method called to detect version of the component that implements this interface; - returned version should never be null, but may return specific "not available" - instance (see Version for details).
        -
        -
        Specified by:
        -
        version in interface Versioned
        -
        Returns:
        -
        Version of the component
        -
        -
      • -
      - - - - - - - -
        -
      • -

        isEnabled

        -
        public final boolean isEnabled(StreamReadFeature f)
        -
        Checked whether specified parser feature is enabled.
        -
      • -
      - - - -
        -
      • -

        isEnabled

        -
        public final boolean isEnabled(StreamWriteFeature f)
        -
        Check whether specified generator feature is enabled.
        -
      • -
      - - - -
        -
      • -

        getStreamReadFeatures

        -
        public final int getStreamReadFeatures()
        -
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        getStreamWriteFeatures

        -
        public final int getStreamWriteFeatures()
        -
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        getFormatReadFeatures

        -
        public int getFormatReadFeatures()
        -
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        getFormatWriteFeatures

        -
        public int getFormatWriteFeatures()
        -
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        constructFieldNameMatcher

        -
        public FieldNameMatcher constructFieldNameMatcher(List<Named> matches,
        -                                                  boolean alreadyInterned)
        -
        Factory method for constructing case-sensitive FieldNameMatcher - for given names. It will call String.intern() on names unless specified - that this has already been done by caller.
        -
        -
        Parameters:
        -
        matches - Names to match, including both primary names and possible aliases
        -
        -
      • -
      - - - -
        -
      • -

        constructCIFieldNameMatcher

        -
        public FieldNameMatcher constructCIFieldNameMatcher(List<Named> matches,
        -                                                    boolean alreadyInterned,
        -                                                    Locale locale)
        -
        Factory method for constructing case-insensitive FieldNameMatcher - for given names. It will call String.intern() on names unless specified - that this has already been done by caller.
        -
        -
        Parameters:
        -
        matches - Names to match, including both primary names and possible aliases
        -
        -
      • -
      - - - -
        -
      • -

        createParser

        -
        public abstract JsonParser createParser(ObjectReadContext readCtxt,
        -                                        File f)
        -                                 throws IOException
        -
        Method for constructing parser instance to decode - contents of specified file. -

        - Encoding is auto-detected from contents according to JSON - specification recommended mechanism. Json specification - supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - so auto-detection implemented only for this charsets. - For other charsets use createParser(java.io.Reader). - -

        - Underlying input stream (needed for reading contents) - will be owned (and managed, i.e. closed as need be) by - the parser, since caller has no access to it.

        -
        -
        Parameters:
        -
        f - File that contains JSON content to parse
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        createParser

        -
        public abstract JsonParser createParser(ObjectReadContext readCtxt,
        -                                        URL url)
        -                                 throws IOException
        -
        Method for constructing JSON parser instance to decode - contents of resource reference by given URL. - -

        - Encoding is auto-detected from contents according to JSON - specification recommended mechanism. Json specification - supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - so auto-detection implemented only for this charsets. - For other charsets use createParser(java.io.Reader). - -

        - Underlying input stream (needed for reading contents) - will be owned (and managed, i.e. closed as need be) by - the parser, since caller has no access to it.

        -
        -
        Parameters:
        -
        url - URL pointing to resource that contains JSON content to parse
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        createParser

        -
        public abstract JsonParser createParser(ObjectReadContext readCtxt,
        -                                        InputStream in)
        -                                 throws IOException
        -
        Method for constructing JSON parser instance to parse - the contents accessed via specified input stream. -

        - The input stream will not be owned by - the parser, it will still be managed (i.e. closed if - end-of-stream is reacher, or parser close method called) - if (and only if) StreamReadFeature.AUTO_CLOSE_SOURCE - is enabled. -

        - - Note: no encoding argument is taken since it can always be - auto-detected as suggested by JSON RFC. Json specification - supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - so auto-detection implemented only for this charsets. - For other charsets use createParser(java.io.Reader).

        -
        -
        Parameters:
        -
        in - InputStream to use for reading JSON content to parse
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        createParser

        -
        public abstract JsonParser createParser(ObjectReadContext readCtxt,
        -                                        Reader r)
        -                                 throws IOException
        -
        Method for constructing parser for parsing - the contents accessed via specified Reader. -

        - The read stream will not be owned by - the parser, it will still be managed (i.e. closed if - end-of-stream is reacher, or parser close method called) - if (and only if) StreamReadFeature.AUTO_CLOSE_SOURCE - is enabled.

        -
        -
        Parameters:
        -
        r - Reader to use for reading JSON content to parse
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        createParser

        -
        public abstract JsonParser createParser(ObjectReadContext readCtxt,
        -                                        byte[] data,
        -                                        int offset,
        -                                        int len)
        -                                 throws IOException
        -
        Method for constructing parser for parsing - the contents of given byte array.
        -
        -
        Parameters:
        -
        data - Buffer that contains data to parse
        -
        offset - Offset of the first data byte within buffer
        -
        len - Length of contents to parse within buffer
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createParser

        -
        public abstract JsonParser createParser(ObjectReadContext readCtxt,
        -                                        char[] content,
        -                                        int offset,
        -                                        int len)
        -                                 throws IOException
        -
        Method for constructing parser for parsing contents of given char array.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        createGenerator

        -
        public JsonGenerator createGenerator(ObjectWriteContext writeCtxt,
        -                                     OutputStream out)
        -                              throws IOException
        -
        Method for constructing generator that writes contents - using specified OutputStream. - Textual encoding used will be UTF-8, where applicable. -

        - Underlying stream is NOT owned by the generator constructed, - so that generator will NOT close the output stream when - JsonGenerator.close() is called (unless auto-closing - feature, - StreamWriteFeature.AUTO_CLOSE_TARGET - is enabled). - Using application needs to close it explicitly if this is the case.

        -
        -
        Parameters:
        -
        writeCtxt - Object-binding context where applicable; used for providing contextual - configuration
        -
        out - OutputStream to use for writing JSON content
        -
        Throws:
        -
        IOException
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        createGenerator

        -
        public abstract JsonGenerator createGenerator(ObjectWriteContext writeCtxt,
        -                                              OutputStream out,
        -                                              JsonEncoding enc)
        -                                       throws IOException
        -
        Method for constructing generator that writes contents - using specified OutputStream with specified textual encoding - (if applicable). -

        - Underlying stream is NOT owned by the generator constructed, - so that generator will NOT close the output stream when - JsonGenerator.close() is called (unless auto-closing - feature, - StreamWriteFeature.AUTO_CLOSE_TARGET - is enabled). - Using application needs to close it explicitly if this is the case.

        -
        -
        Parameters:
        -
        writeCtxt - Object-binding context where applicable; used for providing contextual - configuration
        -
        out - OutputStream to use for writing JSON content
        -
        Throws:
        -
        IOException
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        createGenerator

        -
        public abstract JsonGenerator createGenerator(ObjectWriteContext writeCtxt,
        -                                              Writer w)
        -                                       throws IOException
        -
        Method for constructing generator that writes contents - using specified Writer. - Textual encoding used will be UTF-8, where applicable. -

        - Underlying stream is NOT owned by the generator constructed, - so that generator will NOT close the Reader when - JsonGenerator.close() is called (unless auto-closing - feature, - StreamWriteFeature.AUTO_CLOSE_TARGET is enabled). - Using application needs to close it explicitly.

        -
        -
        Parameters:
        -
        writeCtxt - Object-binding context where applicable; used for providing contextual - configuration
        -
        w - Writer to use for writing JSON content
        -
        Throws:
        -
        IOException
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        createGenerator

        -
        public abstract JsonGenerator createGenerator(ObjectWriteContext writeCtxt,
        -                                              File f,
        -                                              JsonEncoding enc)
        -                                       throws IOException
        -
        Method for constructing generator that writes contents - to specified file, overwriting contents it might have (or creating - it if such file does not yet exist). -

        - Underlying stream is owned by the generator constructed, - i.e. generator will handle closing of file when - JsonGenerator.close() is called.

        -
        -
        Parameters:
        -
        writeCtxt - Object-binding context where applicable; used for providing contextual - configuration
        -
        f - File to write contents to
        -
        Throws:
        -
        IOException
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        createGenerator

        -
        public JsonGenerator createGenerator(ObjectWriteContext writeCtxt,
        -                                     DataOutput out)
        -                              throws IOException
        -
        Method for constructing generator that writes content into specified DataOutput, - using UTF-8 encoding (with formats where encoding is user-configurable).
        -
        -
        Parameters:
        -
        writeCtxt - Object-binding context where applicable; used for providing contextual - configuration
        -
        Throws:
        -
        IOException
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        createGenerator

        -
        @Deprecated
        -public JsonGenerator createGenerator(OutputStream out,
        -                                                 JsonEncoding enc)
        -                                          throws IOException
        -
        Deprecated. 
        -
        Method for constructing JSON generator for writing JSON content - using specified output stream. - Encoding to use must be specified, and needs to be one of available - types (as per JSON specification). -

        - Underlying stream is NOT owned by the generator constructed, - so that generator will NOT close the output stream when - JsonGenerator.close() is called (unless auto-closing - feature, - StreamWriteFeature.AUTO_CLOSE_TARGET - is enabled). - Using application needs to close it explicitly if this is the case. -

        - Note: there are formats that use fixed encoding (like most binary data formats) - and that ignore passed in encoding.

        -
        -
        Parameters:
        -
        out - OutputStream to use for writing JSON content
        -
        enc - Character encoding to use
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        createGenerator

        -
        @Deprecated
        -public JsonGenerator createGenerator(OutputStream out)
        -                                          throws IOException
        -
        Deprecated. 
        -
        Convenience method for constructing generator that uses default - encoding of the format (UTF-8 for JSON and most other data formats). -

        - Note: there are formats that use fixed encoding (like most binary data formats).

        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        createGenerator

        -
        @Deprecated
        -public JsonGenerator createGenerator(Writer w)
        -                                          throws IOException
        -
        Deprecated. 
        -
        Method for constructing JSON generator for writing JSON content - using specified Writer. -

        - Underlying stream is NOT owned by the generator constructed, - so that generator will NOT close the Reader when - JsonGenerator.close() is called (unless auto-closing - feature, - StreamWriteFeature.AUTO_CLOSE_TARGET is enabled). - Using application needs to close it explicitly.

        -
        -
        Parameters:
        -
        w - Writer to use for writing JSON content
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        createGenerator

        -
        @Deprecated
        -public JsonGenerator createGenerator(File f,
        -                                                 JsonEncoding enc)
        -                                          throws IOException
        -
        Deprecated. 
        -
        Method for constructing JSON generator for writing JSON content - to specified file, overwriting contents it might have (or creating - it if such file does not yet exist). - Encoding to use must be specified, and needs to be one of available - types (as per JSON specification). -

        - Underlying stream is owned by the generator constructed, - i.e. generator will handle closing of file when - JsonGenerator.close() is called.

        -
        -
        Parameters:
        -
        f - File to write contents to
        -
        enc - Character encoding to use
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        createGenerator

        -
        @Deprecated
        -public JsonGenerator createGenerator(DataOutput out)
        -                                          throws IOException
        -
        Deprecated. 
        -
        Convenience method for constructing generator that uses default - encoding of the format (UTF-8 for JSON and most other data formats). -

        - Note: there are formats that use fixed encoding (like most binary data formats).

        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _getBufferRecycler

        -
        public BufferRecycler _getBufferRecycler()
        -
        Method used by factory to create buffer recycler instances - for parsers and generators. -

        - Note: only public to give access for ObjectMapper

        -
      • -
      - - - -
        -
      • -

        _createContext

        -
        protected IOContext _createContext(Object srcRef,
        -                                   boolean resourceManaged)
        -
        Overridable factory method that actually instantiates desired - context object.
        -
      • -
      - - - -
        -
      • -

        _createContext

        -
        protected IOContext _createContext(Object srcRef,
        -                                   boolean resourceManaged,
        -                                   JsonEncoding enc)
        -
        Overridable factory method that actually instantiates desired - context object.
        -
      • -
      - - - - - - - -
        -
      • -

        _optimizedStreamFromURL

        -
        protected InputStream _optimizedStreamFromURL(URL url)
        -                                       throws IOException
        -
        Helper methods used for constructing an optimal stream for - parsers to use, when input is to be read from an URL. - This helps when reading file content via URL.
        -
        -
        Parameters:
        -
        url - Source to read content to parse from
        -
        Returns:
        -
        InputStream constructed for given URL
        -
        Throws:
        -
        IOException - If there is a problem accessing content from specified URL
        -
        -
      • -
      - - - -
        -
      • -

        _unsupported

        -
        protected <T> T _unsupported()
        -
      • -
      - - - -
        -
      • -

        _unsupported

        -
        protected <T> T _unsupported(String str,
        -                             Object... args)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TreeCodec.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TreeCodec.html deleted file mode 100644 index 324c05abd8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TreeCodec.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - -TreeCodec (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface TreeCodec

-
-
-
-
    -
  • -
    -
    -
    public interface TreeCodec
    -
    Interface that defines objects that can read and write - TreeNode instances using Streaming API.
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TreeNode.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TreeNode.html deleted file mode 100644 index fa79d93e89..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/TreeNode.html +++ /dev/null @@ -1,726 +0,0 @@ - - - - - - -TreeNode (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface TreeNode

-
-
-
-
    -
  • -
    -
    All Known Subinterfaces:
    -
    ArrayTreeNode, ObjectTreeNode
    -
    -
    -
    -
    public interface TreeNode
    -
    Marker interface used to denote JSON Tree nodes, as far as - the core package knows them (which is very little): mostly - needed to allow ObjectReadContext and ObjectWriteContext - to have some level of interoperability. - Most functionality is within JsonNode - base class in databind package.
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      JsonTokenasToken() -
      Method that can be used for efficient type detection - when using stream abstraction for traversing nodes.
      -
      TreeNodeat(JsonPointer ptr) -
      Method for locating node specified by given JSON pointer instances.
      -
      TreeNodeat(String ptrExpr) -
      Convenience method that is functionally equivalent to:
      -
      Iterator<String>fieldNames() -
      Method for accessing names of all fields for this node, iff - this node is an Object node.
      -
      TreeNodeget(int index) -
      Method for accessing value of the specified element of - an array node.
      -
      TreeNodeget(String fieldName) -
      Method for accessing value of the specified field of - an object node.
      -
      booleanisArray() -
      Method that returns true if this node is an Array node, false - otherwise.
      -
      booleanisContainerNode() -
      Method that returns true for container nodes: Arrays and Objects.
      -
      booleanisEmbeddedValue() -
      Method that returns true if this node represents an embedded - "foreign" (or perhaps native?) object (like POJO), not represented - as regular content.
      -
      booleanisMissingNode() -
      Method that returns true for "virtual" nodes which represent - missing entries constructed by path accessor methods when - there is no actual node matching given criteria.
      -
      booleanisNull() -
      Method that returns true if this node is a node that represents - logical null value.
      -
      booleanisObject() -
      Method that returns true if this node is an Object node, false - otherwise.
      -
      booleanisValueNode() -
      Method that returns true for all value nodes: ones that - are not containers, and that do not represent "missing" nodes - in the path.
      -
      JsonParser.NumberTypenumberType() -
      If this node is a numeric type (as per JsonToken.isNumeric()), - returns native type that node uses to store the numeric value; - otherwise returns null.
      -
      TreeNodepath(int index) -
      Method for accessing value of the specified element of - an array node.
      -
      TreeNodepath(String fieldName) -
      Method for accessing value of the specified field of - an object node.
      -
      intsize() -
      Method that returns number of child nodes this node contains: - for Array nodes, number of child elements, for Object nodes, - number of fields, and for all other nodes 0.
      -
      JsonParsertraverse(ObjectReadContext readCtxt) -
      Method for constructing a JsonParser instance for - iterating over contents of the tree that this node is root of.
      -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        asToken

        -
        JsonToken asToken()
        -
        Method that can be used for efficient type detection - when using stream abstraction for traversing nodes. - Will return the first JsonToken that equivalent - stream event would produce (for most nodes there is just - one token but for structured/container types multiple)
        -
        -
        Returns:
        -
        JsonToken that is most closely associated with the node type
        -
        -
      • -
      - - - -
        -
      • -

        numberType

        -
        JsonParser.NumberType numberType()
        -
        If this node is a numeric type (as per JsonToken.isNumeric()), - returns native type that node uses to store the numeric value; - otherwise returns null.
        -
        -
        Returns:
        -
        Type of number contained, if any; or null if node does not - contain numeric value.
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        int size()
        -
        Method that returns number of child nodes this node contains: - for Array nodes, number of child elements, for Object nodes, - number of fields, and for all other nodes 0.
        -
        -
        Returns:
        -
        For non-container nodes returns 0; for arrays number of - contained elements, and for objects number of fields.
        -
        -
      • -
      - - - -
        -
      • -

        isValueNode

        -
        boolean isValueNode()
        -
        Method that returns true for all value nodes: ones that - are not containers, and that do not represent "missing" nodes - in the path. Such value nodes represent String, Number, Boolean - and null values from JSON. -

        - Note: one and only one of methods isValueNode(), - isContainerNode() and isMissingNode() ever - returns true for any given node.

        -
        -
        Returns:
        -
        True if this node is considered a value node; something that - represents either a scalar value or explicit null
        -
        -
      • -
      - - - -
        -
      • -

        isContainerNode

        -
        boolean isContainerNode()
        -
        Method that returns true for container nodes: Arrays and Objects. -

        - Note: one and only one of methods isValueNode(), - isContainerNode() and isMissingNode() ever - returns true for any given node.

        -
        -
        Returns:
        -
        True for Array and Object nodes, false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        isMissingNode

        -
        boolean isMissingNode()
        -
        Method that returns true for "virtual" nodes which represent - missing entries constructed by path accessor methods when - there is no actual node matching given criteria. -

        - Note: one and only one of methods isValueNode(), - isContainerNode() and isMissingNode() ever - returns true for any given node.

        -
        -
        Returns:
        -
        True if this node represents a "missing" node
        -
        -
      • -
      - - - -
        -
      • -

        isArray

        -
        boolean isArray()
        -
        Method that returns true if this node is an Array node, false - otherwise. - Note that if true is returned, isContainerNode() - must also return true.
        -
        -
        Returns:
        -
        True for Array nodes, false for everything else
        -
        -
      • -
      - - - -
        -
      • -

        isObject

        -
        boolean isObject()
        -
        Method that returns true if this node is an Object node, false - otherwise. - Note that if true is returned, isContainerNode() - must also return true.
        -
        -
        Returns:
        -
        True for Object nodes, false for everything else
        -
        -
      • -
      - - - -
        -
      • -

        isNull

        -
        boolean isNull()
        -
        Method that returns true if this node is a node that represents - logical null value.
        -
        -
        Returns:
        -
        True for nodes representing explicit input null, - false for everything else
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        isEmbeddedValue

        -
        boolean isEmbeddedValue()
        -
        Method that returns true if this node represents an embedded - "foreign" (or perhaps native?) object (like POJO), not represented - as regular content. Such nodes are used to pass information that - either native format can not express as-is, metadata not included within - at all, or something else that requires special handling.
        -
        -
        Returns:
        -
        True for nodes representing "embedded" (or format-specific, native) - value -- ones that streaming api exposes as JsonToken.VALUE_EMBEDDED_OBJECT - -- false for other nodes
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        TreeNode get(String fieldName)
        -
        Method for accessing value of the specified field of - an object node. If this node is not an object (or it - does not have a value for specified field name), or - if there is no field with such name, null is returned. -

        - NOTE: handling of explicit null values may vary between - implementations; some trees may retain explicit nulls, others - not.

        -
        -
        Parameters:
        -
        fieldName - Name of the field (of Object node) to access
        -
        Returns:
        -
        Node that represent value of the specified field, - if this node is an Object and has value for the specified - field; null otherwise.
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        TreeNode get(int index)
        -
        Method for accessing value of the specified element of - an array node. For other nodes, null is returned. -

        - For array nodes, index specifies - exact location within array and allows for efficient iteration - over child elements (underlying storage is guaranteed to - be efficiently indexable, i.e. has random-access to elements). - If index is less than 0, or equal-or-greater than - node.size(), null is returned; no exception is - thrown for any index.

        -
        -
        Parameters:
        -
        index - Index of the Array node element to access
        -
        Returns:
        -
        Node that represent value of the specified element, - if this node is an array and has specified element; - null otherwise.
        -
        -
      • -
      - - - -
        -
      • -

        path

        -
        TreeNode path(String fieldName)
        -
        Method for accessing value of the specified field of - an object node. - For other nodes, a "missing node" (virtual node - for which isMissingNode() returns true) is returned.
        -
        -
        Parameters:
        -
        fieldName - Name of the field (of Object node) to access
        -
        Returns:
        -
        Node that represent value of the specified field, - if this node is an object and has value for the specified field; - otherwise "missing node" is returned.
        -
        -
      • -
      - - - -
        -
      • -

        path

        -
        TreeNode path(int index)
        -
        Method for accessing value of the specified element of - an array node. - For other nodes, a "missing node" (virtual node - for which isMissingNode() returns true) is returned. -

        - For array nodes, index specifies - exact location within array and allows for efficient iteration - over child elements (underlying storage is guaranteed to - be efficiently indexable, i.e. has random-access to elements). - If index is less than 0, or equal-or-greater than - node.size(), "missing node" is returned; no exception is - thrown for any index.

        -
        -
        Parameters:
        -
        index - Index of the Array node element to access
        -
        Returns:
        -
        Node that represent value of the specified element, - if this node is an array and has specified element; - otherwise "missing node" is returned.
        -
        -
      • -
      - - - -
        -
      • -

        fieldNames

        -
        Iterator<String> fieldNames()
        -
        Method for accessing names of all fields for this node, iff - this node is an Object node. Number of field names accessible - will be size().
        -
        -
        Returns:
        -
        An iterator for traversing names of all fields this Object node - has (if Object node); empty Iterator otherwise (never null).
        -
        -
      • -
      - - - -
        -
      • -

        at

        -
        TreeNode at(JsonPointer ptr)
        -
        Method for locating node specified by given JSON pointer instances. - Method will never return null; if no matching node exists, - will return a node for which isMissingNode() returns true.
        -
        -
        Parameters:
        -
        ptr - JsonPointer expression for descendant node to return
        -
        Returns:
        -
        Node that matches given JSON Pointer, if any: if no match exists, - will return a "missing" node (for which isMissingNode() - returns true).
        -
        -
      • -
      - - - -
        -
      • -

        at

        -
        TreeNode at(String ptrExpr)
        -     throws IllegalArgumentException
        -
        Convenience method that is functionally equivalent to: -
        -   return at(JsonPointer.valueOf(jsonPointerExpression));
        -
        -

        - Note that if the same expression is used often, it is preferable to construct - JsonPointer instance once and reuse it: this method will not perform - any caching of compiled expressions.

        -
        -
        Parameters:
        -
        ptrExpr - Expression to compile as a JsonPointer - instance
        -
        Returns:
        -
        Node that matches given JSON Pointer, if any: if no match exists, - will return a "missing" node (for which isMissingNode() - returns true).
        -
        Throws:
        -
        IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        traverse

        -
        JsonParser traverse(ObjectReadContext readCtxt)
        -
        Method for constructing a JsonParser instance for - iterating over contents of the tree that this node is root of. - Functionally equivalent to first serializing tree and then re-parsing but - more efficient. -

        - NOTE: constructed parser instance will NOT initially point to a token, - so before passing it to deserializers, it is typically necessary to - advance it to the first available token by calling JsonParser.nextToken().

        -
        -
        Parameters:
        -
        readCtxt - ObjectReadContext to associate with parser constructed - (to allow seamless databinding functionality)
        -
        Returns:
        -
        JsonParser that will stream over contents of this node
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Version.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Version.html deleted file mode 100644 index 982b9edb9f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Version.html +++ /dev/null @@ -1,600 +0,0 @@ - - - - - - -Version (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Class Version

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable, Comparable<Version>
    -
    -
    -
    -
    public class Version
    -extends Object
    -implements Comparable<Version>, Serializable
    -
    Object that encapsulates versioning information of a component. - Version information includes not just version number but also - optionally group and artifact ids of the component being versioned. -

    - Note that optional group and artifact id properties are new with Jackson 2.0: - if provided, they should align with Maven artifact information.

    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _majorVersion

        -
        protected final int _majorVersion
        -
      • -
      - - - -
        -
      • -

        _minorVersion

        -
        protected final int _minorVersion
        -
      • -
      - - - -
        -
      • -

        _patchLevel

        -
        protected final int _patchLevel
        -
      • -
      - - - -
        -
      • -

        _groupId

        -
        protected final String _groupId
        -
      • -
      - - - -
        -
      • -

        _artifactId

        -
        protected final String _artifactId
        -
      • -
      - - - -
        -
      • -

        _snapshotInfo

        -
        protected final String _snapshotInfo
        -
        Additional information for snapshot versions; null for non-snapshot - (release) versions.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Version

        -
        public Version(int major,
        -               int minor,
        -               int patchLevel,
        -               String snapshotInfo,
        -               String groupId,
        -               String artifactId)
        -
        -
        Parameters:
        -
        major - Major version number
        -
        minor - Minor version number
        -
        patchLevel - patch level of version
        -
        snapshotInfo - Optional additional string qualifier
        -
        groupId - Maven group id
        -
        artifactId - Maven artifact id
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        unknownVersion

        -
        public static Version unknownVersion()
        -
        Method returns canonical "not known" version, which is used as version - in cases where actual version information is not known (instead of null).
        -
        -
        Returns:
        -
        Version instance to use as a placeholder when actual version is not known - (or not relevant)
        -
        -
      • -
      - - - -
        -
      • -

        isUnknownVersion

        -
        public boolean isUnknownVersion()
        -
        -
        Returns:
        -
        True if this instance is the one returned by - call to unknownVersion()
        -
        -
      • -
      - - - -
        -
      • -

        isSnapshot

        -
        public boolean isSnapshot()
        -
      • -
      - - - -
        -
      • -

        getMajorVersion

        -
        public int getMajorVersion()
        -
      • -
      - - - -
        -
      • -

        getMinorVersion

        -
        public int getMinorVersion()
        -
      • -
      - - - -
        -
      • -

        getPatchLevel

        -
        public int getPatchLevel()
        -
      • -
      - - - -
        -
      • -

        getGroupId

        -
        public String getGroupId()
        -
      • -
      - - - -
        -
      • -

        getArtifactId

        -
        public String getArtifactId()
        -
      • -
      - - - -
        -
      • -

        toFullString

        -
        public String toFullString()
        -
      • -
      - - - - - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class Object
        -
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public boolean equals(Object o)
        -
        -
        Overrides:
        -
        equals in class Object
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Versioned.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Versioned.html deleted file mode 100644 index 766f27b51b..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/Versioned.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - -Versioned (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core
-

Interface Versioned

-
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      Versionversion() -
      Method called to detect version of the component that implements this interface; - returned version should never be null, but may return specific "not available" - instance (see Version for details).
      -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        version

        -
        Version version()
        -
        Method called to detect version of the component that implements this interface; - returned version should never be null, but may return specific "not available" - instance (see Version for details).
        -
        -
        Returns:
        -
        Version of the component
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/ByteArrayFeeder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/ByteArrayFeeder.html deleted file mode 100644 index f59cff7a7f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/ByteArrayFeeder.html +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - -ByteArrayFeeder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.async
-

Interface ByteArrayFeeder

-
-
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        feedInput

        -
        void feedInput(byte[] data,
        -               int offset,
        -               int end)
        -        throws IOException
        -
        Method that can be called to feed more data, if (and only if) - NonBlockingInputFeeder.needMoreInput() returns true.
        -
        -
        Parameters:
        -
        data - Byte array that contains data to feed: caller must ensure data remains - stable until it is fully processed (which is true when NonBlockingInputFeeder.needMoreInput() - returns true)
        -
        offset - Offset within array where input data to process starts
        -
        end - Offset after last byte contained in the input array
        -
        Throws:
        -
        IOException - if the state is such that this method should not be called - (has not yet consumed existing input data, or has been marked as closed)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/ByteBufferFeeder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/ByteBufferFeeder.html deleted file mode 100644 index 40b7e36f93..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/ByteBufferFeeder.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - -ByteBufferFeeder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.async
-

Interface ByteBufferFeeder

-
-
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        feedInput

        -
        void feedInput(ByteBuffer buffer)
        -        throws IOException
        -
        Method that can be called to feed more data, if (and only if) - NonBlockingInputFeeder.needMoreInput() returns true.
        -
        -
        Parameters:
        -
        buffer - Buffer that contains additional input to read
        -
        Throws:
        -
        IOException - if the state is such that this method should not be called - (has not yet consumed existing input data, or has been marked as closed)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/NonBlockingInputFeeder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/NonBlockingInputFeeder.html deleted file mode 100644 index 4486c08edf..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/NonBlockingInputFeeder.html +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - -NonBlockingInputFeeder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.async
-

Interface NonBlockingInputFeeder

-
-
-
-
    -
  • -
    -
    All Known Subinterfaces:
    -
    ByteArrayFeeder, ByteBufferFeeder
    -
    -
    -
    All Known Implementing Classes:
    -
    NonBlockingJsonParser
    -
    -
    -
    -
    public interface NonBlockingInputFeeder
    -
    Interface used by non-blocking JsonParser - implementations to feed input to parse. - Feeder is used by entity that feeds content to parse; at any given point - only one chunk of content can be processed so caller has to take care to - only feed more content when existing content has been parsed (which occurs - when parser's nextToken is called). Once application using - non-blocking parser has no more data to feed it should call - endOfInput() to indicate end of logical input (stream) to parse.
    -
    -
    Since:
    -
    2.9
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      voidendOfInput() -
      Method that should be called after last chunk of data to parse has been fed - (with feedInput in sub-class); can be called regardless of what needMoreInput() - returns.
      -
      booleanneedMoreInput() -
      Method called to check whether it is ok to feed more data: parser returns true - if it has no more content to parse (and it is ok to feed more); otherwise false - (and no data should yet be fed).
      -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        needMoreInput

        -
        boolean needMoreInput()
        -
        Method called to check whether it is ok to feed more data: parser returns true - if it has no more content to parse (and it is ok to feed more); otherwise false - (and no data should yet be fed).
        -
      • -
      - - - -
        -
      • -

        endOfInput

        -
        void endOfInput()
        -
        Method that should be called after last chunk of data to parse has been fed - (with feedInput in sub-class); can be called regardless of what needMoreInput() - returns. After calling this method, no more data can be fed; and parser assumes - no more data will be available.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/ByteArrayFeeder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/ByteArrayFeeder.html deleted file mode 100644 index b1a1a3a629..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/ByteArrayFeeder.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.async.ByteArrayFeeder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.async.ByteArrayFeeder

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/ByteBufferFeeder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/ByteBufferFeeder.html deleted file mode 100644 index 03bfe82c43..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/ByteBufferFeeder.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.async.ByteBufferFeeder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.async.ByteBufferFeeder

-
-
No usage of com.fasterxml.jackson.core.async.ByteBufferFeeder
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/NonBlockingInputFeeder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/NonBlockingInputFeeder.html deleted file mode 100644 index 440633e86d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/class-use/NonBlockingInputFeeder.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.async.NonBlockingInputFeeder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.async.NonBlockingInputFeeder

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-frame.html deleted file mode 100644 index 1e03cc1ad2..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-frame.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.async (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.async

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-summary.html deleted file mode 100644 index c6d34babc8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-summary.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.async (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.async

-
-
Package that contains abstractions needed to support optional - non-blocking decoding (parsing) functionality.
-
-

See: Description

-
-
- - - - -

Package com.fasterxml.jackson.core.async Description

-
Package that contains abstractions needed to support optional - non-blocking decoding (parsing) functionality. - Although parsers are constructed normally via - JsonFactory - (and are, in fact, sub-types of JsonParser), - the way input is provided differs.
-
-
Since:
-
2.9
-
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-tree.html deleted file mode 100644 index 436912cf9d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-tree.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.async Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.async

-Package Hierarchies: - -
-
-

Interface Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-use.html deleted file mode 100644 index 3d825b36e0..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/async/package-use.html +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.async (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.async

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/BinaryTSFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/BinaryTSFactory.html deleted file mode 100644 index adc0f3cc41..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/BinaryTSFactory.html +++ /dev/null @@ -1,959 +0,0 @@ - - - - - - -BinaryTSFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.base
-

Class BinaryTSFactory

-
-
- -
- -
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/DecorableTSFactory.DecorableTSFBuilder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/DecorableTSFactory.DecorableTSFBuilder.html deleted file mode 100644 index f5f40b7e87..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/DecorableTSFactory.DecorableTSFBuilder.html +++ /dev/null @@ -1,421 +0,0 @@ - - - - - - -DecorableTSFactory.DecorableTSFBuilder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.base
-

Class DecorableTSFactory.DecorableTSFBuilder<F extends TokenStreamFactory,T extends TokenStreamFactory.TSFBuilder<F,T>>

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _inputDecorator

        -
        protected InputDecorator _inputDecorator
        -
        Optional helper object that may decorate input sources, to do - additional processing on input during parsing.
        -
      • -
      - - - -
        -
      • -

        _outputDecorator

        -
        protected OutputDecorator _outputDecorator
        -
        Optional helper object that may decorate output object, to do - additional processing on output during content generation.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DecorableTSFBuilder

        -
        protected DecorableTSFBuilder(int formatPF,
        -                              int formatGF)
        -
      • -
      - - - - -
    • -
    - - -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/DecorableTSFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/DecorableTSFactory.html deleted file mode 100644 index de74e95276..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/DecorableTSFactory.html +++ /dev/null @@ -1,557 +0,0 @@ - - - - - - -DecorableTSFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.base
-

Class DecorableTSFactory

-
-
- -
- -
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/GeneratorBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/GeneratorBase.html deleted file mode 100644 index 2d12de1e8a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/GeneratorBase.html +++ /dev/null @@ -1,1322 +0,0 @@ - - - - - - -GeneratorBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.base
-

Class GeneratorBase

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Versioned, Closeable, Flushable, AutoCloseable
    -
    -
    -
    Direct Known Subclasses:
    -
    JsonGeneratorBase
    -
    -
    -
    -
    public abstract class GeneratorBase
    -extends JsonGenerator
    -
    This base class implements part of API that a JSON generator exposes - to applications, adds shared internal methods that sub-classes - can use and adds some abstract methods sub-classes must implement.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        MAX_BIG_DECIMAL_SCALE

        -
        protected static final int MAX_BIG_DECIMAL_SCALE
        -
        This value is the limit of scale allowed for serializing BigDecimal - in "plain" (non-engineering) notation; intent is to prevent asymmetric - attack whereupon simple eng-notation with big scale is used to generate - huge "plain" serialization. See [core#315] for details.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        _objectWriteContext

        -
        protected final ObjectWriteContext _objectWriteContext
        -
        Context object used both to pass some initial settings and to allow - triggering of Object serialization through generator.
        -
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        _streamWriteFeatures

        -
        protected int _streamWriteFeatures
        -
        Bit flag composed of bits that indicate which - StreamWriteFeatures - are enabled.
        -
      • -
      - - - -
        -
      • -

        _closed

        -
        protected boolean _closed
        -
        Flag that indicates whether generator is closed or not. Gets - set when it is closed by an explicit call - (close()).
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GeneratorBase

        -
        protected GeneratorBase(ObjectWriteContext writeCtxt,
        -                        int streamWriteFeatures)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        isEnabled

        -
        public final boolean isEnabled(StreamWriteFeature f)
        -
        Description copied from class: JsonGenerator
        -
        Method for checking whether given feature is enabled. - Check StreamWriteFeature for list of available features.
        -
        -
        Specified by:
        -
        isEnabled in class JsonGenerator
        -
        Parameters:
        -
        f - Feature to check
        -
        Returns:
        -
        True if feature is enabled; false if not
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getObjectWriteContext

        -
        public ObjectWriteContext getObjectWriteContext()
        -
        Description copied from class: JsonGenerator
        -
        Accessor for context object provided by higher-level databinding - functionality (or, in some cases, simple placeholder of the same) - that allows some level of interaction including ability to trigger - serialization of Object values through generator instance.
        -
        -
        Specified by:
        -
        getObjectWriteContext in class JsonGenerator
        -
        Returns:
        -
        Object write context (ObjectWriteContext) associated with this generator
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(Object forValue,
        -                            int size)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any) - and how many elements will be written for the array before calling - JsonGenerator.writeEndArray().
        -
        -
        Specified by:
        -
        writeStartArray in class JsonGenerator
        -
        Parameters:
        -
        forValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        size - Number of elements this Array will have: actual - number of values written (before matching call to - JsonGenerator.writeEndArray() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object forValue,
        -                             int size)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. - In addition, caller knows number of key/value pairs ("properties") - that will get written for the Object value: this is relevant for - some format backends (but not, as an example, for JSON). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartObject in class JsonGenerator
        -
        Parameters:
        -
        forValue - Object value to be written (assigned as "current value" for - the Object context that gets created)
        -
        size - Number of key/value pairs this Object will have: actual - number of entries written (before matching call to - JsonGenerator.writeEndObject() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public void writeFieldName(SerializableString name)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeFieldName(String), main difference - being that it may perform better as some of processing (such as - quoting of certain characters, or encoding into external encoding - if supported by generator) can be done just once and reused for - later calls. -

        - Default implementation simple uses unprocessed name container in - serialized String; implementations are strongly encouraged to make - use of more efficient methods argument object has.

        -
        -
        Specified by:
        -
        writeFieldName in class JsonGenerator
        -
        Parameters:
        -
        name - Pre-encoded field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeRawValue

        -
        public void writeRawValue(String text)
        -                   throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim without any modifications, but assuming - it must constitute a single legal JSON value (number, string, - boolean, null, Array or List). Assuming this, proper separators - are added if and as needed (comma or colon), and generator - state updated to reflect this.
        -
        -
        Specified by:
        -
        writeRawValue in class JsonGenerator
        -
        Parameters:
        -
        text - Textual contents to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        writeBinary

        -
        public int writeBinary(Base64Variant b64variant,
        -                       InputStream data,
        -                       int dataLength)
        -                throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeBinary(Base64Variant,byte[],int,int), - but where input is provided through a stream, allowing for incremental - writes without holding the whole input in memory.
        -
        -
        Specified by:
        -
        writeBinary in class JsonGenerator
        -
        Parameters:
        -
        b64variant - Base64 variant to use
        -
        data - InputStream to use for reading binary data to write. - Will not be closed after successful write operation
        -
        dataLength - (optional) number of bytes that will be available; - or -1 to be indicate it is not known. - If a positive length is given, data MUST provide at least - that many bytes: if not, an exception will be thrown. - Note that implementations - need not support cases where length is not known in advance; this - depends on underlying data format: JSON output does NOT require length, - other formats may.
        -
        Returns:
        -
        Number of bytes read from data and written as binary payload
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        flush

        -
        public abstract void flush()
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to flush any buffered content to the underlying - target (output stream, writer), and to flush the target itself - as well.
        -
        -
        Specified by:
        -
        flush in interface Flushable
        -
        Specified by:
        -
        flush in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to close this generator, so that no more content - can be written. -

        - Whether the underlying target (stream, writer) gets closed depends - on whether this generator either manages the target (i.e. is the - only one with access to the target -- case if caller passes a - reference to the resource such as File, but not stream); or - has feature StreamWriteFeature.AUTO_CLOSE_TARGET enabled. - If either of above is true, the target is also closed. Otherwise - (not managing, feature not enabled), target is not closed.

        -
        -
        Specified by:
        -
        close in interface Closeable
        -
        Specified by:
        -
        close in interface AutoCloseable
        -
        Specified by:
        -
        close in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to determine whether this generator - is closed or not. If it is closed, no more output can be done.
        -
        -
        Specified by:
        -
        isClosed in class JsonGenerator
        -
        Returns:
        -
        True if this generator has been closed; false if not
        -
        -
      • -
      - - - -
        -
      • -

        _releaseBuffers

        -
        protected abstract void _releaseBuffers()
        -
        Method called to release any buffers generator may be holding, - once generator is being closed.
        -
      • -
      - - - -
        -
      • -

        _verifyValueWrite

        -
        protected abstract void _verifyValueWrite(String typeMsg)
        -                                   throws IOException
        -
        Method called before trying to write a value (scalar or structured), - to verify that this is legal in current output state, as well as to - output separators if and as necessary.
        -
        -
        Parameters:
        -
        typeMsg - Additional message used for generating exception message - if value output is NOT legal in current generator output state.
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _constructDefaultPrettyPrinter

        -
        protected PrettyPrinter _constructDefaultPrettyPrinter()
        -
        Overridable factory method called to instantiate an appropriate PrettyPrinter - for case of "just use the default one", when default pretty printer handling enabled.
        -
      • -
      - - - - - - - -
        -
      • -

        _decodeSurrogate

        -
        protected final int _decodeSurrogate(int surr1,
        -                                     int surr2)
        -                              throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/ParserBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/ParserBase.html deleted file mode 100644 index 7aea58896c..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/ParserBase.html +++ /dev/null @@ -1,1815 +0,0 @@ - - - - - - -ParserBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.base
-

Class ParserBase

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Versioned, Closeable, AutoCloseable
    -
    -
    -
    Direct Known Subclasses:
    -
    JsonParserBase
    -
    -
    -
    -
    public abstract class ParserBase
    -extends ParserMinimalBase
    -
    Intermediate base class used by many (but not all) Jackson JsonParser - implementations. Contains most common things that are independent - of actual underlying input source.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _ioContext

        -
        protected final IOContext _ioContext
        -
        I/O context for this reader. It handles buffer allocation - for the reader.
        -
      • -
      - - - -
        -
      • -

        _closed

        -
        protected boolean _closed
        -
        Flag that indicates whether parser is closed or not. Gets - set when parser is either closed by explicit call - (close()) or when end-of-input is reached.
        -
      • -
      - - - -
        -
      • -

        _inputPtr

        -
        protected int _inputPtr
        -
        Pointer to next available character in buffer
        -
      • -
      - - - -
        -
      • -

        _inputEnd

        -
        protected int _inputEnd
        -
        Index of character after last available one in the buffer.
        -
      • -
      - - - -
        -
      • -

        _currInputProcessed

        -
        protected long _currInputProcessed
        -
        Number of characters/bytes that were contained in previous blocks - (blocks that were already processed prior to the current buffer).
        -
      • -
      - - - -
        -
      • -

        _currInputRow

        -
        protected int _currInputRow
        -
        Current row location of current point in input buffer, starting - from 1, if available.
        -
      • -
      - - - -
        -
      • -

        _currInputRowStart

        -
        protected int _currInputRowStart
        -
        Current index of the first character of the current row in input - buffer. Needed to calculate column position, if necessary; benefit - of not having column itself is that this only has to be updated - once per line.
        -
      • -
      - - - -
        -
      • -

        _tokenInputTotal

        -
        protected long _tokenInputTotal
        -
        Total number of bytes/characters read before start of current token. - For big (gigabyte-sized) sizes are possible, needs to be long, - unlike pointers and sizes related to in-memory buffers.
        -
      • -
      - - - -
        -
      • -

        _tokenInputRow

        -
        protected int _tokenInputRow
        -
        Input row on which current token starts, 1-based
        -
      • -
      - - - -
        -
      • -

        _tokenInputCol

        -
        protected int _tokenInputCol
        -
        Column on input row that current token starts; 0-based (although - in the end it'll be converted to 1-based)
        -
      • -
      - - - -
        -
      • -

        _textBuffer

        -
        protected final TextBuffer _textBuffer
        -
        Buffer that contains contents of String values, including - field names if necessary (name split across boundary, - contains escape sequence, or access needed to char array)
        -
      • -
      - - - -
        -
      • -

        _byteArrayBuilder

        -
        protected ByteArrayBuilder _byteArrayBuilder
        -
        ByteArrayBuilder is needed if 'getBinaryValue' is called. If so, - we better reuse it for remainder of content.
        -
      • -
      - - - - - - - -
        -
      • -

        _numTypesValid

        -
        protected int _numTypesValid
        -
        Bitfield that indicates which numeric representations - have been calculated for the current type
        -
      • -
      - - - -
        -
      • -

        _numberInt

        -
        protected int _numberInt
        -
      • -
      - - - -
        -
      • -

        _numberLong

        -
        protected long _numberLong
        -
      • -
      - - - -
        -
      • -

        _numberDouble

        -
        protected double _numberDouble
        -
      • -
      - - - -
        -
      • -

        _numberBigInt

        -
        protected BigInteger _numberBigInt
        -
      • -
      - - - -
        -
      • -

        _numberBigDecimal

        -
        protected BigDecimal _numberBigDecimal
        -
      • -
      - - - -
        -
      • -

        _numberNegative

        -
        protected boolean _numberNegative
        -
        Flag that indicates whether numeric value has a negative - value. That is, whether its textual representation starts - with minus character.
        -
      • -
      - - - -
        -
      • -

        _intLength

        -
        protected int _intLength
        -
        Length of integer part of the number, in characters
        -
      • -
      - - - -
        -
      • -

        _fractLength

        -
        protected int _fractLength
        -
        Length of the fractional part (not including decimal - point or exponent), in characters. - Not used for pure integer values.
        -
      • -
      - - - -
        -
      • -

        _expLength

        -
        protected int _expLength
        -
        Length of the exponent part of the number, if any, not - including 'e' marker or sign, just digits. - Not used for pure integer values.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setCurrentValue

        -
        public void setCurrentValue(Object v)
        -
        Description copied from class: JsonParser
        -
        Helper method, usually equivalent to: - - getParsingContext().setCurrentValue(v); -
        -
        -
        Specified by:
        -
        setCurrentValue in class JsonParser
        -
        Parameters:
        -
        v - "Current value" to assign to the current input context of this parser
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentValue

        -
        public Object getCurrentValue()
        -
        Description copied from class: JsonParser
        -
        Helper method, usually equivalent to: - - getParsingContext().getCurrentValue(); - -

        - Note that "current value" is NOT populated (or used) by Streaming parser; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Specified by:
        -
        getCurrentValue in class JsonParser
        -
        Returns:
        -
        "Current value" for the current input context this parser has
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws IOException
        -
        Method that can be called to get the name associated with - the current event.
        -
        -
        Specified by:
        -
        close in interface Closeable
        -
        Specified by:
        -
        close in interface AutoCloseable
        -
        Specified by:
        -
        close in class JsonParser
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
        Description copied from class: JsonParser
        -
        Method that can be called to determine whether this parser - is closed or not. If it is closed, no new tokens can be - retrieved by calling JsonParser.nextToken() (and the underlying - stream may be closed). Closing may be due to an explicit - call to JsonParser.close() or because parser has encountered - end of input.
        -
        -
        Specified by:
        -
        isClosed in class JsonParser
        -
        Returns:
        -
        True if this parser instance has been closed
        -
        -
      • -
      - - - -
        -
      • -

        hasTextCharacters

        -
        public boolean hasTextCharacters()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to determine whether calling of - JsonParser.getTextCharacters() would be the most efficient - way to access textual content for the event parser currently - points to. -

        - Default implementation simply returns false since only actual - implementation class has knowledge of its internal buffering - state. - Implementations are strongly encouraged to properly override - this method, to allow efficient copying of content by other - code.

        -
        -
        Specified by:
        -
        hasTextCharacters in class JsonParser
        -
        Returns:
        -
        True if parser currently has character array that can - be efficiently returned via JsonParser.getTextCharacters(); false - means that it may or may not exist
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryValue

        -
        public byte[] getBinaryValue(Base64Variant variant)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be used to read (and consume -- results - may not be accessible using other methods after the call) - base64-encoded binary data - included in the current textual JSON value. - It works similar to getting String value via JsonParser.getText() - and decoding result (except for decoding part), - but should be significantly more performant. -

        - Note that non-decoded textual contents of the current token - are not guaranteed to be accessible after this method - is called. Current implementation, for example, clears up - textual content during decoding. - Decoded binary content, however, will be retained until - parser is advanced to the next event.

        -
        -
        Specified by:
        -
        getBinaryValue in class JsonParser
        -
        Parameters:
        -
        variant - Expected variant of base64 encoded - content (see Base64Variants for definitions - of "standard" variants).
        -
        Returns:
        -
        Decoded binary data
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getTokenCharacterOffset

        -
        public long getTokenCharacterOffset()
        -
      • -
      - - - -
        -
      • -

        getTokenLineNr

        -
        public int getTokenLineNr()
        -
      • -
      - - - -
        -
      • -

        getTokenColumnNr

        -
        public int getTokenColumnNr()
        -
      • -
      - - - - - - - -
        -
      • -

        _releaseBuffers

        -
        protected void _releaseBuffers()
        -                        throws IOException
        -
        Method called to release internal buffers owned by the base - reader. This may be called along with _closeInput() (for - example, when explicitly closing this reader instance), or - separately (if need be).
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        _getByteArrayBuilder

        -
        protected ByteArrayBuilder _getByteArrayBuilder()
        -
      • -
      - - - -
        -
      • -

        reset

        -
        protected final JsonToken reset(boolean negative,
        -                                int intLen,
        -                                int fractLen,
        -                                int expLen)
        -
      • -
      - - - -
        -
      • -

        resetInt

        -
        protected final JsonToken resetInt(boolean negative,
        -                                   int intLen)
        -
      • -
      - - - -
        -
      • -

        resetFloat

        -
        protected final JsonToken resetFloat(boolean negative,
        -                                     int intLen,
        -                                     int fractLen,
        -                                     int expLen)
        -
      • -
      - - - -
        -
      • -

        resetAsNaN

        -
        protected final JsonToken resetAsNaN(String valueStr,
        -                                     double value)
        -
      • -
      - - - -
        -
      • -

        isNaN

        -
        public boolean isNaN()
        -
        Description copied from class: JsonParser
        -
        Access for checking whether current token is a numeric value token, but - one that is of "not-a-number" (NaN) variety (including both "NaN" AND - positive/negative infinity!): not supported by all formats, - but often supported for JsonToken.VALUE_NUMBER_FLOAT. - NOTE: roughly equivalent to calling !Double.isFinite() - on value you would get from calling JsonParser.getDoubleValue().
        -
        -
        Specified by:
        -
        isNaN in class JsonParser
        -
        Returns:
        -
        True if the current token is of type JsonToken.VALUE_NUMBER_FLOAT - but represents a "Not a Number"; false for other tokens and regular - floating-point numbers
        -
        -
      • -
      - - - -
        -
      • -

        getNumberValue

        -
        public Number getNumberValue()
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Generic number value accessor method that will work for - all kinds of numeric values. It will return the optimal - (simplest/smallest possible) wrapper object that can - express the numeric value just parsed.
        -
        -
        Specified by:
        -
        getNumberValue in class JsonParser
        -
        Returns:
        -
        Numeric value of the current token in its most optimal - representation
        -
        Throws:
        -
        IOException - Problem with access: JsonParseException if - the current token is not numeric, or if decoding of the value fails - (invalid format for numbers); plain IOException if underlying - content read fails (possible if values are extracted lazily)
        -
        -
      • -
      - - - -
        -
      • -

        getNumberValueExact

        -
        public Number getNumberValueExact()
        -                           throws IOException
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.getNumberValue() with the difference that - for floating-point numbers value returned may be BigDecimal - if the underlying format does not store floating-point numbers using - native representation: for example, textual formats represent numbers - as Strings (which are 10-based), and conversion to Double - is potentially lossy operation. -

        - Default implementation simply returns JsonParser.getNumberValue()

        -
        -
        Overrides:
        -
        getNumberValueExact in class ParserMinimalBase
        -
        Returns:
        -
        Numeric value of the current token using most accurate representation
        -
        Throws:
        -
        IOException - Problem with access: JsonParseException if - the current token is not numeric, or if decoding of the value fails - (invalid format for numbers); plain IOException if underlying - content read fails (possible if values are extracted lazily)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getIntValue

        -
        public int getIntValue()
        -                throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java int primitive type. - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling JsonParser.getDoubleValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the resulting integer value falls outside range of - Java int, a InputCoercionException - may be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getIntValue in class JsonParser
        -
        Returns:
        -
        Current number value as int (if numeric token within - Java 32-bit signed int range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getLongValue

        -
        public long getLongValue()
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a Java long primitive type. - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling JsonParser.getDoubleValue() - and then casting to int; except for possible overflow/underflow - exception. -

        - Note: if the token is an integer, but its value falls - outside of range of Java long, a InputCoercionException - may be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getLongValue in class JsonParser
        -
        Returns:
        -
        Current number value as long (if numeric token within - Java 32-bit signed long range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getFloatValue

        -
        public float getFloatValue()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_FLOAT and - it can be expressed as a Java float primitive type. - It can also be called for JsonToken.VALUE_NUMBER_INT; - if so, it is equivalent to calling JsonParser.getLongValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the value falls - outside of range of Java float, a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getFloatValue in class JsonParser
        -
        Returns:
        -
        Current number value as float (if numeric token within - Java float range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getDoubleValue

        -
        public double getDoubleValue()
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_FLOAT and - it can be expressed as a Java double primitive type. - It can also be called for JsonToken.VALUE_NUMBER_INT; - if so, it is equivalent to calling JsonParser.getLongValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the value falls - outside of range of Java double, a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getDoubleValue in class JsonParser
        -
        Returns:
        -
        Current number value as double (if numeric token within - Java double range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _parseNumericValue

        -
        protected abstract void _parseNumericValue(int expType)
        -                                    throws IOException
        -
        Method that will parse actual numeric value out of a syntactically - valid number value. Type it will parse into depends on whether - it is a floating point number, as well as its magnitude: smallest - legal type (of ones available) is used for efficiency.
        -
        -
        Parameters:
        -
        expType - Numeric type that we will immediately need, if any; - mostly necessary to optimize handling of floating point numbers
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _parseIntValue

        -
        protected abstract int _parseIntValue()
        -                               throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        convertNumberToInt

        -
        protected void convertNumberToInt()
        -                           throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        convertNumberToLong

        -
        protected void convertNumberToLong()
        -                            throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        convertNumberToBigInteger

        -
        protected void convertNumberToBigInteger()
        -                                  throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        convertNumberToDouble

        -
        protected void convertNumberToDouble()
        -                              throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        convertNumberToBigDecimal

        -
        protected void convertNumberToBigDecimal()
        -                                  throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _decodeEscaped

        -
        protected char _decodeEscaped()
        -                       throws IOException
        -
        Method that sub-classes must implement to support escaped sequences - in base64-encoded sections. - Sub-classes that do not need base64 support can leave this as is
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        _getSourceReference

        -
        protected Object _getSourceReference()
        -
        Helper method used to encapsulate logic of including (or not) of - "source reference" when constructing JsonLocation instances.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/ParserMinimalBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/ParserMinimalBase.html deleted file mode 100644 index 9ff7be812d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/ParserMinimalBase.html +++ /dev/null @@ -1,3205 +0,0 @@ - - - - - - -ParserMinimalBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.base
-

Class ParserMinimalBase

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Versioned, Closeable, AutoCloseable
    -
    -
    -
    Direct Known Subclasses:
    -
    ParserBase
    -
    -
    -
    -
    public abstract class ParserMinimalBase
    -extends JsonParser
    -
    Intermediate base class used by all Jackson JsonParser - implementations, but does not add any additional fields that depend - on particular method of obtaining input. -

    - Note that 'minimal' here mostly refers to minimal number of fields - (size) and functionality that is specific to certain types - of parser implementations; but not necessarily to number of methods.

    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - - - - - -
        -
      • -

        ParserMinimalBase

        -
        protected ParserMinimalBase(ObjectReadContext readCtxt,
        -                            int streamReadFeatures)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        isEnabled

        -
        public boolean isEnabled(StreamReadFeature f)
        -
        Description copied from class: JsonParser
        -
        Method for checking whether specified StreamReadFeature is enabled.
        -
        -
        Specified by:
        -
        isEnabled in class JsonParser
        -
        Parameters:
        -
        f - Feature to check
        -
        Returns:
        -
        True if feature is enabled; false otherwise
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getReadCapabilities

        -
        public JacksonFeatureSet<StreamReadCapability> getReadCapabilities()
        -
        Description copied from class: JsonParser
        -
        Accessor for getting metadata on capabilities of this parser, based on - underlying data format being read (directly or indirectly).
        -
        -
        Overrides:
        -
        getReadCapabilities in class JsonParser
        -
        Returns:
        -
        Set of read capabilities for content to read via this parser
        -
        -
      • -
      - - - -
        -
      • -

        getObjectReadContext

        -
        public ObjectReadContext getObjectReadContext()
        -
        Description copied from class: JsonParser
        -
        Accessor for context object provided by higher level data-binding - functionality (or, in some cases, simple placeholder of the same) - that allows some level of interaction including ability to trigger - deserialization of Object values through generator instance. -

        - Context object is used by parser to implement some methods, - like readValueAs(...)

        -
        -
        Specified by:
        -
        getObjectReadContext in class JsonParser
        -
        Returns:
        -
        Object write context (ObjectReadContext) associated with this parser
        -
        -
      • -
      - - - - - - - -
        -
      • -

        finishToken

        -
        public void finishToken()
        -                 throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that may be used to force full handling of the current token - so that even if lazy processing is enabled, the whole contents are - read for possible retrieval. This is usually used to ensure that - the token end location is available, as well as token contents - (similar to what calling, say JsonParser.getTextCharacters(), would - achieve). -

        - Note that for many dataformat implementations this method - will not do anything; this is the default implementation unless - overridden by sub-classes.

        -
        -
        Specified by:
        -
        finishToken in class JsonParser
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        currentToken

        -
        public JsonToken currentToken()
        -
        Description copied from class: JsonParser
        -
        Accessor to find which token parser currently points to, if any; - null will be returned if none. - If return value is non-null, data associated with the token - is available via other accessor methods.
        -
        -
        Specified by:
        -
        currentToken in class JsonParser
        -
        Returns:
        -
        Type of the token this parser currently points to, - if any: null before any tokens have been read, and - after end-of-input has been encountered, as well as - if the current token has been explicitly cleared.
        -
        -
      • -
      - - - -
        -
      • -

        currentTokenId

        -
        public int currentTokenId()
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.currentToken() but that returns an - int instead of JsonToken (enum value). -

        - Use of int directly is typically more efficient on switch statements, - so this method may be useful when building low-overhead codecs. - Note, however, that effect may not be big enough to matter: make sure - to profile performance before deciding to use this method.

        -
        -
        Specified by:
        -
        currentTokenId in class JsonParser
        -
        Returns:
        -
        int matching one of constants from JsonTokenId.
        -
        -
      • -
      - - - -
        -
      • -

        hasCurrentToken

        -
        public boolean hasCurrentToken()
        -
        Description copied from class: JsonParser
        -
        Method for checking whether parser currently points to - a token (and data for that token is available). - Equivalent to check for parser.getCurrentToken() != null.
        -
        -
        Specified by:
        -
        hasCurrentToken in class JsonParser
        -
        Returns:
        -
        True if the parser just returned a valid - token via JsonParser.nextToken(); false otherwise (parser - was just constructed, encountered end-of-input - and returned null from JsonParser.nextToken(), or the token - has been consumed)
        -
        -
      • -
      - - - -
        -
      • -

        hasTokenId

        -
        public boolean hasTokenId(int id)
        -
        Description copied from class: JsonParser
        -
        Method that is functionally equivalent to: - - return currentTokenId() == id - - but may be more efficiently implemented. -

        - Note that no traversal or conversion is performed; so in some - cases calling method like JsonParser.isExpectedStartArrayToken() - is necessary instead.

        -
        -
        Specified by:
        -
        hasTokenId in class JsonParser
        -
        Parameters:
        -
        id - Token id to match (from (@link JsonTokenId})
        -
        Returns:
        -
        True if the parser current points to specified token
        -
        -
      • -
      - - - -
        -
      • -

        hasToken

        -
        public boolean hasToken(JsonToken t)
        -
        Description copied from class: JsonParser
        -
        Method that is functionally equivalent to: - - return currentToken() == t - - but may be more efficiently implemented. -

        - Note that no traversal or conversion is performed; so in some - cases calling method like JsonParser.isExpectedStartArrayToken() - is necessary instead.

        -
        -
        Specified by:
        -
        hasToken in class JsonParser
        -
        Parameters:
        -
        t - Token to match
        -
        Returns:
        -
        True if the parser current points to specified token
        -
        -
      • -
      - - - -
        -
      • -

        isExpectedStartArrayToken

        -
        public boolean isExpectedStartArrayToken()
        -
        Description copied from class: JsonParser
        -
        Specialized accessor that can be used to verify that the current - token indicates start array (usually meaning that current token - is JsonToken.START_ARRAY) when start array is expected. - For some specialized parsers this can return true for other cases - as well; this is usually done to emulate arrays in cases underlying - format is ambiguous (XML, for example, has no format-level difference - between Objects and Arrays; it just has elements). -

        - Default implementation is equivalent to: -

        -   currentToken() == JsonToken.START_ARRAY
        -
        - but may be overridden by custom parser implementations.
        -
        -
        Specified by:
        -
        isExpectedStartArrayToken in class JsonParser
        -
        Returns:
        -
        True if the current token can be considered as a - start-array marker (such JsonToken.START_ARRAY); - false if not
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        nextValue

        -
        public JsonToken nextValue()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Iteration method that will advance stream enough - to determine type of the next token that is a value type - (including JSON Array and Object start/end markers). - Or put another way, nextToken() will be called once, - and if JsonToken.FIELD_NAME is returned, another - time to get the value for the field. - Method is most useful for iterating over value entries - of JSON objects; field name will still be available - by calling JsonParser.currentName() when parser points to - the value.
        -
        -
        Specified by:
        -
        nextValue in class JsonParser
        -
        Returns:
        -
        Next non-field-name token from the stream, if any found, - or null to indicate end-of-input (or, for non-blocking - parsers, JsonToken.NOT_AVAILABLE if no tokens were - available yet)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        nextFieldName

        -
        public boolean nextFieldName(SerializableString str)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - verifies whether it is JsonToken.FIELD_NAME with specified name - and returns result of that comparison. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName());
        -
        - but may be faster for parser to verify, and can therefore be used if caller - expects to get such a property name from input next.
        -
        -
        Specified by:
        -
        nextFieldName in class JsonParser
        -
        Parameters:
        -
        str - Property name to compare next token to (if next token is - JsonToken.FIELD_NAME)
        -
        Returns:
        -
        True if parser advanced to JsonToken.FIELD_NAME with - specified name; false otherwise (different token or non-matching name)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextFieldName

        -
        public int nextFieldName(FieldNameMatcher matcher)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that tries to match next token from stream as JsonToken.FIELD_NAME, - and if so, further match it to one of pre-specified (field) names. - If match succeeds, field index (non-negative `int`) is returned; otherwise one of - marker constants from FieldNameMatcher.
        -
        -
        Specified by:
        -
        nextFieldName in class JsonParser
        -
        Parameters:
        -
        matcher - Matcher that will handle actual matching
        -
        Returns:
        -
        Index of the matched field name, if non-negative, or a negative error - code otherwise (see FieldNameMatcher for details)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        clearCurrentToken

        -
        public void clearCurrentToken()
        -
        Description copied from class: JsonParser
        -
        Method called to "consume" the current token by effectively - removing it so that JsonParser.hasCurrentToken() returns false, and - JsonParser.currentToken() null). - Cleared token value can still be accessed by calling - JsonParser.getLastClearedToken() (if absolutely needed), but - usually isn't. -

        - Method was added to be used by the optional data binder, since - it has to be able to consume last token used for binding (so that - it will not be used again).

        -
        -
        Specified by:
        -
        clearCurrentToken in class JsonParser
        -
        -
      • -
      - - - -
        -
      • -

        getLastClearedToken

        -
        public JsonToken getLastClearedToken()
        -
        Description copied from class: JsonParser
        -
        Method that can be called to get the last token that was - cleared using JsonParser.clearCurrentToken(). This is not necessarily - the latest token read. - Will return null if no tokens have been cleared, - or if parser has been closed.
        -
        -
        Specified by:
        -
        getLastClearedToken in class JsonParser
        -
        Returns:
        -
        Last cleared token, if any; null otherwise
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getValueAsBoolean

        -
        public boolean getValueAsBoolean(boolean defaultValue)
        -                          throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - boolean. - JSON booleans map naturally; integer numbers other than 0 map to true, and - 0 maps to false - and Strings 'true' and 'false' map to corresponding values. -

        - If representation can not be converted to a boolean value (including structured types - like Objects and Arrays), - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsBoolean in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to boolean is not possible
        -
        Returns:
        -
        boolean value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getByteValue

        -
        public byte getByteValue()
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java byte primitive type. - Note that in addition to "natural" input range of [-128, 127], - this also allows "unsigned 8-bit byte" values [128, 255]: - but for this range value will be translated by truncation, leading - to sign change. -

        - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling JsonParser.getDoubleValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the resulting integer value falls outside range of - [-128, 255], - a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getByteValue in class JsonParser
        -
        Returns:
        -
        Current number value as byte (if numeric token within - range of [-128, 255]); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getShortValue

        -
        public short getShortValue()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java short primitive type. - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling JsonParser.getDoubleValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the resulting integer value falls outside range of - Java short, a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getShortValue in class JsonParser
        -
        Returns:
        -
        Current number value as short (if numeric token within - Java 16-bit signed short range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt()
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - Java int value. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - default value of 0 will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsInt in class JsonParser
        -
        Returns:
        -
        int value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt(int defaultValue)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - int. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsInt in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to int is not possible
        -
        Returns:
        -
        int value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsLong

        -
        public long getValueAsLong()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - long. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to a long (including structured type - markers like start/end Object/Array) - default value of 0L will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsLong in class JsonParser
        -
        Returns:
        -
        long value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsLong

        -
        public long getValueAsLong(long defaultValue)
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - long. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to a long (including structured type - markers like start/end Object/Array) - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsLong in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to long is not possible
        -
        Returns:
        -
        long value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsDouble

        -
        public double getValueAsDouble(double defaultValue)
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - Java double. - Numbers are coerced using default Java rules; booleans convert to 0.0 (false) - and 1.0 (true), and Strings are parsed using default Java language floating - point parsing rules. -

        - If representation can not be converted to a double (including structured types - like Objects and Arrays), - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsDouble in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to double is not possible
        -
        Returns:
        -
        double value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString()
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), default value of - null will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class JsonParser
        -
        Returns:
        -
        String value current token is converted to, if possible; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString(String defaultValue)
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), specified default value - will be returned; no exceptions are thrown.
        -
        -
        Specified by:
        -
        getValueAsString in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to String is not possible
        -
        Returns:
        -
        String value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getNumberValueExact

        -
        public Number getNumberValueExact()
        -                           throws IOException
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.getNumberValue() with the difference that - for floating-point numbers value returned may be BigDecimal - if the underlying format does not store floating-point numbers using - native representation: for example, textual formats represent numbers - as Strings (which are 10-based), and conversion to Double - is potentially lossy operation. -

        - Default implementation simply returns JsonParser.getNumberValue()

        -
        -
        Specified by:
        -
        getNumberValueExact in class JsonParser
        -
        Returns:
        -
        Numeric value of the current token using most accurate representation
        -
        Throws:
        -
        IOException - Problem with access: JsonParseException if - the current token is not numeric, or if decoding of the value fails - (invalid format for numbers); plain IOException if underlying - content read fails (possible if values are extracted lazily)
        -
        -
      • -
      - - - -
        -
      • -

        readValueAs

        -
        public <T> T readValueAs(Class<T> valueType)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to deserialize stream content into a non-container - type (it can be an array type, however): typically a bean, array - or a wrapper type (like Boolean). -
        - Note: method can only be called if the parser has - been constructed with a linkage to - ObjectReadContext; this is true if constructed by - databinding layer above, or by factory method that takes in - context object. -

        - This method may advance the event stream, for structured values - the current token will be the closing end marker (END_ARRAY, - END_OBJECT) of the bound structure. For non-structured values - (and for JsonToken.VALUE_EMBEDDED_OBJECT) - stream is not advanced. -

        - Note: this method should NOT be used if the result type is a - container (Collection or Map. - The reason is that due to type erasure, key and value types - can not be introspected when using this method.

        -
        -
        Specified by:
        -
        readValueAs in class JsonParser
        -
        Type Parameters:
        -
        T - Nominal type parameter to specify expected node type to - reduce need to cast result value
        -
        Parameters:
        -
        valueType - Type to bind content to
        -
        Returns:
        -
        Java value read from content
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or decoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        readValueAs

        -
        public <T> T readValueAs(TypeReference<T> valueTypeRef)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to deserialize stream content into a Java type, reference - to which is passed as argument. Type is passed using so-called - "super type token" - and specifically needs to be used if the root type is a - parameterized (generic) container type. -
        - Note: method can only be called if the parser has - been constructed with a linkage to - ObjectReadContext; this is true if constructed by - databinding layer above, or by factory method that takes in - context object. -

        - This method may advance the event stream, for structured types - the current token will be the closing end marker (END_ARRAY, - END_OBJECT) of the bound structure. For non-structured types - (and for JsonToken.VALUE_EMBEDDED_OBJECT) - stream is not advanced.

        -
        -
        Specified by:
        -
        readValueAs in class JsonParser
        -
        Type Parameters:
        -
        T - Nominal type parameter to specify expected node type to - reduce need to cast result value
        -
        Parameters:
        -
        valueTypeRef - Type to bind content to
        -
        Returns:
        -
        Java value read from content
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or decoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        readValueAsTree

        -
        public <T extends TreeNode> T readValueAsTree()
        -                                       throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to deserialize stream content into equivalent "tree model", - represented by root TreeNode of resulting model. - For Array values it will an array node (with child nodes), - for Object values object node (with child nodes), and for other types - matching leaf node type. Empty or whitespace documents are null. -
        - Note: method can only be called if the parser has - been constructed with a linkage to - ObjectReadContext; this is true if constructed by - databinding layer above, or by factory method that takes in - context object.
        -
        -
        Specified by:
        -
        readValueAsTree in class JsonParser
        -
        Type Parameters:
        -
        T - Nominal type parameter for result node type (to reduce need for casting)
        -
        Returns:
        -
        root of the document, or null if empty or whitespace.
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or decoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        _decodeBase64

        -
        protected void _decodeBase64(String str,
        -                             ByteArrayBuilder builder,
        -                             Base64Variant b64variant)
        -                      throws IOException
        -
        Helper method that can be used for base64 decoding in cases where - encoded content has already been read as a String.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _hasTextualNull

        -
        protected boolean _hasTextualNull(String value)
        -
        Helper method used to determine whether we are currently pointing to - a String value of "null" (NOT a null token); and, if so, that parser - is to recognize and return it similar to if it was real null token.
        -
      • -
      - - - - - - - -
        -
      • -

        reportInvalidNumber

        -
        protected void reportInvalidNumber(String msg)
        -                            throws JsonParseException
        -
        Method called to throw an exception for input token that looks like a number - based on first character(s), but is not valid according to rules of format. - In case of JSON this also includes invalid forms like positive sign and - leading zeroes.
        -
        -
        Throws:
        -
        JsonParseException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        reportOverflowInt

        -
        protected void reportOverflowInt()
        -                          throws IOException
        -
        Method called to throw an exception for integral (not floating point) input - token with value outside of Java signed 32-bit range when requested as int. - Result will be InputCoercionException being thrown.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        reportOverflowLong

        -
        protected void reportOverflowLong()
        -                           throws IOException
        -
        Method called to throw an exception for integral (not floating point) input - token with value outside of Java signed 64-bit range when requested as long. - Result will be InputCoercionException being thrown.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        _longIntegerDesc

        -
        protected String _longIntegerDesc(String rawNum)
        -
      • -
      - - - -
        -
      • -

        _longNumberDesc

        -
        protected String _longNumberDesc(String rawNum)
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        _getCharDesc

        -
        protected static final String _getCharDesc(int ch)
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        _throwInternal

        -
        protected final void _throwInternal()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/TextualTSFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/TextualTSFactory.html deleted file mode 100644 index 97c6c24722..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/TextualTSFactory.html +++ /dev/null @@ -1,1058 +0,0 @@ - - - - - - -TextualTSFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.base
-

Class TextualTSFactory

-
-
- -
- -
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/BinaryTSFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/BinaryTSFactory.html deleted file mode 100644 index febe876ddf..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/BinaryTSFactory.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.base.BinaryTSFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.base.BinaryTSFactory

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/DecorableTSFactory.DecorableTSFBuilder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/DecorableTSFactory.DecorableTSFBuilder.html deleted file mode 100644 index 60ceafee52..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/DecorableTSFactory.DecorableTSFBuilder.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/DecorableTSFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/DecorableTSFactory.html deleted file mode 100644 index 3493427d92..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/DecorableTSFactory.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.base.DecorableTSFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.base.DecorableTSFactory

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/GeneratorBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/GeneratorBase.html deleted file mode 100644 index eb8fa50de4..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/GeneratorBase.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.base.GeneratorBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.base.GeneratorBase

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/ParserBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/ParserBase.html deleted file mode 100644 index 5384e726bf..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/ParserBase.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.base.ParserBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.base.ParserBase

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/ParserMinimalBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/ParserMinimalBase.html deleted file mode 100644 index b76a18ce3f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/ParserMinimalBase.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.base.ParserMinimalBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.base.ParserMinimalBase

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/TextualTSFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/TextualTSFactory.html deleted file mode 100644 index bdae0d41ed..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/class-use/TextualTSFactory.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.base.TextualTSFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.base.TextualTSFactory

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-frame.html deleted file mode 100644 index 5b1ebd1d78..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-frame.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.base (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.base

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-summary.html deleted file mode 100644 index e5e72b9ac7..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-summary.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.base (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.base

-
-
Base classes used by concrete Parser and Generator implementations; - contain functionality that is not specific to JSON or input - abstraction (byte vs char).
-
-

See: Description

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    BinaryTSFactory -
    Intermediate TokenStreamFactory sub-class used as the base for - binary (non-textual) data formats.
    -
    DecorableTSFactory -
    Intermediate base TokenStreamFactory implementation that offers support for - streams that allow decoration of low-level input sources and output targets.
    -
    DecorableTSFactory.DecorableTSFBuilder<F extends TokenStreamFactory,T extends TokenStreamFactory.TSFBuilder<F,T>> -
    Since factory instances are immutable, a Builder class is needed for creating - configurations for differently configured factory instances.
    -
    GeneratorBase -
    This base class implements part of API that a JSON generator exposes - to applications, adds shared internal methods that sub-classes - can use and adds some abstract methods sub-classes must implement.
    -
    ParserBase -
    Intermediate base class used by many (but not all) Jackson JsonParser - implementations.
    -
    ParserMinimalBase -
    Intermediate base class used by all Jackson JsonParser - implementations, but does not add any additional fields that depend - on particular method of obtaining input.
    -
    TextualTSFactory -
    Intermediate TokenStreamFactory sub-class used as the base for - textual data formats.
    -
    -
  • -
- - - -

Package com.fasterxml.jackson.core.base Description

-
Base classes used by concrete Parser and Generator implementations; - contain functionality that is not specific to JSON or input - abstraction (byte vs char). - Most formats extend these types, although it is also possible to - directly extend JsonParser or - JsonGenerator.
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-tree.html deleted file mode 100644 index 67889e50a5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-tree.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.base Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.base

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-use.html deleted file mode 100644 index 5b28531b51..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/base/package-use.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.base (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.base

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variant.PaddingReadBehaviour.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variant.PaddingReadBehaviour.html deleted file mode 100644 index bbd8590621..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variant.PaddingReadBehaviour.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.Base64Variant.PaddingReadBehaviour (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.Base64Variant.PaddingReadBehaviour

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variant.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variant.html deleted file mode 100644 index a8aa3a7ac2..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variant.html +++ /dev/null @@ -1,639 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.Base64Variant (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.Base64Variant

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variants.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variants.html deleted file mode 100644 index 6e7892932e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Base64Variants.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.Base64Variants (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.Base64Variants

-
-
No usage of com.fasterxml.jackson.core.Base64Variants
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/FormatFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/FormatFeature.html deleted file mode 100644 index 0dd1735c57..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/FormatFeature.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.FormatFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.FormatFeature

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/FormatSchema.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/FormatSchema.html deleted file mode 100644 index 4246f33c13..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/FormatSchema.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.FormatSchema (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.FormatSchema

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JacksonException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JacksonException.html deleted file mode 100644 index 2a33b70d33..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JacksonException.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JacksonException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JacksonException

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonEncoding.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonEncoding.html deleted file mode 100644 index d3088274bd..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonEncoding.html +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonEncoding (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonEncoding

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonGenerationException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonGenerationException.html deleted file mode 100644 index a962e4f63b..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonGenerationException.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonGenerationException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonGenerationException

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonGenerator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonGenerator.html deleted file mode 100644 index 7fdb1902b5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonGenerator.html +++ /dev/null @@ -1,916 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonGenerator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonGenerator

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonLocation.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonLocation.html deleted file mode 100644 index 8e6af68ba3..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonLocation.html +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonLocation (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonLocation

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParseException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParseException.html deleted file mode 100644 index 9e6e7d7003..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParseException.html +++ /dev/null @@ -1,463 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonParseException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonParseException

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParser.NumberType.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParser.NumberType.html deleted file mode 100644 index a0d71b1d2e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParser.NumberType.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonParser.NumberType (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonParser.NumberType

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParser.html deleted file mode 100644 index 4a5b603506..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonParser.html +++ /dev/null @@ -1,1204 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonParser

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonPointer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonPointer.html deleted file mode 100644 index 3fba603627..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonPointer.html +++ /dev/null @@ -1,401 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonPointer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonPointer

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonProcessingException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonProcessingException.html deleted file mode 100644 index eea4a2ae4a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonProcessingException.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonProcessingException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonProcessingException

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonToken.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonToken.html deleted file mode 100644 index cd816e3144..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonToken.html +++ /dev/null @@ -1,1088 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.JsonToken (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.JsonToken

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonTokenId.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonTokenId.html deleted file mode 100644 index ffdb160959..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/JsonTokenId.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.JsonTokenId (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.JsonTokenId

-
-
No usage of com.fasterxml.jackson.core.JsonTokenId
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectReadContext.Base.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectReadContext.Base.html deleted file mode 100644 index f6549622a6..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectReadContext.Base.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.ObjectReadContext.Base (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.ObjectReadContext.Base

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectReadContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectReadContext.html deleted file mode 100644 index 4449152438..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectReadContext.html +++ /dev/null @@ -1,708 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.ObjectReadContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.ObjectReadContext

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectWriteContext.Base.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectWriteContext.Base.html deleted file mode 100644 index 88583c6cf0..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectWriteContext.Base.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.ObjectWriteContext.Base (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.ObjectWriteContext.Base

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectWriteContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectWriteContext.html deleted file mode 100644 index 7620575913..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/ObjectWriteContext.html +++ /dev/null @@ -1,505 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.ObjectWriteContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.ObjectWriteContext

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/PrettyPrinter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/PrettyPrinter.html deleted file mode 100644 index b1ae59d1e5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/PrettyPrinter.html +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.PrettyPrinter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.PrettyPrinter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/SerializableString.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/SerializableString.html deleted file mode 100644 index a612dea07e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/SerializableString.html +++ /dev/null @@ -1,627 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.SerializableString (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.SerializableString

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamReadCapability.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamReadCapability.html deleted file mode 100644 index e13aaffd84..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamReadCapability.html +++ /dev/null @@ -1,290 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.StreamReadCapability (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.StreamReadCapability

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamReadFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamReadFeature.html deleted file mode 100644 index 2830bd2517..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamReadFeature.html +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.StreamReadFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.StreamReadFeature

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamWriteCapability.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamWriteCapability.html deleted file mode 100644 index 278a18d759..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamWriteCapability.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.StreamWriteCapability (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.StreamWriteCapability

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamWriteFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamWriteFeature.html deleted file mode 100644 index 6dd2a5d05c..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/StreamWriteFeature.html +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.StreamWriteFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.StreamWriteFeature

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamContext.html deleted file mode 100644 index 620001c2fd..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamContext.html +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.TokenStreamContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.TokenStreamContext

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.Feature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.Feature.html deleted file mode 100644 index e03f649f3a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.Feature.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.TokenStreamFactory.Feature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.TokenStreamFactory.Feature

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.TSFBuilder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.TSFBuilder.html deleted file mode 100644 index 19d67b2307..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.TSFBuilder.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.html deleted file mode 100644 index cc2d89f74b..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TokenStreamFactory.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.TokenStreamFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.TokenStreamFactory

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TreeCodec.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TreeCodec.html deleted file mode 100644 index a1a5a13ea8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TreeCodec.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.TreeCodec (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.TreeCodec

-
-
No usage of com.fasterxml.jackson.core.TreeCodec
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TreeNode.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TreeNode.html deleted file mode 100644 index 827c347fa8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/TreeNode.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.TreeNode (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.TreeNode

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Version.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Version.html deleted file mode 100644 index a774c2f030..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Version.html +++ /dev/null @@ -1,314 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.Version (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.Version

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Versioned.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Versioned.html deleted file mode 100644 index 1967401643..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/class-use/Versioned.html +++ /dev/null @@ -1,446 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.Versioned (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.Versioned

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/InputCoercionException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/InputCoercionException.html deleted file mode 100644 index affbac25d5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/InputCoercionException.html +++ /dev/null @@ -1,499 +0,0 @@ - - - - - - -InputCoercionException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.exc
-

Class InputCoercionException

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public class InputCoercionException
    -extends StreamReadException
    -
    Exception type for read-side problems that are not direct decoding ("parsing") - problems (those would be reported as JsonParseExceptions), - but rather result from failed attempts to convert specific Java value out of valid - but incompatible input value. One example is numeric coercions where target number type's - range does not allow mapping of too large/too small input value.
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _inputType

        -
        protected final JsonToken _inputType
        -
        Input token that represents input value that failed to coerce.
        -
      • -
      - - - -
        -
      • -

        _targetType

        -
        protected final Class<?> _targetType
        -
        Target type that input value failed to coerce to.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        withRequestPayload

        -
        public InputCoercionException withRequestPayload(RequestPayload p)
        -
        Description copied from class: StreamReadException
        -
        Fluent method that may be used to assign payload to this exception, - to let recipient access it for diagnostics purposes. -

        - NOTE: `this` instance is modified and no new instance is constructed.

        -
        -
        Specified by:
        -
        withRequestPayload in class StreamReadException
        -
        Parameters:
        -
        p - Payload to assign to this exception
        -
        Returns:
        -
        This exception instance to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        getInputType

        -
        public JsonToken getInputType()
        -
        Accessor for getting information about input type (in form of token, giving "shape" - of input) for which coercion failed.
        -
      • -
      - - - -
        -
      • -

        getTargetType

        -
        public Class<?> getTargetType()
        -
        Accessor for getting information about target type (in form of Java Class) - for which coercion failed.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/StreamReadException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/StreamReadException.html deleted file mode 100644 index cc4041ecf9..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/StreamReadException.html +++ /dev/null @@ -1,586 +0,0 @@ - - - - - - -StreamReadException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.exc
-

Class StreamReadException

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _processor

        -
        protected transient JsonParser _processor
        -
      • -
      - - - -
        -
      • -

        _requestPayload

        -
        protected RequestPayload _requestPayload
        -
        Optional payload that can be assigned to pass along for error reporting - or handling purposes. Core streaming parser implementations DO NOT - initialize this; it is up to using applications and frameworks to - populate it.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        withParser

        -
        public abstract StreamReadException withParser(JsonParser p)
        -
        Fluent method that may be used to assign originating JsonParser, - to be accessed using getProcessor(). -

        - NOTE: `this` instance is modified and no new instance is constructed.

        -
        -
        Parameters:
        -
        p - Parser instance to assign to this exception
        -
        Returns:
        -
        This exception instance to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        withRequestPayload

        -
        public abstract StreamReadException withRequestPayload(RequestPayload payload)
        -
        Fluent method that may be used to assign payload to this exception, - to let recipient access it for diagnostics purposes. -

        - NOTE: `this` instance is modified and no new instance is constructed.

        -
        -
        Parameters:
        -
        payload - Payload to assign to this exception
        -
        Returns:
        -
        This exception instance to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        getProcessor

        -
        public JsonParser getProcessor()
        -
        Description copied from class: JacksonException
        -
        Method that allows accessing underlying processor that triggered - this exception; typically either JsonParser or JsonGenerator - for exceptions that originate from streaming API, but other abstractions - when thrown by databinding. -

        - Note that it is possible that `null` may be returned if code throwing - exception either has no access to processor; or has not been retrofitted - to set it; this means that caller needs to take care to check for nulls. - Subtypes override this method with co-variant return type, for more - type-safe access.

        -
        -
        Overrides:
        -
        getProcessor in class JacksonException
        -
        Returns:
        -
        Originating processor, if available; null if not.
        -
        -
      • -
      - - - -
        -
      • -

        getRequestPayload

        -
        public RequestPayload getRequestPayload()
        -
        Method that may be called to find payload that was being parsed, if - one was specified for parser that threw this Exception.
        -
        -
        Returns:
        -
        request body, if payload was specified; `null` otherwise
        -
        -
      • -
      - - - -
        -
      • -

        getRequestPayloadAsString

        -
        public String getRequestPayloadAsString()
        -
        The method returns the String representation of the request payload if - one was specified for parser that threw this Exception.
        -
        -
        Returns:
        -
        request body as String, if payload was specified; `null` otherwise
        -
        -
      • -
      - - - -
        -
      • -

        getMessage

        -
        public String getMessage()
        -
        Overriding the getMessage() to include the request body
        -
        -
        Overrides:
        -
        getMessage in class JacksonException
        -
        Returns:
        -
        Message constructed based on possible optional prefix; explicit - message passed to constructor as well trailing location description - (separate from message by linefeed)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/class-use/InputCoercionException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/class-use/InputCoercionException.html deleted file mode 100644 index 037af7b3f9..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/class-use/InputCoercionException.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.exc.InputCoercionException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.exc.InputCoercionException

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/class-use/StreamReadException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/class-use/StreamReadException.html deleted file mode 100644 index ab99c7a3d7..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/class-use/StreamReadException.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.exc.StreamReadException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.exc.StreamReadException

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-frame.html deleted file mode 100644 index 30a8bc200c..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-frame.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.exc (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.exc

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-summary.html deleted file mode 100644 index 50be119f99..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-summary.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.exc (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.exc

-
-
Package for some of JsonProcessingException - subtypes contained by streaming API.
-
-

See: Description

-
-
-
    -
  • - - - - - - - - - - - - - - - - -
    Exception Summary 
    ExceptionDescription
    InputCoercionException -
    Exception type for read-side problems that are not direct decoding ("parsing") - problems (those would be reported as JsonParseExceptions), - but rather result from failed attempts to convert specific Java value out of valid - but incompatible input value.
    -
    StreamReadException -
    Intermediate base class for all read-side streaming processing problems, including - parsing and input value coercion problems.
    -
    -
  • -
- - - -

Package com.fasterxml.jackson.core.exc Description

-
Package for some of JsonProcessingException - subtypes contained by streaming API.
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-tree.html deleted file mode 100644 index dba99ee8d9..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-tree.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.exc Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.exc

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-use.html deleted file mode 100644 index 77b257ca6a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/exc/package-use.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.exc (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.exc

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/FilteringGeneratorDelegate.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/FilteringGeneratorDelegate.html deleted file mode 100644 index ccbd9679df..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/FilteringGeneratorDelegate.html +++ /dev/null @@ -1,2144 +0,0 @@ - - - - - - -FilteringGeneratorDelegate (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.filter
-

Class FilteringGeneratorDelegate

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        rootFilter

        -
        protected TokenFilter rootFilter
        -
        Object consulted to determine whether to write parts of content generator - is asked to write or not.
        -
      • -
      - - - -
        -
      • -

        _allowMultipleMatches

        -
        protected boolean _allowMultipleMatches
        -
        Flag that determines whether filtering will continue after the first - match is indicated or not: if `false`, output is based on just the first - full match (returning TokenFilter.INCLUDE_ALL) and no more - checks are made; if `true` then filtering will be applied as necessary - until end of content.
        -
      • -
      - - - -
        -
      • -

        _inclusion

        -
        protected TokenFilter.Inclusion _inclusion
        -
        Flag that determines whether path leading up to included content should - also be automatically included or not. If `false`, no path inclusion is - done and only explicitly included entries are output; if `true` then - path from main level down to match is also included as necessary.
        -
      • -
      - - - -
        -
      • -

        _filterContext

        -
        protected TokenFilterContext _filterContext
        -
        Although delegate has its own output context it is not sufficient since we actually - have to keep track of excluded (filtered out) structures as well as ones delegate - actually outputs.
        -
      • -
      - - - -
        -
      • -

        _itemFilter

        -
        protected TokenFilter _itemFilter
        -
        State that applies to the item within container, used where applicable. - Specifically used to pass inclusion state between property name and - property, and also used for array elements.
        -
      • -
      - - - -
        -
      • -

        _matchCount

        -
        protected int _matchCount
        -
        Number of tokens for which TokenFilter.INCLUDE_ALL - has been returned
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        getMatchCount

        -
        public int getMatchCount()
        -
        Accessor for finding number of matches, where specific token and sub-tree - starting (if structured type) are passed.
        -
      • -
      - - - - - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray()
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of a Array value - (for JSON this is character '['; plus possible white space decoration - if pretty-printing is enabled). -

        - Array values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Overrides:
        -
        writeStartArray in class JsonGeneratorDelegate
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(Object currValue)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any); - null may be passed if not known or not applicable. - This value is accessible from context as "current value"
        -
        -
        Overrides:
        -
        writeStartArray in class JsonGeneratorDelegate
        -
        Parameters:
        -
        currValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(Object currValue,
        -                            int size)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any) - and how many elements will be written for the array before calling - JsonGenerator.writeEndArray().
        -
        -
        Overrides:
        -
        writeStartArray in class JsonGeneratorDelegate
        -
        Parameters:
        -
        currValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        size - Number of elements this Array will have: actual - number of values written (before matching call to - JsonGenerator.writeEndArray() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndArray

        -
        public void writeEndArray()
        -                   throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing closing marker of a JSON Array value - (character ']'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Array.

        -
        -
        Overrides:
        -
        writeEndArray in class JsonGeneratorDelegate
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject()
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - (character '{'; plus possible white space decoration - if pretty-printing is enabled). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Overrides:
        -
        writeStartObject in class JsonGeneratorDelegate
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object currValue)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Overrides:
        -
        writeStartObject in class JsonGeneratorDelegate
        -
        Parameters:
        -
        currValue - Java Object that Object being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object currValue,
        -                             int size)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. - In addition, caller knows number of key/value pairs ("properties") - that will get written for the Object value: this is relevant for - some format backends (but not, as an example, for JSON). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Overrides:
        -
        writeStartObject in class JsonGeneratorDelegate
        -
        Parameters:
        -
        currValue - Object value to be written (assigned as "current value" for - the Object context that gets created)
        -
        size - Number of key/value pairs this Object will have: actual - number of entries written (before matching call to - JsonGenerator.writeEndObject() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndObject

        -
        public void writeEndObject()
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing closing marker of an Object value - (character '}'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Object, and the last written event was either a - complete value, or START-OBJECT marker (see JSON specification - for more details).

        -
        -
        Overrides:
        -
        writeEndObject in class JsonGeneratorDelegate
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public void writeFieldName(String name)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing a field name (JSON String surrounded by - double quotes: syntactically identical to a JSON String value), - possibly decorated by white space if pretty-printing is enabled. -

        - Field names can only be written in Object context (check out - JSON specification for details), when field name is expected - (field names alternate with values).

        -
        -
        Overrides:
        -
        writeFieldName in class JsonGeneratorDelegate
        -
        Parameters:
        -
        name - Field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public void writeFieldName(SerializableString name)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeFieldName(String), main difference - being that it may perform better as some of processing (such as - quoting of certain characters, or encoding into external encoding - if supported by generator) can be done just once and reused for - later calls. -

        - Default implementation simple uses unprocessed name container in - serialized String; implementations are strongly encouraged to make - use of more efficient methods argument object has.

        -
        -
        Overrides:
        -
        writeFieldName in class JsonGeneratorDelegate
        -
        Parameters:
        -
        name - Pre-encoded field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldId

        -
        public void writeFieldId(long id)
        -                  throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Alternative to JsonGenerator.writeFieldName(String) that may be used - in cases where property key is of numeric type; either where - underlying format supports such notion (some binary formats do, - unlike JSON), or for convenient conversion into String presentation. - Default implementation will simply convert id into String - and call JsonGenerator.writeFieldName(String).
        -
        -
        Overrides:
        -
        writeFieldId in class JsonGeneratorDelegate
        -
        Parameters:
        -
        id - Field id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(String value)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Overrides:
        -
        writeString in class JsonGeneratorDelegate
        -
        Parameters:
        -
        value - String value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(char[] text,
        -                        int offset,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Overrides:
        -
        writeString in class JsonGeneratorDelegate
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first character of String value to write
        -
        len - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeString

        -
        public void writeString(Reader reader,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification. - If len is < 0, then write all contents of the reader. - Otherwise, write only len characters. -

        - Note: actual length of content available may exceed len but - can not be less than it: if not enough content available, a - JsonGenerationException will be thrown.

        -
        -
        Overrides:
        -
        writeString in class JsonGeneratorDelegate
        -
        Parameters:
        -
        reader - Reader to use for reading Text value to write
        -
        len - Maximum Length of Text value to read (in chars, non-negative) - if known; -1 to indicate "read and write it all"
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer; or if length (len) is specified but - reader does not provide enough content
        -
        -
      • -
      - - - -
        -
      • -

        writeRawUTF8String

        -
        public void writeRawUTF8String(byte[] text,
        -                               int offset,
        -                               int length)
        -                        throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeString(String) but that takes as - its input a UTF-8 encoded String that is to be output as-is, without additional - escaping (type of which depends on data format; backslashes for JSON). - However, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - If so, implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Overrides:
        -
        writeRawUTF8String in class JsonGeneratorDelegate
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        length - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeUTF8String

        -
        public void writeUTF8String(byte[] text,
        -                            int offset,
        -                            int length)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeString(String) but that takes as its input - a UTF-8 encoded String which has not been escaped using whatever - escaping scheme data format requires (for JSON that is backslash-escaping - for control characters and double-quotes; for other formats something else). - This means that textual JSON backends need to check if value needs - JSON escaping, but otherwise can just be copied as is to output. - Also, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - In this case - generator implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Overrides:
        -
        writeUTF8String in class JsonGeneratorDelegate
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        length - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(String text)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Overrides:
        -
        writeRaw in class JsonGeneratorDelegate
        -
        Parameters:
        -
        text - Textual contents to include as-is in output.
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(String text,
        -                     int offset,
        -                     int len)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Overrides:
        -
        writeRaw in class JsonGeneratorDelegate
        -
        Parameters:
        -
        text - String that has contents to include as-is in output
        -
        offset - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(SerializableString text)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException. -

        - The default implementation delegates to JsonGenerator.writeRaw(String); - other backends that support raw inclusion of text are encouraged - to implement it in more efficient manner (especially if they - use UTF-8 encoding).

        -
        -
        Overrides:
        -
        writeRaw in class JsonGeneratorDelegate
        -
        Parameters:
        -
        text - Pre-encoded textual contents to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(char[] text,
        -                     int offset,
        -                     int len)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Overrides:
        -
        writeRaw in class JsonGeneratorDelegate
        -
        Parameters:
        -
        text - Buffer that has contents to include as-is in output
        -
        offset - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(char c)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Overrides:
        -
        writeRaw in class JsonGeneratorDelegate
        -
        Parameters:
        -
        c - Character to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRawValue

        -
        public void writeRawValue(String text)
        -                   throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim without any modifications, but assuming - it must constitute a single legal JSON value (number, string, - boolean, null, Array or List). Assuming this, proper separators - are added if and as needed (comma or colon), and generator - state updated to reflect this.
        -
        -
        Overrides:
        -
        writeRawValue in class JsonGeneratorDelegate
        -
        Parameters:
        -
        text - Textual contents to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        writeBinary

        -
        public void writeBinary(Base64Variant b64variant,
        -                        byte[] data,
        -                        int offset,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will output given chunk of binary data as base64 - encoded, as a complete String value (surrounded by double quotes). - This method defaults -

        - Note: because JSON Strings can not contain unescaped linefeeds, - if linefeeds are included (as per last argument), they must be - escaped. This adds overhead for decoding without improving - readability. - Alternatively if linefeeds are not included, - resulting String value may violate the requirement of base64 - RFC which mandates line-length of 76 characters and use of - linefeeds. However, all JsonParser implementations - are required to accept such "long line base64"; as do - typical production-level base64 decoders.

        -
        -
        Overrides:
        -
        writeBinary in class JsonGeneratorDelegate
        -
        Parameters:
        -
        b64variant - Base64 variant to use: defines details such as - whether padding is used (and if so, using which character); - what is the maximum line length before adding linefeed, - and also the underlying alphabet to use.
        -
        data - Buffer that contains binary data to write
        -
        offset - Offset in data of the first byte of data to write
        -
        len - Length of data to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public int writeBinary(Base64Variant b64variant,
        -                       InputStream data,
        -                       int dataLength)
        -                throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeBinary(Base64Variant,byte[],int,int), - but where input is provided through a stream, allowing for incremental - writes without holding the whole input in memory.
        -
        -
        Overrides:
        -
        writeBinary in class JsonGeneratorDelegate
        -
        Parameters:
        -
        b64variant - Base64 variant to use
        -
        data - InputStream to use for reading binary data to write. - Will not be closed after successful write operation
        -
        dataLength - (optional) number of bytes that will be available; - or -1 to be indicate it is not known. - If a positive length is given, data MUST provide at least - that many bytes: if not, an exception will be thrown. - Note that implementations - need not support cases where length is not known in advance; this - depends on underlying data format: JSON output does NOT require length, - other formats may.
        -
        Returns:
        -
        Number of bytes read from data and written as binary payload
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(short v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Overrides:
        -
        writeNumber in class JsonGeneratorDelegate
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(int v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Overrides:
        -
        writeNumber in class JsonGeneratorDelegate
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(long v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Overrides:
        -
        writeNumber in class JsonGeneratorDelegate
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(BigInteger v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Overrides:
        -
        writeNumber in class JsonGeneratorDelegate
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(double v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Overrides:
        -
        writeNumber in class JsonGeneratorDelegate
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(float v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Overrides:
        -
        writeNumber in class JsonGeneratorDelegate
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(BigDecimal v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Overrides:
        -
        writeNumber in class JsonGeneratorDelegate
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(String encodedValue)
        -                 throws IOException,
        -                        UnsupportedOperationException
        -
        Description copied from class: JsonGenerator
        -
        Write method that can be used for custom numeric types that can - not be (easily?) converted to "standard" Java number types. - Because numbers are not surrounded by double quotes, regular - JsonGenerator.writeString(java.lang.String) method can not be used; nor - JsonGenerator.writeRaw(java.lang.String) because that does not properly handle - value separators needed in Array or Object contexts. -

        - Note: because of lack of type safety, some generator - implementations may not be able to implement this - method. For example, if a binary JSON format is used, - it may require type information for encoding; similarly - for generator-wrappers around Java objects or JSON nodes. - If implementation does not implement this method, - it needs to throw UnsupportedOperationException.

        -
        -
        Overrides:
        -
        writeNumber in class JsonGeneratorDelegate
        -
        Parameters:
        -
        encodedValue - Textual (possibly format) number representation to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        UnsupportedOperationException - If underlying data format does not - support numbers serialized textually AND if generator is not allowed - to just output a String instead (Schema-based formats may require actual - number, for example)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeBoolean

        -
        public void writeBoolean(boolean v)
        -                  throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting literal JSON boolean value (one of - Strings 'true' and 'false'). - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Overrides:
        -
        writeBoolean in class JsonGeneratorDelegate
        -
        Parameters:
        -
        v - Boolean value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNull

        -
        public void writeNull()
        -               throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting literal JSON null value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Overrides:
        -
        writeNull in class JsonGeneratorDelegate
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeOmittedField

        -
        public void writeOmittedField(String fieldName)
        -                       throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to indicate that a property in this position was - skipped. It is usually only called for generators that return - false from JsonGenerator.canOmitFields(). -

        - Default implementation does nothing.

        -
        -
        Overrides:
        -
        writeOmittedField in class JsonGeneratorDelegate
        -
        Parameters:
        -
        fieldName - Name of the field that is being omitted
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectId

        -
        public void writeObjectId(Object id)
        -                   throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to output so-called native Object Id. - Note that it may only be called after ensuring this is legal - (with JsonGenerator.canWriteObjectId()), as not all data formats - have native type id support; and some may only allow them in - certain positions or locations.
        -
        -
        Overrides:
        -
        writeObjectId in class JsonGeneratorDelegate
        -
        Parameters:
        -
        id - Native Object Id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        JsonGenerationException - if Object ID output is not allowed - (either at all, or specifically in this position in output)
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectRef

        -
        public void writeObjectRef(Object id)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to output references to native Object Ids. - Note that it may only be called after ensuring this is legal - (with JsonGenerator.canWriteObjectId()), as not all data formats - have native type id support; and some may only allow them in - certain positions or locations. - If output is not allowed by the data format in this position, - a JsonGenerationException will be thrown.
        -
        -
        Overrides:
        -
        writeObjectRef in class JsonGeneratorDelegate
        -
        Parameters:
        -
        id - Referenced value, for which Object Id is expected to be written
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        JsonGenerationException - if Object ID output is not allowed - (either at all, or specifically in this position in output)
        -
        -
      • -
      - - - -
        -
      • -

        writeTypeId

        -
        public void writeTypeId(Object id)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to output so-called native Type Id. - Note that it may only be called after ensuring this is legal - (with JsonGenerator.canWriteTypeId()), as not all data formats - have native type id support; and some may only allow them in - certain positions or locations. - If output is not allowed by the data format in this position, - a JsonGenerationException will be thrown.
        -
        -
        Overrides:
        -
        writeTypeId in class JsonGeneratorDelegate
        -
        Parameters:
        -
        id - Native Type Id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _checkParentPath

        -
        protected void _checkParentPath(boolean isMatch)
        -                         throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _checkPropertyParentPath

        -
        protected void _checkPropertyParentPath()
        -                                 throws IOException
        -
        Specialized variant of _checkParentPath() used when checking - parent for a property name to be included with value: rules are slightly - different.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _checkBinaryWrite

        -
        protected boolean _checkBinaryWrite()
        -                             throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _checkRawValueWrite

        -
        protected boolean _checkRawValueWrite()
        -                               throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/FilteringParserDelegate.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/FilteringParserDelegate.html deleted file mode 100644 index 9748339a2a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/FilteringParserDelegate.html +++ /dev/null @@ -1,1212 +0,0 @@ - - - - - - -FilteringParserDelegate (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.filter
-

Class FilteringParserDelegate

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        rootFilter

        -
        protected TokenFilter rootFilter
        -
        Object consulted to determine whether to write parts of content generator - is asked to write or not.
        -
      • -
      - - - -
        -
      • -

        _allowMultipleMatches

        -
        protected boolean _allowMultipleMatches
        -
        Flag that determines whether filtering will continue after the first - match is indicated or not: if `false`, output is based on just the first - full match (returning TokenFilter.INCLUDE_ALL) and no more - checks are made; if `true` then filtering will be applied as necessary - until end of content.
        -
      • -
      - - - -
        -
      • -

        _inclusion

        -
        protected TokenFilter.Inclusion _inclusion
        -
        Flag that determines whether path leading up to included content should - also be automatically included or not. If `false`, no path inclusion is - done and only explicitly included entries are output; if `true` then - path from main level down to match is also included as necessary.
        -
      • -
      - - - -
        -
      • -

        _currToken

        -
        protected JsonToken _currToken
        -
        Last token retrieved via nextToken(), if any. - Null before the first call to nextToken(), - as well as if token has been explicitly cleared
        -
      • -
      - - - -
        -
      • -

        _lastClearedToken

        -
        protected JsonToken _lastClearedToken
        -
        Last cleared token, if any: that is, value that was in - effect when clearCurrentToken() was called.
        -
      • -
      - - - -
        -
      • -

        _headContext

        -
        protected TokenFilterContext _headContext
        -
        During traversal this is the actual "open" parse tree, which sometimes - is the same as _exposedContext, and at other times is ahead - of it. Note that this context is never null.
        -
      • -
      - - - -
        -
      • -

        _exposedContext

        -
        protected TokenFilterContext _exposedContext
        -
        In cases where _headContext is "ahead" of context exposed to - caller, this context points to what is currently exposed to caller. - When the two are in sync, this context reference will be null.
        -
      • -
      - - - -
        -
      • -

        _itemFilter

        -
        protected TokenFilter _itemFilter
        -
        State that applies to the item within container, used where applicable. - Specifically used to pass inclusion state between property name and - property, and also used for array elements.
        -
      • -
      - - - -
        -
      • -

        _matchCount

        -
        protected int _matchCount
        -
        Number of tokens for which TokenFilter.INCLUDE_ALL - has been returned.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getMatchCount

        -
        public int getMatchCount()
        -
        Accessor for finding number of matches, where specific token and sub-tree - starting (if structured type) are passed.
        -
      • -
      - - - -
        -
      • -

        currentToken

        -
        public JsonToken currentToken()
        -
        Description copied from class: JsonParser
        -
        Accessor to find which token parser currently points to, if any; - null will be returned if none. - If return value is non-null, data associated with the token - is available via other accessor methods.
        -
        -
        Overrides:
        -
        currentToken in class JsonParserDelegate
        -
        Returns:
        -
        Type of the token this parser currently points to, - if any: null before any tokens have been read, and - after end-of-input has been encountered, as well as - if the current token has been explicitly cleared.
        -
        -
      • -
      - - - -
        -
      • -

        currentTokenId

        -
        public final int currentTokenId()
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.currentToken() but that returns an - int instead of JsonToken (enum value). -

        - Use of int directly is typically more efficient on switch statements, - so this method may be useful when building low-overhead codecs. - Note, however, that effect may not be big enough to matter: make sure - to profile performance before deciding to use this method.

        -
        -
        Overrides:
        -
        currentTokenId in class JsonParserDelegate
        -
        Returns:
        -
        int matching one of constants from JsonTokenId.
        -
        -
      • -
      - - - -
        -
      • -

        hasCurrentToken

        -
        public boolean hasCurrentToken()
        -
        Description copied from class: JsonParser
        -
        Method for checking whether parser currently points to - a token (and data for that token is available). - Equivalent to check for parser.getCurrentToken() != null.
        -
        -
        Overrides:
        -
        hasCurrentToken in class JsonParserDelegate
        -
        Returns:
        -
        True if the parser just returned a valid - token via JsonParser.nextToken(); false otherwise (parser - was just constructed, encountered end-of-input - and returned null from JsonParser.nextToken(), or the token - has been consumed)
        -
        -
      • -
      - - - -
        -
      • -

        hasTokenId

        -
        public boolean hasTokenId(int id)
        -
        Description copied from class: JsonParser
        -
        Method that is functionally equivalent to: - - return currentTokenId() == id - - but may be more efficiently implemented. -

        - Note that no traversal or conversion is performed; so in some - cases calling method like JsonParser.isExpectedStartArrayToken() - is necessary instead.

        -
        -
        Overrides:
        -
        hasTokenId in class JsonParserDelegate
        -
        Parameters:
        -
        id - Token id to match (from (@link JsonTokenId})
        -
        Returns:
        -
        True if the parser current points to specified token
        -
        -
      • -
      - - - -
        -
      • -

        hasToken

        -
        public final boolean hasToken(JsonToken t)
        -
        Description copied from class: JsonParser
        -
        Method that is functionally equivalent to: - - return currentToken() == t - - but may be more efficiently implemented. -

        - Note that no traversal or conversion is performed; so in some - cases calling method like JsonParser.isExpectedStartArrayToken() - is necessary instead.

        -
        -
        Overrides:
        -
        hasToken in class JsonParserDelegate
        -
        Parameters:
        -
        t - Token to match
        -
        Returns:
        -
        True if the parser current points to specified token
        -
        -
      • -
      - - - -
        -
      • -

        isExpectedStartArrayToken

        -
        public boolean isExpectedStartArrayToken()
        -
        Description copied from class: JsonParser
        -
        Specialized accessor that can be used to verify that the current - token indicates start array (usually meaning that current token - is JsonToken.START_ARRAY) when start array is expected. - For some specialized parsers this can return true for other cases - as well; this is usually done to emulate arrays in cases underlying - format is ambiguous (XML, for example, has no format-level difference - between Objects and Arrays; it just has elements). -

        - Default implementation is equivalent to: -

        -   currentToken() == JsonToken.START_ARRAY
        -
        - but may be overridden by custom parser implementations.
        -
        -
        Overrides:
        -
        isExpectedStartArrayToken in class JsonParserDelegate
        -
        Returns:
        -
        True if the current token can be considered as a - start-array marker (such JsonToken.START_ARRAY); - false if not
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getCurrentLocation

        -
        public JsonLocation getCurrentLocation()
        -
        Description copied from class: JsonParser
        -
        Method that returns location of the last processed character; - usually for error reporting purposes. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - report specific boundary locations (start or end locations of tokens) - and others only return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Overrides:
        -
        getCurrentLocation in class JsonParserDelegate
        -
        Returns:
        -
        Location of the last processed input unit (byte or character)
        -
        -
      • -
      - - - -
        -
      • -

        getParsingContext

        -
        public TokenStreamContext getParsingContext()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to access current parsing context reader - is in. There are 3 different types: root, array and object contexts, - with slightly different available information. Contexts are - hierarchically nested, and can be used for example for figuring - out part of the input document that correspond to specific - array or object (for highlighting purposes, or error reporting). - Contexts can also be used for simple xpath-like matching of - input, if so desired.
        -
        -
        Overrides:
        -
        getParsingContext in class JsonParserDelegate
        -
        Returns:
        -
        Stream output context (TokenStreamContext) associated with this parser
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getLastClearedToken

        -
        public JsonToken getLastClearedToken()
        -
        Description copied from class: JsonParser
        -
        Method that can be called to get the last token that was - cleared using JsonParser.clearCurrentToken(). This is not necessarily - the latest token read. - Will return null if no tokens have been cleared, - or if parser has been closed.
        -
        -
        Overrides:
        -
        getLastClearedToken in class JsonParserDelegate
        -
        Returns:
        -
        Last cleared token, if any; null otherwise
        -
        -
      • -
      - - - -
        -
      • -

        nextToken

        -
        public JsonToken nextToken()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Main iteration method, which will advance stream enough - to determine type of the next token, if any. If none - remaining (stream has no content other than possible - white space before ending), null will be returned.
        -
        -
        Overrides:
        -
        nextToken in class JsonParserDelegate
        -
        Returns:
        -
        Next token from the stream, if any found, or null - to indicate end-of-input
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        _nextToken2

        -
        protected final JsonToken _nextToken2()
        -                               throws IOException
        -
        Offlined handling for cases where there was no buffered token to - return, and the token read next could not be returned as-is, - at least not yet, but where we have not yet established that - buffering is needed.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        nextValue

        -
        public JsonToken nextValue()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Iteration method that will advance stream enough - to determine type of the next token that is a value type - (including JSON Array and Object start/end markers). - Or put another way, nextToken() will be called once, - and if JsonToken.FIELD_NAME is returned, another - time to get the value for the field. - Method is most useful for iterating over value entries - of JSON objects; field name will still be available - by calling JsonParser.currentName() when parser points to - the value.
        -
        -
        Overrides:
        -
        nextValue in class JsonParserDelegate
        -
        Returns:
        -
        Next non-field-name token from the stream, if any found, - or null to indicate end-of-input (or, for non-blocking - parsers, JsonToken.NOT_AVAILABLE if no tokens were - available yet)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        nextFieldName

        -
        public boolean nextFieldName(SerializableString str)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - verifies whether it is JsonToken.FIELD_NAME with specified name - and returns result of that comparison. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName());
        -
        - but may be faster for parser to verify, and can therefore be used if caller - expects to get such a property name from input next.
        -
        -
        Overrides:
        -
        nextFieldName in class JsonParserDelegate
        -
        Parameters:
        -
        str - Property name to compare next token to (if next token is - JsonToken.FIELD_NAME)
        -
        Returns:
        -
        True if parser advanced to JsonToken.FIELD_NAME with - specified name; false otherwise (different token or non-matching name)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextFieldName

        -
        public int nextFieldName(FieldNameMatcher matcher)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that tries to match next token from stream as JsonToken.FIELD_NAME, - and if so, further match it to one of pre-specified (field) names. - If match succeeds, field index (non-negative `int`) is returned; otherwise one of - marker constants from FieldNameMatcher.
        -
        -
        Overrides:
        -
        nextFieldName in class JsonParserDelegate
        -
        Parameters:
        -
        matcher - Matcher that will handle actual matching
        -
        Returns:
        -
        Index of the matched field name, if non-negative, or a negative error - code otherwise (see FieldNameMatcher for details)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/JsonPointerBasedFilter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/JsonPointerBasedFilter.html deleted file mode 100644 index d3fcc6bf49..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/JsonPointerBasedFilter.html +++ /dev/null @@ -1,557 +0,0 @@ - - - - - - -JsonPointerBasedFilter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.filter
-

Class JsonPointerBasedFilter

-
-
- -
-
    -
  • -
    -
    -
    public class JsonPointerBasedFilter
    -extends TokenFilter
    -
    Simple TokenFilter implementation that takes a single - JsonPointer and matches a single value accordingly. - Instances are immutable and fully thread-safe, shareable, - and efficient to use.
    -
    -
    Since:
    -
    2.6
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _pathToMatch

        -
        protected final JsonPointer _pathToMatch
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonPointerBasedFilter

        -
        public JsonPointerBasedFilter(String ptrExpr)
        -
      • -
      - - - -
        -
      • -

        JsonPointerBasedFilter

        -
        public JsonPointerBasedFilter(JsonPointer match)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        includeElement

        -
        public TokenFilter includeElement(int index)
        -
        Description copied from class: TokenFilter
        -
        Method called to check whether array element with specified index (zero-based), - at current output location, should be included in output. - Three kinds of return values may be used as follows: -
          -
        • null to indicate that the Array element should be skipped -
        • -
        • TokenFilter.INCLUDE_ALL to indicate that the Array element should be included - completely in output -
        • -
        • Any other TokenFilter implementation (possibly this one) to mean - that further inclusion calls on returned filter object need to be made - as necessary, to determine inclusion. -
        • -
        -

        - The default implementation simply returns this to continue calling - methods on this filter object, without full inclusion or exclusion.

        -
        -
        Overrides:
        -
        includeElement in class TokenFilter
        -
        Returns:
        -
        TokenFilter to use for further calls within element value, unless return value - is null or TokenFilter.INCLUDE_ALL (which have simpler semantics)
        -
        -
      • -
      - - - -
        -
      • -

        includeProperty

        -
        public TokenFilter includeProperty(String name)
        -
        Description copied from class: TokenFilter
        -
        Method called to check whether property value with specified name, - at current output location, should be included in output. - Three kinds of return values may be used as follows: -
          -
        • null to indicate that the property and its value should be skipped -
        • -
        • TokenFilter.INCLUDE_ALL to indicate that the property and its value should be included - completely in output -
        • -
        • Any other TokenFilter implementation (possibly this one) to mean - that further inclusion calls on returned filter object need to be made - as necessary, to determine inclusion. -
        • -
        -

        - The default implementation simply returns this to continue calling - methods on this filter object, without full inclusion or exclusion.

        -
        -
        Overrides:
        -
        includeProperty in class TokenFilter
        -
        Returns:
        -
        TokenFilter to use for further calls within property value, unless return value - is null or TokenFilter.INCLUDE_ALL (which have simpler semantics)
        -
        -
      • -
      - - - -
        -
      • -

        filterStartArray

        -
        public TokenFilter filterStartArray()
        -
        Description copied from class: TokenFilter
        -
        Method called to check whether Array value at current output - location should be included in output. - Three kinds of return values may be used as follows: -
          -
        • null to indicate that the Array should be skipped -
        • -
        • TokenFilter.INCLUDE_ALL to indicate that the Array should be included - completely in output -
        • -
        • Any other TokenFilter implementation (possibly this one) to mean - that further inclusion calls on return filter object need to be made - on contained element values, as necessary. TokenFilter.filterFinishArray() will - also be called on returned filter object -
        • -
        -

        - Default implementation returns this, which means that checks - are made recursively for elements of the array to determine possible inclusion.

        -
        -
        Overrides:
        -
        filterStartArray in class TokenFilter
        -
        Returns:
        -
        TokenFilter to use for further calls within Array, unless return value - is null or TokenFilter.INCLUDE_ALL (which have simpler semantics)
        -
        -
      • -
      - - - -
        -
      • -

        filterStartObject

        -
        public TokenFilter filterStartObject()
        -
        Description copied from class: TokenFilter
        -
        Method called to check whether Object value at current output - location should be included in output. - Three kinds of return values may be used as follows: -
          -
        • null to indicate that the Object should be skipped -
        • -
        • TokenFilter.INCLUDE_ALL to indicate that the Object should be included - completely in output -
        • -
        • Any other TokenFilter implementation (possibly this one) to mean - that further inclusion calls on return filter object need to be made - on contained properties, as necessary. TokenFilter.filterFinishObject() will - also be called on returned filter object -
        • -
        -

        - Default implementation returns this, which means that checks - are made recursively for properties of the Object to determine possible inclusion.

        -
        -
        Overrides:
        -
        filterStartObject in class TokenFilter
        -
        Returns:
        -
        TokenFilter to use for further calls within Array, unless return value - is null or TokenFilter.INCLUDE_ALL (which have simpler semantics)
        -
        -
      • -
      - - - -
        -
      • -

        _includeScalar

        -
        protected boolean _includeScalar()
        -
        Description copied from class: TokenFilter
        -
        Overridable default implementation delegated to all scalar value - inclusion check methods. - The default implementation simply includes all leaf values.
        -
        -
        Overrides:
        -
        _includeScalar in class TokenFilter
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilter.Inclusion.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilter.Inclusion.html deleted file mode 100644 index d4507916e8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilter.Inclusion.html +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - -TokenFilter.Inclusion (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.filter
-

Enum TokenFilter.Inclusion

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        ONLY_INCLUDE_ALL

        -
        public static final TokenFilter.Inclusion ONLY_INCLUDE_ALL
        -
        Tokens will only be included if the filter returns TokenFilter.INCLUDE_ALL
        -
      • -
      - - - -
        -
      • -

        INCLUDE_ALL_AND_PATH

        -
        public static final TokenFilter.Inclusion INCLUDE_ALL_AND_PATH
        -
        When TokenFilter.INCLUDE_ALL is returned, the corresponding token will - be included as well as enclosing tokens up to the root
        -
      • -
      - - - -
        -
      • -

        INCLUDE_NON_NULL

        -
        public static final TokenFilter.Inclusion INCLUDE_NON_NULL
        -
        Tokens will be included if any non-null filter is returned. - The exception is if a field name returns a non-null filter, - but the field value returns a null filter. In this case the - field name and value will both be omitted.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static TokenFilter.Inclusion[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (TokenFilter.Inclusion c : TokenFilter.Inclusion.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static TokenFilter.Inclusion valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilter.html deleted file mode 100644 index c3ba17b0a4..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilter.html +++ /dev/null @@ -1,914 +0,0 @@ - - - - - - -TokenFilter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.filter
-

Class TokenFilter

-
-
- -
- -
-
-
    -
  • - -
      -
    • - - -

      Nested Class Summary

      - - - - - - - - - - -
      Nested Classes 
      Modifier and TypeClass and Description
      static class TokenFilter.Inclusion -
      Enumeration that controls how TokenFilter return values are interpreted.
      -
      -
    • -
    - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      static TokenFilterINCLUDE_ALL -
      Marker value that should be used to indicate inclusion of a structured - value (sub-tree representing Object or Array), or value of a named - property (regardless of type).
      -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ModifierConstructor and Description
      protected TokenFilter() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      protected boolean_includeScalar() -
      Overridable default implementation delegated to all scalar value - inclusion check methods.
      -
      voidfilterFinishArray() -
      Method called to indicate that output of non-filtered Array (one that may - have been included either completely, or in part) is completed, - in cases where filter other that INCLUDE_ALL was returned.
      -
      voidfilterFinishObject() -
      Method called to indicate that output of non-filtered Object (one that may - have been included either completely, or in part) is completed, - in cases where filter other that INCLUDE_ALL was returned.
      -
      TokenFilterfilterStartArray() -
      Method called to check whether Array value at current output - location should be included in output.
      -
      TokenFilterfilterStartObject() -
      Method called to check whether Object value at current output - location should be included in output.
      -
      booleanincludeBinary() -
      Call made to verify whether leaf-level - Binary value - should be included in output or not.
      -
      booleanincludeBoolean(boolean value) -
      Call made to verify whether leaf-level - boolean value - should be included in output or not.
      -
      TokenFilterincludeElement(int index) -
      Method called to check whether array element with specified index (zero-based), - at current output location, should be included in output.
      -
      booleanincludeEmbeddedValue(Object ob) -
      Call made to verify whether leaf-level - embedded (Opaque) value - should be included in output or not.
      -
      booleanincludeNull() -
      Call made to verify whether leaf-level - null value - should be included in output or not.
      -
      booleanincludeNumber(BigDecimal v) -
      Call made to verify whether leaf-level - BigDecimal value - should be included in output or not.
      -
      booleanincludeNumber(BigInteger v) -
      Call made to verify whether leaf-level - BigInteger value - should be included in output or not.
      -
      booleanincludeNumber(double v) -
      Call made to verify whether leaf-level - double value - should be included in output or not.
      -
      booleanincludeNumber(float v) -
      Call made to verify whether leaf-level - float value - should be included in output or not.
      -
      booleanincludeNumber(int v) -
      Call made to verify whether leaf-level - int value - should be included in output or not.
      -
      booleanincludeNumber(long v) -
      Call made to verify whether leaf-level - long value - should be included in output or not.
      -
      TokenFilterincludeProperty(String name) -
      Method called to check whether property value with specified name, - at current output location, should be included in output.
      -
      booleanincludeRawValue() -
      Call made to verify whether leaf-level - raw (pre-encoded, not quoted by generator) value - should be included in output or not.
      -
      TokenFilterincludeRootValue(int index) -
      Method called to check whether root-level value, - at current output location, should be included in output.
      -
      booleanincludeString(Reader r, - int maxLen) -
      Call made to verify whether leaf-level - "streaming" String value - should be included in output or not.
      -
      booleanincludeString(String value) -
      Call made to verify whether leaf-level - String value - should be included in output or not.
      -
      booleanincludeValue(JsonParser p) -
      Call made when verifying whether a scaler value is being - read from a parser.
      -
      StringtoString() 
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        INCLUDE_ALL

        -
        public static final TokenFilter INCLUDE_ALL
        -
        Marker value that should be used to indicate inclusion of a structured - value (sub-tree representing Object or Array), or value of a named - property (regardless of type). - Note that if this instance is returned, it will used as a marker, and - no actual callbacks need to be made. For this reason, it is more efficient - to return this instance if the whole sub-tree is to be included, instead - of implementing similar filter functionality explicitly.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TokenFilter

        -
        protected TokenFilter()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        filterStartObject

        -
        public TokenFilter filterStartObject()
        -
        Method called to check whether Object value at current output - location should be included in output. - Three kinds of return values may be used as follows: -
          -
        • null to indicate that the Object should be skipped -
        • -
        • INCLUDE_ALL to indicate that the Object should be included - completely in output -
        • -
        • Any other TokenFilter implementation (possibly this one) to mean - that further inclusion calls on return filter object need to be made - on contained properties, as necessary. filterFinishObject() will - also be called on returned filter object -
        • -
        -

        - Default implementation returns this, which means that checks - are made recursively for properties of the Object to determine possible inclusion.

        -
        -
        Returns:
        -
        TokenFilter to use for further calls within Array, unless return value - is null or INCLUDE_ALL (which have simpler semantics)
        -
        -
      • -
      - - - -
        -
      • -

        filterStartArray

        -
        public TokenFilter filterStartArray()
        -
        Method called to check whether Array value at current output - location should be included in output. - Three kinds of return values may be used as follows: -
          -
        • null to indicate that the Array should be skipped -
        • -
        • INCLUDE_ALL to indicate that the Array should be included - completely in output -
        • -
        • Any other TokenFilter implementation (possibly this one) to mean - that further inclusion calls on return filter object need to be made - on contained element values, as necessary. filterFinishArray() will - also be called on returned filter object -
        • -
        -

        - Default implementation returns this, which means that checks - are made recursively for elements of the array to determine possible inclusion.

        -
        -
        Returns:
        -
        TokenFilter to use for further calls within Array, unless return value - is null or INCLUDE_ALL (which have simpler semantics)
        -
        -
      • -
      - - - -
        -
      • -

        filterFinishObject

        -
        public void filterFinishObject()
        -
        Method called to indicate that output of non-filtered Object (one that may - have been included either completely, or in part) is completed, - in cases where filter other that INCLUDE_ALL was returned. - This occurs when JsonGenerator.writeEndObject() is called.
        -
      • -
      - - - -
        -
      • -

        filterFinishArray

        -
        public void filterFinishArray()
        -
        Method called to indicate that output of non-filtered Array (one that may - have been included either completely, or in part) is completed, - in cases where filter other that INCLUDE_ALL was returned. - This occurs when JsonGenerator.writeEndArray() is called.
        -
      • -
      - - - -
        -
      • -

        includeProperty

        -
        public TokenFilter includeProperty(String name)
        -
        Method called to check whether property value with specified name, - at current output location, should be included in output. - Three kinds of return values may be used as follows: -
          -
        • null to indicate that the property and its value should be skipped -
        • -
        • INCLUDE_ALL to indicate that the property and its value should be included - completely in output -
        • -
        • Any other TokenFilter implementation (possibly this one) to mean - that further inclusion calls on returned filter object need to be made - as necessary, to determine inclusion. -
        • -
        -

        - The default implementation simply returns this to continue calling - methods on this filter object, without full inclusion or exclusion.

        -
        -
        Returns:
        -
        TokenFilter to use for further calls within property value, unless return value - is null or INCLUDE_ALL (which have simpler semantics)
        -
        -
      • -
      - - - -
        -
      • -

        includeElement

        -
        public TokenFilter includeElement(int index)
        -
        Method called to check whether array element with specified index (zero-based), - at current output location, should be included in output. - Three kinds of return values may be used as follows: -
          -
        • null to indicate that the Array element should be skipped -
        • -
        • INCLUDE_ALL to indicate that the Array element should be included - completely in output -
        • -
        • Any other TokenFilter implementation (possibly this one) to mean - that further inclusion calls on returned filter object need to be made - as necessary, to determine inclusion. -
        • -
        -

        - The default implementation simply returns this to continue calling - methods on this filter object, without full inclusion or exclusion.

        -
        -
        Returns:
        -
        TokenFilter to use for further calls within element value, unless return value - is null or INCLUDE_ALL (which have simpler semantics)
        -
        -
      • -
      - - - -
        -
      • -

        includeRootValue

        -
        public TokenFilter includeRootValue(int index)
        -
        Method called to check whether root-level value, - at current output location, should be included in output. - Three kinds of return values may be used as follows: -
          -
        • null to indicate that the root value should be skipped -
        • -
        • INCLUDE_ALL to indicate that the root value should be included - completely in output -
        • -
        • Any other TokenFilter implementation (possibly this one) to mean - that further inclusion calls on returned filter object need to be made - as necessary, to determine inclusion. -
        • -
        -

        - The default implementation simply returns this to continue calling - methods on this filter object, without full inclusion or exclusion.

        -
        -
        Returns:
        -
        TokenFilter to use for further calls within root value, unless return value - is null or INCLUDE_ALL (which have simpler semantics)
        -
        -
      • -
      - - - -
        -
      • -

        includeValue

        -
        public boolean includeValue(JsonParser p)
        -                     throws IOException
        -
        Call made when verifying whether a scaler value is being - read from a parser. -

        - Default action is to call _includeScalar() and return - whatever it indicates.

        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        includeBoolean

        -
        public boolean includeBoolean(boolean value)
        -
        Call made to verify whether leaf-level - boolean value - should be included in output or not.
        -
      • -
      - - - -
        -
      • -

        includeNull

        -
        public boolean includeNull()
        -
        Call made to verify whether leaf-level - null value - should be included in output or not.
        -
      • -
      - - - -
        -
      • -

        includeString

        -
        public boolean includeString(String value)
        -
        Call made to verify whether leaf-level - String value - should be included in output or not.
        -
      • -
      - - - -
        -
      • -

        includeString

        -
        public boolean includeString(Reader r,
        -                             int maxLen)
        -
        Call made to verify whether leaf-level - "streaming" String value - should be included in output or not. -

        - NOTE: note that any reads from passed in Reader may lead - to actual loss of content to write; typically method should not - access content passed via this method.

        -
        -
        Since:
        -
        2.11
        -
        -
      • -
      - - - -
        -
      • -

        includeNumber

        -
        public boolean includeNumber(int v)
        -
        Call made to verify whether leaf-level - int value - should be included in output or not. - - NOTE: also called for `short`, `byte`
        -
      • -
      - - - -
        -
      • -

        includeNumber

        -
        public boolean includeNumber(long v)
        -
        Call made to verify whether leaf-level - long value - should be included in output or not.
        -
      • -
      - - - -
        -
      • -

        includeNumber

        -
        public boolean includeNumber(float v)
        -
        Call made to verify whether leaf-level - float value - should be included in output or not.
        -
      • -
      - - - -
        -
      • -

        includeNumber

        -
        public boolean includeNumber(double v)
        -
        Call made to verify whether leaf-level - double value - should be included in output or not.
        -
      • -
      - - - -
        -
      • -

        includeNumber

        -
        public boolean includeNumber(BigDecimal v)
        -
        Call made to verify whether leaf-level - BigDecimal value - should be included in output or not.
        -
      • -
      - - - -
        -
      • -

        includeNumber

        -
        public boolean includeNumber(BigInteger v)
        -
        Call made to verify whether leaf-level - BigInteger value - should be included in output or not.
        -
      • -
      - - - -
        -
      • -

        includeBinary

        -
        public boolean includeBinary()
        -
        Call made to verify whether leaf-level - Binary value - should be included in output or not. -

        - NOTE: no binary payload passed; assumption is this won't be of much use.

        -
      • -
      - - - -
        -
      • -

        includeRawValue

        -
        public boolean includeRawValue()
        -
        Call made to verify whether leaf-level - raw (pre-encoded, not quoted by generator) value - should be included in output or not. -

        - NOTE: value itself not passed since it may come on multiple forms - and is unlikely to be of much use in determining inclusion - criteria.

        -
      • -
      - - - -
        -
      • -

        includeEmbeddedValue

        -
        public boolean includeEmbeddedValue(Object ob)
        -
        Call made to verify whether leaf-level - embedded (Opaque) value - should be included in output or not.
        -
      • -
      - - - - - - - -
        -
      • -

        _includeScalar

        -
        protected boolean _includeScalar()
        -
        Overridable default implementation delegated to all scalar value - inclusion check methods. - The default implementation simply includes all leaf values.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilterContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilterContext.html deleted file mode 100644 index 02cf84fcaf..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/TokenFilterContext.html +++ /dev/null @@ -1,851 +0,0 @@ - - - - - - -TokenFilterContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.filter
-

Class TokenFilterContext

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _parent

        -
        protected final TokenFilterContext _parent
        -
        Parent context for this context; null for root context.
        -
      • -
      - - - - - - - -
        -
      • -

        _currentName

        -
        protected String _currentName
        -
        Name of the field of which value is to be parsed; only - used for OBJECT contexts
        -
      • -
      - - - -
        -
      • -

        _currentValue

        -
        protected Object _currentValue
        -
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - -
        -
      • -

        _filter

        -
        protected TokenFilter _filter
        -
        Filter to use for items in this state (for properties of Objects, - elements of Arrays, and root-level values of root context)
        -
      • -
      - - - -
        -
      • -

        _startHandled

        -
        protected boolean _startHandled
        -
        Flag that indicates that start token has been read/written, - so that matching close token needs to be read/written as well - when context is getting closed.
        -
      • -
      - - - -
        -
      • -

        _needToHandleName

        -
        protected boolean _needToHandleName
        -
        Flag that indicates that the current name of this context - still needs to be read/written, if path from root down to - included leaf is to be exposed.
        -
      • -
      -
    • -
    - - - - -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/FilteringGeneratorDelegate.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/FilteringGeneratorDelegate.html deleted file mode 100644 index fd02e26ed1..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/FilteringGeneratorDelegate.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate

-
-
No usage of com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/FilteringParserDelegate.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/FilteringParserDelegate.html deleted file mode 100644 index f2b86b8dbc..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/FilteringParserDelegate.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.filter.FilteringParserDelegate (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.filter.FilteringParserDelegate

-
-
No usage of com.fasterxml.jackson.core.filter.FilteringParserDelegate
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/JsonPointerBasedFilter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/JsonPointerBasedFilter.html deleted file mode 100644 index 1eaad4c305..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/JsonPointerBasedFilter.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.filter.JsonPointerBasedFilter

-
-
No usage of com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilter.Inclusion.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilter.Inclusion.html deleted file mode 100644 index 128da2a7fe..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilter.Inclusion.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.filter.TokenFilter.Inclusion (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.filter.TokenFilter.Inclusion

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilter.html deleted file mode 100644 index be3cd3fb9f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilter.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.filter.TokenFilter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.filter.TokenFilter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilterContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilterContext.html deleted file mode 100644 index b394c47d6e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/class-use/TokenFilterContext.html +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.filter.TokenFilterContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.filter.TokenFilterContext

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-frame.html deleted file mode 100644 index 12fb9a77cc..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-frame.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.filter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.filter

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-summary.html deleted file mode 100644 index b8735e92a4..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-summary.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.filter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.filter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-tree.html deleted file mode 100644 index 116009736e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-tree.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.filter Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.filter

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Enum Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-use.html deleted file mode 100644 index 44e081d397..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/filter/package-use.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.filter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.filter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/CharTypes.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/CharTypes.html deleted file mode 100644 index 81acc13afa..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/CharTypes.html +++ /dev/null @@ -1,632 +0,0 @@ - - - - - - -CharTypes (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class CharTypes

-
-
- -
-
    -
  • -
    -
    -
    public final class CharTypes
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        HC

        -
        protected static final char[] HC
        -
      • -
      - - - -
        -
      • -

        HB

        -
        protected static final byte[] HB
        -
      • -
      - - - -
        -
      • -

        sInputCodes

        -
        protected static final int[] sInputCodes
        -
        Lookup table used for determining which input characters - need special handling when contained in text segment.
        -
      • -
      - - - -
        -
      • -

        sInputCodesUTF8

        -
        protected static final int[] sInputCodesUTF8
        -
        Additionally we can combine UTF-8 decoding info into similar - data table.
        -
      • -
      - - - -
        -
      • -

        sInputCodesJsNames

        -
        protected static final int[] sInputCodesJsNames
        -
        To support non-default (and -standard) unquoted field names mode, - need to have alternate checking. - Basically this is list of 8-bit ASCII characters that are legal - as part of Javascript identifier
        -
      • -
      - - - -
        -
      • -

        sInputCodesUtf8JsNames

        -
        protected static final int[] sInputCodesUtf8JsNames
        -
        This table is similar to Latin-1, except that it marks all "high-bit" - code as ok. They will be validated at a later point, when decoding - name
        -
      • -
      - - - -
        -
      • -

        sInputCodesComment

        -
        protected static final int[] sInputCodesComment
        -
        Decoding table used to quickly determine characters that are - relevant within comment content.
        -
      • -
      - - - -
        -
      • -

        sInputCodesWS

        -
        protected static final int[] sInputCodesWS
        -
        Decoding table used for skipping white space and comments.
        -
        -
        Since:
        -
        2.3
        -
        -
      • -
      - - - -
        -
      • -

        sOutputEscapes128

        -
        protected static final int[] sOutputEscapes128
        -
        Lookup table used for determining which output characters in - 7-bit ASCII range need to be quoted.
        -
      • -
      - - - -
        -
      • -

        sHexValues

        -
        protected static final int[] sHexValues
        -
        Lookup table for the first 256 Unicode characters (ASCII / UTF-8) - range. For actual hex digits, contains corresponding value; - for others -1. -

        - NOTE: before 2.10.1, was of size 128, extended for simpler handling

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CharTypes

        -
        public CharTypes()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getInputCodeLatin1

        -
        public static int[] getInputCodeLatin1()
        -
      • -
      - - - -
        -
      • -

        getInputCodeUtf8

        -
        public static int[] getInputCodeUtf8()
        -
      • -
      - - - -
        -
      • -

        getInputCodeLatin1JsNames

        -
        public static int[] getInputCodeLatin1JsNames()
        -
      • -
      - - - -
        -
      • -

        getInputCodeUtf8JsNames

        -
        public static int[] getInputCodeUtf8JsNames()
        -
      • -
      - - - -
        -
      • -

        getInputCodeComment

        -
        public static int[] getInputCodeComment()
        -
      • -
      - - - -
        -
      • -

        getInputCodeWS

        -
        public static int[] getInputCodeWS()
        -
      • -
      - - - -
        -
      • -

        get7BitOutputEscapes

        -
        public static int[] get7BitOutputEscapes()
        -
        Accessor for getting a read-only encoding table for first 128 Unicode - code points (single-byte UTF-8 characters). - Value of 0 means "no escaping"; other positive values that value is character - to use after backslash; and negative values that generic (backslash - u) - escaping is to be used.
        -
      • -
      - - - -
        -
      • -

        get7BitOutputEscapes

        -
        public static int[] get7BitOutputEscapes(int quoteChar)
        -
        Alternative to get7BitOutputEscapes() when a non-standard quote character - is used.
        -
      • -
      - - - -
        -
      • -

        charToHex

        -
        public static int charToHex(int ch)
        -
      • -
      - - - - - - - -
        -
      • -

        copyHexChars

        -
        public static char[] copyHexChars()
        -
      • -
      - - - -
        -
      • -

        copyHexBytes

        -
        public static byte[] copyHexBytes()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/CharacterEscapes.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/CharacterEscapes.html deleted file mode 100644 index ce76a60f6c..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/CharacterEscapes.html +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - -CharacterEscapes (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class CharacterEscapes

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    Direct Known Subclasses:
    -
    JsonpCharacterEscapes
    -
    -
    -
    -
    public abstract class CharacterEscapes
    -extends Object
    -implements Serializable
    -
    Abstract base class that defines interface for customizing character - escaping aspects for String values, for formats that use escaping. - For JSON this applies to both property names and String values.
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      static intESCAPE_CUSTOM -
      Value used for lookup tables to indicate that matching characters - will need custom escapes; and that another call - to getEscapeSequence(int) is needed to figure out exact escape - sequence to output.
      -
      static intESCAPE_NONE -
      Value used for lookup tables to indicate that matching characters - do not need to be escaped.
      -
      static intESCAPE_STANDARD -
      Value used for lookup tables to indicate that matching characters - are to be escaped using standard escaping; for JSON this means - (for example) using "backslash - u" escape method.
      -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      CharacterEscapes() 
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        ESCAPE_NONE

        -
        public static final int ESCAPE_NONE
        -
        Value used for lookup tables to indicate that matching characters - do not need to be escaped.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        ESCAPE_STANDARD

        -
        public static final int ESCAPE_STANDARD
        -
        Value used for lookup tables to indicate that matching characters - are to be escaped using standard escaping; for JSON this means - (for example) using "backslash - u" escape method.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        ESCAPE_CUSTOM

        -
        public static final int ESCAPE_CUSTOM
        -
        Value used for lookup tables to indicate that matching characters - will need custom escapes; and that another call - to getEscapeSequence(int) is needed to figure out exact escape - sequence to output.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CharacterEscapes

        -
        public CharacterEscapes()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getEscapeCodesForAscii

        -
        public abstract int[] getEscapeCodesForAscii()
        -
        Method generators can call to get lookup table for determining - escape handling for first 128 characters of Unicode (ASCII - characters. Caller is not to modify contents of this array, since - this is expected to be a shared copy.
        -
        -
        Returns:
        -
        Array with size of at least 128, where first 128 entries - have either one of ESCAPE_xxx constants, or non-zero positive - integer (meaning of which is data format specific; for JSON it means - that combination of backslash and character with that value is to be used) - to indicate that specific escape sequence is to be used.
        -
        -
      • -
      - - - -
        -
      • -

        getEscapeSequence

        -
        public abstract SerializableString getEscapeSequence(int ch)
        -
        Method generators can call to get lookup table for determining - exact escape sequence to use for given character. - It can be called for any character, but typically is called for - either for ASCII characters for which custom escape - sequence is needed; or for any non-ASCII character.
        -
        -
        Parameters:
        -
        ch - Character to look escape sequence for
        -
        Returns:
        -
        Escape sequence to use for the character, if any; null if not
        -
        -
      • -
      - - - -
        -
      • -

        standardAsciiEscapesForJSON

        -
        public static int[] standardAsciiEscapesForJSON()
        -
        Helper method that can be used to get a copy of standard JSON - escape definitions; this is useful when just wanting to slightly - customize definitions. Caller can modify this array as it sees - fit and usually returns modified instance via getEscapeCodesForAscii()
        -
        -
        Returns:
        -
        Set of escapes, similar to getEscapeCodesForAscii() (array of - 128 ints), but a copy that caller owns and is free to modify
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/DataOutputAsStream.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/DataOutputAsStream.html deleted file mode 100644 index b7afeee7e9..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/DataOutputAsStream.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - -DataOutputAsStream (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class DataOutputAsStream

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Closeable, Flushable, AutoCloseable
    -
    -
    -
    -
    public class DataOutputAsStream
    -extends OutputStream
    -
    Helper class to support use of DataOutput for output, directly, - without caller having to provide for implementation.
    -
    -
    Since:
    -
    2.8
    -
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/IOContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/IOContext.html deleted file mode 100644 index c78a35de71..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/IOContext.html +++ /dev/null @@ -1,849 +0,0 @@ - - - - - - -IOContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class IOContext

-
-
- -
-
    -
  • -
    -
    -
    public class IOContext
    -extends Object
    -
    To limit number of configuration and state objects to pass, all - contextual objects that need to be passed by the factory to - readers and writers are combined under this object. One instance - is created for each reader and writer. -

    - NOTE: non-final since 2.4, to allow sub-classing.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _sourceRef

        -
        protected final Object _sourceRef
        -
        Reference to the source object, which can be used for displaying - location information
        -
      • -
      - - - -
        -
      • -

        _encoding

        -
        protected JsonEncoding _encoding
        -
        Encoding used by the underlying stream, if known.
        -
      • -
      - - - -
        -
      • -

        _managedResource

        -
        protected final boolean _managedResource
        -
        Flag that indicates whether underlying input/output source/target - object is fully managed by the owner of this context (parser or - generator). If true, it is, and is to be closed by parser/generator; - if false, calling application has to do closing (unless auto-closing - feature is enabled for the parser/generator in question; in which - case it acts like the owner).
        -
      • -
      - - - -
        -
      • -

        _bufferRecycler

        -
        protected final BufferRecycler _bufferRecycler
        -
        Recycler used for actual allocation/deallocation/reuse
        -
      • -
      - - - -
        -
      • -

        _readIOBuffer

        -
        protected byte[] _readIOBuffer
        -
        Reference to the allocated I/O buffer for low-level input reading, - if any allocated.
        -
      • -
      - - - -
        -
      • -

        _writeEncodingBuffer

        -
        protected byte[] _writeEncodingBuffer
        -
        Reference to the allocated I/O buffer used for low-level - encoding-related buffering.
        -
      • -
      - - - -
        -
      • -

        _base64Buffer

        -
        protected byte[] _base64Buffer
        -
        Reference to the buffer allocated for temporary use with - base64 encoding or decoding.
        -
      • -
      - - - -
        -
      • -

        _tokenCBuffer

        -
        protected char[] _tokenCBuffer
        -
        Reference to the buffer allocated for tokenization purposes, - in which character input is read, and from which it can be - further returned.
        -
      • -
      - - - -
        -
      • -

        _concatCBuffer

        -
        protected char[] _concatCBuffer
        -
        Reference to the buffer allocated for buffering it for - output, before being encoded: generally this means concatenating - output, then encoding when buffer fills up.
        -
      • -
      - - - -
        -
      • -

        _nameCopyBuffer

        -
        protected char[] _nameCopyBuffer
        -
        Reference temporary buffer Parser instances need if calling - app decides it wants to access name via 'getTextCharacters' method. - Regular text buffer can not be used as it may contain textual - representation of the value token.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getSourceReference

        -
        public Object getSourceReference()
        -
      • -
      - - - - - - - -
        -
      • -

        isResourceManaged

        -
        public boolean isResourceManaged()
        -
      • -
      - - - -
        -
      • -

        constructTextBuffer

        -
        public TextBuffer constructTextBuffer()
        -
      • -
      - - - -
        -
      • -

        allocReadIOBuffer

        -
        public byte[] allocReadIOBuffer()
        -

        - Note: the method can only be called once during its life cycle. - This is to protect against accidental sharing.

        -
      • -
      - - - -
        -
      • -

        allocReadIOBuffer

        -
        public byte[] allocReadIOBuffer(int minSize)
        -
        -
        Since:
        -
        2.4
        -
        -
      • -
      - - - -
        -
      • -

        allocWriteEncodingBuffer

        -
        public byte[] allocWriteEncodingBuffer()
        -
      • -
      - - - -
        -
      • -

        allocWriteEncodingBuffer

        -
        public byte[] allocWriteEncodingBuffer(int minSize)
        -
        -
        Since:
        -
        2.4
        -
        -
      • -
      - - - -
        -
      • -

        allocBase64Buffer

        -
        public byte[] allocBase64Buffer()
        -
        -
        Since:
        -
        2.1
        -
        -
      • -
      - - - -
        -
      • -

        allocBase64Buffer

        -
        public byte[] allocBase64Buffer(int minSize)
        -
        -
        Since:
        -
        2.9
        -
        -
      • -
      - - - -
        -
      • -

        allocTokenBuffer

        -
        public char[] allocTokenBuffer()
        -
      • -
      - - - -
        -
      • -

        allocTokenBuffer

        -
        public char[] allocTokenBuffer(int minSize)
        -
        -
        Since:
        -
        2.4
        -
        -
      • -
      - - - -
        -
      • -

        allocConcatBuffer

        -
        public char[] allocConcatBuffer()
        -
      • -
      - - - -
        -
      • -

        allocNameCopyBuffer

        -
        public char[] allocNameCopyBuffer(int minSize)
        -
      • -
      - - - -
        -
      • -

        releaseReadIOBuffer

        -
        public void releaseReadIOBuffer(byte[] buf)
        -
        Method to call when all the processing buffers can be safely - recycled.
        -
      • -
      - - - -
        -
      • -

        releaseWriteEncodingBuffer

        -
        public void releaseWriteEncodingBuffer(byte[] buf)
        -
      • -
      - - - -
        -
      • -

        releaseBase64Buffer

        -
        public void releaseBase64Buffer(byte[] buf)
        -
      • -
      - - - -
        -
      • -

        releaseTokenBuffer

        -
        public void releaseTokenBuffer(char[] buf)
        -
      • -
      - - - -
        -
      • -

        releaseConcatBuffer

        -
        public void releaseConcatBuffer(char[] buf)
        -
      • -
      - - - -
        -
      • -

        releaseNameCopyBuffer

        -
        public void releaseNameCopyBuffer(char[] buf)
        -
      • -
      - - - -
        -
      • -

        _verifyAlloc

        -
        protected final void _verifyAlloc(Object buffer)
        -
      • -
      - - - -
        -
      • -

        _verifyRelease

        -
        protected final void _verifyRelease(byte[] toRelease,
        -                                    byte[] src)
        -
      • -
      - - - -
        -
      • -

        _verifyRelease

        -
        protected final void _verifyRelease(char[] toRelease,
        -                                    char[] src)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/InputDecorator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/InputDecorator.html deleted file mode 100644 index f4f85b9173..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/InputDecorator.html +++ /dev/null @@ -1,427 +0,0 @@ - - - - - - -InputDecorator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class InputDecorator

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public abstract class InputDecorator
    -extends Object
    -implements Serializable
    -
    Handler class that can be used to decorate input sources. - Typical use is to use a filter abstraction (filtered stream, - reader) around original input source, and apply additional - processing during read operations.
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        InputDecorator

        -
        public InputDecorator()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        decorate

        -
        public abstract InputStream decorate(IOContext ctxt,
        -                                     InputStream in)
        -                              throws IOException
        -
        Method called by JsonFactory instance when - creating parser given an InputStream, when this decorator - has been registered.
        -
        -
        Parameters:
        -
        ctxt - IO context in use (provides access to declared encoding). - NOTE: at this point context may not have all information initialized; - specifically auto-detected encoding is only available once parsing starts, - which may occur only after this method is called.
        -
        in - Original input source
        -
        Returns:
        -
        InputStream to use; either 'in' as is, or decorator - version that typically delegates to 'in'
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        decorate

        -
        public abstract InputStream decorate(IOContext ctxt,
        -                                     byte[] src,
        -                                     int offset,
        -                                     int length)
        -                              throws IOException
        -
        Method called by JsonFactory instance when - creating parser on given "raw" byte source. - Method can either construct a InputStream for reading; or return - null to indicate that no wrapping should occur.
        -
        -
        Parameters:
        -
        ctxt - IO context in use (provides access to declared encoding) - NOTE: at this point context may not have all information initialized; - specifically auto-detected encoding is only available once parsing starts, - which may occur only after this method is called.
        -
        src - Input buffer that contains contents to parse
        -
        offset - Offset of the first available byte in the input buffer
        -
        length - Number of bytes available in the input buffer
        -
        Returns:
        -
        Either InputStream to use as input source; or null to indicate - that contents are to be processed as-is by caller
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        decorate

        -
        public DataInput decorate(IOContext ctxt,
        -                          DataInput input)
        -                   throws IOException
        -
        Method called by JsonFactory instance when - creating parser given an DataInput, when this decorator - has been registered. -

        - Default implementation simply throws UnsupportedOperationException

        -
        -
        Parameters:
        -
        ctxt - IO context in use (provides access to declared encoding). - NOTE: at this point context may not have all information initialized; - specifically auto-detected encoding is only available once parsing starts, - which may occur only after this method is called.
        -
        input - Original input source
        -
        Returns:
        -
        InputStream to use; either 'input' as is, or decorator - version that typically delogates to 'input'
        -
        Throws:
        -
        IOException
        -
        Since:
        -
        2.8
        -
        -
      • -
      - - - -
        -
      • -

        decorate

        -
        public abstract Reader decorate(IOContext ctxt,
        -                                Reader r)
        -                         throws IOException
        -
        Method called by JsonFactory instance when - creating parser given an Reader, when this decorator - has been registered.
        -
        -
        Parameters:
        -
        ctxt - IO context in use (provides access to declared encoding) - NOTE: at this point context may not have all information initialized; - specifically auto-detected encoding is only available once parsing starts, - which may occur only after this method is called.
        -
        r - Original reader
        -
        Returns:
        -
        Reader to use; either passed in argument, or something that - calls it (for example, a FilterReader)
        -
        Throws:
        -
        IOException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/JsonEOFException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/JsonEOFException.html deleted file mode 100644 index 513ca908c9..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/JsonEOFException.html +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - -JsonEOFException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class JsonEOFException

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public class JsonEOFException
    -extends JsonParseException
    -
    Specialized JsonParseException that is thrown when end-of-input - is reached unexpectedly, either within token being decoded, or during - skipping of intervening white-space that is not between root-level - tokens (that is, is within JSON Object or JSON Array construct).
    -
    -
    Since:
    -
    2.8
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _token

        -
        protected final JsonToken _token
        -
        Type of token that was being decoded, if parser had enough information - to recognize type (such as starting double-quote for Strings)
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getTokenBeingDecoded

        -
        public JsonToken getTokenBeingDecoded()
        -
        Accessor for possibly available information about token that was being - decoded while encountering end of input.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/JsonStringEncoder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/JsonStringEncoder.html deleted file mode 100644 index 370b8d2201..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/JsonStringEncoder.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - -JsonStringEncoder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class JsonStringEncoder

-
-
- -
-
    -
  • -
    -
    -
    public final class JsonStringEncoder
    -extends Object
    -
    Helper class used for efficient encoding of JSON String values (including - JSON field names) into Strings or UTF-8 byte arrays. -

    - Note that methods in here are somewhat optimized, but not ridiculously so. - Reason is that conversion method results are expected to be cached so that - these methods will not be hot spots during normal operation.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonStringEncoder

        -
        public JsonStringEncoder()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getInstance

        -
        public static JsonStringEncoder getInstance()
        -
        Factory method for getting an instance; this is either recycled per-thread instance, - or a newly constructed one.
        -
      • -
      - - - -
        -
      • -

        quoteAsCharArray

        -
        public char[] quoteAsCharArray(CharSequence input)
        -
        Method that will quote text contents using JSON standard quoting, - and return results as a character array
        -
      • -
      - - - -
        -
      • -

        quoteAsString

        -
        public void quoteAsString(CharSequence input,
        -                          StringBuilder output)
        -
        Method that will quote text contents using JSON standard quoting, - and append results to a supplied StringBuilder. - Use this variant if you have e.g. a StringBuilder and want to avoid superfluous copying of it.
        -
      • -
      - - - -
        -
      • -

        quoteAsUTF8

        -
        public byte[] quoteAsUTF8(CharSequence text)
        -
        Will quote given JSON String value using standard quoting, encode - results as UTF-8, and return result as a byte array.
        -
      • -
      - - - -
        -
      • -

        encodeAsUTF8

        -
        public byte[] encodeAsUTF8(CharSequence text)
        -
        Will encode given String as UTF-8 (without any quoting), return - resulting byte array.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/MergedStream.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/MergedStream.html deleted file mode 100644 index 48a3fd2085..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/MergedStream.html +++ /dev/null @@ -1,465 +0,0 @@ - - - - - - -MergedStream (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class MergedStream

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Closeable, AutoCloseable
    -
    -
    -
    -
    public final class MergedStream
    -extends InputStream
    -
    Simple InputStream implementation that is used to "unwind" some - data previously read from an input stream; so that as long as some of - that data remains, it's returned; but as long as it's read, we'll - just use data from the underlying original stream. - This is similar to PushbackInputStream, but here there's - only one implicit pushback, when instance is constructed.
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/NumberInput.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/NumberInput.html deleted file mode 100644 index 7f24859bdf..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/NumberInput.html +++ /dev/null @@ -1,555 +0,0 @@ - - - - - - -NumberInput (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class NumberInput

-
-
- -
-
    -
  • -
    -
    -
    public final class NumberInput
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        NASTY_SMALL_DOUBLE

        -
        public static final String NASTY_SMALL_DOUBLE
        -
        Textual representation of a double constant that can cause nasty problems - with JDK (see http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308).
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        NumberInput

        -
        public NumberInput()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        parseInt

        -
        public static int parseInt(char[] ch,
        -                           int off,
        -                           int len)
        -
        Fast method for parsing integers that are known to fit into - regular 32-bit signed int type. This means that length is - between 1 and 9 digits (inclusive) -

        - Note: public to let unit tests call it

        -
      • -
      - - - -
        -
      • -

        parseInt

        -
        public static int parseInt(String s)
        -
        Helper method to (more) efficiently parse integer numbers from - String values.
        -
      • -
      - - - -
        -
      • -

        parseLong

        -
        public static long parseLong(char[] ch,
        -                             int off,
        -                             int len)
        -
      • -
      - - - -
        -
      • -

        parseLong

        -
        public static long parseLong(String s)
        -
      • -
      - - - -
        -
      • -

        inLongRange

        -
        public static boolean inLongRange(char[] ch,
        -                                  int off,
        -                                  int len,
        -                                  boolean negative)
        -
        Helper method for determining if given String representation of - an integral number would fit in 64-bit Java long or not. - Note that input String must NOT contain leading minus sign (even - if 'negative' is set to true).
        -
        -
        Parameters:
        -
        negative - Whether original number had a minus sign (which is - NOT passed to this method) or not
        -
        -
      • -
      - - - -
        -
      • -

        inLongRange

        -
        public static boolean inLongRange(String s,
        -                                  boolean negative)
        -
        Similar to inLongRange(char[],int,int,boolean), but - with String argument
        -
        -
        Parameters:
        -
        negative - Whether original number had a minus sign (which is - NOT passed to this method) or not
        -
        -
      • -
      - - - -
        -
      • -

        parseAsInt

        -
        public static int parseAsInt(String s,
        -                             int def)
        -
      • -
      - - - -
        -
      • -

        parseAsLong

        -
        public static long parseAsLong(String s,
        -                               long def)
        -
      • -
      - - - -
        -
      • -

        parseAsDouble

        -
        public static double parseAsDouble(String s,
        -                                   double def)
        -
      • -
      - - - - - - - - - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/NumberOutput.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/NumberOutput.html deleted file mode 100644 index 7aad1ab383..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/NumberOutput.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - -NumberOutput (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class NumberOutput

-
-
- -
-
    -
  • -
    -
    -
    public final class NumberOutput
    -extends Object
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      NumberOutput() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static booleannotFinite(double value) -
      Helper method to verify whether given double value is finite - (regular rational number} or not (NaN or Infinity).
      -
      static booleannotFinite(float value) -
      Helper method to verify whether given float value is finite - (regular rational number} or not (NaN or Infinity).
      -
      static intoutputInt(int v, - byte[] b, - int off) 
      static intoutputInt(int v, - char[] b, - int off) 
      static intoutputLong(long v, - byte[] b, - int off) 
      static intoutputLong(long v, - char[] b, - int off) 
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        NumberOutput

        -
        public NumberOutput()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        outputInt

        -
        public static int outputInt(int v,
        -                            char[] b,
        -                            int off)
        -
        -
        Returns:
        -
        Offset within buffer after outputting int
        -
        -
      • -
      - - - -
        -
      • -

        outputInt

        -
        public static int outputInt(int v,
        -                            byte[] b,
        -                            int off)
        -
      • -
      - - - -
        -
      • -

        outputLong

        -
        public static int outputLong(long v,
        -                             char[] b,
        -                             int off)
        -
        -
        Returns:
        -
        Offset within buffer after outputting int
        -
        -
      • -
      - - - -
        -
      • -

        outputLong

        -
        public static int outputLong(long v,
        -                             byte[] b,
        -                             int off)
        -
      • -
      - - - -
        -
      • -

        notFinite

        -
        public static boolean notFinite(double value)
        -
        Helper method to verify whether given double value is finite - (regular rational number} or not (NaN or Infinity).
        -
        -
        Returns:
        -
        True if number is NOT finite (is Infinity or NaN); false otherwise - - Since 2.10
        -
        -
      • -
      - - - -
        -
      • -

        notFinite

        -
        public static boolean notFinite(float value)
        -
        Helper method to verify whether given float value is finite - (regular rational number} or not (NaN or Infinity).
        -
        -
        Returns:
        -
        True if number is NOT finite (is Infinity or NaN); false otherwise - - Since 2.10
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/OutputDecorator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/OutputDecorator.html deleted file mode 100644 index be0bd0c29f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/OutputDecorator.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - -OutputDecorator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class OutputDecorator

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public abstract class OutputDecorator
    -extends Object
    -implements Serializable
    -
    Handler class that can be used to decorate output destinations. - Typical use is to use a filter abstraction (filtered output stream, - writer) around original output destination, and apply additional - processing during write operations.
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        OutputDecorator

        -
        public OutputDecorator()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        decorate

        -
        public abstract OutputStream decorate(IOContext ctxt,
        -                                      OutputStream out)
        -                               throws IOException
        -
        Method called by JsonFactory instance when - creating generator for given OutputStream, when this decorator - has been registered.
        -
        -
        Parameters:
        -
        ctxt - IO context in use (provides access to declared encoding)
        -
        out - Original output destination
        -
        Returns:
        -
        OutputStream to use; either passed in argument, or something that - calls it
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        decorate

        -
        public abstract Writer decorate(IOContext ctxt,
        -                                Writer w)
        -                         throws IOException
        -
        Method called by JsonFactory instance when - creating generator for given Writer, when this decorator - has been registered.
        -
        -
        Parameters:
        -
        ctxt - IO context in use (provides access to declared encoding)
        -
        w - Original output writer
        -
        Returns:
        -
        Writer to use; either passed in argument, or something that calls it
        -
        Throws:
        -
        IOException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/SegmentedStringWriter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/SegmentedStringWriter.html deleted file mode 100644 index 24628ea4f5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/SegmentedStringWriter.html +++ /dev/null @@ -1,506 +0,0 @@ - - - - - - -SegmentedStringWriter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class SegmentedStringWriter

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Closeable, Flushable, Appendable, AutoCloseable
    -
    -
    -
    -
    public final class SegmentedStringWriter
    -extends Writer
    -
    Efficient alternative to StringWriter, based on using segmented - internal buffer. Initial input buffer is also recyclable. -

    - This class is most useful when serializing JSON content as a String: - if so, instance of this class can be given as the writer to - JsonGenerator.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SegmentedStringWriter

        -
        public SegmentedStringWriter(BufferRecycler br)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        flush

        -
        public void flush()
        -
        -
        Specified by:
        -
        flush in interface Flushable
        -
        Specified by:
        -
        flush in class Writer
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(char[] cbuf)
        -
        -
        Overrides:
        -
        write in class Writer
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(char[] cbuf,
        -                  int off,
        -                  int len)
        -
        -
        Specified by:
        -
        write in class Writer
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(int c)
        -
        -
        Overrides:
        -
        write in class Writer
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(String str)
        -
        -
        Overrides:
        -
        write in class Writer
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(String str,
        -                  int off,
        -                  int len)
        -
        -
        Overrides:
        -
        write in class Writer
        -
        -
      • -
      - - - -
        -
      • -

        getAndClear

        -
        public String getAndClear()
        -
        Main access method that will construct a String that contains - all the contents, release all internal buffers we may have, - and return result String. - Note that the method is not idempotent -- if called second time, - will just return an empty String.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/SerializedString.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/SerializedString.html deleted file mode 100644 index d4d68f79ad..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/SerializedString.html +++ /dev/null @@ -1,807 +0,0 @@ - - - - - - -SerializedString (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class SerializedString

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    SerializableString, Serializable
    -
    -
    -
    -
    public class SerializedString
    -extends Object
    -implements SerializableString, Serializable
    -
    String token that can lazily serialize String contained and then reuse that - serialization later on. This is similar to JDBC prepared statements, for example, - in that instances should only be created when they are used more than use; - prime candidates are various serializers. -

    - Class is final for performance reasons and since this is not designed to - be extensible or customizable (customizations would occur in calling code)

    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - - - - - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      intappendQuoted(char[] buffer, - int offset) -
      Method that will append quoted characters of this String into given - buffer.
      -
      intappendQuotedUTF8(byte[] buffer, - int offset) -
      Method that will append quoted UTF-8 bytes of this String into given - buffer, if there is enough room; if not, returns -1.
      -
      intappendUnquoted(char[] buffer, - int offset) -
      Method that will append unquoted characters of this String into given - buffer.
      -
      intappendUnquotedUTF8(byte[] buffer, - int offset) -
      Method that will append unquoted ('raw') UTF-8 bytes of this String into given - buffer.
      -
      char[]asQuotedChars() -
      Accessor for accessing value that has been quoted (escaped) using JSON - quoting rules (using backslash-prefixed codes) into a char array.
      -
      byte[]asQuotedUTF8() -
      Accessor for accessing value that has been quoted (escaped) using JSON - quoting rules (using backslash-prefixed codes), and encoded using - UTF-8 encoding into a byte array.
      -
      byte[]asUnquotedUTF8() -
      Accessor for accessing value as is (without JSON quoting (ecaping)) - encoded as UTF-8 byte array.
      -
      intcharLength() -
      Returns length of the String as characters
      -
      booleanequals(Object o) 
      StringgetValue() -
      Returns unquoted String that this object represents (and offers - serialized forms for)
      -
      inthashCode() 
      intputQuotedUTF8(ByteBuffer buffer) -
      Method for appending JSON-escaped UTF-8 encoded String value into given - ByteBuffer, if it fits.
      -
      intputUnquotedUTF8(ByteBuffer buffer) -
      Method for appending unquoted ('raw') UTF-8 encoded String value into given - ByteBuffer, if it fits.
      -
      protected ObjectreadResolve() 
      StringtoString() 
      intwriteQuotedUTF8(OutputStream out) -
      Method for writing JSON-escaped UTF-8 encoded String value using given - OutputStream.
      -
      intwriteUnquotedUTF8(OutputStream out) -
      Method for writing unescaped UTF-8 encoded String value using given - OutputStream.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _value

        -
        protected final String _value
        -
      • -
      - - - -
        -
      • -

        _quotedUTF8Ref

        -
        protected byte[] _quotedUTF8Ref
        -
      • -
      - - - -
        -
      • -

        _unquotedUTF8Ref

        -
        protected byte[] _unquotedUTF8Ref
        -
      • -
      - - - -
        -
      • -

        _quotedChars

        -
        protected char[] _quotedChars
        -
      • -
      - - - -
        -
      • -

        _jdkSerializeValue

        -
        protected transient String _jdkSerializeValue
        -
        Ugly hack, to work through the requirement that _value is indeed final, - and that JDK serialization won't call ctor(s).
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SerializedString

        -
        public SerializedString(String v)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        readResolve

        -
        protected Object readResolve()
        -
      • -
      - - - -
        -
      • -

        getValue

        -
        public final String getValue()
        -
        Description copied from interface: SerializableString
        -
        Returns unquoted String that this object represents (and offers - serialized forms for)
        -
        -
        Specified by:
        -
        getValue in interface SerializableString
        -
        Returns:
        -
        Unquoted String
        -
        -
      • -
      - - - -
        -
      • -

        charLength

        -
        public final int charLength()
        -
        Returns length of the String as characters
        -
        -
        Specified by:
        -
        charLength in interface SerializableString
        -
        Returns:
        -
        Length of the String in characters
        -
        -
      • -
      - - - -
        -
      • -

        asQuotedChars

        -
        public final char[] asQuotedChars()
        -
        Accessor for accessing value that has been quoted (escaped) using JSON - quoting rules (using backslash-prefixed codes) into a char array.
        -
        -
        Specified by:
        -
        asQuotedChars in interface SerializableString
        -
        -
      • -
      - - - -
        -
      • -

        asQuotedUTF8

        -
        public final byte[] asQuotedUTF8()
        -
        Accessor for accessing value that has been quoted (escaped) using JSON - quoting rules (using backslash-prefixed codes), and encoded using - UTF-8 encoding into a byte array.
        -
        -
        Specified by:
        -
        asQuotedUTF8 in interface SerializableString
        -
        Returns:
        -
        UTF-8 encoded version of JSON-escaped String
        -
        -
      • -
      - - - -
        -
      • -

        asUnquotedUTF8

        -
        public final byte[] asUnquotedUTF8()
        -
        Accessor for accessing value as is (without JSON quoting (ecaping)) - encoded as UTF-8 byte array.
        -
        -
        Specified by:
        -
        asUnquotedUTF8 in interface SerializableString
        -
        Returns:
        -
        UTF-8 encoded version of String, without any escaping
        -
        -
      • -
      - - - -
        -
      • -

        appendQuoted

        -
        public int appendQuoted(char[] buffer,
        -                        int offset)
        -
        Description copied from interface: SerializableString
        -
        Method that will append quoted characters of this String into given - buffer. Functionally equivalent to: -
        -  char[] ch = str.asQuotedChars();
        -  System.arraycopy(ch, 0, buffer, offset, ch.length);
        -  return ch.length;
        -
        -
        -
        Specified by:
        -
        appendQuoted in interface SerializableString
        -
        Parameters:
        -
        buffer - Buffer to append JSON-escaped String into
        -
        offset - Offset in buffer to append String at
        -
        Returns:
        -
        Number of characters appended, if successful, otherwise -1
        -
        -
      • -
      - - - -
        -
      • -

        appendQuotedUTF8

        -
        public int appendQuotedUTF8(byte[] buffer,
        -                            int offset)
        -
        Description copied from interface: SerializableString
        -
        Method that will append quoted UTF-8 bytes of this String into given - buffer, if there is enough room; if not, returns -1. - Functionally equivalent to: -
        -  byte[] bytes = str.asQuotedUTF8();
        -  System.arraycopy(bytes, 0, buffer, offset, bytes.length);
        -  return bytes.length;
        -
        -
        -
        Specified by:
        -
        appendQuotedUTF8 in interface SerializableString
        -
        Parameters:
        -
        buffer - Buffer to append JSON-escaped String into
        -
        offset - Offset in buffer to append String at
        -
        Returns:
        -
        Number of bytes appended, if successful, otherwise -1
        -
        -
      • -
      - - - -
        -
      • -

        appendUnquoted

        -
        public int appendUnquoted(char[] buffer,
        -                          int offset)
        -
        Description copied from interface: SerializableString
        -
        Method that will append unquoted characters of this String into given - buffer. Functionally equivalent to: -
        -  char[] ch = str.getValue().toCharArray();
        -  System.arraycopy(bytes, 0, buffer, offset, ch.length);
        -  return ch.length;
        -
        -
        -
        Specified by:
        -
        appendUnquoted in interface SerializableString
        -
        Parameters:
        -
        buffer - Buffer to append literal (unescaped) String into
        -
        offset - Offset in buffer to append String at
        -
        Returns:
        -
        Number of characters appended, if successful, otherwise -1
        -
        -
      • -
      - - - -
        -
      • -

        appendUnquotedUTF8

        -
        public int appendUnquotedUTF8(byte[] buffer,
        -                              int offset)
        -
        Description copied from interface: SerializableString
        -
        Method that will append unquoted ('raw') UTF-8 bytes of this String into given - buffer. Functionally equivalent to: -
        -  byte[] bytes = str.asUnquotedUTF8();
        -  System.arraycopy(bytes, 0, buffer, offset, bytes.length);
        -  return bytes.length;
        -
        -
        -
        Specified by:
        -
        appendUnquotedUTF8 in interface SerializableString
        -
        Parameters:
        -
        buffer - Buffer to append literal (unescaped) String into
        -
        offset - Offset in buffer to append String at
        -
        Returns:
        -
        Number of bytes appended, if successful, otherwise -1
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        putQuotedUTF8

        -
        public int putQuotedUTF8(ByteBuffer buffer)
        -
        Description copied from interface: SerializableString
        -
        Method for appending JSON-escaped UTF-8 encoded String value into given - ByteBuffer, if it fits.
        -
        -
        Specified by:
        -
        putQuotedUTF8 in interface SerializableString
        -
        Parameters:
        -
        buffer - ByteBuffer to append String into
        -
        Returns:
        -
        Number of bytes put, if contents fit, otherwise -1
        -
        -
      • -
      - - - -
        -
      • -

        putUnquotedUTF8

        -
        public int putUnquotedUTF8(ByteBuffer buffer)
        -
        Description copied from interface: SerializableString
        -
        Method for appending unquoted ('raw') UTF-8 encoded String value into given - ByteBuffer, if it fits.
        -
        -
        Specified by:
        -
        putUnquotedUTF8 in interface SerializableString
        -
        Parameters:
        -
        buffer - ByteBuffer to append String into
        -
        Returns:
        -
        Number of bytes put, if contents fit, otherwise -1
        -
        -
      • -
      - - - - - - - -
        -
      • -

        hashCode

        -
        public final int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class Object
        -
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public final boolean equals(Object o)
        -
        -
        Overrides:
        -
        equals in class Object
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/UTF32Reader.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/UTF32Reader.html deleted file mode 100644 index 5f21a5aee7..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/UTF32Reader.html +++ /dev/null @@ -1,592 +0,0 @@ - - - - - - -UTF32Reader (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class UTF32Reader

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Closeable, AutoCloseable, Readable
    -
    -
    -
    -
    public class UTF32Reader
    -extends Reader
    -
    Since JDK does not come with UTF-32/UCS-4, let's implement a simple - decoder to use.
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      protected boolean_bigEndian 
      protected byte[]_buffer 
      protected int_byteCount -
      Total read byte count; used for error reporting purposes
      -
      protected int_charCount -
      Total read character count; used for error reporting purposes
      -
      protected IOContext_context 
      protected InputStream_in 
      protected int_length 
      protected boolean_managedBuffers 
      protected int_ptr 
      protected char_surrogate -
      Although input is fine with full Unicode set, Java still uses - 16-bit chars, so we may have to split high-order chars into - surrogate pairs.
      -
      protected char[]_tmpBuf 
      protected static intLAST_VALID_UNICODE_CHAR -
      JSON actually limits available Unicode range in the high end - to the same as xml (to basically limit UTF-8 max byte sequence - length to 4)
      -
      protected static charNC 
      - -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      UTF32Reader(IOContext ctxt, - InputStream in, - boolean autoClose, - byte[] buf, - int ptr, - int len, - boolean isBigEndian) 
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        LAST_VALID_UNICODE_CHAR

        -
        protected static final int LAST_VALID_UNICODE_CHAR
        -
        JSON actually limits available Unicode range in the high end - to the same as xml (to basically limit UTF-8 max byte sequence - length to 4)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _context

        -
        protected final IOContext _context
        -
      • -
      - - - - - - - -
        -
      • -

        _buffer

        -
        protected byte[] _buffer
        -
      • -
      - - - -
        -
      • -

        _ptr

        -
        protected int _ptr
        -
      • -
      - - - -
        -
      • -

        _length

        -
        protected int _length
        -
      • -
      - - - -
        -
      • -

        _bigEndian

        -
        protected final boolean _bigEndian
        -
      • -
      - - - -
        -
      • -

        _surrogate

        -
        protected char _surrogate
        -
        Although input is fine with full Unicode set, Java still uses - 16-bit chars, so we may have to split high-order chars into - surrogate pairs.
        -
      • -
      - - - -
        -
      • -

        _charCount

        -
        protected int _charCount
        -
        Total read character count; used for error reporting purposes
        -
      • -
      - - - -
        -
      • -

        _byteCount

        -
        protected int _byteCount
        -
        Total read byte count; used for error reporting purposes
        -
      • -
      - - - -
        -
      • -

        _managedBuffers

        -
        protected final boolean _managedBuffers
        -
      • -
      - - - -
        -
      • -

        _tmpBuf

        -
        protected char[] _tmpBuf
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        UTF32Reader

        -
        public UTF32Reader(IOContext ctxt,
        -                   InputStream in,
        -                   boolean autoClose,
        -                   byte[] buf,
        -                   int ptr,
        -                   int len,
        -                   boolean isBigEndian)
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/UTF8Writer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/UTF8Writer.html deleted file mode 100644 index f7060e8b88..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/UTF8Writer.html +++ /dev/null @@ -1,521 +0,0 @@ - - - - - - -UTF8Writer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.io
-

Class UTF8Writer

-
-
- -
- -
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/CharTypes.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/CharTypes.html deleted file mode 100644 index 514caee1e6..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/CharTypes.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.CharTypes (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.CharTypes

-
-
No usage of com.fasterxml.jackson.core.io.CharTypes
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/CharacterEscapes.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/CharacterEscapes.html deleted file mode 100644 index 57225d65f2..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/CharacterEscapes.html +++ /dev/null @@ -1,395 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.CharacterEscapes (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.CharacterEscapes

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/DataOutputAsStream.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/DataOutputAsStream.html deleted file mode 100644 index 3fb837b9ec..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/DataOutputAsStream.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.DataOutputAsStream (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.DataOutputAsStream

-
-
No usage of com.fasterxml.jackson.core.io.DataOutputAsStream
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/IOContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/IOContext.html deleted file mode 100644 index c0661d2984..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/IOContext.html +++ /dev/null @@ -1,725 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.IOContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.IOContext

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/InputDecorator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/InputDecorator.html deleted file mode 100644 index c69b726fab..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/InputDecorator.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.InputDecorator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.InputDecorator

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/JsonEOFException.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/JsonEOFException.html deleted file mode 100644 index 0953a66b9d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/JsonEOFException.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.JsonEOFException (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.JsonEOFException

-
-
No usage of com.fasterxml.jackson.core.io.JsonEOFException
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/JsonStringEncoder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/JsonStringEncoder.html deleted file mode 100644 index 22212b6162..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/JsonStringEncoder.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.JsonStringEncoder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.JsonStringEncoder

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/MergedStream.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/MergedStream.html deleted file mode 100644 index 9780e95c11..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/MergedStream.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.MergedStream (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.MergedStream

-
-
No usage of com.fasterxml.jackson.core.io.MergedStream
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/NumberInput.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/NumberInput.html deleted file mode 100644 index ab6897a54f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/NumberInput.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.NumberInput (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.NumberInput

-
-
No usage of com.fasterxml.jackson.core.io.NumberInput
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/NumberOutput.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/NumberOutput.html deleted file mode 100644 index df8f697bb2..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/NumberOutput.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.NumberOutput (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.NumberOutput

-
-
No usage of com.fasterxml.jackson.core.io.NumberOutput
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/OutputDecorator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/OutputDecorator.html deleted file mode 100644 index 0822df7de4..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/OutputDecorator.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.OutputDecorator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.OutputDecorator

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/SegmentedStringWriter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/SegmentedStringWriter.html deleted file mode 100644 index ec2505f776..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/SegmentedStringWriter.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.SegmentedStringWriter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.SegmentedStringWriter

-
-
No usage of com.fasterxml.jackson.core.io.SegmentedStringWriter
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/SerializedString.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/SerializedString.html deleted file mode 100644 index 95885cd549..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/SerializedString.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.SerializedString (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.SerializedString

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/UTF32Reader.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/UTF32Reader.html deleted file mode 100644 index ccb5acc849..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/UTF32Reader.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.UTF32Reader (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.UTF32Reader

-
-
No usage of com.fasterxml.jackson.core.io.UTF32Reader
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/UTF8Writer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/UTF8Writer.html deleted file mode 100644 index f0461180cd..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/class-use/UTF8Writer.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.io.UTF8Writer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.io.UTF8Writer

-
-
No usage of com.fasterxml.jackson.core.io.UTF8Writer
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-frame.html deleted file mode 100644 index 6f44cd3f60..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-frame.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.io (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.io

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-summary.html deleted file mode 100644 index eefa2e8a26..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-summary.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.io (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.io

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    CharacterEscapes -
    Abstract base class that defines interface for customizing character - escaping aspects for String values, for formats that use escaping.
    -
    CharTypes 
    DataOutputAsStream -
    Helper class to support use of DataOutput for output, directly, - without caller having to provide for implementation.
    -
    InputDecorator -
    Handler class that can be used to decorate input sources.
    -
    IOContext -
    To limit number of configuration and state objects to pass, all - contextual objects that need to be passed by the factory to - readers and writers are combined under this object.
    -
    JsonStringEncoder -
    Helper class used for efficient encoding of JSON String values (including - JSON field names) into Strings or UTF-8 byte arrays.
    -
    MergedStream -
    Simple InputStream implementation that is used to "unwind" some - data previously read from an input stream; so that as long as some of - that data remains, it's returned; but as long as it's read, we'll - just use data from the underlying original stream.
    -
    NumberInput 
    NumberOutput 
    OutputDecorator -
    Handler class that can be used to decorate output destinations.
    -
    SegmentedStringWriter -
    Efficient alternative to StringWriter, based on using segmented - internal buffer.
    -
    SerializedString -
    String token that can lazily serialize String contained and then reuse that - serialization later on.
    -
    UTF32Reader -
    Since JDK does not come with UTF-32/UCS-4, let's implement a simple - decoder to use.
    -
    UTF8Writer 
    -
  • -
  • - - - - - - - - - - - - -
    Exception Summary 
    ExceptionDescription
    JsonEOFException -
    Specialized JsonParseException that is thrown when end-of-input - is reached unexpectedly, either within token being decoded, or during - skipping of intervening white-space that is not between root-level - tokens (that is, is within JSON Object or JSON Array construct).
    -
    -
  • -
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-tree.html deleted file mode 100644 index d88e09bf91..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-tree.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.io Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.io

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-use.html deleted file mode 100644 index f86d0e11ab..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/io/package-use.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.io (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.io

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.html deleted file mode 100644 index fad9128b54..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.html +++ /dev/null @@ -1,471 +0,0 @@ - - - - - - -ByteSourceJsonBootstrapper (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class ByteSourceJsonBootstrapper

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public final class ByteSourceJsonBootstrapper
    -extends Object
    -
    This class is used to determine the encoding of byte stream - that is to contain JSON content. Rules are fairly simple, and - defined in JSON specification (RFC-4627 or newer), except - for BOM handling, which is a property of underlying - streams.
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/DupDetector.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/DupDetector.html deleted file mode 100644 index 95b96c6490..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/DupDetector.html +++ /dev/null @@ -1,416 +0,0 @@ - - - - - - -DupDetector (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class DupDetector

-
-
- -
-
    -
  • -
    -
    -
    public class DupDetector
    -extends Object
    -
    Helper class used if - StreamReadFeature.STRICT_DUPLICATE_DETECTION - is enabled. - Optimized to try to limit memory usage and processing overhead for smallest - entries, but without adding trashing (immutable objects would achieve optimal - memory usage but lead to significant number of discarded temp objects for - scopes with large number of entries). Another consideration is trying to limit - actual number of compiled classes as it contributes significantly to overall - jar size (due to linkage etc).
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonFactory.html deleted file mode 100644 index 96b6209799..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonFactory.html +++ /dev/null @@ -1,1251 +0,0 @@ - - - - - - -JsonFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class JsonFactory

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        DEFAULT_ROOT_VALUE_SEPARATOR

        -
        public static final SerializableString DEFAULT_ROOT_VALUE_SEPARATOR
        -
      • -
      - - - -
        -
      • -

        DEFAULT_QUOTE_CHAR

        -
        public static final char DEFAULT_QUOTE_CHAR
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        _characterEscapes

        -
        protected final CharacterEscapes _characterEscapes
        -
        Definition of custom character escapes to use for generators created - by this factory, if any. If null, standard data format specific - escapes are used.
        -
      • -
      - - - -
        -
      • -

        _rootValueSeparator

        -
        protected final SerializableString _rootValueSeparator
        -
        Separator used between root-level values, if any; null indicates - "do not add separator". - Default separator is a single space character.
        -
      • -
      - - - -
        -
      • -

        _maximumNonEscapedChar

        -
        protected final int _maximumNonEscapedChar
        -
        Optional threshold used for automatically escaping character above certain character - code value: either 0 to indicate that no threshold is specified, or value - at or above 127 to indicate last character code that is NOT automatically escaped - (but depends on other configuration rules for checking).
        -
      • -
      - - - -
        -
      • -

        _quoteChar

        -
        protected final char _quoteChar
        -
        Character used for quoting field names (if field name quoting has not - been disabled with JsonWriteFeature.QUOTE_FIELD_NAMES) - and JSON String values.
        -
      • -
      - - - -
        -
      • -

        _rootCharSymbols

        -
        protected final transient CharsToNameCanonicalizer _rootCharSymbols
        -
        Each factory comes equipped with a shared root symbol table. - It should not be linked back to the original blueprint, to - avoid contents from leaking between factories.
        -
      • -
      - - - -
        -
      • -

        _byteSymbolCanonicalizer

        -
        protected final transient ByteQuadsCanonicalizer _byteSymbolCanonicalizer
        -
        Alternative to the basic symbol table, some stream-based - parsers use different name canonicalization method.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonFactory

        -
        public JsonFactory()
        -
        Default constructor used to create factory instances. - Creation of a factory instance is a light-weight operation, - but it is still a good idea to reuse limited number of - factory instances (and quite often just a single instance): - factories are used as context for storing some reused - processing objects (such as symbol tables parsers use) - and this reuse only works within context of a single - factory instance.
        -
      • -
      - - - -
        -
      • -

        JsonFactory

        -
        protected JsonFactory(JsonFactory src)
        -
        Copy constructor.
        -
      • -
      - - - - -
    • -
    - - -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonFactoryBuilder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonFactoryBuilder.html deleted file mode 100644 index 8d540e1885..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonFactoryBuilder.html +++ /dev/null @@ -1,755 +0,0 @@ - - - - - - -JsonFactoryBuilder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class JsonFactoryBuilder

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - - - - - -
        -
      • -

        _maximumNonEscapedChar

        -
        protected int _maximumNonEscapedChar
        -
      • -
      - - - -
        -
      • -

        _quoteChar

        -
        protected char _quoteChar
        -
        Character used for quoting field names (if field name quoting has not - been disabled with JsonWriteFeature.QUOTE_FIELD_NAMES) - and JSON String values.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonFactoryBuilder

        -
        public JsonFactoryBuilder()
        -
      • -
      - - - -
        -
      • -

        JsonFactoryBuilder

        -
        public JsonFactoryBuilder(JsonFactory base)
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonGeneratorBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonGeneratorBase.html deleted file mode 100644 index b256c64376..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonGeneratorBase.html +++ /dev/null @@ -1,990 +0,0 @@ - - - - - - -JsonGeneratorBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class JsonGeneratorBase

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        DEFAULT_OUTPUT_ESCAPES

        -
        protected static final int[] DEFAULT_OUTPUT_ESCAPES
        -
        This is the default set of escape codes, over 7-bit ASCII range - (first 128 character codes), used for single-byte UTF-8 characters.
        -
      • -
      - - - -
        -
      • -

        _ioContext

        -
        protected final IOContext _ioContext
        -
      • -
      - - - -
        -
      • -

        _formatWriteFeatures

        -
        protected int _formatWriteFeatures
        -
        Bit flag composed of bits that indicate which - JsonWriteFeatures - are enabled.
        -
      • -
      - - - -
        -
      • -

        _outputEscapes

        -
        protected int[] _outputEscapes
        -
        Currently active set of output escape code definitions (whether - and how to escape or not) for 7-bit ASCII range (first 128 - character codes). Defined separately to make potentially - customizable
        -
      • -
      - - - -
        -
      • -

        _characterEscapes

        -
        protected CharacterEscapes _characterEscapes
        -
        Definition of custom character escapes to use for generators created - by this factory, if any. If null, standard data format specific - escapes are used. -

        - NOTE: although typically set during construction (in constructor), - can not be made final in 3.0 due to some edge use cases (JSONP support).

        -
      • -
      - - - -
        -
      • -

        _maximumNonEscapedChar

        -
        protected int _maximumNonEscapedChar
        -
        Value between 128 (0x80) and 65535 (0xFFFF) that indicates highest - Unicode code point that will not need escaping; or 0 to indicate - that all characters can be represented without escaping. - Typically used to force escaping of some portion of character set; - for example to always escape non-ASCII characters (if value was 127). -

        - NOTE: not all sub-classes make use of this setting.

        -
      • -
      - - - -
        -
      • -

        _cfgPrettyPrinter

        -
        protected PrettyPrinter _cfgPrettyPrinter
        -
        Object that handles pretty-printing (usually additional - white space to make results more human-readable) during - output. If null, no pretty-printing is done.
        -
      • -
      - - - -
        -
      • -

        _rootValueSeparator

        -
        protected final SerializableString _rootValueSeparator
        -
        Separator to use, if any, between root-level values.
        -
      • -
      - - - -
        -
      • -

        _cfgUnqNames

        -
        protected boolean _cfgUnqNames
        -
        Flag that is set if quoting is not to be added around - JSON Object property names.
        -
      • -
      - - - -
        -
      • -

        _cfgNumbersAsStrings

        -
        protected boolean _cfgNumbersAsStrings
        -
        Flag set to indicate that implicit conversion from number - to JSON String is needed (as per - JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS).
        -
      • -
      - - - -
        -
      • -

        _tokenWriteContext

        -
        protected JsonWriteContext _tokenWriteContext
        -
        Object that keeps track of the current contextual state of the generator.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        version

        -
        public Version version()
        -
        Description copied from class: JsonGenerator
        -
        Accessor for finding out version of the bundle that provided this generator instance.
        -
        -
        Specified by:
        -
        version in interface Versioned
        -
        Specified by:
        -
        version in class JsonGenerator
        -
        Returns:
        -
        Version of the component
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getWriteCapabilities

        -
        public JacksonFeatureSet<StreamWriteCapability> getWriteCapabilities()
        -
        Description copied from class: JsonGenerator
        -
        Accessor for getting metadata on capabilities of this generator, based on - underlying data format being read (directly or indirectly).
        -
        -
        Specified by:
        -
        getWriteCapabilities in class JsonGenerator
        -
        Returns:
        -
        Set of read capabilities for content to generate via this generator
        -
        -
      • -
      - - - -
        -
      • -

        setHighestNonEscapedChar

        -
        public JsonGenerator setHighestNonEscapedChar(int charCode)
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to request that generator escapes - all character codes above specified code point (if positive value); - or, to not escape any characters except for ones that must be - escaped for the data format (if -1). - To force escaping of all non-ASCII characters, for example, - this method would be called with value of 127. -

        - Note that generators are NOT required to support setting of value - higher than 127, because there are other ways to affect quoting - (or lack thereof) of character codes between 0 and 127. - Not all generators support concept of escaping, either; if so, - calling this method will have no effect. -

        - Default implementation does nothing; sub-classes need to redefine - it according to rules of supported data format.

        -
        -
        Overrides:
        -
        setHighestNonEscapedChar in class JsonGenerator
        -
        Parameters:
        -
        charCode - Either -1 to indicate that no additional escaping - is to be done; or highest code point not to escape (meaning higher - ones will be), if positive value.
        -
        Returns:
        -
        This generator, to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        getHighestNonEscapedChar

        -
        public int getHighestNonEscapedChar()
        -
        Description copied from class: JsonGenerator
        -
        Accessor method for testing what is the highest unescaped character - configured for this generator. This may be either positive value - (when escaping configuration has been set and is in effect), or - 0 to indicate that no additional escaping is in effect. - Some generators may not support additional escaping: for example, - generators for binary formats that do not use escaping should - simply return 0.
        -
        -
        Overrides:
        -
        getHighestNonEscapedChar in class JsonGenerator
        -
        Returns:
        -
        Currently active limitation for highest non-escaped character, - if defined; or 0 to indicate no additional escaping is performed.
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getOutputContext

        -
        public final TokenStreamContext getOutputContext()
        -
        Description copied from class: JsonGenerator
        -
        Accessor for context object that provides information about low-level - logical position withing output token stream.
        -
        -
        Specified by:
        -
        getOutputContext in class JsonGenerator
        -
        Returns:
        -
        Stream output context (TokenStreamContext) associated with this generator
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentValue

        -
        public final Object getCurrentValue()
        -
        Description copied from class: JsonGenerator
        -
        Helper method, usually equivalent to: - - getOutputContext().getCurrentValue(); - -

        - Note that "current value" is NOT populated (or used) by Streaming generator; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Specified by:
        -
        getCurrentValue in class JsonGenerator
        -
        Returns:
        -
        "Current value" for the current context this generator has
        -
        -
      • -
      - - - -
        -
      • -

        setCurrentValue

        -
        public final void setCurrentValue(Object v)
        -
        Description copied from class: JsonGenerator
        -
        Helper method, usually equivalent to: - - getOutputContext().setCurrentValue(v); - - used to assign "current value" for the current context of this generator. - It is usually assigned and used by higher level data-binding functionality - (instead of streaming parsers/generators) but is stored at streaming level.
        -
        -
        Specified by:
        -
        setCurrentValue in class JsonGenerator
        -
        Parameters:
        -
        v - "Current value" to assign to the current output context of this generator
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(Object currentValue,
        -                            int size)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any) - and how many elements will be written for the array before calling - JsonGenerator.writeEndArray().
        -
        -
        Overrides:
        -
        writeStartArray in class GeneratorBase
        -
        Parameters:
        -
        currentValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        size - Number of elements this Array will have: actual - number of values written (before matching call to - JsonGenerator.writeEndArray() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object currentValue,
        -                             int size)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. - In addition, caller knows number of key/value pairs ("properties") - that will get written for the Object value: this is relevant for - some format backends (but not, as an example, for JSON). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Overrides:
        -
        writeStartObject in class GeneratorBase
        -
        Parameters:
        -
        currentValue - Object value to be written (assigned as "current value" for - the Object context that gets created)
        -
        size - Number of key/value pairs this Object will have: actual - number of entries written (before matching call to - JsonGenerator.writeEndObject() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldId

        -
        public void writeFieldId(long id)
        -                  throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Alternative to JsonGenerator.writeFieldName(String) that may be used - in cases where property key is of numeric type; either where - underlying format supports such notion (some binary formats do, - unlike JSON), or for convenient conversion into String presentation. - Default implementation will simply convert id into String - and call JsonGenerator.writeFieldName(String).
        -
        -
        Specified by:
        -
        writeFieldId in class JsonGenerator
        -
        Parameters:
        -
        id - Field id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        _verifyPrettyValueWrite

        -
        protected void _verifyPrettyValueWrite(String typeMsg,
        -                                       int status)
        -                                throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _reportCantWriteValueExpectName

        -
        protected void _reportCantWriteValueExpectName(String typeMsg)
        -                                        throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonParserBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonParserBase.html deleted file mode 100644 index c8e76115bd..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonParserBase.html +++ /dev/null @@ -1,883 +0,0 @@ - - - - - - -JsonParserBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class JsonParserBase

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _formatReadFeatures

        -
        protected int _formatReadFeatures
        -
        Bit flag for JsonReadFeatures that are enabled.
        -
      • -
      - - - -
        -
      • -

        _parsingContext

        -
        protected JsonReadContext _parsingContext
        -
        Information about parser context, context in which - the next token is to be parsed (root, array, object).
        -
      • -
      - - - -
        -
      • -

        _nextToken

        -
        protected JsonToken _nextToken
        -
        Secondary token related to the next token after current one; - used if its type is known. This may be value token that - follows FIELD_NAME, for example.
        -
      • -
      - - - -
        -
      • -

        _nameCopied

        -
        protected boolean _nameCopied
        -
        Flag set to indicate whether the field name is available - from the name copy buffer or not (in addition to its String - representation being available via read context)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonParserBase

        -
        protected JsonParserBase(ObjectReadContext readCtxt,
        -                         IOContext ctxt,
        -                         int streamReadFeatures,
        -                         int formatReadFeatures)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        version

        -
        public Version version()
        -
        Description copied from class: JsonParser
        -
        Accessor for getting version of the core package, given a parser instance. - Left for sub-classes to implement.
        -
        -
        Specified by:
        -
        version in interface Versioned
        -
        Specified by:
        -
        version in class JsonParser
        -
        Returns:
        -
        Version of the component
        -
        -
      • -
      - - - -
        -
      • -

        getReadCapabilities

        -
        public JacksonFeatureSet<StreamReadCapability> getReadCapabilities()
        -
        Description copied from class: JsonParser
        -
        Accessor for getting metadata on capabilities of this parser, based on - underlying data format being read (directly or indirectly).
        -
        -
        Overrides:
        -
        getReadCapabilities in class ParserMinimalBase
        -
        Returns:
        -
        Set of read capabilities for content to read via this parser
        -
        -
      • -
      - - - -
        -
      • -

        getParsingContext

        -
        public TokenStreamContext getParsingContext()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to access current parsing context reader - is in. There are 3 different types: root, array and object contexts, - with slightly different available information. Contexts are - hierarchically nested, and can be used for example for figuring - out part of the input document that correspond to specific - array or object (for highlighting purposes, or error reporting). - Contexts can also be used for simple xpath-like matching of - input, if so desired.
        -
        -
        Specified by:
        -
        getParsingContext in class JsonParser
        -
        Returns:
        -
        Stream output context (TokenStreamContext) associated with this parser
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentValue

        -
        public Object getCurrentValue()
        -
        Description copied from class: JsonParser
        -
        Helper method, usually equivalent to: - - getParsingContext().getCurrentValue(); - -

        - Note that "current value" is NOT populated (or used) by Streaming parser; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Overrides:
        -
        getCurrentValue in class ParserBase
        -
        Returns:
        -
        "Current value" for the current input context this parser has
        -
        -
      • -
      - - - -
        -
      • -

        setCurrentValue

        -
        public void setCurrentValue(Object v)
        -
        Description copied from class: JsonParser
        -
        Helper method, usually equivalent to: - - getParsingContext().setCurrentValue(v); -
        -
        -
        Overrides:
        -
        setCurrentValue in class ParserBase
        -
        Parameters:
        -
        v - "Current value" to assign to the current input context of this parser
        -
        -
      • -
      - - - -
        -
      • -

        currentName

        -
        public String currentName()
        -                   throws IOException
        -
        Method that can be called to get the name associated with - the current event.
        -
        -
        Specified by:
        -
        currentName in class JsonParser
        -
        Returns:
        -
        Name of the current field in the parsing context
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        hasTextCharacters

        -
        public boolean hasTextCharacters()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to determine whether calling of - JsonParser.getTextCharacters() would be the most efficient - way to access textual content for the event parser currently - points to. -

        - Default implementation simply returns false since only actual - implementation class has knowledge of its internal buffering - state. - Implementations are strongly encouraged to properly override - this method, to allow efficient copying of content by other - code.

        -
        -
        Overrides:
        -
        hasTextCharacters in class ParserBase
        -
        Returns:
        -
        True if parser currently has character array that can - be efficiently returned via JsonParser.getTextCharacters(); false - means that it may or may not exist
        -
        -
      • -
      - - - -
        -
      • -

        _parseNumericValue

        -
        protected void _parseNumericValue(int expType)
        -                           throws IOException
        -
        Description copied from class: ParserBase
        -
        Method that will parse actual numeric value out of a syntactically - valid number value. Type it will parse into depends on whether - it is a floating point number, as well as its magnitude: smallest - legal type (of ones available) is used for efficiency.
        -
        -
        Specified by:
        -
        _parseNumericValue in class ParserBase
        -
        Parameters:
        -
        expType - Numeric type that we will immediately need, if any; - mostly necessary to optimize handling of floating point numbers
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _reportTooLongIntegral

        -
        protected void _reportTooLongIntegral(int expType,
        -                                      String rawNum)
        -                               throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        currentFieldNameInBuffer

        -
        protected char[] currentFieldNameInBuffer()
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        _validJsonTokenList

        -
        protected String _validJsonTokenList()
        -                              throws IOException
        -
        -
        Returns:
        -
        Description to use as "valid tokens" in an exception message about - invalid (unrecognized) JSON token: called when parser finds something that - looks like unquoted textual token
        -
        Throws:
        -
        IOException
        -
        Since:
        -
        2.10
        -
        -
      • -
      - - - -
        -
      • -

        _validJsonValueList

        -
        protected String _validJsonValueList()
        -                              throws IOException
        -
        -
        Returns:
        -
        Description to use as "valid JSON values" in an exception message about - invalid (unrecognized) JSON value: called when parser finds something that - does not look like a value or separator.
        -
        Throws:
        -
        IOException
        -
        Since:
        -
        2.10
        -
        -
      • -
      - - - -
        -
      • -

        growArrayBy

        -
        protected static int[] growArrayBy(int[] arr,
        -                                   int more)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonReadContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonReadContext.html deleted file mode 100644 index 3447b15db4..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonReadContext.html +++ /dev/null @@ -1,736 +0,0 @@ - - - - - - -JsonReadContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class JsonReadContext

-
-
- -
-
    -
  • -
    -
    -
    public final class JsonReadContext
    -extends TokenStreamContext
    -
    Extension of TokenStreamContext, which implements - core methods needed, and also exposes - more complete API to parser implementation classes.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _parent

        -
        protected final JsonReadContext _parent
        -
        Parent context for this context; null for root context.
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        _currentName

        -
        protected String _currentName
        -
      • -
      - - - -
        -
      • -

        _currentValue

        -
        protected Object _currentValue
        -
      • -
      - - - -
        -
      • -

        _lineNr

        -
        protected int _lineNr
        -
      • -
      - - - -
        -
      • -

        _columnNr

        -
        protected int _columnNr
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonReadContext

        -
        public JsonReadContext(JsonReadContext parent,
        -                       DupDetector dups,
        -                       int type,
        -                       int lineNr,
        -                       int colNr)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        reset

        -
        public void reset(int type,
        -                  int lineNr,
        -                  int colNr)
        -
        Internal method to allow instance reuse: DO NOT USE unless you absolutely - know what you are doing. - Clears up state (including "current value"), changes type to one specified; - resets current duplicate-detection state (if any). - Parent link left as-is since it is final.
        -
      • -
      - - - - - - - -
        -
      • -

        getCurrentValue

        -
        public Object getCurrentValue()
        -
        Description copied from class: TokenStreamContext
        -
        Method for accessing currently active value being used by data-binding - (as the source of streaming data to write, or destination of data being - read), at this level in hierarchy. -

        - Note that "current value" is NOT populated (or used) by Streaming parser or generator; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Overrides:
        -
        getCurrentValue in class TokenStreamContext
        -
        Returns:
        -
        Currently active value, if one has been assigned.
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        createChildArrayContext

        -
        public JsonReadContext createChildArrayContext(int lineNr,
        -                                               int colNr)
        -
      • -
      - - - -
        -
      • -

        createChildObjectContext

        -
        public JsonReadContext createChildObjectContext(int lineNr,
        -                                                int colNr)
        -
      • -
      - - - -
        -
      • -

        currentName

        -
        public String currentName()
        -
        Description copied from class: TokenStreamContext
        -
        Method for accessing name associated with the current location. - Non-null for FIELD_NAME and value events that directly - follow field names; null for root level and array values.
        -
        -
        Specified by:
        -
        currentName in class TokenStreamContext
        -
        Returns:
        -
        Current field name within context, if any; null if none
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getParent

        -
        public JsonReadContext getParent()
        -
        Description copied from class: TokenStreamContext
        -
        Accessor for finding parent context of this context; will - return null for root context.
        -
        -
        Specified by:
        -
        getParent in class TokenStreamContext
        -
        Returns:
        -
        Parent context of this context, if any; null for Root contexts
        -
        -
      • -
      - - - -
        -
      • -

        getStartLocation

        -
        public JsonLocation getStartLocation(Object srcRef)
        -
        Description copied from class: TokenStreamContext
        -
        Optional method that may be used to access starting location of this context: - for example, in case of JSON `Object` context, offset at which `[` token was - read or written. Often used for error reporting purposes. - Implementations that do not keep track of such location are expected to return - JsonLocation.NA; this is what the default implementation does. -

        - NOTE: demoted from JsonReadContext in 2.9, to allow use for - "non-standard" read contexts.

        -
        -
        Overrides:
        -
        getStartLocation in class TokenStreamContext
        -
        Parameters:
        -
        srcRef - Source reference needed to construct location instance
        -
        Returns:
        -
        Location pointing to the point where the context - start marker was found (or written); never `null`.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getDupDetector

        -
        public DupDetector getDupDetector()
        -
      • -
      - - - -
        -
      • -

        expectComma

        -
        public boolean expectComma()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonReadFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonReadFeature.html deleted file mode 100644 index ab9addf76a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonReadFeature.html +++ /dev/null @@ -1,704 +0,0 @@ - - - - - - -JsonReadFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Enum JsonReadFeature

-
-
- -
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Enum Constants 
      Enum Constant and Description
      ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER -
      Feature that can be enabled to accept quoting of all character - using backslash quoting mechanism: if not enabled, only characters - that are explicitly listed by JSON specification can be thus - escaped (see JSON spec for small list of these characters)
      -
      ALLOW_JAVA_COMMENTS -
      Feature that determines whether parser will allow use - of Java/C/C++ style comments (both '/'+'*' and - '//' varieties) within parsed content or not.
      -
      ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS -
      Feature that determines whether parser will allow - JSON decimal numbers to start with a decimal point - (like: .123).
      -
      ALLOW_LEADING_ZEROS_FOR_NUMBERS -
      Feature that determines whether parser will allow - JSON integral numbers to start with additional (ignorable) - zeroes (like: 000001).
      -
      ALLOW_MISSING_VALUES -
      Feature allows the support for "missing" values in a JSON array: missing - value meaning sequence of two commas, without value in-between but only - optional white space.
      -
      ALLOW_NON_NUMERIC_NUMBERS -
      Feature that allows parser to recognize set of - "Not-a-Number" (NaN) tokens as legal floating number - values (similar to how many other data formats and - programming language source code allows it).
      -
      ALLOW_SINGLE_QUOTES -
      Feature that determines whether parser will allow use - of single quotes (apostrophe, character '\'') for - quoting Strings (names and String values).
      -
      ALLOW_TRAILING_COMMA -
      Feature that determines whether JsonParser will allow for a single trailing - comma following the final value (in an Array) or member (in an Object).
      -
      ALLOW_UNESCAPED_CONTROL_CHARS -
      Feature that determines whether parser will allow - JSON Strings to contain unescaped control characters - (ASCII characters with value less than 32, including - tab and line feed characters) or not.
      -
      ALLOW_UNQUOTED_FIELD_NAMES -
      Feature that determines whether parser will allow use - of unquoted field names (which is allowed by Javascript, - but not by JSON specification).
      -
      ALLOW_YAML_COMMENTS -
      Feature that determines whether parser will allow use - of YAML comments, ones starting with '#' and continuing - until the end of the line.
      -
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        ALLOW_JAVA_COMMENTS

        -
        public static final JsonReadFeature ALLOW_JAVA_COMMENTS
        -
        Feature that determines whether parser will allow use - of Java/C/C++ style comments (both '/'+'*' and - '//' varieties) within parsed content or not. -

        - Since JSON specification does not mention comments as legal - construct, - this is a non-standard feature; however, in the wild - this is extensively used. As such, feature is - disabled by default for parsers and must be - explicitly enabled.

        -
      • -
      - - - -
        -
      • -

        ALLOW_YAML_COMMENTS

        -
        public static final JsonReadFeature ALLOW_YAML_COMMENTS
        -
        Feature that determines whether parser will allow use - of YAML comments, ones starting with '#' and continuing - until the end of the line. This commenting style is common - with scripting languages as well. -

        - Since JSON specification does not mention comments as legal - construct, - this is a non-standard feature. As such, feature is - disabled by default for parsers and must be - explicitly enabled.

        -
      • -
      - - - -
        -
      • -

        ALLOW_SINGLE_QUOTES

        -
        public static final JsonReadFeature ALLOW_SINGLE_QUOTES
        -
        Feature that determines whether parser will allow use - of single quotes (apostrophe, character '\'') for - quoting Strings (names and String values). If so, - this is in addition to other acceptable markers. -

        - Since JSON specification requires use of double quotes for - field names, - this is a non-standard feature, and as such disabled by default.

        -
      • -
      - - - -
        -
      • -

        ALLOW_UNQUOTED_FIELD_NAMES

        -
        public static final JsonReadFeature ALLOW_UNQUOTED_FIELD_NAMES
        -
        Feature that determines whether parser will allow use - of unquoted field names (which is allowed by Javascript, - but not by JSON specification). -

        - Since JSON specification requires use of double quotes for - field names, - this is a non-standard feature, and as such disabled by default.

        -
      • -
      - - - -
        -
      • -

        ALLOW_UNESCAPED_CONTROL_CHARS

        -
        public static final JsonReadFeature ALLOW_UNESCAPED_CONTROL_CHARS
        -
        Feature that determines whether parser will allow - JSON Strings to contain unescaped control characters - (ASCII characters with value less than 32, including - tab and line feed characters) or not. - If feature is set false, an exception is thrown if such a - character is encountered. -

        - Since JSON specification requires quoting for all control characters, - this is a non-standard feature, and as such disabled by default.

        -
      • -
      - - - -
        -
      • -

        ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER

        -
        public static final JsonReadFeature ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER
        -
        Feature that can be enabled to accept quoting of all character - using backslash quoting mechanism: if not enabled, only characters - that are explicitly listed by JSON specification can be thus - escaped (see JSON spec for small list of these characters) -

        - Since JSON specification requires quoting for all control characters, - this is a non-standard feature, and as such disabled by default.

        -
      • -
      - - - -
        -
      • -

        ALLOW_LEADING_ZEROS_FOR_NUMBERS

        -
        public static final JsonReadFeature ALLOW_LEADING_ZEROS_FOR_NUMBERS
        -
        Feature that determines whether parser will allow - JSON integral numbers to start with additional (ignorable) - zeroes (like: 000001). If enabled, no exception is thrown, and extra - nulls are silently ignored (and not included in textual representation - exposed via JsonParser.getText()). -

        - Since JSON specification does not allow leading zeroes, - this is a non-standard feature, and as such disabled by default.

        -
      • -
      - - - -
        -
      • -

        ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS

        -
        public static final JsonReadFeature ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS
        -
        Feature that determines whether parser will allow - JSON decimal numbers to start with a decimal point - (like: .123). If enabled, no exception is thrown, and the number - is parsed as though a leading 0 had been present. -

        - Since JSON specification does not allow leading decimal, - this is a non-standard feature, and as such disabled by default.

        -
      • -
      - - - -
        -
      • -

        ALLOW_NON_NUMERIC_NUMBERS

        -
        public static final JsonReadFeature ALLOW_NON_NUMERIC_NUMBERS
        -
        Feature that allows parser to recognize set of - "Not-a-Number" (NaN) tokens as legal floating number - values (similar to how many other data formats and - programming language source code allows it). - Specific subset contains values that - XML Schema - (see section 3.2.4.1, Lexical Representation) - allows (tokens are quoted contents, not including quotes): -
          -
        • "INF" (for positive infinity), as well as alias of "Infinity" -
        • "-INF" (for negative infinity), alias "-Infinity" -
        • "NaN" (for other not-a-numbers, like result of division by zero) -
        -

        - Since JSON specification does not allow use of such values, - this is a non-standard feature, and as such disabled by default.

        -
      • -
      - - - -
        -
      • -

        ALLOW_MISSING_VALUES

        -
        public static final JsonReadFeature ALLOW_MISSING_VALUES
        -
        Feature allows the support for "missing" values in a JSON array: missing - value meaning sequence of two commas, without value in-between but only - optional white space. - Enabling this feature will expose "missing" values as JsonToken.VALUE_NULL - tokens, which typically become Java nulls in arrays and Collection - in data-binding. -

        - For example, enabling this feature will represent a JSON array ["value1",,"value3",] - as ["value1", null, "value3", null] -

        - Since the JSON specification does not allow missing values this is a non-compliant JSON - feature and is disabled by default.

        -
      • -
      - - - -
        -
      • -

        ALLOW_TRAILING_COMMA

        -
        public static final JsonReadFeature ALLOW_TRAILING_COMMA
        -
        Feature that determines whether JsonParser will allow for a single trailing - comma following the final value (in an Array) or member (in an Object). These commas - will simply be ignored. -

        - For example, when this feature is enabled, [true,true,] is equivalent to - [true, true] and {"a": true,} is equivalent to - {"a": true}. -

        - When combined with ALLOW_MISSING_VALUES, this feature takes priority, and - the final trailing comma in an array declaration does not imply a missing - (null) value. For example, when both ALLOW_MISSING_VALUES - and ALLOW_TRAILING_COMMA are enabled, [true,true,] is - equivalent to [true, true], and [true,true,,] is equivalent to - [true, true, null]. -

        - Since the JSON specification does not permit trailing commas, this is a non-standard - feature, and as such disabled by default.

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static JsonReadFeature[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (JsonReadFeature c : JsonReadFeature.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static JsonReadFeature valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        collectDefaults

        -
        public static int collectDefaults()
        -
        Method that calculates bit set (flags) of all features that - are enabled by default.
        -
      • -
      - - - -
        -
      • -

        enabledByDefault

        -
        public boolean enabledByDefault()
        -
        Description copied from interface: JacksonFeature
        -
        Accessor for checking whether this feature is enabled by default.
        -
        -
        Specified by:
        -
        enabledByDefault in interface JacksonFeature
        -
        Returns:
        -
        Whether this instance is enabled by default or not
        -
        -
      • -
      - - - -
        -
      • -

        getMask

        -
        public int getMask()
        -
        Description copied from interface: JacksonFeature
        -
        Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
        -
        -
        Specified by:
        -
        getMask in interface JacksonFeature
        -
        Returns:
        -
        Bit mask of this feature
        -
        -
      • -
      - - - -
        -
      • -

        enabledIn

        -
        public boolean enabledIn(int flags)
        -
        Description copied from interface: JacksonFeature
        -
        Convenience method for checking whether feature is enabled in given bitmask.
        -
        -
        Specified by:
        -
        enabledIn in interface JacksonFeature
        -
        Parameters:
        -
        flags - Bit field that contains a set of enabled features of this type
        -
        Returns:
        -
        True if this feature is enabled in passed bit field
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonWriteContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonWriteContext.html deleted file mode 100644 index 0e2ea72bbf..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonWriteContext.html +++ /dev/null @@ -1,780 +0,0 @@ - - - - - - -JsonWriteContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class JsonWriteContext

-
-
- -
-
    -
  • -
    -
    -
    public class JsonWriteContext
    -extends TokenStreamContext
    -
    Extension of TokenStreamContext, which implements - core methods needed, and also exposes - more complete API to generator implementation classes.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        STATUS_OK_AFTER_COMMA

        -
        public static final int STATUS_OK_AFTER_COMMA
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        STATUS_OK_AFTER_COLON

        -
        public static final int STATUS_OK_AFTER_COLON
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        STATUS_OK_AFTER_SPACE

        -
        public static final int STATUS_OK_AFTER_SPACE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        STATUS_EXPECT_VALUE

        -
        public static final int STATUS_EXPECT_VALUE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        STATUS_EXPECT_NAME

        -
        public static final int STATUS_EXPECT_NAME
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        _parent

        -
        protected final JsonWriteContext _parent
        -
        Parent context for this context; null for root context.
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        _currentName

        -
        protected String _currentName
        -
        Name of the field of which value is to be written; only - used for OBJECT contexts
        -
      • -
      - - - -
        -
      • -

        _currentValue

        -
        protected Object _currentValue
        -
      • -
      - - - -
        -
      • -

        _gotName

        -
        protected boolean _gotName
        -
        Marker used to indicate that we just wrote a name, and - now expect a value to write
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        reset

        -
        protected JsonWriteContext reset(int type,
        -                                 Object currValue)
        -
        Internal method to allow instance reuse: DO NOT USE unless you absolutely - know what you are doing. - Clears up state, changes type to one specified, assigns "current value"; - resets current duplicate-detection state (if any). - Parent link left as-is since it is final.
        -
      • -
      - - - - - - - -
        -
      • -

        getCurrentValue

        -
        public Object getCurrentValue()
        -
        Description copied from class: TokenStreamContext
        -
        Method for accessing currently active value being used by data-binding - (as the source of streaming data to write, or destination of data being - read), at this level in hierarchy. -

        - Note that "current value" is NOT populated (or used) by Streaming parser or generator; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Overrides:
        -
        getCurrentValue in class TokenStreamContext
        -
        Returns:
        -
        Currently active value, if one has been assigned.
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        getParent

        -
        public final JsonWriteContext getParent()
        -
        Description copied from class: TokenStreamContext
        -
        Accessor for finding parent context of this context; will - return null for root context.
        -
        -
        Specified by:
        -
        getParent in class TokenStreamContext
        -
        Returns:
        -
        Parent context of this context, if any; null for Root contexts
        -
        -
      • -
      - - - -
        -
      • -

        currentName

        -
        public final String currentName()
        -
        Description copied from class: TokenStreamContext
        -
        Method for accessing name associated with the current location. - Non-null for FIELD_NAME and value events that directly - follow field names; null for root level and array values.
        -
        -
        Specified by:
        -
        currentName in class TokenStreamContext
        -
        Returns:
        -
        Current field name within context, if any; null if none
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getDupDetector

        -
        public DupDetector getDupDetector()
        -
      • -
      - - - - - - - -
        -
      • -

        writeValue

        -
        public int writeValue()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonWriteFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonWriteFeature.html deleted file mode 100644 index 9e1c973af8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/JsonWriteFeature.html +++ /dev/null @@ -1,511 +0,0 @@ - - - - - - -JsonWriteFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Enum JsonWriteFeature

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        QUOTE_FIELD_NAMES

        -
        public static final JsonWriteFeature QUOTE_FIELD_NAMES
        -
        Feature that determines whether JSON Object field names are - quoted using double-quotes, as specified by JSON specification - or not. Ability to disable quoting was added to support use - cases where they are not usually expected, which most commonly - occurs when used straight from Javascript. -

        - Feature is enabled by default (since it is required by JSON specification).

        -
      • -
      - - - -
        -
      • -

        WRITE_NAN_AS_STRINGS

        -
        public static final JsonWriteFeature WRITE_NAN_AS_STRINGS
        -
        Feature that determines whether "NaN" ("not a number", that is, not - real number) float/double values are output as JSON strings. - The values checked are Double.Nan, - Double.POSITIVE_INFINITY and Double.NEGATIVE_INIFINTY (and - associated Float values). - If feature is disabled, these numbers are still output using - associated literal values, resulting in non-conforming - output. -

        - Feature is enabled by default.

        -
      • -
      - - - -
        -
      • -

        WRITE_NUMBERS_AS_STRINGS

        -
        public static final JsonWriteFeature WRITE_NUMBERS_AS_STRINGS
        -
        Feature that forces all regular number values to be written as JSON Strings, - instead of as JSON Numbers. - Default state is 'false', meaning that Java numbers are to - be serialized using basic numeric representation but - if enabled all such numeric values are instead written out as - JSON Strings instead. -

        - One use case is to avoid problems with Javascript limitations: - since Javascript standard specifies that all number handling - should be done using 64-bit IEEE 754 floating point values, - result being that some 64-bit integer values can not be - accurately represent (as mantissa is only 51 bit wide). -

        - Feature is disabled by default.

        -
      • -
      - - - -
        -
      • -

        ESCAPE_NON_ASCII

        -
        public static final JsonWriteFeature ESCAPE_NON_ASCII
        -
        Feature that specifies that all characters beyond 7-bit ASCII - range (i.e. code points of 128 and above) need to be output - using format-specific escapes (for JSON, backslash escapes), - if format uses escaping mechanisms (which is generally true - for textual formats but not for binary formats). -

        - Feature is disabled by default.

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static JsonWriteFeature[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (JsonWriteFeature c : JsonWriteFeature.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static JsonWriteFeature valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        collectDefaults

        -
        public static int collectDefaults()
        -
        Method that calculates bit set (flags) of all features that - are enabled by default.
        -
      • -
      - - - -
        -
      • -

        enabledByDefault

        -
        public boolean enabledByDefault()
        -
        Description copied from interface: JacksonFeature
        -
        Accessor for checking whether this feature is enabled by default.
        -
        -
        Specified by:
        -
        enabledByDefault in interface JacksonFeature
        -
        Returns:
        -
        Whether this instance is enabled by default or not
        -
        -
      • -
      - - - -
        -
      • -

        getMask

        -
        public int getMask()
        -
        Description copied from interface: JacksonFeature
        -
        Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
        -
        -
        Specified by:
        -
        getMask in interface JacksonFeature
        -
        Returns:
        -
        Bit mask of this feature
        -
        -
      • -
      - - - -
        -
      • -

        enabledIn

        -
        public boolean enabledIn(int flags)
        -
        Description copied from interface: JacksonFeature
        -
        Convenience method for checking whether feature is enabled in given bitmask.
        -
        -
        Specified by:
        -
        enabledIn in interface JacksonFeature
        -
        Parameters:
        -
        flags - Bit field that contains a set of enabled features of this type
        -
        Returns:
        -
        True if this feature is enabled in passed bit field
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/PackageVersion.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/PackageVersion.html deleted file mode 100644 index fdc210a730..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/PackageVersion.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - - -PackageVersion (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class PackageVersion

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Versioned
    -
    -
    -
    -
    public final class PackageVersion
    -extends Object
    -implements Versioned
    -
    Automatically generated from PackageVersion.java.in during - packageVersion-generate execution of maven-replacer-plugin in - pom.xml.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        VERSION

        -
        public static final Version VERSION
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PackageVersion

        -
        public PackageVersion()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        version

        -
        public Version version()
        -
        Description copied from interface: Versioned
        -
        Method called to detect version of the component that implements this interface; - returned version should never be null, but may return specific "not available" - instance (see Version for details).
        -
        -
        Specified by:
        -
        version in interface Versioned
        -
        Returns:
        -
        Version of the component
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.html deleted file mode 100644 index 1d483d00e5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.html +++ /dev/null @@ -1,1936 +0,0 @@ - - - - - - -ReaderBasedJsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class ReaderBasedJsonParser

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _icLatin1

        -
        protected static final int[] _icLatin1
        -
      • -
      - - - -
        -
      • -

        _reader

        -
        protected Reader _reader
        -
        Reader that can be used for reading more content, if one - buffer from input source, but in some cases pre-loaded buffer - is handed to the parser.
        -
      • -
      - - - -
        -
      • -

        _inputBuffer

        -
        protected char[] _inputBuffer
        -
        Current buffer from which data is read; generally data is read into - buffer from input source.
        -
      • -
      - - - -
        -
      • -

        _bufferRecyclable

        -
        protected boolean _bufferRecyclable
        -
        Flag that indicates whether the input buffer is recycable (and - needs to be returned to recycler once we are done) or not. -

        - If it is not, it also means that parser can NOT modify underlying - buffer.

        -
      • -
      - - - - - - - -
        -
      • -

        _hashSeed

        -
        protected final int _hashSeed
        -
      • -
      - - - -
        -
      • -

        _tokenIncomplete

        -
        protected boolean _tokenIncomplete
        -
        Flag that indicates that the current token has not yet - been fully processed, and needs to be finished for - some access (or skipped to obtain the next token)
        -
      • -
      - - - -
        -
      • -

        _nameStartOffset

        -
        protected long _nameStartOffset
        -
        Value of ParserBase._inputPtr at the time when the first character of - name token was read. Used for calculating token location when requested; - combined with ParserBase._currInputProcessed, may be updated appropriately - as needed.
        -
      • -
      - - - -
        -
      • -

        _nameStartRow

        -
        protected int _nameStartRow
        -
        -
        Since:
        -
        2.7
        -
        -
      • -
      - - - -
        -
      • -

        _nameStartCol

        -
        protected int _nameStartCol
        -
        -
        Since:
        -
        2.7
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ReaderBasedJsonParser

        -
        public ReaderBasedJsonParser(ObjectReadContext readCtxt,
        -                             IOContext ctxt,
        -                             int stdFeatures,
        -                             int formatFeatures,
        -                             Reader r,
        -                             CharsToNameCanonicalizer st,
        -                             char[] inputBuffer,
        -                             int start,
        -                             int end,
        -                             boolean bufferRecyclable)
        -
        Method called when caller wants to provide input buffer directly, - and it may or may not be recyclable use standard recycle context.
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        releaseBuffered

        -
        public int releaseBuffered(Writer w)
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be called to push back any content that - has been read but not consumed by the parser. - This is usually - done after reading all content of interest using parser. - Content is released by writing it to given writer if possible; - if underlying input is char-based it can released, if not (byte-based) - it can not.
        -
        -
        Overrides:
        -
        releaseBuffered in class JsonParser
        -
        Parameters:
        -
        w - Writer to which buffered but unprocessed content is written to
        -
        Returns:
        -
        -1 if the underlying content source is not char-based - (that is, input can not be sent to Writer; - otherwise number of chars released (0 if there was nothing to release)
        -
        Throws:
        -
        IOException - if write using Writer threw exception
        -
        -
      • -
      - - - -
        -
      • -

        getInputSource

        -
        public Object getInputSource()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to get access to object that is used - to access input being parsed; this is usually either - InputStream or Reader, depending on what - parser was constructed with. - Note that returned value may be null in some cases; including - case where parser implementation does not want to exposed raw - source to caller. - In cases where input has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of parser and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Specified by:
        -
        getInputSource in class JsonParser
        -
        Returns:
        -
        Input source this parser was configured with
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        _releaseBuffers

        -
        protected void _releaseBuffers()
        -                        throws IOException
        -
        Method called to release internal buffers owned by the base - reader. This may be called along with _closeInput() (for - example, when explicitly closing this reader instance), or - separately (if need be).
        -
        -
        Overrides:
        -
        _releaseBuffers in class ParserBase
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _loadMoreGuaranteed

        -
        protected void _loadMoreGuaranteed()
        -                            throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getText

        -
        public final String getText()
        -                     throws IOException
        -
        Method for accessing textual representation of the current event; - if no current event (before first call to nextToken(), or - after encountering end-of-input), returns null. - Method can be called for any event.
        -
        -
        Specified by:
        -
        getText in class JsonParser
        -
        Returns:
        -
        Textual value associated with the current token (one returned - by JsonParser.nextToken() or other iteration methods)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public int getText(Writer writer)
        -            throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to read the textual representation of the current token in chunks and - pass it to the given Writer. - Conceptually same as calling: -
        -  writer.write(parser.getText());
        -
        - but should typically be more efficient as longer content does need to - be combined into a single String to return, and write - can occur directly from intermediate buffers Jackson uses.
        -
        -
        Overrides:
        -
        getText in class JsonParser
        -
        Parameters:
        -
        writer - Writer to write textual content to
        -
        Returns:
        -
        The number of characters written to the Writer
        -
        Throws:
        -
        IOException - for low-level read issues or writes using passed - writer, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public final String getValueAsString()
        -                              throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), default value of - null will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class ParserMinimalBase
        -
        Returns:
        -
        String value current token is converted to, if possible; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public final String getValueAsString(String defValue)
        -                              throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), specified default value - will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class ParserMinimalBase
        -
        Parameters:
        -
        defValue - Default value to return if conversion to String is not possible
        -
        Returns:
        -
        String value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getTextCharacters

        -
        public final char[] getTextCharacters()
        -                               throws IOException
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.getText(), but that will return - underlying (unmodifiable) character array that contains - textual value, instead of constructing a String object - to contain this information. - Note, however, that: -
          -
        • Textual contents are not guaranteed to start at - index 0 (rather, call JsonParser.getTextOffset()) to - know the actual offset -
        • -
        • Length of textual contents may be less than the - length of returned buffer: call JsonParser.getTextLength() - for actual length of returned content. -
        • -
        -

        - Note that caller MUST NOT modify the returned - character array in any way -- doing so may corrupt - current parser state and render parser instance useless. -

        - The only reason to call this method (over JsonParser.getText()) - is to avoid construction of a String object (which - will make a copy of contents).

        -
        -
        Specified by:
        -
        getTextCharacters in class JsonParser
        -
        Returns:
        -
        Buffer that contains the current textual value (but not necessarily - at offset 0, and not necessarily until the end of buffer)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getBinaryValue

        -
        public byte[] getBinaryValue(Base64Variant b64variant)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be used to read (and consume -- results - may not be accessible using other methods after the call) - base64-encoded binary data - included in the current textual JSON value. - It works similar to getting String value via JsonParser.getText() - and decoding result (except for decoding part), - but should be significantly more performant. -

        - Note that non-decoded textual contents of the current token - are not guaranteed to be accessible after this method - is called. Current implementation, for example, clears up - textual content during decoding. - Decoded binary content, however, will be retained until - parser is advanced to the next event.

        -
        -
        Overrides:
        -
        getBinaryValue in class ParserBase
        -
        Parameters:
        -
        b64variant - Expected variant of base64 encoded - content (see Base64Variants for definitions - of "standard" variants).
        -
        Returns:
        -
        Decoded binary data
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        nextToken

        -
        public final JsonToken nextToken()
        -                          throws IOException
        -
        Description copied from class: JsonParser
        -
        Main iteration method, which will advance stream enough - to determine type of the next token, if any. If none - remaining (stream has no content other than possible - white space before ending), null will be returned.
        -
        -
        Specified by:
        -
        nextToken in class JsonParser
        -
        Returns:
        -
        Next token from the stream, if any found, or null - to indicate end-of-input
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        finishToken

        -
        public void finishToken()
        -                 throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that may be used to force full handling of the current token - so that even if lazy processing is enabled, the whole contents are - read for possible retrieval. This is usually used to ensure that - the token end location is available, as well as token contents - (similar to what calling, say JsonParser.getTextCharacters(), would - achieve). -

        - Note that for many dataformat implementations this method - will not do anything; this is the default implementation unless - overridden by sub-classes.

        -
        -
        Overrides:
        -
        finishToken in class ParserMinimalBase
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextFieldName

        -
        public boolean nextFieldName(SerializableString sstr)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - verifies whether it is JsonToken.FIELD_NAME with specified name - and returns result of that comparison. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName());
        -
        - but may be faster for parser to verify, and can therefore be used if caller - expects to get such a property name from input next.
        -
        -
        Overrides:
        -
        nextFieldName in class ParserMinimalBase
        -
        Parameters:
        -
        sstr - Property name to compare next token to (if next token is - JsonToken.FIELD_NAME)
        -
        Returns:
        -
        True if parser advanced to JsonToken.FIELD_NAME with - specified name; false otherwise (different token or non-matching name)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _isNextTokenNameMaybe

        -
        protected boolean _isNextTokenNameMaybe(int i,
        -                                        String nameToMatch)
        -                                 throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        nextTextValue

        -
        public final String nextTextValue()
        -                           throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_STRING returns contained String value; - otherwise returns null. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_STRING) ? getText() : null;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a String value next from input.
        -
        -
        Overrides:
        -
        nextTextValue in class JsonParser
        -
        Returns:
        -
        Text value of the JsonToken.VALUE_STRING token parser advanced - to; or null if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextIntValue

        -
        public final int nextIntValue(int defaultValue)
        -                       throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 32-bit int value; - otherwise returns specified default value - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get an int value next from input. -

        - NOTE: value checks are performed similar to JsonParser.getIntValue()

        -
        -
        Overrides:
        -
        nextIntValue in class JsonParser
        -
        Parameters:
        -
        defaultValue - Value to return if next token is NOT of type JsonToken.VALUE_NUMBER_INT
        -
        Returns:
        -
        Integer (int) value of the JsonToken.VALUE_NUMBER_INT token parser advanced - to; or defaultValue if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        InputCoercionException - if integer number does not fit in Java int
        -
        -
      • -
      - - - -
        -
      • -

        nextLongValue

        -
        public final long nextLongValue(long defaultValue)
        -                         throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 64-bit long value; - otherwise returns specified default value - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a long value next from input. -

        - NOTE: value checks are performed similar to JsonParser.getLongValue()

        -
        -
        Overrides:
        -
        nextLongValue in class JsonParser
        -
        Parameters:
        -
        defaultValue - Value to return if next token is NOT of type JsonToken.VALUE_NUMBER_INT
        -
        Returns:
        -
        long value of the JsonToken.VALUE_NUMBER_INT token parser advanced - to; or defaultValue if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        InputCoercionException - if integer number does not fit in Java long
        -
        -
      • -
      - - - -
        -
      • -

        nextBooleanValue

        -
        public final Boolean nextBooleanValue()
        -                               throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE - returns matching Boolean value; otherwise return null. - It is functionally equivalent to: -
        -  JsonToken t = nextToken();
        -  if (t == JsonToken.VALUE_TRUE) return Boolean.TRUE;
        -  if (t == JsonToken.VALUE_FALSE) return Boolean.FALSE;
        -  return null;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a Boolean value next from input.
        -
        -
        Overrides:
        -
        nextBooleanValue in class JsonParser
        -
        Returns:
        -
        Boolean value of the JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE - token parser advanced to; or null if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _parsePosNumber

        -
        protected final JsonToken _parsePosNumber(int ch)
        -                                   throws IOException
        -
        Initial parsing method for number values. It needs to be able - to parse enough input to be able to determine whether the - value is to be considered a simple integer value, or a more - generic decimal value: latter of which needs to be expressed - as a floating point number. The basic rule is that if the number - has no fractional or exponential part, it is an integer; otherwise - a floating point number. -

        - Because much of input has to be processed in any case, no partial - parsing is done: all input text will be stored for further - processing. However, actual numeric value conversion will be - deferred, since it is usually the most complicated and costliest - part of processing.

        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _handleInvalidNumberStart

        -
        protected JsonToken _handleInvalidNumberStart(int ch,
        -                                              boolean negative)
        -                                       throws IOException
        -
        Method called if expected numeric value (due to leading sign) does not - look like a number
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _handleOddName

        -
        protected String _handleOddName(int i)
        -                         throws IOException
        -
        Method called when we see non-white space character other - than double quote, when expecting a field name. - In standard mode will just throw an expection; but - in non-standard modes may be able to parse name.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _handleOddValue

        -
        protected JsonToken _handleOddValue(int i)
        -                             throws IOException
        -
        Method for handling cases where first non-space character - of an expected value token is not legal for standard JSON content.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        _skipString

        -
        protected final void _skipString()
        -                          throws IOException
        -
        Method called to skim through rest of unparsed String value, - if it is not needed. This can be done bit faster if contents - need not be stored for future access.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _skipCR

        -
        protected final void _skipCR()
        -                      throws IOException
        -
        We actually need to check the character value here - (to see if we have \n following \r).
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _decodeEscaped

        -
        protected char _decodeEscaped()
        -                       throws IOException
        -
        Description copied from class: ParserBase
        -
        Method that sub-classes must implement to support escaped sequences - in base64-encoded sections. - Sub-classes that do not need base64 support can leave this as is
        -
        -
        Overrides:
        -
        _decodeEscaped in class ParserBase
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _matchToken

        -
        protected final void _matchToken(String matchStr,
        -                                 int i)
        -                          throws IOException
        -
        Helper method for checking whether input matches expected token
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _decodeBase64

        -
        protected byte[] _decodeBase64(Base64Variant b64variant)
        -                        throws IOException
        -
        Efficient handling for incremental parsing of base64-encoded - textual content.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getTokenLocation

        -
        public JsonLocation getTokenLocation()
        -
        Description copied from class: JsonParser
        -
        Method that return the starting location of the current - token; that is, position of the first character from input - that starts the current token. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getTokenLocation in class JsonParser
        -
        Returns:
        -
        Starting location of the token parser currently points to
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentLocation

        -
        public JsonLocation getCurrentLocation()
        -
        Description copied from class: JsonParser
        -
        Method that returns location of the last processed character; - usually for error reporting purposes. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - report specific boundary locations (start or end locations of tokens) - and others only return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getCurrentLocation in class JsonParser
        -
        Returns:
        -
        Location of the last processed input unit (byte or character)
        -
        -
      • -
      - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.html deleted file mode 100644 index 358aeb4ccb..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.html +++ /dev/null @@ -1,1845 +0,0 @@ - - - - - - -UTF8DataInputJsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class UTF8DataInputJsonParser

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Versioned, Closeable, AutoCloseable
    -
    -
    -
    -
    public class UTF8DataInputJsonParser
    -extends JsonParserBase
    -
    This is a concrete implementation of JsonParser, which is - based on a DataInput as the input source. -

    - Due to limitations in look-ahead (basically there's none), as well - as overhead of reading content mostly byte-by-byte, - there are some - minor differences from regular streaming parsing. Specifically: -

      -
    • Input location offsets not being tracked, as offsets would need to - be updated for each read from all over the place. If caller wants - this information, it has to track this with DataInput. - This also affects column number, so the only location information - available is the row (line) number (but even that is approximate in - case of two-byte linefeeds -- it should work with single CR or LF tho) -
    • -
    • No white space validation: - checks are simplified NOT to check for control characters. -
    • -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _icLatin1

        -
        protected static final int[] _icLatin1
        -
      • -
      - - - -
        -
      • -

        _symbols

        -
        protected final ByteQuadsCanonicalizer _symbols
        -
        Symbol table that contains field names encountered so far
        -
      • -
      - - - -
        -
      • -

        _quadBuffer

        -
        protected int[] _quadBuffer
        -
        Temporary buffer used for name parsing.
        -
      • -
      - - - -
        -
      • -

        _tokenIncomplete

        -
        protected boolean _tokenIncomplete
        -
        Flag that indicates that the current token has not yet - been fully processed, and needs to be finished for - some access (or skipped to obtain the next token)
        -
      • -
      - - - -
        -
      • -

        _inputData

        -
        protected DataInput _inputData
        -
      • -
      - - - -
        -
      • -

        _nextByte

        -
        protected int _nextByte
        -
        Sometimes we need buffering for just a single byte we read but - have to "push back"
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        releaseBuffered

        -
        public int releaseBuffered(OutputStream out)
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be called to push back any content that - has been read but not consumed by the parser. This is usually - done after reading all content of interest using parser. - Content is released by writing it to given stream if possible; - if underlying input is byte-based it can released, if not (char-based) - it can not.
        -
        -
        Overrides:
        -
        releaseBuffered in class JsonParser
        -
        Parameters:
        -
        out - OutputStream to which buffered, undecoded content is written to
        -
        Returns:
        -
        -1 if the underlying content source is not byte based - (that is, input can not be sent to OutputStream; - otherwise number of bytes released (0 if there was nothing to release)
        -
        Throws:
        -
        IOException - if write to stream threw exception
        -
        -
      • -
      - - - -
        -
      • -

        getInputSource

        -
        public Object getInputSource()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to get access to object that is used - to access input being parsed; this is usually either - InputStream or Reader, depending on what - parser was constructed with. - Note that returned value may be null in some cases; including - case where parser implementation does not want to exposed raw - source to caller. - In cases where input has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of parser and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Specified by:
        -
        getInputSource in class JsonParser
        -
        Returns:
        -
        Input source this parser was configured with
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _releaseBuffers

        -
        protected void _releaseBuffers()
        -                        throws IOException
        -
        Method called to release internal buffers owned by the base - reader. This may be called along with _closeInput() (for - example, when explicitly closing this reader instance), or - separately (if need be).
        -
        -
        Overrides:
        -
        _releaseBuffers in class ParserBase
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public String getText()
        -               throws IOException
        -
        Description copied from class: JsonParser
        -
        Method for accessing textual representation of the current token; - if no current token (before first call to JsonParser.nextToken(), or - after encountering end-of-input), returns null. - Method can be called for any token type.
        -
        -
        Specified by:
        -
        getText in class JsonParser
        -
        Returns:
        -
        Textual value associated with the current token (one returned - by JsonParser.nextToken() or other iteration methods)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public int getText(Writer writer)
        -            throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to read the textual representation of the current token in chunks and - pass it to the given Writer. - Conceptually same as calling: -
        -  writer.write(parser.getText());
        -
        - but should typically be more efficient as longer content does need to - be combined into a single String to return, and write - can occur directly from intermediate buffers Jackson uses.
        -
        -
        Overrides:
        -
        getText in class JsonParser
        -
        Parameters:
        -
        writer - Writer to write textual content to
        -
        Returns:
        -
        The number of characters written to the Writer
        -
        Throws:
        -
        IOException - for low-level read issues or writes using passed - writer, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString()
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), default value of - null will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class ParserMinimalBase
        -
        Returns:
        -
        String value current token is converted to, if possible; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString(String defValue)
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), specified default value - will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class ParserMinimalBase
        -
        Parameters:
        -
        defValue - Default value to return if conversion to String is not possible
        -
        Returns:
        -
        String value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt()
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - Java int value. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - default value of 0 will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsInt in class ParserMinimalBase
        -
        Returns:
        -
        int value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt(int defValue)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - int. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsInt in class ParserMinimalBase
        -
        Parameters:
        -
        defValue - Default value to return if conversion to int is not possible
        -
        Returns:
        -
        int value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getTextCharacters

        -
        public char[] getTextCharacters()
        -                         throws IOException
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.getText(), but that will return - underlying (unmodifiable) character array that contains - textual value, instead of constructing a String object - to contain this information. - Note, however, that: -
          -
        • Textual contents are not guaranteed to start at - index 0 (rather, call JsonParser.getTextOffset()) to - know the actual offset -
        • -
        • Length of textual contents may be less than the - length of returned buffer: call JsonParser.getTextLength() - for actual length of returned content. -
        • -
        -

        - Note that caller MUST NOT modify the returned - character array in any way -- doing so may corrupt - current parser state and render parser instance useless. -

        - The only reason to call this method (over JsonParser.getText()) - is to avoid construction of a String object (which - will make a copy of contents).

        -
        -
        Specified by:
        -
        getTextCharacters in class JsonParser
        -
        Returns:
        -
        Buffer that contains the current textual value (but not necessarily - at offset 0, and not necessarily until the end of buffer)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getBinaryValue

        -
        public byte[] getBinaryValue(Base64Variant b64variant)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be used to read (and consume -- results - may not be accessible using other methods after the call) - base64-encoded binary data - included in the current textual JSON value. - It works similar to getting String value via JsonParser.getText() - and decoding result (except for decoding part), - but should be significantly more performant. -

        - Note that non-decoded textual contents of the current token - are not guaranteed to be accessible after this method - is called. Current implementation, for example, clears up - textual content during decoding. - Decoded binary content, however, will be retained until - parser is advanced to the next event.

        -
        -
        Overrides:
        -
        getBinaryValue in class ParserBase
        -
        Parameters:
        -
        b64variant - Expected variant of base64 encoded - content (see Base64Variants for definitions - of "standard" variants).
        -
        Returns:
        -
        Decoded binary data
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        nextToken

        -
        public JsonToken nextToken()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Main iteration method, which will advance stream enough - to determine type of the next token, if any. If none - remaining (stream has no content other than possible - white space before ending), null will be returned.
        -
        -
        Specified by:
        -
        nextToken in class JsonParser
        -
        Returns:
        -
        Next token from the stream, if any found, or null - to indicate end-of-input
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        finishToken

        -
        public void finishToken()
        -                 throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that may be used to force full handling of the current token - so that even if lazy processing is enabled, the whole contents are - read for possible retrieval. This is usually used to ensure that - the token end location is available, as well as token contents - (similar to what calling, say JsonParser.getTextCharacters(), would - achieve). -

        - Note that for many dataformat implementations this method - will not do anything; this is the default implementation unless - overridden by sub-classes.

        -
        -
        Overrides:
        -
        finishToken in class ParserMinimalBase
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        nextTextValue

        -
        public String nextTextValue()
        -                     throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_STRING returns contained String value; - otherwise returns null. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_STRING) ? getText() : null;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a String value next from input.
        -
        -
        Overrides:
        -
        nextTextValue in class JsonParser
        -
        Returns:
        -
        Text value of the JsonToken.VALUE_STRING token parser advanced - to; or null if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextIntValue

        -
        public int nextIntValue(int defaultValue)
        -                 throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 32-bit int value; - otherwise returns specified default value - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get an int value next from input. -

        - NOTE: value checks are performed similar to JsonParser.getIntValue()

        -
        -
        Overrides:
        -
        nextIntValue in class JsonParser
        -
        Parameters:
        -
        defaultValue - Value to return if next token is NOT of type JsonToken.VALUE_NUMBER_INT
        -
        Returns:
        -
        Integer (int) value of the JsonToken.VALUE_NUMBER_INT token parser advanced - to; or defaultValue if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        InputCoercionException - if integer number does not fit in Java int
        -
        -
      • -
      - - - -
        -
      • -

        nextLongValue

        -
        public long nextLongValue(long defaultValue)
        -                   throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 64-bit long value; - otherwise returns specified default value - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a long value next from input. -

        - NOTE: value checks are performed similar to JsonParser.getLongValue()

        -
        -
        Overrides:
        -
        nextLongValue in class JsonParser
        -
        Parameters:
        -
        defaultValue - Value to return if next token is NOT of type JsonToken.VALUE_NUMBER_INT
        -
        Returns:
        -
        long value of the JsonToken.VALUE_NUMBER_INT token parser advanced - to; or defaultValue if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        InputCoercionException - if integer number does not fit in Java long
        -
        -
      • -
      - - - -
        -
      • -

        nextBooleanValue

        -
        public Boolean nextBooleanValue()
        -                         throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE - returns matching Boolean value; otherwise return null. - It is functionally equivalent to: -
        -  JsonToken t = nextToken();
        -  if (t == JsonToken.VALUE_TRUE) return Boolean.TRUE;
        -  if (t == JsonToken.VALUE_FALSE) return Boolean.FALSE;
        -  return null;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a Boolean value next from input.
        -
        -
        Overrides:
        -
        nextBooleanValue in class JsonParser
        -
        Returns:
        -
        Boolean value of the JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE - token parser advanced to; or null if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _parsePosNumber

        -
        protected JsonToken _parsePosNumber(int c)
        -                             throws IOException
        -
        Initial parsing method for number values. It needs to be able - to parse enough input to be able to determine whether the - value is to be considered a simple integer value, or a more - generic decimal value: latter of which needs to be expressed - as a floating point number. The basic rule is that if the number - has no fractional or exponential part, it is an integer; otherwise - a floating point number. -

        - Because much of input has to be processed in any case, no partial - parsing is done: all input text will be stored for further - processing. However, actual numeric value conversion will be - deferred, since it is usually the most complicated and costliest - part of processing.

        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        parseEscapedName

        -
        protected final String parseEscapedName(int[] quads,
        -                                        int qlen,
        -                                        int currQuad,
        -                                        int ch,
        -                                        int currQuadBytes)
        -                                 throws IOException
        -
        Slower parsing method which is generally branched to when - an escape sequence is detected (or alternatively for long - names, one crossing input buffer boundary). - Needs to be able to handle more exceptional cases, gets slower, - and hance is offlined to a separate method.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _handleOddName

        -
        protected String _handleOddName(int ch)
        -                         throws IOException
        -
        Method called when we see non-white space character other - than double quote, when expecting a field name. - In standard mode will just throw an exception; but - in non-standard modes may be able to parse name.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        _skipString

        -
        protected void _skipString()
        -                    throws IOException
        -
        Method called to skim through rest of unparsed String value, - if it is not needed. This can be done bit faster if contents - need not be stored for future access.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _handleUnexpectedValue

        -
        protected JsonToken _handleUnexpectedValue(int c)
        -                                    throws IOException
        -
        Method for handling cases where first non-space character - of an expected value token is not legal for standard JSON content.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _handleInvalidNumberStart

        -
        protected JsonToken _handleInvalidNumberStart(int ch,
        -                                              boolean neg)
        -                                       throws IOException
        -
        Method called if expected numeric value (due to leading sign) does not - look like a number
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _decodeEscaped

        -
        protected char _decodeEscaped()
        -                       throws IOException
        -
        Description copied from class: ParserBase
        -
        Method that sub-classes must implement to support escaped sequences - in base64-encoded sections. - Sub-classes that do not need base64 support can leave this as is
        -
        -
        Overrides:
        -
        _decodeEscaped in class ParserBase
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _decodeCharForError

        -
        protected int _decodeCharForError(int firstByte)
        -                           throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _reportInvalidToken

        -
        protected void _reportInvalidToken(int ch,
        -                                   String matchedPart)
        -                            throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        _decodeBase64

        -
        protected final byte[] _decodeBase64(Base64Variant b64variant)
        -                              throws IOException
        -
        Efficient handling for incremental parsing of base64-encoded - textual content.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getTokenLocation

        -
        public JsonLocation getTokenLocation()
        -
        Description copied from class: JsonParser
        -
        Method that return the starting location of the current - token; that is, position of the first character from input - that starts the current token. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getTokenLocation in class JsonParser
        -
        Returns:
        -
        Starting location of the token parser currently points to
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentLocation

        -
        public JsonLocation getCurrentLocation()
        -
        Description copied from class: JsonParser
        -
        Method that returns location of the last processed character; - usually for error reporting purposes. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - report specific boundary locations (start or end locations of tokens) - and others only return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getCurrentLocation in class JsonParser
        -
        Returns:
        -
        Location of the last processed input unit (byte or character)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8JsonGenerator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8JsonGenerator.html deleted file mode 100644 index 99e67542e1..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8JsonGenerator.html +++ /dev/null @@ -1,2258 +0,0 @@ - - - - - - -UTF8JsonGenerator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class UTF8JsonGenerator

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _outputStream

        -
        protected final OutputStream _outputStream
        -
        Underlying output stream used for writing JSON content.
        -
      • -
      - - - -
        -
      • -

        _quoteChar

        -
        protected final byte _quoteChar
        -
        Character used for quoting JSON Object property names - and String values.
        -
      • -
      - - - -
        -
      • -

        _outputBuffer

        -
        protected byte[] _outputBuffer
        -
        Intermediate buffer in which contents are buffered before - being written using _outputStream.
        -
      • -
      - - - -
        -
      • -

        _outputTail

        -
        protected int _outputTail
        -
        Pointer to the position right beyond the last character to output - (end marker; may be past the buffer)
        -
      • -
      - - - -
        -
      • -

        _outputEnd

        -
        protected final int _outputEnd
        -
        End marker of the output buffer; one past the last valid position - within the buffer.
        -
      • -
      - - - -
        -
      • -

        _outputMaxContiguous

        -
        protected final int _outputMaxContiguous
        -
        Maximum number of chars that we know will always fit - in the output buffer after escaping
        -
      • -
      - - - -
        -
      • -

        _charBuffer

        -
        protected char[] _charBuffer
        -
        Intermediate buffer in which characters of a String are copied - before being encoded.
        -
      • -
      - - - -
        -
      • -

        _charBufferLength

        -
        protected final int _charBufferLength
        -
        Length of _charBuffer
        -
      • -
      - - - -
        -
      • -

        _entityBuffer

        -
        protected byte[] _entityBuffer
        -
        6 character temporary buffer allocated if needed, for constructing - escape sequences
        -
      • -
      - - - -
        -
      • -

        _bufferRecyclable

        -
        protected boolean _bufferRecyclable
        -
        Flag that indicates whether the output buffer is recycable (and - needs to be returned to recycler once we are done) or not.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getOutputTarget

        -
        public Object getOutputTarget()
        -
        Description copied from class: JsonGenerator
        -
        Method that can be used to get access to object that is used - as target for generated output; this is usually either - OutputStream or Writer, depending on what - generator was constructed with. - Note that returned value may be null in some cases; including - case where implementation does not want to exposed raw - source to caller. - In cases where output has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of generator and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Specified by:
        -
        getOutputTarget in class JsonGenerator
        -
        Returns:
        -
        Output target this generator was configured with
        -
        -
      • -
      - - - -
        -
      • -

        getOutputBuffered

        -
        public int getOutputBuffered()
        -
        Description copied from class: JsonGenerator
        -
        Method for verifying amount of content that is buffered by generator - but not yet flushed to the underlying target (stream, writer), - in units (byte, char) that the generator implementation uses for buffering; - or -1 if this information is not available. - Unit used is often the same as the unit of underlying target (that is, - byte for OutputStream, - char for Writer), - but may differ if buffering is done before encoding. - Default JSON-backed implementations do use matching units.
        -
        -
        Specified by:
        -
        getOutputBuffered in class JsonGenerator
        -
        Returns:
        -
        Amount of content buffered in internal units, if amount known and - accessible; -1 if not accessible.
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public void writeFieldName(String name)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing a field name (JSON String surrounded by - double quotes: syntactically identical to a JSON String value), - possibly decorated by white space if pretty-printing is enabled. -

        - Field names can only be written in Object context (check out - JSON specification for details), when field name is expected - (field names alternate with values).

        -
        -
        Specified by:
        -
        writeFieldName in class JsonGenerator
        -
        Parameters:
        -
        name - Field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public void writeFieldName(SerializableString name)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeFieldName(String), main difference - being that it may perform better as some of processing (such as - quoting of certain characters, or encoding into external encoding - if supported by generator) can be done just once and reused for - later calls. -

        - Default implementation simple uses unprocessed name container in - serialized String; implementations are strongly encouraged to make - use of more efficient methods argument object has.

        -
        -
        Overrides:
        -
        writeFieldName in class GeneratorBase
        -
        Parameters:
        -
        name - Pre-encoded field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public final void writeStartArray()
        -                           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of a Array value - (for JSON this is character '['; plus possible white space decoration - if pretty-printing is enabled). -

        - Array values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartArray in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public final void writeStartArray(Object forValue)
        -                           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any); - null may be passed if not known or not applicable. - This value is accessible from context as "current value"
        -
        -
        Specified by:
        -
        writeStartArray in class JsonGenerator
        -
        Parameters:
        -
        forValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public final void writeStartArray(Object forValue,
        -                                  int len)
        -                           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any) - and how many elements will be written for the array before calling - JsonGenerator.writeEndArray().
        -
        -
        Overrides:
        -
        writeStartArray in class JsonGeneratorBase
        -
        Parameters:
        -
        forValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        len - Number of elements this Array will have: actual - number of values written (before matching call to - JsonGenerator.writeEndArray() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndArray

        -
        public final void writeEndArray()
        -                         throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing closing marker of a JSON Array value - (character ']'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Array.

        -
        -
        Specified by:
        -
        writeEndArray in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public final void writeStartObject()
        -                            throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - (character '{'; plus possible white space decoration - if pretty-printing is enabled). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartObject in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object forValue)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartObject in class JsonGenerator
        -
        Parameters:
        -
        forValue - Java Object that Object being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object forValue,
        -                             int size)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. - In addition, caller knows number of key/value pairs ("properties") - that will get written for the Object value: this is relevant for - some format backends (but not, as an example, for JSON). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Overrides:
        -
        writeStartObject in class JsonGeneratorBase
        -
        Parameters:
        -
        forValue - Object value to be written (assigned as "current value" for - the Object context that gets created)
        -
        size - Number of key/value pairs this Object will have: actual - number of entries written (before matching call to - JsonGenerator.writeEndObject() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndObject

        -
        public final void writeEndObject()
        -                          throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing closing marker of an Object value - (character '}'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Object, and the last written event was either a - complete value, or START-OBJECT marker (see JSON specification - for more details).

        -
        -
        Specified by:
        -
        writeEndObject in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        _writePPFieldName

        -
        protected final void _writePPFieldName(String name)
        -                                throws IOException
        -
        Specialized version of _writeFieldName, off-lined - to keep the "fast path" as simple (and hopefully fast) as possible.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeString

        -
        public void writeString(String text)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Specified by:
        -
        writeString in class JsonGenerator
        -
        Parameters:
        -
        text - String value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(Reader reader,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification. - If len is < 0, then write all contents of the reader. - Otherwise, write only len characters. -

        - Note: actual length of content available may exceed len but - can not be less than it: if not enough content available, a - JsonGenerationException will be thrown.

        -
        -
        Overrides:
        -
        writeString in class JsonGenerator
        -
        Parameters:
        -
        reader - Reader to use for reading Text value to write
        -
        len - Maximum Length of Text value to read (in chars, non-negative) - if known; -1 to indicate "read and write it all"
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer; or if length (len) is specified but - reader does not provide enough content
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(char[] text,
        -                        int offset,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Specified by:
        -
        writeString in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first character of String value to write
        -
        len - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeRawUTF8String

        -
        public void writeRawUTF8String(byte[] text,
        -                               int offset,
        -                               int length)
        -                        throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeString(String) but that takes as - its input a UTF-8 encoded String that is to be output as-is, without additional - escaping (type of which depends on data format; backslashes for JSON). - However, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - If so, implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Specified by:
        -
        writeRawUTF8String in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        length - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeUTF8String

        -
        public void writeUTF8String(byte[] text,
        -                            int offset,
        -                            int len)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeString(String) but that takes as its input - a UTF-8 encoded String which has not been escaped using whatever - escaping scheme data format requires (for JSON that is backslash-escaping - for control characters and double-quotes; for other formats something else). - This means that textual JSON backends need to check if value needs - JSON escaping, but otherwise can just be copied as is to output. - Also, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - In this case - generator implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Specified by:
        -
        writeUTF8String in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        len - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(String text)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - Textual contents to include as-is in output.
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(String text,
        -                     int offset,
        -                     int len)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - String that has contents to include as-is in output
        -
        offset - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(SerializableString text)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException. -

        - The default implementation delegates to JsonGenerator.writeRaw(String); - other backends that support raw inclusion of text are encouraged - to implement it in more efficient manner (especially if they - use UTF-8 encoding).

        -
        -
        Overrides:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - Pre-encoded textual contents to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeRaw

        -
        public final void writeRaw(char[] cbuf,
        -                           int offset,
        -                           int len)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        cbuf - Buffer that has contents to include as-is in output
        -
        offset - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(char ch)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        ch - Character to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public void writeBinary(Base64Variant b64variant,
        -                        byte[] data,
        -                        int offset,
        -                        int len)
        -                 throws IOException,
        -                        JsonGenerationException
        -
        Description copied from class: JsonGenerator
        -
        Method that will output given chunk of binary data as base64 - encoded, as a complete String value (surrounded by double quotes). - This method defaults -

        - Note: because JSON Strings can not contain unescaped linefeeds, - if linefeeds are included (as per last argument), they must be - escaped. This adds overhead for decoding without improving - readability. - Alternatively if linefeeds are not included, - resulting String value may violate the requirement of base64 - RFC which mandates line-length of 76 characters and use of - linefeeds. However, all JsonParser implementations - are required to accept such "long line base64"; as do - typical production-level base64 decoders.

        -
        -
        Specified by:
        -
        writeBinary in class JsonGenerator
        -
        Parameters:
        -
        b64variant - Base64 variant to use: defines details such as - whether padding is used (and if so, using which character); - what is the maximum line length before adding linefeed, - and also the underlying alphabet to use.
        -
        data - Buffer that contains binary data to write
        -
        offset - Offset in data of the first byte of data to write
        -
        len - Length of data to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        JsonGenerationException
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public int writeBinary(Base64Variant b64variant,
        -                       InputStream data,
        -                       int dataLength)
        -                throws IOException,
        -                       JsonGenerationException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeBinary(Base64Variant,byte[],int,int), - but where input is provided through a stream, allowing for incremental - writes without holding the whole input in memory.
        -
        -
        Overrides:
        -
        writeBinary in class GeneratorBase
        -
        Parameters:
        -
        b64variant - Base64 variant to use
        -
        data - InputStream to use for reading binary data to write. - Will not be closed after successful write operation
        -
        dataLength - (optional) number of bytes that will be available; - or -1 to be indicate it is not known. - If a positive length is given, data MUST provide at least - that many bytes: if not, an exception will be thrown. - Note that implementations - need not support cases where length is not known in advance; this - depends on underlying data format: JSON output does NOT require length, - other formats may.
        -
        Returns:
        -
        Number of bytes read from data and written as binary payload
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        JsonGenerationException
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(short s)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        s - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(int i)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        i - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(long l)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        l - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(BigInteger value)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        value - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(double d)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        d - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(float f)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        f - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(BigDecimal value)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        value - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(String encodedValue)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Write method that can be used for custom numeric types that can - not be (easily?) converted to "standard" Java number types. - Because numbers are not surrounded by double quotes, regular - JsonGenerator.writeString(java.lang.String) method can not be used; nor - JsonGenerator.writeRaw(java.lang.String) because that does not properly handle - value separators needed in Array or Object contexts. -

        - Note: because of lack of type safety, some generator - implementations may not be able to implement this - method. For example, if a binary JSON format is used, - it may require type information for encoding; similarly - for generator-wrappers around Java objects or JSON nodes. - If implementation does not implement this method, - it needs to throw UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        encodedValue - Textual (possibly format) number representation to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(char[] encodedValueBuffer,
        -                        int offset,
        -                        int length)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Overloaded version of JsonGenerator.writeNumber(String) with same semantics - but possibly more efficient operation.
        -
        -
        Overrides:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        encodedValueBuffer - Buffer that contains the textual number representation to write
        -
        offset - Offset of the first character of value to write
        -
        length - Length of the value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBoolean

        -
        public void writeBoolean(boolean state)
        -                  throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting literal JSON boolean value (one of - Strings 'true' and 'false'). - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeBoolean in class JsonGenerator
        -
        Parameters:
        -
        state - Boolean value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNull

        -
        public void writeNull()
        -               throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting literal JSON null value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNull in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        _verifyValueWrite

        -
        protected final void _verifyValueWrite(String typeMsg)
        -                                throws IOException
        -
        Description copied from class: GeneratorBase
        -
        Method called before trying to write a value (scalar or structured), - to verify that this is legal in current output state, as well as to - output separators if and as necessary.
        -
        -
        Specified by:
        -
        _verifyValueWrite in class GeneratorBase
        -
        Parameters:
        -
        typeMsg - Additional message used for generating exception message - if value output is NOT legal in current generator output state.
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to flush any buffered content to the underlying - target (output stream, writer), and to flush the target itself - as well.
        -
        -
        Specified by:
        -
        flush in interface Flushable
        -
        Specified by:
        -
        flush in class GeneratorBase
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to close this generator, so that no more content - can be written. -

        - Whether the underlying target (stream, writer) gets closed depends - on whether this generator either manages the target (i.e. is the - only one with access to the target -- case if caller passes a - reference to the resource such as File, but not stream); or - has feature StreamWriteFeature.AUTO_CLOSE_TARGET enabled. - If either of above is true, the target is also closed. Otherwise - (not managing, feature not enabled), target is not closed.

        -
        -
        Specified by:
        -
        close in interface Closeable
        -
        Specified by:
        -
        close in interface AutoCloseable
        -
        Overrides:
        -
        close in class GeneratorBase
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        _releaseBuffers

        -
        protected void _releaseBuffers()
        -
        Description copied from class: GeneratorBase
        -
        Method called to release any buffers generator may be holding, - once generator is being closed.
        -
        -
        Specified by:
        -
        _releaseBuffers in class GeneratorBase
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        _outputSurrogates

        -
        protected final void _outputSurrogates(int surr1,
        -                                       int surr2)
        -                                throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.html deleted file mode 100644 index 2304b8888f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.html +++ /dev/null @@ -1,2336 +0,0 @@ - - - - - - -UTF8StreamJsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class UTF8StreamJsonParser

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _icLatin1

        -
        protected static final int[] _icLatin1
        -
      • -
      - - - -
        -
      • -

        _symbols

        -
        protected final ByteQuadsCanonicalizer _symbols
        -
        Symbol table that contains field names encountered so far
        -
      • -
      - - - -
        -
      • -

        _quadBuffer

        -
        protected int[] _quadBuffer
        -
        Temporary buffer used for name parsing.
        -
      • -
      - - - -
        -
      • -

        _tokenIncomplete

        -
        protected boolean _tokenIncomplete
        -
        Flag that indicates that the current token has not yet - been fully processed, and needs to be finished for - some access (or skipped to obtain the next token)
        -
      • -
      - - - -
        -
      • -

        _nameStartOffset

        -
        protected int _nameStartOffset
        -
        Value of ParserBase._inputPtr at the time when the first character of - name token was read. Used for calculating token location when requested; - combined with ParserBase._currInputProcessed, may be updated appropriately - as needed.
        -
      • -
      - - - -
        -
      • -

        _nameStartRow

        -
        protected int _nameStartRow
        -
      • -
      - - - -
        -
      • -

        _nameStartCol

        -
        protected int _nameStartCol
        -
      • -
      - - - -
        -
      • -

        _inputStream

        -
        protected InputStream _inputStream
        -
      • -
      - - - -
        -
      • -

        _inputBuffer

        -
        protected byte[] _inputBuffer
        -
        Current buffer from which data is read; generally data is read into - buffer from input source, but in some cases pre-loaded buffer - is handed to the parser.
        -
      • -
      - - - -
        -
      • -

        _bufferRecyclable

        -
        protected boolean _bufferRecyclable
        -
        Flag that indicates whether the input buffer is recycable (and - needs to be returned to recycler once we are done) or not. -

        - If it is not, it also means that parser can NOT modify underlying - buffer.

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        UTF8StreamJsonParser

        -
        public UTF8StreamJsonParser(ObjectReadContext readCtxt,
        -                            IOContext ctxt,
        -                            int stdFeatures,
        -                            int formatReadFeatures,
        -                            InputStream in,
        -                            ByteQuadsCanonicalizer sym,
        -                            byte[] inputBuffer,
        -                            int start,
        -                            int end,
        -                            int bytesPreProcessed,
        -                            boolean bufferRecyclable)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        releaseBuffered

        -
        public int releaseBuffered(OutputStream out)
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be called to push back any content that - has been read but not consumed by the parser. This is usually - done after reading all content of interest using parser. - Content is released by writing it to given stream if possible; - if underlying input is byte-based it can released, if not (char-based) - it can not.
        -
        -
        Overrides:
        -
        releaseBuffered in class JsonParser
        -
        Parameters:
        -
        out - OutputStream to which buffered, undecoded content is written to
        -
        Returns:
        -
        -1 if the underlying content source is not byte based - (that is, input can not be sent to OutputStream; - otherwise number of bytes released (0 if there was nothing to release)
        -
        Throws:
        -
        IOException - if write to stream threw exception
        -
        -
      • -
      - - - -
        -
      • -

        getInputSource

        -
        public Object getInputSource()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to get access to object that is used - to access input being parsed; this is usually either - InputStream or Reader, depending on what - parser was constructed with. - Note that returned value may be null in some cases; including - case where parser implementation does not want to exposed raw - source to caller. - In cases where input has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of parser and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Specified by:
        -
        getInputSource in class JsonParser
        -
        Returns:
        -
        Input source this parser was configured with
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        _releaseBuffers

        -
        protected void _releaseBuffers()
        -                        throws IOException
        -
        Method called to release internal buffers owned by the base - reader. This may be called along with _closeInput() (for - example, when explicitly closing this reader instance), or - separately (if need be).
        -
        -
        Overrides:
        -
        _releaseBuffers in class ParserBase
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public String getText()
        -               throws IOException
        -
        Description copied from class: JsonParser
        -
        Method for accessing textual representation of the current token; - if no current token (before first call to JsonParser.nextToken(), or - after encountering end-of-input), returns null. - Method can be called for any token type.
        -
        -
        Specified by:
        -
        getText in class JsonParser
        -
        Returns:
        -
        Textual value associated with the current token (one returned - by JsonParser.nextToken() or other iteration methods)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public int getText(Writer writer)
        -            throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to read the textual representation of the current token in chunks and - pass it to the given Writer. - Conceptually same as calling: -
        -  writer.write(parser.getText());
        -
        - but should typically be more efficient as longer content does need to - be combined into a single String to return, and write - can occur directly from intermediate buffers Jackson uses.
        -
        -
        Overrides:
        -
        getText in class JsonParser
        -
        Parameters:
        -
        writer - Writer to write textual content to
        -
        Returns:
        -
        The number of characters written to the Writer
        -
        Throws:
        -
        IOException - for low-level read issues or writes using passed - writer, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString()
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), default value of - null will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class ParserMinimalBase
        -
        Returns:
        -
        String value current token is converted to, if possible; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString(String defValue)
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), specified default value - will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class ParserMinimalBase
        -
        Parameters:
        -
        defValue - Default value to return if conversion to String is not possible
        -
        Returns:
        -
        String value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt()
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - Java int value. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - default value of 0 will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsInt in class ParserMinimalBase
        -
        Returns:
        -
        int value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt(int defValue)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - int. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsInt in class ParserMinimalBase
        -
        Parameters:
        -
        defValue - Default value to return if conversion to int is not possible
        -
        Returns:
        -
        int value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getTextCharacters

        -
        public char[] getTextCharacters()
        -                         throws IOException
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.getText(), but that will return - underlying (unmodifiable) character array that contains - textual value, instead of constructing a String object - to contain this information. - Note, however, that: -
          -
        • Textual contents are not guaranteed to start at - index 0 (rather, call JsonParser.getTextOffset()) to - know the actual offset -
        • -
        • Length of textual contents may be less than the - length of returned buffer: call JsonParser.getTextLength() - for actual length of returned content. -
        • -
        -

        - Note that caller MUST NOT modify the returned - character array in any way -- doing so may corrupt - current parser state and render parser instance useless. -

        - The only reason to call this method (over JsonParser.getText()) - is to avoid construction of a String object (which - will make a copy of contents).

        -
        -
        Specified by:
        -
        getTextCharacters in class JsonParser
        -
        Returns:
        -
        Buffer that contains the current textual value (but not necessarily - at offset 0, and not necessarily until the end of buffer)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getBinaryValue

        -
        public byte[] getBinaryValue(Base64Variant b64variant)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be used to read (and consume -- results - may not be accessible using other methods after the call) - base64-encoded binary data - included in the current textual JSON value. - It works similar to getting String value via JsonParser.getText() - and decoding result (except for decoding part), - but should be significantly more performant. -

        - Note that non-decoded textual contents of the current token - are not guaranteed to be accessible after this method - is called. Current implementation, for example, clears up - textual content during decoding. - Decoded binary content, however, will be retained until - parser is advanced to the next event.

        -
        -
        Overrides:
        -
        getBinaryValue in class ParserBase
        -
        Parameters:
        -
        b64variant - Expected variant of base64 encoded - content (see Base64Variants for definitions - of "standard" variants).
        -
        Returns:
        -
        Decoded binary data
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        nextToken

        -
        public JsonToken nextToken()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Main iteration method, which will advance stream enough - to determine type of the next token, if any. If none - remaining (stream has no content other than possible - white space before ending), null will be returned.
        -
        -
        Specified by:
        -
        nextToken in class JsonParser
        -
        Returns:
        -
        Next token from the stream, if any found, or null - to indicate end-of-input
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        finishToken

        -
        public void finishToken()
        -                 throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that may be used to force full handling of the current token - so that even if lazy processing is enabled, the whole contents are - read for possible retrieval. This is usually used to ensure that - the token end location is available, as well as token contents - (similar to what calling, say JsonParser.getTextCharacters(), would - achieve). -

        - Note that for many dataformat implementations this method - will not do anything; this is the default implementation unless - overridden by sub-classes.

        -
        -
        Overrides:
        -
        finishToken in class ParserMinimalBase
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        nextFieldName

        -
        public boolean nextFieldName(SerializableString str)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - verifies whether it is JsonToken.FIELD_NAME with specified name - and returns result of that comparison. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName());
        -
        - but may be faster for parser to verify, and can therefore be used if caller - expects to get such a property name from input next.
        -
        -
        Overrides:
        -
        nextFieldName in class ParserMinimalBase
        -
        Parameters:
        -
        str - Property name to compare next token to (if next token is - JsonToken.FIELD_NAME)
        -
        Returns:
        -
        True if parser advanced to JsonToken.FIELD_NAME with - specified name; false otherwise (different token or non-matching name)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextFieldName

        -
        public int nextFieldName(FieldNameMatcher matcher)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that tries to match next token from stream as JsonToken.FIELD_NAME, - and if so, further match it to one of pre-specified (field) names. - If match succeeds, field index (non-negative `int`) is returned; otherwise one of - marker constants from FieldNameMatcher.
        -
        -
        Overrides:
        -
        nextFieldName in class ParserMinimalBase
        -
        Parameters:
        -
        matcher - Matcher that will handle actual matching
        -
        Returns:
        -
        Index of the matched field name, if non-negative, or a negative error - code otherwise (see FieldNameMatcher for details)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        nextTextValue

        -
        public String nextTextValue()
        -                     throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_STRING returns contained String value; - otherwise returns null. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_STRING) ? getText() : null;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a String value next from input.
        -
        -
        Overrides:
        -
        nextTextValue in class JsonParser
        -
        Returns:
        -
        Text value of the JsonToken.VALUE_STRING token parser advanced - to; or null if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextIntValue

        -
        public int nextIntValue(int defaultValue)
        -                 throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 32-bit int value; - otherwise returns specified default value - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get an int value next from input. -

        - NOTE: value checks are performed similar to JsonParser.getIntValue()

        -
        -
        Overrides:
        -
        nextIntValue in class JsonParser
        -
        Parameters:
        -
        defaultValue - Value to return if next token is NOT of type JsonToken.VALUE_NUMBER_INT
        -
        Returns:
        -
        Integer (int) value of the JsonToken.VALUE_NUMBER_INT token parser advanced - to; or defaultValue if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        InputCoercionException - if integer number does not fit in Java int
        -
        -
      • -
      - - - -
        -
      • -

        nextLongValue

        -
        public long nextLongValue(long defaultValue)
        -                   throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 64-bit long value; - otherwise returns specified default value - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a long value next from input. -

        - NOTE: value checks are performed similar to JsonParser.getLongValue()

        -
        -
        Overrides:
        -
        nextLongValue in class JsonParser
        -
        Parameters:
        -
        defaultValue - Value to return if next token is NOT of type JsonToken.VALUE_NUMBER_INT
        -
        Returns:
        -
        long value of the JsonToken.VALUE_NUMBER_INT token parser advanced - to; or defaultValue if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        InputCoercionException - if integer number does not fit in Java long
        -
        -
      • -
      - - - -
        -
      • -

        nextBooleanValue

        -
        public Boolean nextBooleanValue()
        -                         throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE - returns matching Boolean value; otherwise return null. - It is functionally equivalent to: -
        -  JsonToken t = nextToken();
        -  if (t == JsonToken.VALUE_TRUE) return Boolean.TRUE;
        -  if (t == JsonToken.VALUE_FALSE) return Boolean.FALSE;
        -  return null;
        -
        - but may be faster for parser to process, and can therefore be used if caller - expects to get a Boolean value next from input.
        -
        -
        Overrides:
        -
        nextBooleanValue in class JsonParser
        -
        Returns:
        -
        Boolean value of the JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE - token parser advanced to; or null if next token is of some other type
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _parsePosNumber

        -
        protected JsonToken _parsePosNumber(int c)
        -                             throws IOException
        -
        Initial parsing method for number values. It needs to be able - to parse enough input to be able to determine whether the - value is to be considered a simple integer value, or a more - generic decimal value: latter of which needs to be expressed - as a floating point number. The basic rule is that if the number - has no fractional or exponential part, it is an integer; otherwise - a floating point number. -

        - Because much of input has to be processed in any case, no partial - parsing is done: all input text will be stored for further - processing. However, actual numeric value conversion will be - deferred, since it is usually the most complicated and costliest - part of processing.

        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        slowParseName

        -
        protected String slowParseName()
        -                        throws IOException
        -
        Method called when not even first 8 bytes are guaranteed - to come consecutively. Happens rarely, so this is offlined; - plus we'll also do full checks for escaping etc.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        parseEscapedName

        -
        protected final String parseEscapedName(int[] quads,
        -                                        int qlen,
        -                                        int currQuad,
        -                                        int ch,
        -                                        int currQuadBytes)
        -                                 throws IOException
        -
        Slower parsing method which is generally branched to when an escape - sequence is detected (or alternatively for long names, one crossing - input buffer boundary). Needs to be able to handle more exceptional - cases, gets slower, and hence is offlined to a separate method.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _handleOddName

        -
        protected String _handleOddName(int ch)
        -                         throws IOException
        -
        Method called when we see non-white space character other - than double quote, when expecting a field name. - In standard mode will just throw an exception; but - in non-standard modes may be able to parse name.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _loadMoreGuaranteed

        -
        protected void _loadMoreGuaranteed()
        -                            throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        _skipString

        -
        protected void _skipString()
        -                    throws IOException
        -
        Method called to skim through rest of unparsed String value, - if it is not needed. This can be done bit faster if contents - need not be stored for future access.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _handleUnexpectedValue

        -
        protected JsonToken _handleUnexpectedValue(int c)
        -                                    throws IOException
        -
        Method for handling cases where first non-space character - of an expected value token is not legal for standard JSON content.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        _handleInvalidNumberStart

        -
        protected JsonToken _handleInvalidNumberStart(int ch,
        -                                              boolean neg)
        -                                       throws IOException
        -
        Method called if expected numeric value (due to leading sign) does not - look like a number
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        _decodeEscaped

        -
        protected char _decodeEscaped()
        -                       throws IOException
        -
        Description copied from class: ParserBase
        -
        Method that sub-classes must implement to support escaped sequences - in base64-encoded sections. - Sub-classes that do not need base64 support can leave this as is
        -
        -
        Overrides:
        -
        _decodeEscaped in class ParserBase
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _decodeCharForError

        -
        protected int _decodeCharForError(int firstByte)
        -                           throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _skipCR

        -
        protected final void _skipCR()
        -                      throws IOException
        -
        We actually need to check the character value here - (to see if we have \n following \r).
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _reportInvalidToken

        -
        protected void _reportInvalidToken(String matchedPart,
        -                                   int ptr)
        -                            throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        _decodeBase64

        -
        protected final byte[] _decodeBase64(Base64Variant b64variant)
        -                              throws IOException
        -
        Efficient handling for incremental parsing of base64-encoded - textual content.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getTokenLocation

        -
        public JsonLocation getTokenLocation()
        -
        Description copied from class: JsonParser
        -
        Method that return the starting location of the current - token; that is, position of the first character from input - that starts the current token. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getTokenLocation in class JsonParser
        -
        Returns:
        -
        Starting location of the token parser currently points to
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentLocation

        -
        public JsonLocation getCurrentLocation()
        -
        Description copied from class: JsonParser
        -
        Method that returns location of the last processed character; - usually for error reporting purposes. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - report specific boundary locations (start or end locations of tokens) - and others only return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getCurrentLocation in class JsonParser
        -
        Returns:
        -
        Location of the last processed input unit (byte or character)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/WriterBasedJsonGenerator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/WriterBasedJsonGenerator.html deleted file mode 100644 index 4905f69dcc..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/WriterBasedJsonGenerator.html +++ /dev/null @@ -1,2261 +0,0 @@ - - - - - - -WriterBasedJsonGenerator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json
-

Class WriterBasedJsonGenerator

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        HEX_CHARS

        -
        protected static final char[] HEX_CHARS
        -
      • -
      - - - -
        -
      • -

        _writer

        -
        protected final Writer _writer
        -
      • -
      - - - -
        -
      • -

        _quoteChar

        -
        protected final char _quoteChar
        -
        Character used for quoting JSON Object property names - and String values.
        -
      • -
      - - - -
        -
      • -

        _outputBuffer

        -
        protected char[] _outputBuffer
        -
        Intermediate buffer in which contents are buffered before - being written using _writer.
        -
      • -
      - - - -
        -
      • -

        _outputHead

        -
        protected int _outputHead
        -
        Pointer to the first buffered character to output
        -
      • -
      - - - -
        -
      • -

        _outputTail

        -
        protected int _outputTail
        -
        Pointer to the position right beyond the last character to output - (end marker; may point to position right beyond the end of the buffer)
        -
      • -
      - - - -
        -
      • -

        _outputEnd

        -
        protected int _outputEnd
        -
        End marker of the output buffer; one past the last valid position - within the buffer.
        -
      • -
      - - - -
        -
      • -

        _entityBuffer

        -
        protected char[] _entityBuffer
        -
        Short (14 char) temporary buffer allocated if needed, for constructing - escape sequences
        -
      • -
      - - - -
        -
      • -

        _currentEscape

        -
        protected SerializableString _currentEscape
        -
        When custom escapes are used, this member variable is used - internally to hold a reference to currently used escape
        -
      • -
      - - - -
        -
      • -

        _copyBuffer

        -
        protected char[] _copyBuffer
        -
        Intermediate buffer in which characters of a String are copied - before being encoded.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getOutputTarget

        -
        public Object getOutputTarget()
        -
        Description copied from class: JsonGenerator
        -
        Method that can be used to get access to object that is used - as target for generated output; this is usually either - OutputStream or Writer, depending on what - generator was constructed with. - Note that returned value may be null in some cases; including - case where implementation does not want to exposed raw - source to caller. - In cases where output has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of generator and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Specified by:
        -
        getOutputTarget in class JsonGenerator
        -
        Returns:
        -
        Output target this generator was configured with
        -
        -
      • -
      - - - -
        -
      • -

        getOutputBuffered

        -
        public int getOutputBuffered()
        -
        Description copied from class: JsonGenerator
        -
        Method for verifying amount of content that is buffered by generator - but not yet flushed to the underlying target (stream, writer), - in units (byte, char) that the generator implementation uses for buffering; - or -1 if this information is not available. - Unit used is often the same as the unit of underlying target (that is, - byte for OutputStream, - char for Writer), - but may differ if buffering is done before encoding. - Default JSON-backed implementations do use matching units.
        -
        -
        Specified by:
        -
        getOutputBuffered in class JsonGenerator
        -
        Returns:
        -
        Amount of content buffered in internal units, if amount known and - accessible; -1 if not accessible.
        -
        -
      • -
      - - - -
        -
      • -

        canWriteFormattedNumbers

        -
        public boolean canWriteFormattedNumbers()
        -
        Description copied from class: JsonGenerator
        -
        Introspection method to call to check whether it is possible - to write numbers using JsonGenerator.writeNumber(java.lang.String) - using possible custom format, or not. Typically textual formats - allow this (and JSON specifically does), whereas binary formats - do not allow this (except by writing them as Strings). - Usual reason for calling this method is to check whether custom - formatting of numbers may be applied by higher-level code (databinding) - or not.
        -
        -
        Overrides:
        -
        canWriteFormattedNumbers in class JsonGenerator
        -
        Returns:
        -
        True if this generator is capable of writing "formatted" - numbers (and if so, need to be passed using - JsonGenerator.writeNumber(String), that is, passed as String); - false if not
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public void writeFieldName(String name)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing a field name (JSON String surrounded by - double quotes: syntactically identical to a JSON String value), - possibly decorated by white space if pretty-printing is enabled. -

        - Field names can only be written in Object context (check out - JSON specification for details), when field name is expected - (field names alternate with values).

        -
        -
        Specified by:
        -
        writeFieldName in class JsonGenerator
        -
        Parameters:
        -
        name - Field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public void writeFieldName(SerializableString name)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeFieldName(String), main difference - being that it may perform better as some of processing (such as - quoting of certain characters, or encoding into external encoding - if supported by generator) can be done just once and reused for - later calls. -

        - Default implementation simple uses unprocessed name container in - serialized String; implementations are strongly encouraged to make - use of more efficient methods argument object has.

        -
        -
        Overrides:
        -
        writeFieldName in class GeneratorBase
        -
        Parameters:
        -
        name - Pre-encoded field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        _writeFieldName

        -
        protected final void _writeFieldName(String name,
        -                                     boolean commaBefore)
        -                              throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray()
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of a Array value - (for JSON this is character '['; plus possible white space decoration - if pretty-printing is enabled). -

        - Array values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartArray in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(Object forValue)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any); - null may be passed if not known or not applicable. - This value is accessible from context as "current value"
        -
        -
        Specified by:
        -
        writeStartArray in class JsonGenerator
        -
        Parameters:
        -
        forValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(Object forValue,
        -                            int len)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any) - and how many elements will be written for the array before calling - JsonGenerator.writeEndArray().
        -
        -
        Overrides:
        -
        writeStartArray in class JsonGeneratorBase
        -
        Parameters:
        -
        forValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        len - Number of elements this Array will have: actual - number of values written (before matching call to - JsonGenerator.writeEndArray() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndArray

        -
        public void writeEndArray()
        -                   throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing closing marker of a JSON Array value - (character ']'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Array.

        -
        -
        Specified by:
        -
        writeEndArray in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject()
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - (character '{'; plus possible white space decoration - if pretty-printing is enabled). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartObject in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object forValue)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartObject in class JsonGenerator
        -
        Parameters:
        -
        forValue - Java Object that Object being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object forValue,
        -                             int size)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. - In addition, caller knows number of key/value pairs ("properties") - that will get written for the Object value: this is relevant for - some format backends (but not, as an example, for JSON). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Overrides:
        -
        writeStartObject in class JsonGeneratorBase
        -
        Parameters:
        -
        forValue - Object value to be written (assigned as "current value" for - the Object context that gets created)
        -
        size - Number of key/value pairs this Object will have: actual - number of entries written (before matching call to - JsonGenerator.writeEndObject() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndObject

        -
        public void writeEndObject()
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing closing marker of an Object value - (character '}'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Object, and the last written event was either a - complete value, or START-OBJECT marker (see JSON specification - for more details).

        -
        -
        Specified by:
        -
        writeEndObject in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        _writePPFieldName

        -
        protected final void _writePPFieldName(String name,
        -                                       boolean commaBefore)
        -                                throws IOException
        -
        Specialized version of _writeFieldName, off-lined - to keep the "fast path" as simple (and hopefully fast) as possible.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeString

        -
        public void writeString(String text)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Specified by:
        -
        writeString in class JsonGenerator
        -
        Parameters:
        -
        text - String value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(Reader reader,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification. - If len is < 0, then write all contents of the reader. - Otherwise, write only len characters. -

        - Note: actual length of content available may exceed len but - can not be less than it: if not enough content available, a - JsonGenerationException will be thrown.

        -
        -
        Overrides:
        -
        writeString in class JsonGenerator
        -
        Parameters:
        -
        reader - Reader to use for reading Text value to write
        -
        len - Maximum Length of Text value to read (in chars, non-negative) - if known; -1 to indicate "read and write it all"
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer; or if length (len) is specified but - reader does not provide enough content
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(char[] text,
        -                        int offset,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Specified by:
        -
        writeString in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first character of String value to write
        -
        len - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeRawUTF8String

        -
        public void writeRawUTF8String(byte[] text,
        -                               int offset,
        -                               int length)
        -                        throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeString(String) but that takes as - its input a UTF-8 encoded String that is to be output as-is, without additional - escaping (type of which depends on data format; backslashes for JSON). - However, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - If so, implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Specified by:
        -
        writeRawUTF8String in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        length - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeUTF8String

        -
        public void writeUTF8String(byte[] text,
        -                            int offset,
        -                            int length)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeString(String) but that takes as its input - a UTF-8 encoded String which has not been escaped using whatever - escaping scheme data format requires (for JSON that is backslash-escaping - for control characters and double-quotes; for other formats something else). - This means that textual JSON backends need to check if value needs - JSON escaping, but otherwise can just be copied as is to output. - Also, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - In this case - generator implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Specified by:
        -
        writeUTF8String in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        length - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(String text)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - Textual contents to include as-is in output.
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(String text,
        -                     int start,
        -                     int len)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - String that has contents to include as-is in output
        -
        start - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(SerializableString text)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException. -

        - The default implementation delegates to JsonGenerator.writeRaw(String); - other backends that support raw inclusion of text are encouraged - to implement it in more efficient manner (especially if they - use UTF-8 encoding).

        -
        -
        Overrides:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - Pre-encoded textual contents to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(char[] text,
        -                     int offset,
        -                     int len)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that has contents to include as-is in output
        -
        offset - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(char c)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        c - Character to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public void writeBinary(Base64Variant b64variant,
        -                        byte[] data,
        -                        int offset,
        -                        int len)
        -                 throws IOException,
        -                        JsonGenerationException
        -
        Description copied from class: JsonGenerator
        -
        Method that will output given chunk of binary data as base64 - encoded, as a complete String value (surrounded by double quotes). - This method defaults -

        - Note: because JSON Strings can not contain unescaped linefeeds, - if linefeeds are included (as per last argument), they must be - escaped. This adds overhead for decoding without improving - readability. - Alternatively if linefeeds are not included, - resulting String value may violate the requirement of base64 - RFC which mandates line-length of 76 characters and use of - linefeeds. However, all JsonParser implementations - are required to accept such "long line base64"; as do - typical production-level base64 decoders.

        -
        -
        Specified by:
        -
        writeBinary in class JsonGenerator
        -
        Parameters:
        -
        b64variant - Base64 variant to use: defines details such as - whether padding is used (and if so, using which character); - what is the maximum line length before adding linefeed, - and also the underlying alphabet to use.
        -
        data - Buffer that contains binary data to write
        -
        offset - Offset in data of the first byte of data to write
        -
        len - Length of data to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        JsonGenerationException
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public int writeBinary(Base64Variant b64variant,
        -                       InputStream data,
        -                       int dataLength)
        -                throws IOException,
        -                       JsonGenerationException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeBinary(Base64Variant,byte[],int,int), - but where input is provided through a stream, allowing for incremental - writes without holding the whole input in memory.
        -
        -
        Overrides:
        -
        writeBinary in class GeneratorBase
        -
        Parameters:
        -
        b64variant - Base64 variant to use
        -
        data - InputStream to use for reading binary data to write. - Will not be closed after successful write operation
        -
        dataLength - (optional) number of bytes that will be available; - or -1 to be indicate it is not known. - If a positive length is given, data MUST provide at least - that many bytes: if not, an exception will be thrown. - Note that implementations - need not support cases where length is not known in advance; this - depends on underlying data format: JSON output does NOT require length, - other formats may.
        -
        Returns:
        -
        Number of bytes read from data and written as binary payload
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        JsonGenerationException
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(short s)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        s - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(int i)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        i - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(long l)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        l - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(BigInteger value)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        value - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(double d)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        d - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(float f)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        f - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(BigDecimal value)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        value - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(String encodedValue)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Write method that can be used for custom numeric types that can - not be (easily?) converted to "standard" Java number types. - Because numbers are not surrounded by double quotes, regular - JsonGenerator.writeString(java.lang.String) method can not be used; nor - JsonGenerator.writeRaw(java.lang.String) because that does not properly handle - value separators needed in Array or Object contexts. -

        - Note: because of lack of type safety, some generator - implementations may not be able to implement this - method. For example, if a binary JSON format is used, - it may require type information for encoding; similarly - for generator-wrappers around Java objects or JSON nodes. - If implementation does not implement this method, - it needs to throw UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        encodedValue - Textual (possibly format) number representation to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(char[] encodedValueBuffer,
        -                        int offset,
        -                        int length)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Overloaded version of JsonGenerator.writeNumber(String) with same semantics - but possibly more efficient operation.
        -
        -
        Overrides:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        encodedValueBuffer - Buffer that contains the textual number representation to write
        -
        offset - Offset of the first character of value to write
        -
        length - Length of the value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBoolean

        -
        public void writeBoolean(boolean state)
        -                  throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting literal JSON boolean value (one of - Strings 'true' and 'false'). - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeBoolean in class JsonGenerator
        -
        Parameters:
        -
        state - Boolean value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNull

        -
        public void writeNull()
        -               throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting literal JSON null value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNull in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        _verifyValueWrite

        -
        protected final void _verifyValueWrite(String typeMsg)
        -                                throws IOException
        -
        Description copied from class: GeneratorBase
        -
        Method called before trying to write a value (scalar or structured), - to verify that this is legal in current output state, as well as to - output separators if and as necessary.
        -
        -
        Specified by:
        -
        _verifyValueWrite in class GeneratorBase
        -
        Parameters:
        -
        typeMsg - Additional message used for generating exception message - if value output is NOT legal in current generator output state.
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to flush any buffered content to the underlying - target (output stream, writer), and to flush the target itself - as well.
        -
        -
        Specified by:
        -
        flush in interface Flushable
        -
        Specified by:
        -
        flush in class GeneratorBase
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to close this generator, so that no more content - can be written. -

        - Whether the underlying target (stream, writer) gets closed depends - on whether this generator either manages the target (i.e. is the - only one with access to the target -- case if caller passes a - reference to the resource such as File, but not stream); or - has feature StreamWriteFeature.AUTO_CLOSE_TARGET enabled. - If either of above is true, the target is also closed. Otherwise - (not managing, feature not enabled), target is not closed.

        -
        -
        Specified by:
        -
        close in interface Closeable
        -
        Specified by:
        -
        close in interface AutoCloseable
        -
        Overrides:
        -
        close in class GeneratorBase
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        _releaseBuffers

        -
        protected void _releaseBuffers()
        -
        Description copied from class: GeneratorBase
        -
        Method called to release any buffers generator may be holding, - once generator is being closed.
        -
        -
        Specified by:
        -
        _releaseBuffers in class GeneratorBase
        -
        -
      • -
      - - - - - - - - - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.html deleted file mode 100644 index ab219f3ba6..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.html +++ /dev/null @@ -1,1228 +0,0 @@ - - - - - - -NonBlockingJsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json.async
-

Class NonBlockingJsonParser

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _icLatin1

        -
        protected static final int[] _icLatin1
        -
      • -
      - - - -
        -
      • -

        _inputBuffer

        -
        protected byte[] _inputBuffer
        -
        This buffer is actually provided via NonBlockingInputFeeder
        -
      • -
      - - - -
        -
      • -

        _origBufferLen

        -
        protected int _origBufferLen
        -
        In addition to current buffer pointer, and end pointer, - we will also need to know number of bytes originally - contained. This is needed to correctly update location - information when the block has been completed.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getNonBlockingInputFeeder

        -
        public ByteArrayFeeder getNonBlockingInputFeeder()
        -
        Description copied from class: JsonParser
        -
        Method that will either return a feeder instance (if parser uses - non-blocking, aka asynchronous access); or null for - parsers that use blocking I/O.
        -
        -
        Overrides:
        -
        getNonBlockingInputFeeder in class JsonParser
        -
        Returns:
        -
        Input feeder to use with non-blocking (async) parsing
        -
        -
      • -
      - - - -
        -
      • -

        needMoreInput

        -
        public final boolean needMoreInput()
        -
        Description copied from interface: NonBlockingInputFeeder
        -
        Method called to check whether it is ok to feed more data: parser returns true - if it has no more content to parse (and it is ok to feed more); otherwise false - (and no data should yet be fed).
        -
        -
        Specified by:
        -
        needMoreInput in interface NonBlockingInputFeeder
        -
        -
      • -
      - - - -
        -
      • -

        feedInput

        -
        public void feedInput(byte[] buf,
        -                      int start,
        -                      int end)
        -               throws IOException
        -
        Description copied from interface: ByteArrayFeeder
        -
        Method that can be called to feed more data, if (and only if) - NonBlockingInputFeeder.needMoreInput() returns true.
        -
        -
        Specified by:
        -
        feedInput in interface ByteArrayFeeder
        -
        Parameters:
        -
        buf - Byte array that contains data to feed: caller must ensure data remains - stable until it is fully processed (which is true when NonBlockingInputFeeder.needMoreInput() - returns true)
        -
        start - Offset within array where input data to process starts
        -
        end - Offset after last byte contained in the input array
        -
        Throws:
        -
        IOException - if the state is such that this method should not be called - (has not yet consumed existing input data, or has been marked as closed)
        -
        -
      • -
      - - - -
        -
      • -

        endOfInput

        -
        public void endOfInput()
        -
        Description copied from interface: NonBlockingInputFeeder
        -
        Method that should be called after last chunk of data to parse has been fed - (with feedInput in sub-class); can be called regardless of what NonBlockingInputFeeder.needMoreInput() - returns. After calling this method, no more data can be fed; and parser assumes - no more data will be available.
        -
        -
        Specified by:
        -
        endOfInput in interface NonBlockingInputFeeder
        -
        -
      • -
      - - - -
        -
      • -

        releaseBuffered

        -
        public int releaseBuffered(OutputStream out)
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be called to push back any content that - has been read but not consumed by the parser. This is usually - done after reading all content of interest using parser. - Content is released by writing it to given stream if possible; - if underlying input is byte-based it can released, if not (char-based) - it can not.
        -
        -
        Specified by:
        -
        releaseBuffered in class NonBlockingJsonParserBase
        -
        Parameters:
        -
        out - OutputStream to which buffered, undecoded content is written to
        -
        Returns:
        -
        -1 if the underlying content source is not byte based - (that is, input can not be sent to OutputStream; - otherwise number of bytes released (0 if there was nothing to release)
        -
        Throws:
        -
        IOException - if write to stream threw exception
        -
        -
      • -
      - - - -
        -
      • -

        _decodeEscaped

        -
        protected char _decodeEscaped()
        -                       throws IOException
        -
        Description copied from class: ParserBase
        -
        Method that sub-classes must implement to support escaped sequences - in base64-encoded sections. - Sub-classes that do not need base64 support can leave this as is
        -
        -
        Overrides:
        -
        _decodeEscaped in class ParserBase
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        nextToken

        -
        public JsonToken nextToken()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Main iteration method, which will advance stream enough - to determine type of the next token, if any. If none - remaining (stream has no content other than possible - white space before ending), null will be returned.
        -
        -
        Specified by:
        -
        nextToken in class JsonParser
        -
        Returns:
        -
        Next token from the stream, if any found, or null - to indicate end-of-input
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        finishToken

        -
        public void finishToken()
        -                 throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that may be used to force full handling of the current token - so that even if lazy processing is enabled, the whole contents are - read for possible retrieval. This is usually used to ensure that - the token end location is available, as well as token contents - (similar to what calling, say JsonParser.getTextCharacters(), would - achieve). -

        - Note that for many dataformat implementations this method - will not do anything; this is the default implementation unless - overridden by sub-classes.

        -
        -
        Overrides:
        -
        finishToken in class ParserMinimalBase
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        _finishToken

        -
        protected final JsonToken _finishToken()
        -                                throws IOException
        -
        Method called when decoding of a token has been started, but not yet completed due - to missing input; method is to continue decoding due to at least one more byte - being made available to decode.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _finishTokenWithEOF

        -
        protected final JsonToken _finishTokenWithEOF()
        -                                       throws IOException
        -
        Method similar to _finishToken(), but called when no more input is - available, and end-of-input has been detected. This is usually problem - case, but not always: root-level values may be properly terminated by - this, and similarly trailing white-space may have been skipped.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        _startUnexpectedValue

        -
        protected JsonToken _startUnexpectedValue(boolean leadingComma,
        -                                          int ch)
        -                                   throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        _finishNonStdTokenWithEOF

        -
        protected JsonToken _finishNonStdTokenWithEOF(int type,
        -                                              int matched)
        -                                       throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        _finishNumberIntegralPart

        -
        protected JsonToken _finishNumberIntegralPart(char[] outBuf,
        -                                              int outPtr)
        -                                       throws IOException
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/NonBlockingJsonParserBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/NonBlockingJsonParserBase.html deleted file mode 100644 index bf62f104e1..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/NonBlockingJsonParserBase.html +++ /dev/null @@ -1,2565 +0,0 @@ - - - - - - -NonBlockingJsonParserBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.json.async
-

Class NonBlockingJsonParserBase

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        MAJOR_INITIAL

        -
        protected static final int MAJOR_INITIAL
        -
        State right after parser has been constructed, before seeing the first byte - to handle possible (but optional) BOM.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MAJOR_ROOT

        -
        protected static final int MAJOR_ROOT
        -
        State right after parser a root value has been - finished, but next token has not yet been recognized.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MAJOR_OBJECT_FIELD_FIRST

        -
        protected static final int MAJOR_OBJECT_FIELD_FIRST
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MAJOR_OBJECT_FIELD_NEXT

        -
        protected static final int MAJOR_OBJECT_FIELD_NEXT
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MAJOR_OBJECT_VALUE

        -
        protected static final int MAJOR_OBJECT_VALUE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MAJOR_ARRAY_ELEMENT_FIRST

        -
        protected static final int MAJOR_ARRAY_ELEMENT_FIRST
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MAJOR_ARRAY_ELEMENT_NEXT

        -
        protected static final int MAJOR_ARRAY_ELEMENT_NEXT
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MAJOR_CLOSED

        -
        protected static final int MAJOR_CLOSED
        -
        State after non-blocking input source has indicated that no more input - is forthcoming AND we have exhausted all the input
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_ROOT_BOM

        -
        protected static final int MINOR_ROOT_BOM
        -
        State in which part of (UTF-8) BOM has been detected, but not yet completely.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_ROOT_NEED_SEPARATOR

        -
        protected static final int MINOR_ROOT_NEED_SEPARATOR
        -
        State between root-level value, waiting for at least one white-space - character as separator
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_ROOT_GOT_SEPARATOR

        -
        protected static final int MINOR_ROOT_GOT_SEPARATOR
        -
        State between root-level value, having processed at least one white-space - character, and expecting either more, start of a value, or end of input - stream.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_FIELD_LEADING_WS

        -
        protected static final int MINOR_FIELD_LEADING_WS
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_FIELD_LEADING_COMMA

        -
        protected static final int MINOR_FIELD_LEADING_COMMA
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_FIELD_NAME

        -
        protected static final int MINOR_FIELD_NAME
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_FIELD_NAME_ESCAPE

        -
        protected static final int MINOR_FIELD_NAME_ESCAPE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_FIELD_APOS_NAME

        -
        protected static final int MINOR_FIELD_APOS_NAME
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_FIELD_UNQUOTED_NAME

        -
        protected static final int MINOR_FIELD_UNQUOTED_NAME
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_LEADING_WS

        -
        protected static final int MINOR_VALUE_LEADING_WS
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_EXPECTING_COMMA

        -
        protected static final int MINOR_VALUE_EXPECTING_COMMA
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_EXPECTING_COLON

        -
        protected static final int MINOR_VALUE_EXPECTING_COLON
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_WS_AFTER_COMMA

        -
        protected static final int MINOR_VALUE_WS_AFTER_COMMA
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_TOKEN_NULL

        -
        protected static final int MINOR_VALUE_TOKEN_NULL
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_TOKEN_TRUE

        -
        protected static final int MINOR_VALUE_TOKEN_TRUE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_TOKEN_FALSE

        -
        protected static final int MINOR_VALUE_TOKEN_FALSE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_TOKEN_NON_STD

        -
        protected static final int MINOR_VALUE_TOKEN_NON_STD
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_NUMBER_MINUS

        -
        protected static final int MINOR_NUMBER_MINUS
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_NUMBER_ZERO

        -
        protected static final int MINOR_NUMBER_ZERO
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_NUMBER_MINUSZERO

        -
        protected static final int MINOR_NUMBER_MINUSZERO
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_NUMBER_INTEGER_DIGITS

        -
        protected static final int MINOR_NUMBER_INTEGER_DIGITS
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_NUMBER_FRACTION_DIGITS

        -
        protected static final int MINOR_NUMBER_FRACTION_DIGITS
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_NUMBER_EXPONENT_MARKER

        -
        protected static final int MINOR_NUMBER_EXPONENT_MARKER
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_NUMBER_EXPONENT_DIGITS

        -
        protected static final int MINOR_NUMBER_EXPONENT_DIGITS
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_STRING

        -
        protected static final int MINOR_VALUE_STRING
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_STRING_ESCAPE

        -
        protected static final int MINOR_VALUE_STRING_ESCAPE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_STRING_UTF8_2

        -
        protected static final int MINOR_VALUE_STRING_UTF8_2
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_STRING_UTF8_3

        -
        protected static final int MINOR_VALUE_STRING_UTF8_3
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_STRING_UTF8_4

        -
        protected static final int MINOR_VALUE_STRING_UTF8_4
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_APOS_STRING

        -
        protected static final int MINOR_VALUE_APOS_STRING
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_VALUE_TOKEN_ERROR

        -
        protected static final int MINOR_VALUE_TOKEN_ERROR
        -
        Special state at which point decoding of a non-quoted token has encountered - a problem; that is, either not matching fully (like "truf" instead of "true", - at "tru"), or not having trailing separator (or end of input), like "trueful". - Attempt is made, then, to decode likely full input token to report suitable - error.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_COMMENT_LEADING_SLASH

        -
        protected static final int MINOR_COMMENT_LEADING_SLASH
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_COMMENT_CLOSING_ASTERISK

        -
        protected static final int MINOR_COMMENT_CLOSING_ASTERISK
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_COMMENT_C

        -
        protected static final int MINOR_COMMENT_C
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_COMMENT_CPP

        -
        protected static final int MINOR_COMMENT_CPP
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MINOR_COMMENT_YAML

        -
        protected static final int MINOR_COMMENT_YAML
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        _symbols

        -
        protected final ByteQuadsCanonicalizer _symbols
        -
        Symbol table that contains field names encountered so far
        -
      • -
      - - - -
        -
      • -

        _quadBuffer

        -
        protected int[] _quadBuffer
        -
        Temporary buffer used for name parsing.
        -
      • -
      - - - -
        -
      • -

        _quadLength

        -
        protected int _quadLength
        -
      • -
      - - - -
        -
      • -

        _quad1

        -
        protected int _quad1
        -
      • -
      - - - -
        -
      • -

        _pending32

        -
        protected int _pending32
        -
      • -
      - - - -
        -
      • -

        _pendingBytes

        -
        protected int _pendingBytes
        -
      • -
      - - - -
        -
      • -

        _quoted32

        -
        protected int _quoted32
        -
      • -
      - - - -
        -
      • -

        _quotedDigits

        -
        protected int _quotedDigits
        -
      • -
      - - - -
        -
      • -

        _majorState

        -
        protected int _majorState
        -
        Current main decoding state within logical tree
        -
      • -
      - - - -
        -
      • -

        _majorStateAfterValue

        -
        protected int _majorStateAfterValue
        -
        Value of _majorState after completing a scalar value
        -
      • -
      - - - -
        -
      • -

        _minorState

        -
        protected int _minorState
        -
        Additional indicator within state; contextually relevant for just that state
        -
      • -
      - - - -
        -
      • -

        _minorStateAfterSplit

        -
        protected int _minorStateAfterSplit
        -
        Secondary minor state indicator used during decoding of escapes and/or - multi-byte Unicode characters
        -
      • -
      - - - -
        -
      • -

        _endOfInput

        -
        protected boolean _endOfInput
        -
        Flag that is sent when calling application indicates that there will - be no more input to parse.
        -
      • -
      - - - -
        -
      • -

        NON_STD_TOKEN_NAN

        -
        protected static final int NON_STD_TOKEN_NAN
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        NON_STD_TOKEN_INFINITY

        -
        protected static final int NON_STD_TOKEN_INFINITY
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        NON_STD_TOKEN_PLUS_INFINITY

        -
        protected static final int NON_STD_TOKEN_PLUS_INFINITY
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        NON_STD_TOKEN_MINUS_INFINITY

        -
        protected static final int NON_STD_TOKEN_MINUS_INFINITY
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        NON_STD_TOKENS

        -
        protected static final String[] NON_STD_TOKENS
        -
      • -
      - - - -
        -
      • -

        NON_STD_TOKEN_VALUES

        -
        protected static final double[] NON_STD_TOKEN_VALUES
        -
      • -
      - - - -
        -
      • -

        _nonStdTokenType

        -
        protected int _nonStdTokenType
        -
        When tokenizing non-standard ("odd") tokens, this is the type to consider; - also works as index to actual textual representation.
        -
      • -
      - - - -
        -
      • -

        _currBufferStart

        -
        protected int _currBufferStart
        -
        Since we are fed content that may or may not start at zero offset, we need - to keep track of the first byte within that buffer, to be able to calculate - logical offset within input "stream"
        -
      • -
      - - - -
        -
      • -

        _currInputRowAlt

        -
        protected int _currInputRowAlt
        -
        Alternate row tracker, used to keep track of position by `\r` marker - (whereas _currInputRow tracks `\n`). Used to simplify - tracking of linefeeds, assuming that input typically uses various - linefeed combinations (`\r`, `\n` or `\r\n`) consistently, in which - case we can simply choose max of two row candidates.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        canParseAsync

        -
        public boolean canParseAsync()
        -
        Description copied from class: JsonParser
        -
        Method that can be called to determine if this parser instance - uses non-blocking ("asynchronous") input access for decoding or not. - Access mode is determined by earlier calls via JsonFactory; - it may not be changed after construction. -

        - If non-blocking decoding is true, it is possible to call - JsonParser.getNonBlockingInputFeeder() to obtain object to use - for feeding input; otherwise (false returned) - input is read by blocking.

        -
        -
        Overrides:
        -
        canParseAsync in class JsonParser
        -
        Returns:
        -
        True if this is a non-blocking ("asynchronous") parser
        -
        -
      • -
      - - - - - - - -
        -
      • -

        releaseBuffered

        -
        public abstract int releaseBuffered(OutputStream out)
        -                             throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be called to push back any content that - has been read but not consumed by the parser. This is usually - done after reading all content of interest using parser. - Content is released by writing it to given stream if possible; - if underlying input is byte-based it can released, if not (char-based) - it can not.
        -
        -
        Overrides:
        -
        releaseBuffered in class JsonParser
        -
        Parameters:
        -
        out - OutputStream to which buffered, undecoded content is written to
        -
        Returns:
        -
        -1 if the underlying content source is not byte based - (that is, input can not be sent to OutputStream; - otherwise number of bytes released (0 if there was nothing to release)
        -
        Throws:
        -
        IOException - if write to stream threw exception
        -
        -
      • -
      - - - -
        -
      • -

        _releaseBuffers

        -
        protected void _releaseBuffers()
        -                        throws IOException
        -
        Description copied from class: ParserBase
        -
        Method called to release internal buffers owned by the base - reader. This may be called along with ParserBase._closeInput() (for - example, when explicitly closing this reader instance), or - separately (if need be).
        -
        -
        Overrides:
        -
        _releaseBuffers in class ParserBase
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getInputSource

        -
        public Object getInputSource()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to get access to object that is used - to access input being parsed; this is usually either - InputStream or Reader, depending on what - parser was constructed with. - Note that returned value may be null in some cases; including - case where parser implementation does not want to exposed raw - source to caller. - In cases where input has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of parser and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Specified by:
        -
        getInputSource in class JsonParser
        -
        Returns:
        -
        Input source this parser was configured with
        -
        -
      • -
      - - - - - - - -
        -
      • -

        hasTextCharacters

        -
        public boolean hasTextCharacters()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to determine whether calling of - JsonParser.getTextCharacters() would be the most efficient - way to access textual content for the event parser currently - points to. -

        - Default implementation simply returns false since only actual - implementation class has knowledge of its internal buffering - state. - Implementations are strongly encouraged to properly override - this method, to allow efficient copying of content by other - code.

        -
        -
        Overrides:
        -
        hasTextCharacters in class JsonParserBase
        -
        Returns:
        -
        True if parser currently has character array that can - be efficiently returned via JsonParser.getTextCharacters(); false - means that it may or may not exist
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentLocation

        -
        public JsonLocation getCurrentLocation()
        -
        Description copied from class: JsonParser
        -
        Method that returns location of the last processed character; - usually for error reporting purposes. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - report specific boundary locations (start or end locations of tokens) - and others only return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getCurrentLocation in class JsonParser
        -
        Returns:
        -
        Location of the last processed input unit (byte or character)
        -
        -
      • -
      - - - -
        -
      • -

        getTokenLocation

        -
        public JsonLocation getTokenLocation()
        -
        Description copied from class: JsonParser
        -
        Method that return the starting location of the current - token; that is, position of the first character from input - that starts the current token. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getTokenLocation in class JsonParser
        -
        Returns:
        -
        Starting location of the token parser currently points to
        -
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public String getText()
        -               throws IOException
        -
        Method for accessing textual representation of the current event; - if no current event (before first call to JsonParser.nextToken(), or - after encountering end-of-input), returns null. - Method can be called for any event.
        -
        -
        Specified by:
        -
        getText in class JsonParser
        -
        Returns:
        -
        Textual value associated with the current token (one returned - by JsonParser.nextToken() or other iteration methods)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getText

        -
        public int getText(Writer writer)
        -            throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to read the textual representation of the current token in chunks and - pass it to the given Writer. - Conceptually same as calling: -
        -  writer.write(parser.getText());
        -
        - but should typically be more efficient as longer content does need to - be combined into a single String to return, and write - can occur directly from intermediate buffers Jackson uses.
        -
        -
        Overrides:
        -
        getText in class JsonParser
        -
        Parameters:
        -
        writer - Writer to write textual content to
        -
        Returns:
        -
        The number of characters written to the Writer
        -
        Throws:
        -
        IOException - for low-level read issues or writes using passed - writer, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString()
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), default value of - null will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class ParserMinimalBase
        -
        Returns:
        -
        String value current token is converted to, if possible; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString(String defValue)
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), specified default value - will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class ParserMinimalBase
        -
        Parameters:
        -
        defValue - Default value to return if conversion to String is not possible
        -
        Returns:
        -
        String value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getTextCharacters

        -
        public char[] getTextCharacters()
        -                         throws IOException
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.getText(), but that will return - underlying (unmodifiable) character array that contains - textual value, instead of constructing a String object - to contain this information. - Note, however, that: -
          -
        • Textual contents are not guaranteed to start at - index 0 (rather, call JsonParser.getTextOffset()) to - know the actual offset -
        • -
        • Length of textual contents may be less than the - length of returned buffer: call JsonParser.getTextLength() - for actual length of returned content. -
        • -
        -

        - Note that caller MUST NOT modify the returned - character array in any way -- doing so may corrupt - current parser state and render parser instance useless. -

        - The only reason to call this method (over JsonParser.getText()) - is to avoid construction of a String object (which - will make a copy of contents).

        -
        -
        Specified by:
        -
        getTextCharacters in class JsonParser
        -
        Returns:
        -
        Buffer that contains the current textual value (but not necessarily - at offset 0, and not necessarily until the end of buffer)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getBinaryValue

        -
        public byte[] getBinaryValue(Base64Variant b64variant)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be used to read (and consume -- results - may not be accessible using other methods after the call) - base64-encoded binary data - included in the current textual JSON value. - It works similar to getting String value via JsonParser.getText() - and decoding result (except for decoding part), - but should be significantly more performant. -

        - Note that non-decoded textual contents of the current token - are not guaranteed to be accessible after this method - is called. Current implementation, for example, clears up - textual content during decoding. - Decoded binary content, however, will be retained until - parser is advanced to the next event.

        -
        -
        Overrides:
        -
        getBinaryValue in class ParserBase
        -
        Parameters:
        -
        b64variant - Expected variant of base64 encoded - content (see Base64Variants for definitions - of "standard" variants).
        -
        Returns:
        -
        Decoded binary data
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getEmbeddedObject

        -
        public Object getEmbeddedObject()
        -                         throws IOException
        -
        Description copied from class: JsonParser
        -
        Accessor that can be called if (and only if) the current token - is JsonToken.VALUE_EMBEDDED_OBJECT. For other token types, - null is returned. -

        - Note: only some specialized parser implementations support - embedding of objects (usually ones that are facades on top - of non-streaming sources, such as object trees). One exception - is access to binary content (whether via base64 encoding or not) - which typically is accessible using this method, as well as - JsonParser.getBinaryValue().

        -
        -
        Overrides:
        -
        getEmbeddedObject in class JsonParser
        -
        Returns:
        -
        Embedded value (usually of "native" type supported by format) - for the current token, if any; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        _addName

        -
        protected final String _addName(int[] quads,
        -                                int qlen,
        -                                int lastQuadBytes)
        -                         throws JsonParseException
        -
        This is the main workhorse method used when we take a symbol - table miss. It needs to demultiplex individual bytes, decode - multi-byte chars (if any), and then construct Name instance - and add it to the symbol table.
        -
        -
        Throws:
        -
        JsonParseException
        -
        -
      • -
      - - - -
        -
      • -

        _padLastQuad

        -
        protected static final int _padLastQuad(int q,
        -                                        int bytes)
        -
        Helper method needed to fix [jackson-core#148], masking of 0x00 character
        -
      • -
      - - - -
        -
      • -

        _eofAsNextToken

        -
        protected final JsonToken _eofAsNextToken()
        -                                   throws IOException
        -
        Helper method called at point when all input has been exhausted and - input feeder has indicated no more input will be forthcoming.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        _nonStdToken

        -
        protected final String _nonStdToken(int type)
        -
      • -
      - - - - - - - -
        -
      • -

        _updateTokenLocation

        -
        protected final void _updateTokenLocation()
        -
      • -
      - - - - - - - - - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/class-use/NonBlockingJsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/class-use/NonBlockingJsonParser.html deleted file mode 100644 index 61357e933d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/class-use/NonBlockingJsonParser.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.async.NonBlockingJsonParser

-
-
No usage of com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/class-use/NonBlockingJsonParserBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/class-use/NonBlockingJsonParserBase.html deleted file mode 100644 index de85515434..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/class-use/NonBlockingJsonParserBase.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-frame.html deleted file mode 100644 index d82ce59603..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-frame.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.json.async (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.json.async

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-summary.html deleted file mode 100644 index 6127505563..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-summary.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.json.async (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.json.async

-
-
Non-blocking ("async") JSON parser implementation.
-
-

See: Description

-
-
-
    -
  • - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    NonBlockingJsonParser -
    Non-blocking parser implementation for JSON content.
    -
    NonBlockingJsonParserBase -
    Intermediate base class for non-blocking JSON parsers.
    -
    -
  • -
- - - -

Package com.fasterxml.jackson.core.json.async Description

-
Non-blocking ("async") JSON parser implementation.
-
-
Since:
-
2.9
-
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-tree.html deleted file mode 100644 index b5f5edad66..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-tree.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.json.async Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.json.async

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-use.html deleted file mode 100644 index 547a78173a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/async/package-use.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.json.async (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.json.async

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/ByteSourceJsonBootstrapper.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/ByteSourceJsonBootstrapper.html deleted file mode 100644 index 914938f8e5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/ByteSourceJsonBootstrapper.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper

-
-
No usage of com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/DupDetector.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/DupDetector.html deleted file mode 100644 index c4e7f86425..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/DupDetector.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.DupDetector (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.DupDetector

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonFactory.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonFactory.html deleted file mode 100644 index 8285090382..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonFactory.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.JsonFactory (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.JsonFactory

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonFactoryBuilder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonFactoryBuilder.html deleted file mode 100644 index 92a4bd616f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonFactoryBuilder.html +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.JsonFactoryBuilder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.JsonFactoryBuilder

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonGeneratorBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonGeneratorBase.html deleted file mode 100644 index e20f600ae6..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonGeneratorBase.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.JsonGeneratorBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.JsonGeneratorBase

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonParserBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonParserBase.html deleted file mode 100644 index 0c7c708eed..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonParserBase.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.JsonParserBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.JsonParserBase

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonReadContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonReadContext.html deleted file mode 100644 index 33a17bb66c..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonReadContext.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.JsonReadContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.JsonReadContext

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonReadFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonReadFeature.html deleted file mode 100644 index 6f895087bc..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonReadFeature.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.JsonReadFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.JsonReadFeature

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonWriteContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonWriteContext.html deleted file mode 100644 index c79881b1bc..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonWriteContext.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.JsonWriteContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.JsonWriteContext

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonWriteFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonWriteFeature.html deleted file mode 100644 index 1343c98a69..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/JsonWriteFeature.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.JsonWriteFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.JsonWriteFeature

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/PackageVersion.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/PackageVersion.html deleted file mode 100644 index a3abc9670e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/PackageVersion.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.PackageVersion (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.PackageVersion

-
-
No usage of com.fasterxml.jackson.core.json.PackageVersion
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/ReaderBasedJsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/ReaderBasedJsonParser.html deleted file mode 100644 index 58d7df7369..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/ReaderBasedJsonParser.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.ReaderBasedJsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.ReaderBasedJsonParser

-
-
No usage of com.fasterxml.jackson.core.json.ReaderBasedJsonParser
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8DataInputJsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8DataInputJsonParser.html deleted file mode 100644 index 82caa7cdd6..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8DataInputJsonParser.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.UTF8DataInputJsonParser

-
-
No usage of com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8JsonGenerator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8JsonGenerator.html deleted file mode 100644 index 00395e40a8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8JsonGenerator.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.UTF8JsonGenerator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.UTF8JsonGenerator

-
-
No usage of com.fasterxml.jackson.core.json.UTF8JsonGenerator
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8StreamJsonParser.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8StreamJsonParser.html deleted file mode 100644 index 77cc53293e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/UTF8StreamJsonParser.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.UTF8StreamJsonParser (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.UTF8StreamJsonParser

-
-
No usage of com.fasterxml.jackson.core.json.UTF8StreamJsonParser
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/WriterBasedJsonGenerator.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/WriterBasedJsonGenerator.html deleted file mode 100644 index 4341691e8e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/class-use/WriterBasedJsonGenerator.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.json.WriterBasedJsonGenerator

-
-
No usage of com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-frame.html deleted file mode 100644 index aab8e67bde..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-frame.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.json (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.json

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-summary.html deleted file mode 100644 index 035848c156..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-summary.html +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.json (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.json

-
-
JSON-specific parser and generator implementation classes that - Jackson defines and uses.
-
-

See: Description

-
-
- - - - -

Package com.fasterxml.jackson.core.json Description

-
JSON-specific parser and generator implementation classes that - Jackson defines and uses. - Application code should not (need to) use contents of this package; - nor are these implementations likely to be of use for sub-classing.
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-tree.html deleted file mode 100644 index 5a49c420c4..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-tree.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.json Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.json

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Enum Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-use.html deleted file mode 100644 index ee11ef0c24..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/json/package-use.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.json (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.json

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-frame.html deleted file mode 100644 index 8b78726615..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-frame.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - -com.fasterxml.jackson.core (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-summary.html deleted file mode 100644 index d9a2e924e0..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-summary.html +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - -com.fasterxml.jackson.core (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core

-
-
Main public API classes of the core streaming JSON - processor: most importantly JsonFactory - used for constructing - JSON parser (JsonParser) - and generator - (JsonGenerator) - instances.
-
-

See: Description

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    FormatFeature -
    Marker interface that is to be implemented by data format - specific features.
    -
    FormatSchema -
    Simple tag interface used to mark schema objects that are used by some - JsonParser and JsonGenerator implementations to further - specify structure of expected format.
    -
    JsonTokenId -
    Interface defined to contain ids accessible with JsonToken.id().
    -
    ObjectReadContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during read (token stream to Object deserialization) process.
    -
    ObjectWriteContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during write (Object to token stream serialization) process.
    -
    PrettyPrinter -
    Interface for objects that implement pretty printer functionality, such - as indentation.
    -
    SerializableString -
    Interface that defines how Jackson package can interact with efficient - pre-serialized or lazily-serialized and reused String representations.
    -
    TreeCodec -
    Interface that defines objects that can read and write - TreeNode instances using Streaming API.
    -
    TreeNode -
    Marker interface used to denote JSON Tree nodes, as far as - the core package knows them (which is very little): mostly - needed to allow ObjectReadContext and ObjectWriteContext - to have some level of interoperability.
    -
    Versioned -
    Interface that those Jackson components that are explicitly versioned will implement.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    Base64Variant -
    Class used to define specific details of which - variant of Base64 encoding/decoding is to be used.
    -
    Base64Variants -
    Container for commonly used Base64 variants: - - Base64Variants.MIME - Base64Variants.MIME_NO_LINEFEEDS - Base64Variants.PEM - Base64Variants.MODIFIED_FOR_URL - - See entries for full description of differences.
    -
    JsonGenerator -
    Base class that defines public API for writing JSON content.
    -
    JsonLocation -
    Object that encapsulates Location information used for reporting - parsing (or potentially generation) errors, as well as current location - within input streams.
    -
    JsonParser -
    Base class that defines public API for reading JSON content.
    -
    JsonPointer -
    Implementation of - JSON Pointer - specification.
    -
    ObjectReadContext.Base -
    Default no-op implementation.
    -
    ObjectWriteContext.Base -
    Default no-op implementation.
    -
    TokenStreamContext -
    Shared base class for streaming processing contexts used during - reading and writing of token streams using Streaming API.
    -
    TokenStreamFactory -
    The main factory class of Jackson streaming package, used to configure and - construct token reader (aka parser, JsonParser) - and token writer (aka generator, JsonGenerator) - instances.
    -
    TokenStreamFactory.TSFBuilder<F extends TokenStreamFactory,B extends TokenStreamFactory.TSFBuilder<F,B>> -
    Since factory instances are immutable, a Builder class is needed for creating - configurations for differently configured factory instances.
    -
    Version -
    Object that encapsulates versioning information of a component.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Enum Summary 
    EnumDescription
    Base64Variant.PaddingReadBehaviour -
    Defines how the Base64Variant deals with Padding while reading
    -
    JsonEncoding -
    Enumeration that defines legal encodings that can be used - for JSON content, based on list of allowed encodings from - JSON specification.
    -
    JsonParser.NumberType -
    Enumeration of possible "native" (optimal) types that can be - used for numbers.
    -
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    StreamReadCapability -
    Set of on/off capabilities that a JsonParser for given format - (or in case of buffering, original format) has.
    -
    StreamReadFeature -
    Token reader (parser) features not-specific to any particular format backend.
    -
    StreamWriteCapability -
    Set of on/off capabilities that a JsonGenerator for given format - (or in case of buffering, original format) has.
    -
    StreamWriteFeature -
    Token writer (generator) features not-specific to any particular format backend.
    -
    TokenStreamFactory.Feature -
    Enumeration that defines all on/off features that can only be - changed for TokenStreamFactory.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - -
    Exception Summary 
    ExceptionDescription
    JacksonException -
    Base class for all Jackson-produced checked exceptions.
    -
    JsonGenerationException -
    Exception type for exceptions during JSON writing, such as trying - to output content in wrong context (non-matching end-array or end-object, - for example).
    -
    JsonParseException -
    Exception type for parsing problems, used when non-well-formed content - (content that does not conform to JSON syntax as per specification) - is encountered.
    -
    JsonProcessingException -
    Intermediate base class for all problems encountered when - processing (parsing, generating) JSON content - that are not pure I/O problems.
    -
    -
  • -
- - - -

Package com.fasterxml.jackson.core Description

-
Main public API classes of the core streaming JSON - processor: most importantly JsonFactory - used for constructing - JSON parser (JsonParser) - and generator - (JsonGenerator) - instances. -

- Public API of the higher-level mapping interfaces ("Mapping API") - is found from the "jackson-databind" bundle, except for following - base interfaces that are defined here: -

    -
  • TreeNode is included -within Streaming API to support integration of the Tree Model -(which is based on JsonNode) with the basic -parsers and generators (iff using mapping-supporting factory: which -is part of Mapping API, not core) -
  • -
  • ObjectReadContext is included so that - reference to the object capable of deserializing - Objects from token streams (usually, com.fasterxml.jackson.databind.ObjectMapper) - can be exposed, without adding direct dependency to implementation. -
  • -
  • ObjectWriteContext is included so that - reference to the object capable of serializing - Objects from token streams (usually, com.fasterxml.jackson.databind.ObjectMapper) - can be exposed, without adding direct dependency to implementation. -
  • -
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-tree.html deleted file mode 100644 index fac280e7fb..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-tree.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - -com.fasterxml.jackson.core Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -

Enum Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-use.html deleted file mode 100644 index 9a5f3432a8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/package-use.html +++ /dev/null @@ -1,1088 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Packages that use com.fasterxml.jackson.core 
    PackageDescription
    com.fasterxml.jackson.core -
    Main public API classes of the core streaming JSON - processor: most importantly JsonFactory - used for constructing - JSON parser (JsonParser) - and generator - (JsonGenerator) - instances.
    -
    com.fasterxml.jackson.core.base -
    Base classes used by concrete Parser and Generator implementations; - contain functionality that is not specific to JSON or input - abstraction (byte vs char).
    -
    com.fasterxml.jackson.core.exc -
    Package for some of JsonProcessingException - subtypes contained by streaming API.
    -
    com.fasterxml.jackson.core.filter 
    com.fasterxml.jackson.core.io 
    com.fasterxml.jackson.core.json -
    JSON-specific parser and generator implementation classes that - Jackson defines and uses.
    -
    com.fasterxml.jackson.core.json.async -
    Non-blocking ("async") JSON parser implementation.
    -
    com.fasterxml.jackson.core.tree -
    Package that contains abstractions that are used dealing - with Tree Models (other than - TreeNode).
    -
    com.fasterxml.jackson.core.type -
    Contains classes needed for type introspection, mostly used by data binding - functionality.
    -
    com.fasterxml.jackson.core.util -
    Utility classes used by Jackson Core functionality.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core 
    Class and Description
    Base64Variant -
    Class used to define specific details of which - variant of Base64 encoding/decoding is to be used.
    -
    Base64Variant.PaddingReadBehaviour -
    Defines how the Base64Variant deals with Padding while reading
    -
    FormatFeature -
    Marker interface that is to be implemented by data format - specific features.
    -
    FormatSchema -
    Simple tag interface used to mark schema objects that are used by some - JsonParser and JsonGenerator implementations to further - specify structure of expected format.
    -
    JacksonException -
    Base class for all Jackson-produced checked exceptions.
    -
    JsonEncoding -
    Enumeration that defines legal encodings that can be used - for JSON content, based on list of allowed encodings from - JSON specification.
    -
    JsonGenerationException -
    Exception type for exceptions during JSON writing, such as trying - to output content in wrong context (non-matching end-array or end-object, - for example).
    -
    JsonGenerator -
    Base class that defines public API for writing JSON content.
    -
    JsonLocation -
    Object that encapsulates Location information used for reporting - parsing (or potentially generation) errors, as well as current location - within input streams.
    -
    JsonParseException -
    Exception type for parsing problems, used when non-well-formed content - (content that does not conform to JSON syntax as per specification) - is encountered.
    -
    JsonParser -
    Base class that defines public API for reading JSON content.
    -
    JsonParser.NumberType -
    Enumeration of possible "native" (optimal) types that can be - used for numbers.
    -
    JsonPointer -
    Implementation of - JSON Pointer - specification.
    -
    JsonProcessingException -
    Intermediate base class for all problems encountered when - processing (parsing, generating) JSON content - that are not pure I/O problems.
    -
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    ObjectReadContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during read (token stream to Object deserialization) process.
    -
    ObjectReadContext.Base -
    Default no-op implementation.
    -
    ObjectWriteContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during write (Object to token stream serialization) process.
    -
    ObjectWriteContext.Base -
    Default no-op implementation.
    -
    PrettyPrinter -
    Interface for objects that implement pretty printer functionality, such - as indentation.
    -
    SerializableString -
    Interface that defines how Jackson package can interact with efficient - pre-serialized or lazily-serialized and reused String representations.
    -
    StreamReadCapability -
    Set of on/off capabilities that a JsonParser for given format - (or in case of buffering, original format) has.
    -
    StreamReadFeature -
    Token reader (parser) features not-specific to any particular format backend.
    -
    StreamWriteCapability -
    Set of on/off capabilities that a JsonGenerator for given format - (or in case of buffering, original format) has.
    -
    StreamWriteFeature -
    Token writer (generator) features not-specific to any particular format backend.
    -
    TokenStreamContext -
    Shared base class for streaming processing contexts used during - reading and writing of token streams using Streaming API.
    -
    TokenStreamFactory -
    The main factory class of Jackson streaming package, used to configure and - construct token reader (aka parser, JsonParser) - and token writer (aka generator, JsonGenerator) - instances.
    -
    TokenStreamFactory.Feature -
    Enumeration that defines all on/off features that can only be - changed for TokenStreamFactory.
    -
    TokenStreamFactory.TSFBuilder -
    Since factory instances are immutable, a Builder class is needed for creating - configurations for differently configured factory instances.
    -
    TreeNode -
    Marker interface used to denote JSON Tree nodes, as far as - the core package knows them (which is very little): mostly - needed to allow ObjectReadContext and ObjectWriteContext - to have some level of interoperability.
    -
    Version -
    Object that encapsulates versioning information of a component.
    -
    Versioned -
    Interface that those Jackson components that are explicitly versioned will implement.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core.base 
    Class and Description
    Base64Variant -
    Class used to define specific details of which - variant of Base64 encoding/decoding is to be used.
    -
    JsonEncoding -
    Enumeration that defines legal encodings that can be used - for JSON content, based on list of allowed encodings from - JSON specification.
    -
    JsonGenerator -
    Base class that defines public API for writing JSON content.
    -
    JsonParseException -
    Exception type for parsing problems, used when non-well-formed content - (content that does not conform to JSON syntax as per specification) - is encountered.
    -
    JsonParser -
    Base class that defines public API for reading JSON content.
    -
    JsonParser.NumberType -
    Enumeration of possible "native" (optimal) types that can be - used for numbers.
    -
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    ObjectReadContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during read (token stream to Object deserialization) process.
    -
    ObjectWriteContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during write (Object to token stream serialization) process.
    -
    PrettyPrinter -
    Interface for objects that implement pretty printer functionality, such - as indentation.
    -
    SerializableString -
    Interface that defines how Jackson package can interact with efficient - pre-serialized or lazily-serialized and reused String representations.
    -
    StreamReadCapability -
    Set of on/off capabilities that a JsonParser for given format - (or in case of buffering, original format) has.
    -
    StreamReadFeature -
    Token reader (parser) features not-specific to any particular format backend.
    -
    StreamWriteCapability -
    Set of on/off capabilities that a JsonGenerator for given format - (or in case of buffering, original format) has.
    -
    StreamWriteFeature -
    Token writer (generator) features not-specific to any particular format backend.
    -
    TokenStreamFactory -
    The main factory class of Jackson streaming package, used to configure and - construct token reader (aka parser, JsonParser) - and token writer (aka generator, JsonGenerator) - instances.
    -
    TokenStreamFactory.TSFBuilder -
    Since factory instances are immutable, a Builder class is needed for creating - configurations for differently configured factory instances.
    -
    TreeNode -
    Marker interface used to denote JSON Tree nodes, as far as - the core package knows them (which is very little): mostly - needed to allow ObjectReadContext and ObjectWriteContext - to have some level of interoperability.
    -
    Versioned -
    Interface that those Jackson components that are explicitly versioned will implement.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core.exc 
    Class and Description
    JacksonException -
    Base class for all Jackson-produced checked exceptions.
    -
    JsonLocation -
    Object that encapsulates Location information used for reporting - parsing (or potentially generation) errors, as well as current location - within input streams.
    -
    JsonParser -
    Base class that defines public API for reading JSON content.
    -
    JsonProcessingException -
    Intermediate base class for all problems encountered when - processing (parsing, generating) JSON content - that are not pure I/O problems.
    -
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core.filter 
    Class and Description
    Base64Variant -
    Class used to define specific details of which - variant of Base64 encoding/decoding is to be used.
    -
    JsonGenerator -
    Base class that defines public API for writing JSON content.
    -
    JsonLocation -
    Object that encapsulates Location information used for reporting - parsing (or potentially generation) errors, as well as current location - within input streams.
    -
    JsonParser -
    Base class that defines public API for reading JSON content.
    -
    JsonPointer -
    Implementation of - JSON Pointer - specification.
    -
    JsonProcessingException -
    Intermediate base class for all problems encountered when - processing (parsing, generating) JSON content - that are not pure I/O problems.
    -
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    SerializableString -
    Interface that defines how Jackson package can interact with efficient - pre-serialized or lazily-serialized and reused String representations.
    -
    TokenStreamContext -
    Shared base class for streaming processing contexts used during - reading and writing of token streams using Streaming API.
    -
    Versioned -
    Interface that those Jackson components that are explicitly versioned will implement.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core.io 
    Class and Description
    JacksonException -
    Base class for all Jackson-produced checked exceptions.
    -
    JsonEncoding -
    Enumeration that defines legal encodings that can be used - for JSON content, based on list of allowed encodings from - JSON specification.
    -
    JsonParseException -
    Exception type for parsing problems, used when non-well-formed content - (content that does not conform to JSON syntax as per specification) - is encountered.
    -
    JsonParser -
    Base class that defines public API for reading JSON content.
    -
    JsonProcessingException -
    Intermediate base class for all problems encountered when - processing (parsing, generating) JSON content - that are not pure I/O problems.
    -
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    SerializableString -
    Interface that defines how Jackson package can interact with efficient - pre-serialized or lazily-serialized and reused String representations.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core.json 
    Class and Description
    Base64Variant -
    Class used to define specific details of which - variant of Base64 encoding/decoding is to be used.
    -
    FormatFeature -
    Marker interface that is to be implemented by data format - specific features.
    -
    FormatSchema -
    Simple tag interface used to mark schema objects that are used by some - JsonParser and JsonGenerator implementations to further - specify structure of expected format.
    -
    JsonEncoding -
    Enumeration that defines legal encodings that can be used - for JSON content, based on list of allowed encodings from - JSON specification.
    -
    JsonGenerationException -
    Exception type for exceptions during JSON writing, such as trying - to output content in wrong context (non-matching end-array or end-object, - for example).
    -
    JsonGenerator -
    Base class that defines public API for writing JSON content.
    -
    JsonLocation -
    Object that encapsulates Location information used for reporting - parsing (or potentially generation) errors, as well as current location - within input streams.
    -
    JsonParseException -
    Exception type for parsing problems, used when non-well-formed content - (content that does not conform to JSON syntax as per specification) - is encountered.
    -
    JsonParser -
    Base class that defines public API for reading JSON content.
    -
    JsonProcessingException -
    Intermediate base class for all problems encountered when - processing (parsing, generating) JSON content - that are not pure I/O problems.
    -
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    ObjectReadContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during read (token stream to Object deserialization) process.
    -
    ObjectWriteContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during write (Object to token stream serialization) process.
    -
    PrettyPrinter -
    Interface for objects that implement pretty printer functionality, such - as indentation.
    -
    SerializableString -
    Interface that defines how Jackson package can interact with efficient - pre-serialized or lazily-serialized and reused String representations.
    -
    StreamReadCapability -
    Set of on/off capabilities that a JsonParser for given format - (or in case of buffering, original format) has.
    -
    StreamWriteCapability -
    Set of on/off capabilities that a JsonGenerator for given format - (or in case of buffering, original format) has.
    -
    TokenStreamContext -
    Shared base class for streaming processing contexts used during - reading and writing of token streams using Streaming API.
    -
    TokenStreamFactory -
    The main factory class of Jackson streaming package, used to configure and - construct token reader (aka parser, JsonParser) - and token writer (aka generator, JsonGenerator) - instances.
    -
    TokenStreamFactory.TSFBuilder -
    Since factory instances are immutable, a Builder class is needed for creating - configurations for differently configured factory instances.
    -
    Version -
    Object that encapsulates versioning information of a component.
    -
    Versioned -
    Interface that those Jackson components that are explicitly versioned will implement.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core.json.async 
    Class and Description
    Base64Variant -
    Class used to define specific details of which - variant of Base64 encoding/decoding is to be used.
    -
    JsonLocation -
    Object that encapsulates Location information used for reporting - parsing (or potentially generation) errors, as well as current location - within input streams.
    -
    JsonParseException -
    Exception type for parsing problems, used when non-well-formed content - (content that does not conform to JSON syntax as per specification) - is encountered.
    -
    JsonParser -
    Base class that defines public API for reading JSON content.
    -
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    ObjectReadContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during read (token stream to Object deserialization) process.
    -
    Versioned -
    Interface that those Jackson components that are explicitly versioned will implement.
    -
    -
  • -
  • - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core.tree 
    Class and Description
    TreeNode -
    Marker interface used to denote JSON Tree nodes, as far as - the core package knows them (which is very little): mostly - needed to allow ObjectReadContext and ObjectWriteContext - to have some level of interoperability.
    -
    -
  • -
  • - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core.type 
    Class and Description
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Classes in com.fasterxml.jackson.core used by com.fasterxml.jackson.core.util 
    Class and Description
    Base64Variant -
    Class used to define specific details of which - variant of Base64 encoding/decoding is to be used.
    -
    FormatSchema -
    Simple tag interface used to mark schema objects that are used by some - JsonParser and JsonGenerator implementations to further - specify structure of expected format.
    -
    JsonGenerator -
    Base class that defines public API for writing JSON content.
    -
    JsonLocation -
    Object that encapsulates Location information used for reporting - parsing (or potentially generation) errors, as well as current location - within input streams.
    -
    JsonParser -
    Base class that defines public API for reading JSON content.
    -
    JsonParser.NumberType -
    Enumeration of possible "native" (optimal) types that can be - used for numbers.
    -
    JsonProcessingException -
    Intermediate base class for all problems encountered when - processing (parsing, generating) JSON content - that are not pure I/O problems.
    -
    JsonToken -
    Enumeration for basic token types used for returning results - of parsing JSON content.
    -
    ObjectReadContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during read (token stream to Object deserialization) process.
    -
    ObjectWriteContext -
    Defines API for accessing configuration and state exposed by - higher level databind - functionality during write (Object to token stream serialization) process.
    -
    PrettyPrinter -
    Interface for objects that implement pretty printer functionality, such - as indentation.
    -
    SerializableString -
    Interface that defines how Jackson package can interact with efficient - pre-serialized or lazily-serialized and reused String representations.
    -
    StreamReadCapability -
    Set of on/off capabilities that a JsonParser for given format - (or in case of buffering, original format) has.
    -
    StreamReadFeature -
    Token reader (parser) features not-specific to any particular format backend.
    -
    StreamWriteCapability -
    Set of on/off capabilities that a JsonGenerator for given format - (or in case of buffering, original format) has.
    -
    StreamWriteFeature -
    Token writer (generator) features not-specific to any particular format backend.
    -
    TokenStreamContext -
    Shared base class for streaming processing contexts used during - reading and writing of token streams using Streaming API.
    -
    TreeNode -
    Marker interface used to denote JSON Tree nodes, as far as - the core package knows them (which is very little): mostly - needed to allow ObjectReadContext and ObjectWriteContext - to have some level of interoperability.
    -
    Version -
    Object that encapsulates versioning information of a component.
    -
    Versioned -
    Interface that those Jackson components that are explicitly versioned will implement.
    -
    -
  • -
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/BinaryNameMatcher.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/BinaryNameMatcher.html deleted file mode 100644 index e1c23c199d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/BinaryNameMatcher.html +++ /dev/null @@ -1,632 +0,0 @@ - - - - - - -BinaryNameMatcher (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.sym
-

Class BinaryNameMatcher

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public final class BinaryNameMatcher
    -extends HashedMatcherBase
    -implements Serializable
    -
    Simplified static symbol table used instead of global quad-based canonicalizer - when we have smaller set of symbols (like properties of a POJO class).
    -
    -
    Since:
    -
    3.0
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - - - - - -
        -
      • -

        addName

        -
        public int addName(String name)
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
      • -
      - - - -
        -
      • -

        bucketCount

        -
        public int bucketCount()
        -
      • -
      - - - -
        -
      • -

        primaryQuadCount

        -
        public int primaryQuadCount()
        -
      • -
      - - - -
        -
      • -

        secondaryQuadCount

        -
        public int secondaryQuadCount()
        -
      • -
      - - - -
        -
      • -

        tertiaryQuadCount

        -
        public int tertiaryQuadCount()
        -
      • -
      - - - -
        -
      • -

        spilloverQuadCount

        -
        public int spilloverQuadCount()
        -
      • -
      - - - -
        -
      • -

        totalCount

        -
        public int totalCount()
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        matchByQuad

        -
        public int matchByQuad(int q1,
        -                       int q2,
        -                       int q3)
        -
        -
        Specified by:
        -
        matchByQuad in class FieldNameMatcher
        -
        -
      • -
      - - - - - - - -
        -
      • -

        calcHash

        -
        public int calcHash(int q1)
        -
      • -
      - - - -
        -
      • -

        calcHash

        -
        public int calcHash(int q1,
        -                    int q2)
        -
      • -
      - - - -
        -
      • -

        calcHash

        -
        public int calcHash(int q1,
        -                    int q2,
        -                    int q3)
        -
      • -
      - - - -
        -
      • -

        calcHash

        -
        public int calcHash(int[] q,
        -                    int qlen)
        -
      • -
      - - - - - - - -
        -
      • -

        _quads

        -
        public static int[] _quads(String name)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/ByteQuadsCanonicalizer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/ByteQuadsCanonicalizer.html deleted file mode 100644 index 0e2c0d5f19..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/ByteQuadsCanonicalizer.html +++ /dev/null @@ -1,1038 +0,0 @@ - - - - - - -ByteQuadsCanonicalizer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.sym
-

Class ByteQuadsCanonicalizer

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public final class ByteQuadsCanonicalizer
    -extends Object
    -
    Replacement for BytesToNameCanonicalizer which aims at more localized - memory access due to flattening of name quad data. - Performance improvement modest for simple JSON document data binding (maybe 3%), - but should help more for larger symbol tables, or for binary formats like Smile. -

    - Hash area is divided into 4 sections: -

      -
    1. Primary area (1/2 of total size), direct match from hash (LSB)
    2. -
    3. Secondary area (1/4 of total size), match from hash (LSB) >> 1
    4. -
    5. Tertiary area (1/8 of total size), match from hash (LSB) >> 2
    6. -
    7. Spill-over area (remaining 1/8) with linear scan, insertion order
    8. -
    9. -
    - and within every area, entries are 4 ints, where 1 - 3 ints contain 1 - 12 - UTF-8 encoded bytes of name (null-padded), and last int is offset in - _names that contains actual name Strings.
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      protected int_count -
      Total number of Strings in the symbol table; only used for child tables.
      -
      protected boolean_failOnDoS -
      Flag that indicates whether we should throw an exception if enough - hash collisions are detected (true); or just worked around (false).
      -
      protected int[]_hashArea -
      Primary hash information area: consists of 2 * _hashSize - entries of 16 bytes (4 ints), arranged in a cascading lookup - structure (details of which may be tweaked depending on expected rates - of collisions).
      -
      protected boolean_hashShared -
      Flag that indicates whether underlying data structures for - the main hash area are shared or not.
      -
      protected int_hashSize -
      Number of slots for primary entries within _hashArea; which is - at most 1/8 of actual size of the underlying array (4-int slots, - primary covers only half of the area; plus, additional area for longer - symbols after hash area).
      -
      protected boolean_intern -
      Whether canonical symbol Strings are to be intern()ed before added - to the table or not.
      -
      protected int_longNameOffset -
      Offset within _hashArea that follows main slots and contains - quads for longer names (13 bytes or longer), and points to the - first available int that may be used for appending quads of the next - long name.
      -
      protected String[]_names -
      Array that contains String instances matching - entries in _hashArea.
      -
      protected ByteQuadsCanonicalizer_parent -
      Reference to the root symbol table, for child tables, so - that they can merge table information back as necessary.
      -
      protected int_secondaryStart -
      Offset within _hashArea where secondary entries start
      -
      protected int_seed -
      Seed value we use as the base to make hash codes non-static between - different runs, but still stable for lifetime of a single symbol table - instance.
      -
      protected int_spilloverEnd -
      Pointer to the offset within spill-over area where there is room - for more spilled over entries (if any).
      -
      protected AtomicReference<com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer.TableInfo>_tableInfo -
      Member that is only used by the root table instance: root - passes immutable state info child instances, and children - may return new state if they add entries to the table.
      -
      protected int_tertiaryShift -
      Constant that determines size of buckets for tertiary entries: - 1 << _tertiaryShift is the size, and shift value - is also used for translating from primary offset into - tertiary bucket (shift right by 4 + _tertiaryShift).
      -
      protected int_tertiaryStart -
      Offset within _hashArea where tertiary entries start
      -
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _parent

        -
        protected final ByteQuadsCanonicalizer _parent
        -
        Reference to the root symbol table, for child tables, so - that they can merge table information back as necessary.
        -
      • -
      - - - -
        -
      • -

        _tableInfo

        -
        protected final AtomicReference<com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer.TableInfo> _tableInfo
        -
        Member that is only used by the root table instance: root - passes immutable state info child instances, and children - may return new state if they add entries to the table. - Child tables do NOT use the reference.
        -
      • -
      - - - -
        -
      • -

        _seed

        -
        protected final int _seed
        -
        Seed value we use as the base to make hash codes non-static between - different runs, but still stable for lifetime of a single symbol table - instance. - This is done for security reasons, to avoid potential DoS attack via - hash collisions.
        -
      • -
      - - - -
        -
      • -

        _intern

        -
        protected boolean _intern
        -
        Whether canonical symbol Strings are to be intern()ed before added - to the table or not. -

        - NOTE: non-final to allow disabling intern()ing in case of excessive - collisions.

        -
      • -
      - - - -
        -
      • -

        _failOnDoS

        -
        protected final boolean _failOnDoS
        -
        Flag that indicates whether we should throw an exception if enough - hash collisions are detected (true); or just worked around (false).
        -
      • -
      - - - -
        -
      • -

        _hashArea

        -
        protected int[] _hashArea
        -
        Primary hash information area: consists of 2 * _hashSize - entries of 16 bytes (4 ints), arranged in a cascading lookup - structure (details of which may be tweaked depending on expected rates - of collisions).
        -
      • -
      - - - -
        -
      • -

        _hashSize

        -
        protected int _hashSize
        -
        Number of slots for primary entries within _hashArea; which is - at most 1/8 of actual size of the underlying array (4-int slots, - primary covers only half of the area; plus, additional area for longer - symbols after hash area).
        -
      • -
      - - - -
        -
      • -

        _secondaryStart

        -
        protected int _secondaryStart
        -
        Offset within _hashArea where secondary entries start
        -
      • -
      - - - -
        -
      • -

        _tertiaryStart

        -
        protected int _tertiaryStart
        -
        Offset within _hashArea where tertiary entries start
        -
      • -
      - - - -
        -
      • -

        _tertiaryShift

        -
        protected int _tertiaryShift
        -
        Constant that determines size of buckets for tertiary entries: - 1 << _tertiaryShift is the size, and shift value - is also used for translating from primary offset into - tertiary bucket (shift right by 4 + _tertiaryShift). -

        - Default value is 2, for buckets of 4 slots; grows bigger with - bigger table sizes.

        -
      • -
      - - - -
        -
      • -

        _count

        -
        protected int _count
        -
        Total number of Strings in the symbol table; only used for child tables.
        -
      • -
      - - - -
        -
      • -

        _names

        -
        protected String[] _names
        -
        Array that contains String instances matching - entries in _hashArea. - Contains nulls for unused entries. Note that this size is twice - that of _hashArea
        -
      • -
      - - - -
        -
      • -

        _spilloverEnd

        -
        protected int _spilloverEnd
        -
        Pointer to the offset within spill-over area where there is room - for more spilled over entries (if any). - Spill over area is within fixed-size portion of _hashArea.
        -
      • -
      - - - -
        -
      • -

        _longNameOffset

        -
        protected int _longNameOffset
        -
        Offset within _hashArea that follows main slots and contains - quads for longer names (13 bytes or longer), and points to the - first available int that may be used for appending quads of the next - long name. - Note that long name area follows immediately after the fixed-size - main hash area (_hashArea).
        -
      • -
      - - - -
        -
      • -

        _hashShared

        -
        protected boolean _hashShared
        -
        Flag that indicates whether underlying data structures for - the main hash area are shared or not. If they are, then they - need to be handled in copy-on-write way, i.e. if they need - to be modified, a copy needs to be made first; at this point - it will not be shared any more, and can be modified. -

        - This flag needs to be checked both when adding new main entries, - and when adding new collision list queues (i.e. creating a new - collision list head entry)

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        createRoot

        -
        public static ByteQuadsCanonicalizer createRoot()
        -
        Factory method to call to create a symbol table instance with a - randomized seed value.
        -
        -
        Returns:
        -
        Root instance to use for constructing new child instances
        -
        -
      • -
      - - - - - - - -
        -
      • -

        makeChild

        -
        public ByteQuadsCanonicalizer makeChild(int flags)
        -
        Factory method used to create actual symbol table instance to - use for parsing.
        -
        -
        Parameters:
        -
        flags - Bit flags of active TokenStreamFactory.Features enabled.
        -
        Returns:
        -
        Actual canonicalizer instance that can be used by a parser
        -
        -
      • -
      - - - -
        -
      • -

        release

        -
        public void release()
        -
        Method called by the using code to indicate it is done with this instance. - This lets instance merge accumulated changes into parent (if need be), - safely and efficiently, and without calling code having to know about parent - information.
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        -
        Returns:
        -
        Number of symbol entries contained by this canonicalizer instance
        -
        -
      • -
      - - - -
        -
      • -

        bucketCount

        -
        public int bucketCount()
        -
        -
        Returns:
        -
        number of primary slots table has currently
        -
        -
      • -
      - - - -
        -
      • -

        maybeDirty

        -
        public boolean maybeDirty()
        -
        Method called to check to quickly see if a child symbol table - may have gotten additional entries. Used for checking to see - if a child table should be merged into shared table.
        -
        -
        Returns:
        -
        Whether main hash area has been modified
        -
        -
      • -
      - - - -
        -
      • -

        hashSeed

        -
        public int hashSeed()
        -
      • -
      - - - -
        -
      • -

        primaryCount

        -
        public int primaryCount()
        -
        Method mostly needed by unit tests; calculates number of - entries that are in the primary slot set. These are - "perfect" entries, accessible with a single lookup
        -
        -
        Returns:
        -
        Number of entries in the primary hash area
        -
        -
      • -
      - - - -
        -
      • -

        secondaryCount

        -
        public int secondaryCount()
        -
        Method mostly needed by unit tests; calculates number of entries - in secondary buckets
        -
        -
        Returns:
        -
        Number of entries in the secondary hash area
        -
        -
      • -
      - - - -
        -
      • -

        tertiaryCount

        -
        public int tertiaryCount()
        -
        Method mostly needed by unit tests; calculates number of entries - in tertiary buckets
        -
        -
        Returns:
        -
        Number of entries in the tertiary hash area
        -
        -
      • -
      - - - -
        -
      • -

        spilloverCount

        -
        public int spilloverCount()
        -
        Method mostly needed by unit tests; calculates number of entries - in shared spill-over area
        -
        -
        Returns:
        -
        Number of entries in the linear spill-over areay
        -
        -
      • -
      - - - -
        -
      • -

        totalCount

        -
        public int totalCount()
        -
      • -
      - - - - - - - -
        -
      • -

        findName

        -
        public String findName(int q1)
        -
      • -
      - - - -
        -
      • -

        findName

        -
        public String findName(int q1,
        -                       int q2)
        -
      • -
      - - - -
        -
      • -

        findName

        -
        public String findName(int q1,
        -                       int q2,
        -                       int q3)
        -
      • -
      - - - -
        -
      • -

        findName

        -
        public String findName(int[] q,
        -                       int qlen)
        -
      • -
      - - - -
        -
      • -

        addName

        -
        public String addName(String name,
        -                      int q1)
        -
      • -
      - - - -
        -
      • -

        addName

        -
        public String addName(String name,
        -                      int q1,
        -                      int q2)
        -
      • -
      - - - -
        -
      • -

        addName

        -
        public String addName(String name,
        -                      int q1,
        -                      int q2,
        -                      int q3)
        -
      • -
      - - - -
        -
      • -

        addName

        -
        public String addName(String name,
        -                      int[] q,
        -                      int qlen)
        -
      • -
      - - - -
        -
      • -

        calcHash

        -
        public int calcHash(int q1)
        -
      • -
      - - - -
        -
      • -

        calcHash

        -
        public int calcHash(int q1,
        -                    int q2)
        -
      • -
      - - - -
        -
      • -

        calcHash

        -
        public int calcHash(int q1,
        -                    int q2,
        -                    int q3)
        -
      • -
      - - - -
        -
      • -

        calcHash

        -
        public int calcHash(int[] q,
        -                    int qlen)
        -
      • -
      - - - -
        -
      • -

        _reportTooManyCollisions

        -
        protected void _reportTooManyCollisions()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/CharsToNameCanonicalizer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/CharsToNameCanonicalizer.html deleted file mode 100644 index c9872b0752..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/CharsToNameCanonicalizer.html +++ /dev/null @@ -1,874 +0,0 @@ - - - - - - -CharsToNameCanonicalizer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.sym
-

Class CharsToNameCanonicalizer

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public final class CharsToNameCanonicalizer
    -extends Object
    -
    This class is a kind of specialized type-safe Map, from char array to - String value. Specialization means that in addition to type-safety - and specific access patterns (key char array, Value optionally interned - String; values added on access if necessary), and that instances are - meant to be used concurrently, but by using well-defined mechanisms - to obtain such concurrently usable instances. Main use for the class - is to store symbol table information for things like compilers and - parsers; especially when number of symbols (keywords) is limited. -

    - For optimal performance, usage pattern should be one where matches - should be very common (especially after "warm-up"), and as with most hash-based - maps/sets, that hash codes are uniformly distributed. Also, collisions - are slightly more expensive than with HashMap or HashSet, since hash codes - are not used in resolving collisions; that is, equals() comparison is - done with all symbols in same bucket index.
    - Finally, rehashing is also more expensive, as hash codes are not - stored; rehashing requires all entries' hash codes to be recalculated. - Reason for not storing hash codes is reduced memory usage, hoping - for better memory locality. -

    - Usual usage pattern is to create a single "master" instance, and either - use that instance in sequential fashion, or to create derived "child" - instances, which after use, are asked to return possible symbol additions - to master instance. In either case benefit is that symbol table gets - initialized so that further uses are more efficient, as eventually all - symbols needed will already be in symbol table. At that point no more - Symbol String allocations are needed, nor changes to symbol table itself. -

    - Note that while individual SymbolTable instances are NOT thread-safe - (much like generic collection classes), concurrently used "child" - instances can be freely used without synchronization. However, using - master table concurrently with child instances can only be done if - access to master instance is read-only (i.e. no modifications done).

    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      protected com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer.Bucket[]_buckets -
      Overflow buckets; if primary doesn't match, lookup is done - from here.
      -
      protected boolean_canonicalize -
      Whether any canonicalization should be attempted (whether using - intern or not.
      -
      protected int_flags 
      protected boolean_hashShared -
      Flag that indicates whether underlying data structures for - the main hash area are shared or not.
      -
      protected int_indexMask -
      Mask used to get index from hash values; equal to - _buckets.length - 1, when _buckets.length is - a power of two.
      -
      protected int_longestCollisionList -
      We need to keep track of the longest collision list; this is needed - both to indicate problems with attacks and to allow flushing for - other cases.
      -
      protected BitSet_overflows -
      Lazily constructed structure that is used to keep track of - collision buckets that have overflowed once: this is used - to detect likely attempts at denial-of-service attacks that - uses hash collisions.
      -
      protected CharsToNameCanonicalizer_parent -
      Sharing of learnt symbols is done by optional linking of symbol - table instances with their parents.
      -
      protected int_seed -
      Seed value we use as the base to make hash codes non-static between - different runs, but still stable for lifetime of a single symbol table - instance.
      -
      protected int_size -
      Current size (number of entries); needed to know if and when - rehash.
      -
      protected int_sizeThreshold -
      Limit that indicates maximum size this instance can hold before - it needs to be expanded and rehashed.
      -
      protected String[]_symbols -
      Primary matching symbols; it's expected most match occur from - here.
      -
      protected AtomicReference<com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer.TableInfo>_tableInfo -
      Member that is only used by the root table instance: root - passes immutable state info child instances, and children - may return new state if they add entries to the table.
      -
      static intHASH_MULT 
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        _parent

        -
        protected final CharsToNameCanonicalizer _parent
        -
        Sharing of learnt symbols is done by optional linking of symbol - table instances with their parents. When parent linkage is - defined, and child instance is released (call to release), - parent's shared tables may be updated from the child instance.
        -
      • -
      - - - -
        -
      • -

        _tableInfo

        -
        protected final AtomicReference<com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer.TableInfo> _tableInfo
        -
        Member that is only used by the root table instance: root - passes immutable state info child instances, and children - may return new state if they add entries to the table. - Child tables do NOT use the reference.
        -
      • -
      - - - -
        -
      • -

        _seed

        -
        protected final int _seed
        -
        Seed value we use as the base to make hash codes non-static between - different runs, but still stable for lifetime of a single symbol table - instance. - This is done for security reasons, to avoid potential DoS attack via - hash collisions.
        -
      • -
      - - - -
        -
      • -

        _flags

        -
        protected final int _flags
        -
      • -
      - - - -
        -
      • -

        _canonicalize

        -
        protected boolean _canonicalize
        -
        Whether any canonicalization should be attempted (whether using - intern or not. -

        - NOTE: non-final since we may need to disable this with overflow.

        -
      • -
      - - - -
        -
      • -

        _symbols

        -
        protected String[] _symbols
        -
        Primary matching symbols; it's expected most match occur from - here.
        -
      • -
      - - - -
        -
      • -

        _buckets

        -
        protected com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer.Bucket[] _buckets
        -
        Overflow buckets; if primary doesn't match, lookup is done - from here. -

        - Note: Number of buckets is half of number of symbol entries, on - assumption there's less need for buckets.

        -
      • -
      - - - -
        -
      • -

        _size

        -
        protected int _size
        -
        Current size (number of entries); needed to know if and when - rehash.
        -
      • -
      - - - -
        -
      • -

        _sizeThreshold

        -
        protected int _sizeThreshold
        -
        Limit that indicates maximum size this instance can hold before - it needs to be expanded and rehashed. Calculated using fill - factor passed in to constructor.
        -
      • -
      - - - -
        -
      • -

        _indexMask

        -
        protected int _indexMask
        -
        Mask used to get index from hash values; equal to - _buckets.length - 1, when _buckets.length is - a power of two.
        -
      • -
      - - - -
        -
      • -

        _longestCollisionList

        -
        protected int _longestCollisionList
        -
        We need to keep track of the longest collision list; this is needed - both to indicate problems with attacks and to allow flushing for - other cases.
        -
      • -
      - - - -
        -
      • -

        _hashShared

        -
        protected boolean _hashShared
        -
        Flag that indicates whether underlying data structures for - the main hash area are shared or not. If they are, then they - need to be handled in copy-on-write way, i.e. if they need - to be modified, a copy needs to be made first; at this point - it will not be shared any more, and can be modified. -

        - This flag needs to be checked both when adding new main entries, - and when adding new collision list queues (i.e. creating a new - collision list head entry)

        -
      • -
      - - - -
        -
      • -

        _overflows

        -
        protected BitSet _overflows
        -
        Lazily constructed structure that is used to keep track of - collision buckets that have overflowed once: this is used - to detect likely attempts at denial-of-service attacks that - uses hash collisions.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        createRoot

        -
        public static CharsToNameCanonicalizer createRoot()
        -
        Method called to create root canonicalizer for a JsonFactory - instance. Root instance is never used directly; its main use is for - storing and sharing underlying symbol arrays as needed.
        -
        -
        Returns:
        -
        Root instance to use for constructing new child instances
        -
        -
      • -
      - - - - - - - -
        -
      • -

        makeChild

        -
        public CharsToNameCanonicalizer makeChild(int flags)
        -
        "Factory" method; will create a new child instance of this symbol - table. It will be a copy-on-write instance, ie. it will only use - read-only copy of parent's data, but when changes are needed, a - copy will be created. -

        - Note: while this method is synchronized, it is generally not - safe to both use makeChild/mergeChild, AND to use instance - actively. Instead, a separate 'root' instance should be used - on which only makeChild/mergeChild are called, but instance itself - is not used as a symbol table.

        -
        -
        Parameters:
        -
        flags - Bit flags of active TokenStreamFactory.Features enabled.
        -
        Returns:
        -
        Actual canonicalizer instance that can be used by a parser
        -
        -
      • -
      - - - -
        -
      • -

        release

        -
        public void release()
        -
        Method called by the using code to indicate it is done with this instance. - This lets instance merge accumulated changes into parent (if need be), - safely and efficiently, and without calling code having to know about parent - information.
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        -
        Returns:
        -
        Number of symbol entries contained by this canonicalizer instance
        -
        -
      • -
      - - - -
        -
      • -

        bucketCount

        -
        public int bucketCount()
        -
        Method for checking number of primary hash buckets this symbol - table uses.
        -
        -
        Returns:
        -
        number of primary slots table has currently
        -
        -
      • -
      - - - -
        -
      • -

        maybeDirty

        -
        public boolean maybeDirty()
        -
      • -
      - - - -
        -
      • -

        hashSeed

        -
        public int hashSeed()
        -
      • -
      - - - -
        -
      • -

        collisionCount

        -
        public int collisionCount()
        -
        Method mostly needed by unit tests; calculates number of - entries that are in collision list. Value can be at most - (size() - 1), but should usually be much lower, ideally 0.
        -
        -
        Returns:
        -
        Number of collisions in the primary hash area
        -
        Since:
        -
        2.1
        -
        -
      • -
      - - - -
        -
      • -

        maxCollisionLength

        -
        public int maxCollisionLength()
        -
        Method mostly needed by unit tests; calculates length of the - longest collision chain. This should typically be a low number, - but may be up to size() - 1 in the pathological case
        -
        -
        Returns:
        -
        Length of the collision chain
        -
        Since:
        -
        2.1
        -
        -
      • -
      - - - -
        -
      • -

        findSymbol

        -
        public String findSymbol(char[] buffer,
        -                         int start,
        -                         int len,
        -                         int h)
        -
      • -
      - - - -
        -
      • -

        _hashToIndex

        -
        public int _hashToIndex(int rawHash)
        -
        Helper method that takes in a "raw" hash value, shuffles it as necessary, - and truncates to be used as the index.
        -
        -
        Parameters:
        -
        rawHash - Raw hash value to use for calculating index
        -
        Returns:
        -
        Index value calculated
        -
        -
      • -
      - - - -
        -
      • -

        calcHash

        -
        public int calcHash(char[] buffer,
        -                    int start,
        -                    int len)
        -
        Implementation of a hashing method for variable length - Strings. Most of the time intention is that this calculation - is done by caller during parsing, not here; however, sometimes - it needs to be done for parsed "String" too.
        -
        -
        Parameters:
        -
        buffer - Input buffer that contains name to decode
        -
        start - Pointer to the first character of the name
        -
        len - Length of String; has to be at least 1 (caller guarantees)
        -
        Returns:
        -
        Hash code calculated
        -
        -
      • -
      - - - -
        -
      • -

        calcHash

        -
        public int calcHash(String key)
        -
      • -
      - - - -
        -
      • -

        reportTooManyCollisions

        -
        protected void reportTooManyCollisions(int maxLen)
        -
      • -
      - - - -
        -
      • -

        verifyInternalConsistency

        -
        protected void verifyInternalConsistency()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/FieldNameMatcher.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/FieldNameMatcher.html deleted file mode 100644 index 232c39314a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/FieldNameMatcher.html +++ /dev/null @@ -1,620 +0,0 @@ - - - - - - -FieldNameMatcher (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.sym
-

Class FieldNameMatcher

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    Direct Known Subclasses:
    -
    HashedMatcherBase
    -
    -
    -
    -
    public abstract class FieldNameMatcher
    -extends Object
    -implements Serializable
    -
    Interface for implementations used for efficient matching of field names from - input stream (via parser) to higher-level abstractions like properties that - databind uses. Used to avoid two-phase lookups -- first from input stream to - strings; then from strings to entities -- but details may heavily depend on - format parser (some formats can optimize better than others).
    -
    -
    Since:
    -
    3.0
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        MATCH_END_OBJECT

        -
        public static final int MATCH_END_OBJECT
        -
        Marker for case where JsonToken.END_OBJECT encountered.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MATCH_UNKNOWN_NAME

        -
        public static final int MATCH_UNKNOWN_NAME
        -
        Marker for case where field name encountered but not one of matches.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        MATCH_ODD_TOKEN

        -
        public static final int MATCH_ODD_TOKEN
        -
        Marker for case where token encountered is neither FIELD_NAME - nor END_OBJECT.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        _nameLookup

        -
        protected final String[] _nameLookup
        -
      • -
      - - - - - - - -
        -
      • -

        _locale

        -
        protected final Locale _locale
        -
        Since case-handling is Locale-specific in some (rare) cases, need to hold - on to configured Locale.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        matchName

        -
        public abstract int matchName(String toMatch)
        -
        Lookup method that does not assume name to be matched to be - String.intern()ed (although passing interned String is likely - to result in more efficient matching).
        -
        -
        Parameters:
        -
        toMatch - Name to match
        -
        Returns:
        -
        Index of the name matched, if any (non-negative number); or an - error code (negative constant MATCH_xxx) if none
        -
        -
      • -
      - - - -
        -
      • -

        matchByQuad

        -
        public abstract int matchByQuad(int q1)
        -
      • -
      - - - -
        -
      • -

        matchByQuad

        -
        public abstract int matchByQuad(int q1,
        -                                int q2)
        -
      • -
      - - - -
        -
      • -

        matchByQuad

        -
        public abstract int matchByQuad(int q1,
        -                                int q2,
        -                                int q3)
        -
      • -
      - - - -
        -
      • -

        matchByQuad

        -
        public abstract int matchByQuad(int[] q,
        -                                int qlen)
        -
      • -
      - - - -
        -
      • -

        nameLookup

        -
        public final String[] nameLookup()
        -
        Accessor to names matching indexes, iff passed during construction.
        -
        -
        Returns:
        -
        Array of names that this matcher may match (with indices that - match non-negative values by matchXxx methods)
        -
        -
      • -
      - - - -
        -
      • -

        matchSecondary

        -
        protected int matchSecondary(String toMatch)
        -
        Secondary lookup method used for matchers that operate with more complex - matching rules, such as case-insensitive matchers.
        -
        -
        Parameters:
        -
        toMatch - Name to match
        -
        Returns:
        -
        Index for the match, if any (non-negative); or error code if no match
        -
        -
      • -
      - - - -
        -
      • -

        _hash

        -
        protected static final int _hash(int h,
        -                                 int mask)
        -
      • -
      - - - -
        -
      • -

        _findSize

        -
        protected static int _findSize(int size)
        -
      • -
      - - - -
        -
      • -

        stringsFromNames

        -
        public static List<String> stringsFromNames(List<Named> fields,
        -                                            boolean alreadyInterned)
        -
      • -
      - - - -
        -
      • -

        _fromName

        -
        protected static String _fromName(Named n,
        -                                  boolean alreadyInterned)
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/HashedMatcherBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/HashedMatcherBase.html deleted file mode 100644 index 305e6fb4af..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/HashedMatcherBase.html +++ /dev/null @@ -1,469 +0,0 @@ - - - - - - -HashedMatcherBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.sym
-

Class HashedMatcherBase

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _mask

        -
        protected final int _mask
        -
        Mask used to get index from raw hash code, within hash area.
        -
      • -
      - - - -
        -
      • -

        _offsets

        -
        protected final int[] _offsets
        -
      • -
      - - - -
        -
      • -

        _names

        -
        protected final String[] _names
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        matchName

        -
        public final int matchName(String toMatch)
        -
        Description copied from class: FieldNameMatcher
        -
        Lookup method that does not assume name to be matched to be - String.intern()ed (although passing interned String is likely - to result in more efficient matching).
        -
        -
        Specified by:
        -
        matchName in class FieldNameMatcher
        -
        Parameters:
        -
        toMatch - Name to match
        -
        Returns:
        -
        Index of the name matched, if any (non-negative number); or an - error code (negative constant MATCH_xxx) if none
        -
        -
      • -
      - - - -
        -
      • -

        _matchSpill

        -
        protected int _matchSpill(String toMatch)
        -
      • -
      - - - -
        -
      • -

        spillCount

        -
        public int spillCount()
        -
      • -
      - - - -
        -
      • -

        secondaryCount

        -
        public int secondaryCount()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/SimpleNameMatcher.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/SimpleNameMatcher.html deleted file mode 100644 index bb16f24602..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/SimpleNameMatcher.html +++ /dev/null @@ -1,502 +0,0 @@ - - - - - - -SimpleNameMatcher (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.sym
-

Class SimpleNameMatcher

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        constructFrom

        -
        public static SimpleNameMatcher constructFrom(Locale locale,
        -                                              List<Named> fields,
        -                                              boolean alreadyInterned)
        -
        Factory method for constructing case-sensitive matcher that only supports - matching from `String`.
        -
        -
        Parameters:
        -
        locale - Locale to use (relevant for case-insensitive matchers)
        -
        fields - Names to match
        -
        alreadyInterned - Whether underlying Strings have been String.intern()ed or not
        -
        Returns:
        -
        Matcher constructed
        -
        -
      • -
      - - - -
        -
      • -

        construct

        -
        public static SimpleNameMatcher construct(Locale locale,
        -                                          List<String> fieldNames)
        -
        Factory method for constructing case-sensitive matcher that only supports - matching from `String`.
        -
        -
        Parameters:
        -
        locale - Locale to use (relevant for case-insensitive matchers)
        -
        fieldNames - Names to match
        -
        Returns:
        -
        Matcher constructed
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        matchByQuad

        -
        public int matchByQuad(int q1,
        -                       int q2,
        -                       int q3)
        -
        -
        Specified by:
        -
        matchByQuad in class FieldNameMatcher
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/BinaryNameMatcher.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/BinaryNameMatcher.html deleted file mode 100644 index 38703b3565..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/BinaryNameMatcher.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.sym.BinaryNameMatcher (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.sym.BinaryNameMatcher

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/ByteQuadsCanonicalizer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/ByteQuadsCanonicalizer.html deleted file mode 100644 index c300479aba..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/ByteQuadsCanonicalizer.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/CharsToNameCanonicalizer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/CharsToNameCanonicalizer.html deleted file mode 100644 index bfed126d03..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/CharsToNameCanonicalizer.html +++ /dev/null @@ -1,282 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/FieldNameMatcher.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/FieldNameMatcher.html deleted file mode 100644 index 95ffc76aa4..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/FieldNameMatcher.html +++ /dev/null @@ -1,444 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.sym.FieldNameMatcher (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.sym.FieldNameMatcher

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/HashedMatcherBase.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/HashedMatcherBase.html deleted file mode 100644 index b233ffdd18..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/HashedMatcherBase.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.sym.HashedMatcherBase (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.sym.HashedMatcherBase

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/SimpleNameMatcher.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/SimpleNameMatcher.html deleted file mode 100644 index 234fb668d9..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/class-use/SimpleNameMatcher.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.sym.SimpleNameMatcher (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.sym.SimpleNameMatcher

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-frame.html deleted file mode 100644 index df8ddf701a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-frame.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.sym (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.sym

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-summary.html deleted file mode 100644 index 3f7b72f7b9..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-summary.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.sym (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.sym

-
-
Internal implementation classes for efficient handling of - of symbols in JSON (field names in Objects)
-
-

See: Description

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    BinaryNameMatcher -
    Simplified static symbol table used instead of global quad-based canonicalizer - when we have smaller set of symbols (like properties of a POJO class).
    -
    ByteQuadsCanonicalizer -
    Replacement for BytesToNameCanonicalizer which aims at more localized - memory access due to flattening of name quad data.
    -
    CharsToNameCanonicalizer -
    This class is a kind of specialized type-safe Map, from char array to - String value.
    -
    FieldNameMatcher -
    Interface for implementations used for efficient matching of field names from - input stream (via parser) to higher-level abstractions like properties that - databind uses.
    -
    HashedMatcherBase -
    Intermediate base class for matchers that use hash-array based approach - with Strings.
    -
    SimpleNameMatcher -
    Basic FieldNameMatcher that uses case-sensitive match and does - not require (or expect) that names passed as arguments have been - String.intern()ed.
    -
    -
  • -
- - - -

Package com.fasterxml.jackson.core.sym Description

-
Internal implementation classes for efficient handling of - of symbols in JSON (field names in Objects)
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-tree.html deleted file mode 100644 index ca61fa89ec..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-tree.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.sym Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.sym

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-use.html deleted file mode 100644 index 05dfe72cad..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/sym/package-use.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.sym (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.sym

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/ArrayTreeNode.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/ArrayTreeNode.html deleted file mode 100644 index 459ebc2e6a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/ArrayTreeNode.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - -ArrayTreeNode (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.tree
-

Interface ArrayTreeNode

-
-
-
-
    -
  • -
    -
    All Superinterfaces:
    -
    TreeNode
    -
    -
    -
    -
    public interface ArrayTreeNode
    -extends TreeNode
    -
    Tag interface (for now) for Array nodes
    -
    -
    Since:
    -
    3.0
    -
    -
  • -
-
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/ObjectTreeNode.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/ObjectTreeNode.html deleted file mode 100644 index 680c69bdcb..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/ObjectTreeNode.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - -ObjectTreeNode (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.tree
-

Interface ObjectTreeNode

-
-
-
-
    -
  • -
    -
    All Superinterfaces:
    -
    TreeNode
    -
    -
    -
    -
    public interface ObjectTreeNode
    -extends TreeNode
    -
    Tag interface (for now) for Object nodes
    -
    -
    Since:
    -
    3.0
    -
    -
  • -
-
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/class-use/ArrayTreeNode.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/class-use/ArrayTreeNode.html deleted file mode 100644 index bc6183626b..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/class-use/ArrayTreeNode.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.tree.ArrayTreeNode (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.tree.ArrayTreeNode

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/class-use/ObjectTreeNode.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/class-use/ObjectTreeNode.html deleted file mode 100644 index ca6476868d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/class-use/ObjectTreeNode.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.tree.ObjectTreeNode (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.tree.ObjectTreeNode

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-frame.html deleted file mode 100644 index c31025dd57..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-frame.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.tree (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.tree

-
-

Interfaces

- -
- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-summary.html deleted file mode 100644 index 97b5571c03..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-summary.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.tree (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.tree

-
-
Package that contains abstractions that are used dealing - with Tree Models (other than - TreeNode).
-
-

See: Description

-
-
-
    -
  • - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    ArrayTreeNode -
    Tag interface (for now) for Array nodes
    -
    ObjectTreeNode -
    Tag interface (for now) for Object nodes
    -
    -
  • -
- - - -

Package com.fasterxml.jackson.core.tree Description

-
Package that contains abstractions that are used dealing - with Tree Models (other than - TreeNode).
-
-
Since:
-
3.0
-
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-tree.html deleted file mode 100644 index 44ba76956e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-tree.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.tree Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.tree

-Package Hierarchies: - -
-
-

Interface Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-use.html deleted file mode 100644 index 97719e057a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/tree/package-use.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.tree (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.tree

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/ResolvedType.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/ResolvedType.html deleted file mode 100644 index 715101d2e4..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/ResolvedType.html +++ /dev/null @@ -1,606 +0,0 @@ - - - - - - -ResolvedType (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.type
-

Class ResolvedType

-
-
- -
-
    -
  • -
    -
    -
    public abstract class ResolvedType
    -extends Object
    -
    Type abstraction that represents Java type that has been resolved - (i.e. has all generic information, if any, resolved to concrete - types). - Note that this is an intermediate type, and all concrete instances - MUST be of type JavaType from "databind" bundle -- this - abstraction is only needed so that types can be passed through - JsonParser.readValueAs(java.lang.Class<T>) methods.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ResolvedType

        -
        public ResolvedType()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getRawClass

        -
        public abstract Class<?> getRawClass()
        -
        Accessor for type-erased Class of resolved type.
        -
      • -
      - - - -
        -
      • -

        hasRawClass

        -
        public abstract boolean hasRawClass(Class<?> clz)
        -
      • -
      - - - -
        -
      • -

        isAbstract

        -
        public abstract boolean isAbstract()
        -
      • -
      - - - -
        -
      • -

        isConcrete

        -
        public abstract boolean isConcrete()
        -
      • -
      - - - -
        -
      • -

        isThrowable

        -
        public abstract boolean isThrowable()
        -
      • -
      - - - -
        -
      • -

        isArrayType

        -
        public abstract boolean isArrayType()
        -
      • -
      - - - -
        -
      • -

        isEnumType

        -
        public abstract boolean isEnumType()
        -
      • -
      - - - -
        -
      • -

        isInterface

        -
        public abstract boolean isInterface()
        -
      • -
      - - - -
        -
      • -

        isPrimitive

        -
        public abstract boolean isPrimitive()
        -
      • -
      - - - -
        -
      • -

        isFinal

        -
        public abstract boolean isFinal()
        -
      • -
      - - - -
        -
      • -

        isContainerType

        -
        public abstract boolean isContainerType()
        -
      • -
      - - - -
        -
      • -

        isCollectionLikeType

        -
        public abstract boolean isCollectionLikeType()
        -
      • -
      - - - -
        -
      • -

        isReferenceType

        -
        public boolean isReferenceType()
        -
        Whether this type is a referential type, meaning that values are - basically pointers to "real" values (or null) and not regular - values themselves. Typical examples include things like - AtomicReference, and various - Optional types (in JDK8, Guava).
        -
      • -
      - - - -
        -
      • -

        isMapLikeType

        -
        public abstract boolean isMapLikeType()
        -
      • -
      - - - -
        -
      • -

        hasGenericTypes

        -
        public abstract boolean hasGenericTypes()
        -
        Method that can be used to find out if the type directly declares generic - parameters (for its direct super-class and/or super-interfaces).
        -
      • -
      - - - -
        -
      • -

        getKeyType

        -
        public abstract ResolvedType getKeyType()
        -
        Method for accessing key type for this type, assuming type - has such a concept (only Map types do)
        -
      • -
      - - - -
        -
      • -

        getContentType

        -
        public abstract ResolvedType getContentType()
        -
        Method for accessing content type of this type, if type has - such a thing: simple types do not, structured types do - (like arrays, Collections and Maps)
        -
      • -
      - - - -
        -
      • -

        getReferencedType

        -
        public abstract ResolvedType getReferencedType()
        -
        Method for accessing type of value that instances of this - type references, if any.
        -
        -
        Returns:
        -
        Referenced type, if any; null if not.
        -
        -
      • -
      - - - -
        -
      • -

        containedTypeCount

        -
        public abstract int containedTypeCount()
        -
        Method for checking how many contained types this type - has. Contained types are usually generic types, so that - generic Maps have 2 contained types.
        -
      • -
      - - - -
        -
      • -

        containedType

        -
        public abstract ResolvedType containedType(int index)
        -
        Method for accessing definitions of contained ("child") - types.
        -
        -
        Parameters:
        -
        index - Index of contained type to return
        -
        Returns:
        -
        Contained type at index, or null if no such type - exists (no exception thrown)
        -
        -
      • -
      - - - -
        -
      • -

        toCanonical

        -
        public abstract String toCanonical()
        -
        Method that can be used to serialize type into form from which - it can be fully deserialized from at a later point (using - TypeFactory from mapper package). - For simple types this is same as calling - Class.getName(), but for structured types it may additionally - contain type information about contents.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/TypeReference.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/TypeReference.html deleted file mode 100644 index 1a5c7435b8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/TypeReference.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - -TypeReference (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.type
-

Class TypeReference<T>

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Comparable<TypeReference<T>>
    -
    -
    -
    -
    public abstract class TypeReference<T>
    -extends Object
    -implements Comparable<TypeReference<T>>
    -
    This generic abstract class is used for obtaining full generics type information - by sub-classing; it must be converted to ResolvedType implementation - (implemented by JavaType from "databind" bundle) to be used. - Class is based on ideas from - http://gafter.blogspot.com/2006/12/super-type-tokens.html, - Additional idea (from a suggestion made in comments of the article) - is to require bogus implementation of Comparable - (any such generic interface would do, as long as it forces a method - with generic type to be implemented). - to ensure that a Type argument is indeed given. -

    - Usage is by sub-classing: here is one way to instantiate reference - to generic type List<Integer>: -

    -  TypeReference ref = new TypeReference<List<Integer>>() { };
    -
    - which can be passed to methods that accept TypeReference, or resolved - using TypeFactory to obtain ResolvedType.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _type

        -
        protected final Type _type
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TypeReference

        -
        protected TypeReference()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getType

        -
        public Type getType()
        -
      • -
      - - - -
        -
      • -

        compareTo

        -
        public int compareTo(TypeReference<T> o)
        -
        The only reason we define this method (and require implementation - of Comparable) is to prevent constructing a - reference without type information.
        -
        -
        Specified by:
        -
        compareTo in interface Comparable<TypeReference<T>>
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/WritableTypeId.Inclusion.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/WritableTypeId.Inclusion.html deleted file mode 100644 index dafe3c081e..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/WritableTypeId.Inclusion.html +++ /dev/null @@ -1,460 +0,0 @@ - - - - - - -WritableTypeId.Inclusion (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.type
-

Enum WritableTypeId.Inclusion

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable, Comparable<WritableTypeId.Inclusion>
    -
    -
    -
    Enclosing class:
    -
    WritableTypeId
    -
    -
    -
    -
    public static enum WritableTypeId.Inclusion
    -extends Enum<WritableTypeId.Inclusion>
    -
    Enumeration of values that matches enum `As` from annotation - `JsonTypeInfo`: separate definition to avoid dependency between - streaming core and annotations packages; also allows more flexibility - in case new values needed at this level of internal API. -

    - NOTE: in most cases this only matters with formats that do NOT have native - type id capabilities, and require type id to be included within regular - data (whether exposed as Java properties or not). Formats with native - types usually use native type id functionality regardless, unless - overridden by a feature to use "non-native" type inclusion.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        WRAPPER_ARRAY

        -
        public static final WritableTypeId.Inclusion WRAPPER_ARRAY
        -
        Inclusion as wrapper Array (1st element type id, 2nd element value). -

        - Corresponds to JsonTypeInfo.As.WRAPPER_ARRAY.

        -
      • -
      - - - -
        -
      • -

        WRAPPER_OBJECT

        -
        public static final WritableTypeId.Inclusion WRAPPER_OBJECT
        -
        Inclusion as wrapper Object that has one key/value pair where type id - is the key for typed value. -

        - Corresponds to JsonTypeInfo.As.WRAPPER_OBJECT.

        -
      • -
      - - - -
        -
      • -

        METADATA_PROPERTY

        -
        public static final WritableTypeId.Inclusion METADATA_PROPERTY
        -
        Inclusion as a property within Object to write, but logically as separate - metadata that is not exposed as payload to caller: that is, does not match - any of visible properties value object has. -

        - NOTE: if shape of typed value to write is NOT Object, will instead use - WRAPPER_ARRAY inclusion. -

        - Corresponds to JsonTypeInfo.As.PROPERTY.

        -
      • -
      - - - -
        -
      • -

        PAYLOAD_PROPERTY

        -
        public static final WritableTypeId.Inclusion PAYLOAD_PROPERTY
        -
        Inclusion as a "regular" property within Object to write; this implies that - its value should come from regular POJO property on serialization, and - be deserialized into such property. This handling, however, is up to databinding. -

        - Regarding handling, type id is ONLY written as native type id; if no native - type ids available, caller is assumed to handle output some other way. - This is different from METADATA_PROPERTY. -

        - NOTE: if shape of typed value to write is NOT Object, will instead use - WRAPPER_ARRAY inclusion. -

        - Corresponds to JsonTypeInfo.As.EXISTING_PROPERTY.

        -
      • -
      - - - -
        -
      • -

        PARENT_PROPERTY

        -
        public static final WritableTypeId.Inclusion PARENT_PROPERTY
        -
        Inclusion as a property within "parent" Object of value Object to write. - This typically requires slightly convoluted processing in which property - that contains type id is actually written after typed value object - itself is written. -
        - Note that it is illegal to call write method if the current (parent) write context - is not Object: no coercion is done for other inclusion types (unlike with - other xxx_PROPERTY choices. - This also means that root values MAY NOT use this type id inclusion mechanism - (as they have no parent context). -

        - Corresponds to JsonTypeInfo.As.EXTERNAL_PROPERTY.

        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static WritableTypeId.Inclusion[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (WritableTypeId.Inclusion c : WritableTypeId.Inclusion.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static WritableTypeId.Inclusion valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        requiresObjectContext

        -
        public boolean requiresObjectContext()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/WritableTypeId.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/WritableTypeId.html deleted file mode 100644 index 63f742d294..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/WritableTypeId.html +++ /dev/null @@ -1,520 +0,0 @@ - - - - - - -WritableTypeId (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.type
-

Class WritableTypeId

-
-
- -
-
    -
  • -
    -
    -
    public class WritableTypeId
    -extends Object
    -
    This is a simple value class used between core streaming and higher level - databinding to pass information about type ids to write. - Properties are exposed and mutable on purpose: they are only used for communication - over serialization of a single value, and neither retained across calls nor shared - between threads. -

    - Usual usage pattern is such that instance of this class is passed on two calls that are - needed for outputting type id (and possible additional wrapping, depending on format; - JSON, for example, requires wrapping as type id is part of regular data): first, a "prefix" - write (which usually includes actual id), performed before value write; and then - matching "suffix" write after value serialization.

    -
    -
    Since:
    -
    2.9
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Nested Class Summary

      - - - - - - - - - - -
      Nested Classes 
      Modifier and TypeClass and Description
      static class WritableTypeId.Inclusion -
      Enumeration of values that matches enum `As` from annotation - `JsonTypeInfo`: separate definition to avoid dependency between - streaming core and annotations packages; also allows more flexibility - in case new values needed at this level of internal API.
      -
      -
    • -
    - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      StringasProperty -
      If type id is to be embedded as a regular property, name of the property; - otherwise `null`.
      -
      Objectextra -
      Optional additional information that generator may add during "prefix write", - to be available on matching "suffix write".
      -
      ObjectforValue -
      Java object for which type id is being written.
      -
      Class<?>forValueType -
      (optional) Super-type of forValue to use for type id generation (if no - explicit id passed): used instead of actual class of forValue in cases - where we do not want to use the "real" type but something more generic, usually - to work around specific problem with implementation type, or its deserializer.
      -
      Objectid -
      Actual type id to use: usually {link java.lang.String}.
      -
      WritableTypeId.Inclusioninclude -
      Property used to indicate style of inclusion for this type id, in cases where - no native type id may be used (either because format has none, like JSON; or - because use of native type ids is disabled [with YAML]).
      -
      JsonTokenvalueShape -
      Information about intended shape of the value being written (that is, forValue); - in case of structured values, start token of the structure; for scalars, value token.
      -
      booleanwrapperWritten -
      Flag that can be set to indicate that wrapper structure was written (during - prefix-writing); used to determine if suffix requires matching close markers.
      -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      WritableTypeId() 
      WritableTypeId(Object value, - Class<?> valueType0, - JsonToken valueShape0) -
      Constructor used when calling a method for generating and writing Type Id, - but where actual type to use for generating id is NOT the type of value - (but its supertype).
      -
      WritableTypeId(Object value, - JsonToken valueShape0) -
      Constructor used when calling a method for generating and writing Type Id; - caller only knows value object and its intended shape.
      -
      WritableTypeId(Object value, - JsonToken valueShape0, - Object id0) -
      Constructor used when calling a method for writing Type Id; - caller knows value object, its intended shape as well as id to - use; but not details of wrapping (if any).
      -
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        forValue

        -
        public Object forValue
        -
        Java object for which type id is being written. Not needed by default handling, - but may be useful for customized format handling.
        -
      • -
      - - - -
        -
      • -

        forValueType

        -
        public Class<?> forValueType
        -
        (optional) Super-type of forValue to use for type id generation (if no - explicit id passed): used instead of actual class of forValue in cases - where we do not want to use the "real" type but something more generic, usually - to work around specific problem with implementation type, or its deserializer.
        -
      • -
      - - - -
        -
      • -

        id

        -
        public Object id
        -
        Actual type id to use: usually {link java.lang.String}.
        -
      • -
      - - - -
        -
      • -

        asProperty

        -
        public String asProperty
        -
        If type id is to be embedded as a regular property, name of the property; - otherwise `null`. -

        - NOTE: if "wrap-as-Object" is used, this does NOT contain property name to - use but `null`.

        -
      • -
      - - - -
        -
      • -

        include

        -
        public WritableTypeId.Inclusion include
        -
        Property used to indicate style of inclusion for this type id, in cases where - no native type id may be used (either because format has none, like JSON; or - because use of native type ids is disabled [with YAML]).
        -
      • -
      - - - -
        -
      • -

        valueShape

        -
        public JsonToken valueShape
        -
        Information about intended shape of the value being written (that is, forValue); - in case of structured values, start token of the structure; for scalars, value token. - Main difference is between structured values - (JsonToken.START_ARRAY, JsonToken.START_OBJECT) - and scalars (JsonToken.VALUE_STRING): specific scalar type may not be - important for processing.
        -
      • -
      - - - -
        -
      • -

        wrapperWritten

        -
        public boolean wrapperWritten
        -
        Flag that can be set to indicate that wrapper structure was written (during - prefix-writing); used to determine if suffix requires matching close markers.
        -
      • -
      - - - -
        -
      • -

        extra

        -
        public Object extra
        -
        Optional additional information that generator may add during "prefix write", - to be available on matching "suffix write".
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        WritableTypeId

        -
        public WritableTypeId()
        -
      • -
      - - - -
        -
      • -

        WritableTypeId

        -
        public WritableTypeId(Object value,
        -                      JsonToken valueShape0)
        -
        Constructor used when calling a method for generating and writing Type Id; - caller only knows value object and its intended shape.
        -
      • -
      - - - -
        -
      • -

        WritableTypeId

        -
        public WritableTypeId(Object value,
        -                      Class<?> valueType0,
        -                      JsonToken valueShape0)
        -
        Constructor used when calling a method for generating and writing Type Id, - but where actual type to use for generating id is NOT the type of value - (but its supertype).
        -
      • -
      - - - -
        -
      • -

        WritableTypeId

        -
        public WritableTypeId(Object value,
        -                      JsonToken valueShape0,
        -                      Object id0)
        -
        Constructor used when calling a method for writing Type Id; - caller knows value object, its intended shape as well as id to - use; but not details of wrapping (if any).
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/ResolvedType.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/ResolvedType.html deleted file mode 100644 index ffd90f4652..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/ResolvedType.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.type.ResolvedType (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.type.ResolvedType

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/TypeReference.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/TypeReference.html deleted file mode 100644 index 6b7f51ce4a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/TypeReference.html +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.type.TypeReference (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.type.TypeReference

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/WritableTypeId.Inclusion.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/WritableTypeId.Inclusion.html deleted file mode 100644 index 3efe1940ee..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/WritableTypeId.Inclusion.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.type.WritableTypeId.Inclusion (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.type.WritableTypeId.Inclusion

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/WritableTypeId.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/WritableTypeId.html deleted file mode 100644 index f83e756e19..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/class-use/WritableTypeId.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.type.WritableTypeId (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.type.WritableTypeId

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-frame.html deleted file mode 100644 index e9e001a82b..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-frame.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.type (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.type

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-summary.html deleted file mode 100644 index a67d9a5e34..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-summary.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.type (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.type

-
-
Contains classes needed for type introspection, mostly used by data binding - functionality.
-
-

See: Description

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    ResolvedType -
    Type abstraction that represents Java type that has been resolved - (i.e.
    -
    TypeReference<T> -
    This generic abstract class is used for obtaining full generics type information - by sub-classing; it must be converted to ResolvedType implementation - (implemented by JavaType from "databind" bundle) to be used.
    -
    WritableTypeId -
    This is a simple value class used between core streaming and higher level - databinding to pass information about type ids to write.
    -
    -
  • -
  • - - - - - - - - - - - - -
    Enum Summary 
    EnumDescription
    WritableTypeId.Inclusion -
    Enumeration of values that matches enum `As` from annotation - `JsonTypeInfo`: separate definition to avoid dependency between - streaming core and annotations packages; also allows more flexibility - in case new values needed at this level of internal API.
    -
    -
  • -
- - - -

Package com.fasterxml.jackson.core.type Description

-
Contains classes needed for type introspection, mostly used by data binding - functionality. Most of this functionality is needed to properly handled - generic types, and to simplify and unify processing of things Jackson needs - to determine how contained types (of Collection and - Map classes) are to be handled. -

- With 2.9, an additional type (WritableTypeId) - was added to help handling of type identifiers needed to support polymorphic - type serialization, deserialization.

-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-tree.html deleted file mode 100644 index 46536ba8b5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-tree.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.type Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.type

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Enum Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-use.html deleted file mode 100644 index 8300be065b..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/type/package-use.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.type (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.type

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/BufferRecycler.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/BufferRecycler.html deleted file mode 100644 index 504b8b93eb..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/BufferRecycler.html +++ /dev/null @@ -1,680 +0,0 @@ - - - - - - -BufferRecycler (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class BufferRecycler

-
-
- -
-
    -
  • -
    -
    -
    public class BufferRecycler
    -extends Object
    -
    This is a small utility class, whose main functionality is to allow - simple reuse of raw byte/char buffers. It is usually used through - ThreadLocal member of the owning class pointing to - instance of this class through a SoftReference. The - end result is a low-overhead GC-cleanable recycling: hopefully - ideal for use by stream readers. -

    - Rewritten in 2.10 to be thread-safe (see [jackson-core#479] for details), - to not rely on ThreadLocal access.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        BYTE_READ_IO_BUFFER

        -
        public static final int BYTE_READ_IO_BUFFER
        -
        Buffer used for reading byte-based input.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        BYTE_WRITE_ENCODING_BUFFER

        -
        public static final int BYTE_WRITE_ENCODING_BUFFER
        -
        Buffer used for temporarily storing encoded content; used - for example by UTF-8 encoding writer
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        BYTE_WRITE_CONCAT_BUFFER

        -
        public static final int BYTE_WRITE_CONCAT_BUFFER
        -
        Buffer used for temporarily concatenating output; used for - example when requesting output as byte array.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        BYTE_BASE64_CODEC_BUFFER

        -
        public static final int BYTE_BASE64_CODEC_BUFFER
        -
        Buffer used for concatenating binary data that is either being - encoded as base64 output, or decoded from base64 input.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CHAR_TOKEN_BUFFER

        -
        public static final int CHAR_TOKEN_BUFFER
        -
        Buffer used as input buffer for tokenization for character-based parsers.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CHAR_CONCAT_BUFFER

        -
        public static final int CHAR_CONCAT_BUFFER
        -
        Buffer used by generators; for byte-backed generators for buffering of - String values to output (before encoding into UTF-8), - and for char-backed generators as actual concatenation buffer.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CHAR_TEXT_BUFFER

        -
        public static final int CHAR_TEXT_BUFFER
        -
        Used through TextBuffer: directly by parsers (to concatenate - String values) - and indirectly via - SegmentedStringWriter - when serializing (databind level ObjectMapper and - ObjectWriter). In both cases used as segments (and not for whole value), - but may result in retention of larger chunks for big content - (long text values during parsing; bigger output documents for generation).
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CHAR_NAME_COPY_BUFFER

        -
        public static final int CHAR_NAME_COPY_BUFFER
        -
        For parsers, temporary buffer into which char[] for names is copied - when requested as such; for WriterBasedGenerator used for buffering - during writeString(Reader) operation (not commonly used).
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - - - - - -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        BufferRecycler

        -
        public BufferRecycler()
        -
        Default constructor used for creating instances of this default - implementation.
        -
      • -
      - - - -
        -
      • -

        BufferRecycler

        -
        protected BufferRecycler(int bbCount,
        -                         int cbCount)
        -
        Alternate constructor to be used by sub-classes, to allow customization - of number of low-level buffers in use.
        -
        -
        Parameters:
        -
        bbCount - Number of byte[] buffers to allocate
        -
        cbCount - Number of char[] buffers to allocate
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        allocByteBuffer

        -
        public final byte[] allocByteBuffer(int ix)
        -
        -
        Parameters:
        -
        ix - One of READ_IO_BUFFER constants.
        -
        Returns:
        -
        Buffer allocated (possibly recycled)
        -
        -
      • -
      - - - -
        -
      • -

        allocByteBuffer

        -
        public byte[] allocByteBuffer(int ix,
        -                              int minSize)
        -
      • -
      - - - -
        -
      • -

        releaseByteBuffer

        -
        public void releaseByteBuffer(int ix,
        -                              byte[] buffer)
        -
      • -
      - - - -
        -
      • -

        allocCharBuffer

        -
        public final char[] allocCharBuffer(int ix)
        -
      • -
      - - - -
        -
      • -

        allocCharBuffer

        -
        public char[] allocCharBuffer(int ix,
        -                              int minSize)
        -
      • -
      - - - -
        -
      • -

        releaseCharBuffer

        -
        public void releaseCharBuffer(int ix,
        -                              char[] buffer)
        -
      • -
      - - - -
        -
      • -

        byteBufferLength

        -
        protected int byteBufferLength(int ix)
        -
      • -
      - - - -
        -
      • -

        charBufferLength

        -
        protected int charBufferLength(int ix)
        -
      • -
      - - - -
        -
      • -

        balloc

        -
        protected byte[] balloc(int size)
        -
      • -
      - - - -
        -
      • -

        calloc

        -
        protected char[] calloc(int size)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/BufferRecyclers.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/BufferRecyclers.html deleted file mode 100644 index b0193bc667..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/BufferRecyclers.html +++ /dev/null @@ -1,387 +0,0 @@ - - - - - - -BufferRecyclers (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class BufferRecyclers

-
-
- -
-
    -
  • -
    -
    -
    public class BufferRecyclers
    -extends Object
    -
    Helper entity used to control access to simple buffer recyling scheme used for - some encoding, decoding tasks.
    -
    -
    Since:
    -
    2.9.2
    -
    See Also:
    -
    BufferRecycler
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS

        -
        public static final String SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS
        -
        System property that is checked to see if recycled buffers (see BufferRecycler) - should be tracked, for purpose of forcing release of all such buffers, typically - during major classloading.
        -
        -
        Since:
        -
        2.9.6
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        BufferRecyclers

        -
        public BufferRecyclers()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        releaseBuffers

        -
        public static int releaseBuffers()
        -
        Specialized method that will release all recycled BufferRecycler if - (and only if) recycler tracking has been enabled - (see SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS). - This method is usually called on shutdown of the container like Application Server - to ensure that no references are reachable via ThreadLocals as this may cause - unintentional retention of sizable amounts of memory. It may also be called regularly - if GC for some reason does not clear up SoftReferences aggressively enough.
        -
        -
        Returns:
        -
        Number of buffers released, if tracking enabled (zero or more); -1 if tracking not enabled.
        -
        Since:
        -
        2.9.6
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/ByteArrayBuilder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/ByteArrayBuilder.html deleted file mode 100644 index 031ea557bc..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/ByteArrayBuilder.html +++ /dev/null @@ -1,704 +0,0 @@ - - - - - - -ByteArrayBuilder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class ByteArrayBuilder

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Closeable, Flushable, AutoCloseable
    -
    -
    -
    -
    public final class ByteArrayBuilder
    -extends OutputStream
    -
    Helper class that is similar to ByteArrayOutputStream - in usage, but more geared to Jackson use cases internally. - Specific changes include segment storage (no need to have linear - backing buffer, can avoid reallocations, copying), as well API - not based on OutputStream. In short, a very much - specialized builder object. -

    - Also implements OutputStream to allow - efficient aggregation of output content as a byte array, similar - to how ByteArrayOutputStream works, but somewhat more - efficiently for many use cases. -

    - NOTE: maximum size limited to Java Array maximum, 2 gigabytes: this - because usage pattern is to collect content for a `byte[]` and so although - theoretically this builder can aggregate more content it will not be usable - as things are. Behavior may be improved if we solve the access problem.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        NO_BYTES

        -
        public static final byte[] NO_BYTES
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ByteArrayBuilder

        -
        public ByteArrayBuilder()
        -
      • -
      - - - -
        -
      • -

        ByteArrayBuilder

        -
        public ByteArrayBuilder(BufferRecycler br)
        -
      • -
      - - - -
        -
      • -

        ByteArrayBuilder

        -
        public ByteArrayBuilder(int firstBlockSize)
        -
      • -
      - - - -
        -
      • -

        ByteArrayBuilder

        -
        public ByteArrayBuilder(BufferRecycler br,
        -                        int firstBlockSize)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        fromInitial

        -
        public static ByteArrayBuilder fromInitial(byte[] initialBlock,
        -                                           int length)
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset()
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        -
        Returns:
        -
        Number of bytes aggregated so far
        -
        Since:
        -
        2.9
        -
        -
      • -
      - - - -
        -
      • -

        release

        -
        public void release()
        -
        Clean up method to call to release all buffers this object may be - using. After calling the method, no other accessors can be used (and - attempt to do so may result in an exception)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(int i)
        -
      • -
      - - - -
        -
      • -

        appendTwoBytes

        -
        public void appendTwoBytes(int b16)
        -
      • -
      - - - -
        -
      • -

        appendThreeBytes

        -
        public void appendThreeBytes(int b24)
        -
      • -
      - - - -
        -
      • -

        appendFourBytes

        -
        public void appendFourBytes(int b32)
        -
      • -
      - - - -
        -
      • -

        toByteArray

        -
        public byte[] toByteArray()
        -
        Method called when results are finalized and we can get the - full aggregated result buffer to return to the caller
        -
        -
        Returns:
        -
        Aggregated contents as a byte[]
        -
        -
      • -
      - - - -
        -
      • -

        resetAndGetFirstSegment

        -
        public byte[] resetAndGetFirstSegment()
        -
        Method called when starting "manual" output: will clear out - current state and return the first segment buffer to fill
        -
        -
        Returns:
        -
        Segment to use for writing
        -
        -
      • -
      - - - -
        -
      • -

        finishCurrentSegment

        -
        public byte[] finishCurrentSegment()
        -
        Method called when the current segment buffer is full; will - append to current contents, allocate a new segment buffer - and return it
        -
        -
        Returns:
        -
        Segment to use for writing
        -
        -
      • -
      - - - -
        -
      • -

        completeAndCoalesce

        -
        public byte[] completeAndCoalesce(int lastBlockLength)
        -
        Method that will complete "manual" output process, coalesce - content (if necessary) and return results as a contiguous buffer.
        -
        -
        Parameters:
        -
        lastBlockLength - Amount of content in the current segment - buffer.
        -
        Returns:
        -
        Coalesced contents
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentSegment

        -
        public byte[] getCurrentSegment()
        -
      • -
      - - - -
        -
      • -

        setCurrentSegmentLength

        -
        public void setCurrentSegmentLength(int len)
        -
      • -
      - - - -
        -
      • -

        getCurrentSegmentLength

        -
        public int getCurrentSegmentLength()
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(byte[] b)
        -
        -
        Overrides:
        -
        write in class OutputStream
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(byte[] b,
        -                  int off,
        -                  int len)
        -
        -
        Overrides:
        -
        write in class OutputStream
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(int b)
        -
        -
        Specified by:
        -
        write in class OutputStream
        -
        -
      • -
      - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultIndenter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultIndenter.html deleted file mode 100644 index a47ac5dcd3..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultIndenter.html +++ /dev/null @@ -1,458 +0,0 @@ - - - - - - -DefaultIndenter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class DefaultIndenter

-
-
- -
- -
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.FixedSpaceIndenter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.FixedSpaceIndenter.html deleted file mode 100644 index 2ba27843ee..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.FixedSpaceIndenter.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - -DefaultPrettyPrinter.FixedSpaceIndenter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class DefaultPrettyPrinter.FixedSpaceIndenter

-
-
- -
- -
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.Indenter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.Indenter.html deleted file mode 100644 index 93d73fdfc6..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.Indenter.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - -DefaultPrettyPrinter.Indenter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Interface DefaultPrettyPrinter.Indenter

-
-
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        isInline

        -
        boolean isInline()
        -
        -
        Returns:
        -
        True if indenter is considered inline (does not add linefeeds), - false otherwise
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.NopIndenter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.NopIndenter.html deleted file mode 100644 index 3ca0dcc433..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.NopIndenter.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - -DefaultPrettyPrinter.NopIndenter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class DefaultPrettyPrinter.NopIndenter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.util.DefaultPrettyPrinter.NopIndenter
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.html deleted file mode 100644 index 2b9553b1ed..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.html +++ /dev/null @@ -1,1088 +0,0 @@ - - - - - - -DefaultPrettyPrinter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class DefaultPrettyPrinter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.util.DefaultPrettyPrinter
    • -
    -
  • -
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        DEFAULT_ROOT_VALUE_SEPARATOR

        -
        public static final SerializedString DEFAULT_ROOT_VALUE_SEPARATOR
        -
        Constant that specifies default "root-level" separator to use between - root values: a single space character.
        -
      • -
      - - - - - - - -
        -
      • -

        _objectIndenter

        -
        protected DefaultPrettyPrinter.Indenter _objectIndenter
        -
        By default, let's use linefeed-adding indenter for separate - object entries. We'll further configure indenter to use - system-specific linefeeds, and 2 spaces per level (as opposed to, - say, single tabs)
        -
      • -
      - - - -
        -
      • -

        _rootSeparator

        -
        protected final SerializableString _rootSeparator
        -
        String printed between root-level values, if any.
        -
      • -
      - - - -
        -
      • -

        _spacesInObjectEntries

        -
        protected boolean _spacesInObjectEntries
        -
        By default we will add spaces around colons used to - separate object fields and values. - If disabled, will not use spaces around colon.
        -
      • -
      - - - -
        -
      • -

        _nesting

        -
        protected transient int _nesting
        -
        Number of open levels of nesting. Used to determine amount of - indentation to use.
        -
      • -
      - - - -
        -
      • -

        _separators

        -
        protected Separators _separators
        -
      • -
      - - - -
        -
      • -

        _objectFieldValueSeparatorWithSpaces

        -
        protected String _objectFieldValueSeparatorWithSpaces
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DefaultPrettyPrinter

        -
        public DefaultPrettyPrinter()
        -
      • -
      - - - -
        -
      • -

        DefaultPrettyPrinter

        -
        public DefaultPrettyPrinter(String rootSeparator)
        -
        Constructor that specifies separator String to use between root values; - if null, no separator is printed. -

        - Note: simply constructs a SerializedString out of parameter, - calls DefaultPrettyPrinter(SerializableString)

        -
        -
        Parameters:
        -
        rootSeparator - String to use as root value separator
        -
        -
      • -
      - - - -
        -
      • -

        DefaultPrettyPrinter

        -
        public DefaultPrettyPrinter(SerializableString rootSeparator)
        -
        Constructor that specifies separator String to use between root values; - if null, no separator is printed.
        -
        -
        Parameters:
        -
        rootSeparator - String to use as root value separator
        -
        -
      • -
      - - - - - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        withRootSeparator

        -
        public DefaultPrettyPrinter withRootSeparator(String rootSeparator)
        -
        -
        Parameters:
        -
        rootSeparator - Root-level value separator to use
        -
        Returns:
        -
        This pretty-printer instance (for call chaining)
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        withSpacesInObjectEntries

        -
        public DefaultPrettyPrinter withSpacesInObjectEntries()
        -
        "Mutant factory" method that will return a pretty printer instance - that does use spaces inside object entries; if 'this' instance already - does this, it is returned; if not, a new instance will be constructed - and returned.
        -
        -
        Returns:
        -
        This pretty-printer instance (for call chaining)
        -
        -
      • -
      - - - -
        -
      • -

        withoutSpacesInObjectEntries

        -
        public DefaultPrettyPrinter withoutSpacesInObjectEntries()
        -
        "Mutant factory" method that will return a pretty printer instance - that does not use spaces inside object entries; if 'this' instance already - does this, it is returned; if not, a new instance will be constructed - and returned.
        -
        -
        Returns:
        -
        This pretty-printer instance (for call chaining)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        withSeparators

        -
        public DefaultPrettyPrinter withSeparators(Separators separators)
        -
        Method for configuring separators for this pretty-printer to use
        -
        -
        Parameters:
        -
        separators - Separator definitions to use
        -
        Returns:
        -
        This pretty-printer instance (for call chaining)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeRootValueSeparator

        -
        public void writeRootValueSeparator(JsonGenerator g)
        -                             throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after a root-level value has been completely - output, and before another value is to be output. -

        - Default handling (without pretty-printing) will output a space, to - allow values to be parsed correctly. Pretty-printer is - to output some other suitable and nice-looking separator - (tab(s), space(s), linefeed(s) or any combination thereof).

        -
        -
        Specified by:
        -
        writeRootValueSeparator in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(JsonGenerator g)
        -                      throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called when an Object value is to be output, before - any fields are output. -

        - Default handling (without pretty-printing) will output - the opening curly bracket. - Pretty-printer is - to output a curly bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Specified by:
        -
        writeStartObject in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        beforeObjectEntries

        -
        public void beforeObjectEntries(JsonGenerator g)
        -                         throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after object start marker has been output, - and right before the field name of the first entry is - to be output. - It is not called for objects without entries. -

        - Default handling does not output anything, but pretty-printer - is free to add any white space decoration.

        -
        -
        Specified by:
        -
        beforeObjectEntries in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectFieldValueSeparator

        -
        public void writeObjectFieldValueSeparator(JsonGenerator g)
        -                                    throws IOException
        -
        Method called after an object field has been output, but - before the value is output. -

        - Default handling (without pretty-printing) will output a single - colon to separate the two. Pretty-printer is - to output a colon as well, but can surround that with other - (white-space) decoration.

        -
        -
        Specified by:
        -
        writeObjectFieldValueSeparator in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectEntrySeparator

        -
        public void writeObjectEntrySeparator(JsonGenerator g)
        -                               throws IOException
        -
        Method called after an object entry (field:value) has been completely - output, and before another value is to be output. -

        - Default handling (without pretty-printing) will output a single - comma to separate the two. Pretty-printer is - to output a comma as well, but can surround that with other - (white-space) decoration.

        -
        -
        Specified by:
        -
        writeObjectEntrySeparator in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndObject

        -
        public void writeEndObject(JsonGenerator g,
        -                           int nrOfEntries)
        -                    throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after an Object value has been completely output - (minus closing curly bracket). -

        - Default handling (without pretty-printing) will output - the closing curly bracket. - Pretty-printer is - to output a curly bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Specified by:
        -
        writeEndObject in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        nrOfEntries - Number of direct members of the Object that - have been output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(JsonGenerator g)
        -                     throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called when an Array value is to be output, before - any member/child values are output. -

        - Default handling (without pretty-printing) will output - the opening bracket. - Pretty-printer is - to output a bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Specified by:
        -
        writeStartArray in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        beforeArrayValues

        -
        public void beforeArrayValues(JsonGenerator g)
        -                       throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after array start marker has been output, - and right before the first value is to be output. - It is not called for arrays with no values. -

        - Default handling does not output anything, but pretty-printer - is free to add any white space decoration.

        -
        -
        Specified by:
        -
        beforeArrayValues in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArrayValueSeparator

        -
        public void writeArrayValueSeparator(JsonGenerator g)
        -                              throws IOException
        -
        Method called after an array value has been completely - output, and before another value is to be output. -

        - Default handling (without pretty-printing) will output a single - comma to separate the two. Pretty-printer is - to output a comma as well, but can surround that with other - (white-space) decoration.

        -
        -
        Specified by:
        -
        writeArrayValueSeparator in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndArray

        -
        public void writeEndArray(JsonGenerator g,
        -                          int nrOfValues)
        -                   throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after an Array value has been completely output - (minus closing bracket). -

        - Default handling (without pretty-printing) will output - the closing bracket. - Pretty-printer is - to output a bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Specified by:
        -
        writeEndArray in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        nrOfValues - Number of direct members of the array that - have been output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Instantiatable.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Instantiatable.html deleted file mode 100644 index b3497931cb..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Instantiatable.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - -Instantiatable (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Interface Instantiatable<T>

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    DefaultPrettyPrinter
    -
    -
    -
    -
    public interface Instantiatable<T>
    -
    Add-on interface used to indicate things that may be "blueprint" objects - which can not be used as is, but are used for creating usable per-process - (serialization, deserialization) instances, using - createInstance() method. -

    - Note that some implementations may choose to implement createInstance() - by simply returning 'this': this is acceptable if instances are stateless.

    -
    -
    See Also:
    -
    DefaultPrettyPrinter
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      TcreateInstance() -
      Method called to ensure that we have a non-blueprint object to use; - it is either this object (if stateless), or a newly created object - with separate state.
      -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        createInstance

        -
        T createInstance()
        -
        Method called to ensure that we have a non-blueprint object to use; - it is either this object (if stateless), or a newly created object - with separate state.
        -
        -
        Returns:
        -
        Actual instance to use
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/InternCache.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/InternCache.html deleted file mode 100644 index bfd60dd806..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/InternCache.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - -InternCache (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class InternCache

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable, ConcurrentMap<String,String>, Map<String,String>
    -
    -
    -
    -
    public final class InternCache
    -extends ConcurrentHashMap<String,String>
    -
    Singleton class that adds a simple first-level cache in front of - regular String.intern() functionality. This is done as a minor - performance optimization, to avoid calling native intern() method - in cases where same String is being interned multiple times. -

    - Note: that this class extends LinkedHashMap is an implementation - detail -- no code should ever directly call Map methods.

    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JacksonFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JacksonFeature.html deleted file mode 100644 index 0effa14778..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JacksonFeature.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - -JacksonFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Interface JacksonFeature

-
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      booleanenabledByDefault() -
      Accessor for checking whether this feature is enabled by default.
      -
      booleanenabledIn(int flags) -
      Convenience method for checking whether feature is enabled in given bitmask.
      -
      intgetMask() -
      Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
      -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        enabledByDefault

        -
        boolean enabledByDefault()
        -
        Accessor for checking whether this feature is enabled by default.
        -
        -
        Returns:
        -
        Whether this instance is enabled by default or not
        -
        -
      • -
      - - - -
        -
      • -

        getMask

        -
        int getMask()
        -
        Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
        -
        -
        Returns:
        -
        Bit mask of this feature
        -
        -
      • -
      - - - -
        -
      • -

        enabledIn

        -
        boolean enabledIn(int flags)
        -
        Convenience method for checking whether feature is enabled in given bitmask.
        -
        -
        Parameters:
        -
        flags - Bit field that contains a set of enabled features of this type
        -
        Returns:
        -
        True if this feature is enabled in passed bit field
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JacksonFeatureSet.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JacksonFeatureSet.html deleted file mode 100644 index 07816b175d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JacksonFeatureSet.html +++ /dev/null @@ -1,458 +0,0 @@ - - - - - - -JacksonFeatureSet (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class JacksonFeatureSet<F extends JacksonFeature>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.util.JacksonFeatureSet<F>
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public final class JacksonFeatureSet<F extends JacksonFeature>
    -extends Object
    -
    Container similar to EnumSet meant for storing sets of - JacksonFeatures (usually Enums): main - difference being that these sets are immutable. Also only supports relatively - small sets of features: specifically, up to 31 features.
    -
    -
    Since:
    -
    2.12
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _enabled

        -
        protected int _enabled
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JacksonFeatureSet

        -
        protected JacksonFeatureSet(int bitmask)
        -
        Constructor for creating instance with specific bitmask, wherein - 1 bit means matching JacksonFeature is enabled and - 0 disabled.
        -
        -
        Parameters:
        -
        bitmask - Bitmask for features that are enabled
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - -
        -
      • -

        fromDefaults

        -
        public static <F extends JacksonFeatureJacksonFeatureSet<F> fromDefaults(F[] allFeatures)
        -
        "Default" factory which will calculate settings based on default-enabled - status of all features.
        -
        -
        Type Parameters:
        -
        F - Self-reference for convenience
        -
        Parameters:
        -
        allFeatures - Set of all features (enabled or disabled): usually from Enum.values()
        -
        Returns:
        -
        Feature set instance constructed
        -
        -
      • -
      - - - - - - - - - -
        -
      • -

        with

        -
        public JacksonFeatureSet<F> with(F feature)
        -
        Mutant factory for getting a set in which specified feature is enabled: - will either return this instance (if no change), or newly created set (if there - is change).
        -
        -
        Parameters:
        -
        feature - Feature to enable in set returned
        -
        Returns:
        -
        Newly created set of state of feature changed; this if not
        -
        -
      • -
      - - - - - -
        -
      • -

        without

        -
        public JacksonFeatureSet<F> without(F feature)
        -
        Mutant factory for getting a set in which specified feature is disabled: - will either return this instance (if no change), or newly created set (if there - is change).
        -
        -
        Parameters:
        -
        feature - Feature to disable in set returned
        -
        Returns:
        -
        Newly created set of state of feature changed; this if not
        -
        -
      • -
      - - - - - -
        -
      • -

        isEnabled

        -
        public boolean isEnabled(F feature)
        -
        Main accessor for checking whether given feature is enabled in this feature set.
        -
        -
        Parameters:
        -
        feature - Feature to check
        -
        Returns:
        -
        True if feature is enabled in this set; false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        asBitmask

        -
        public int asBitmask()
        -
        Accessor for underlying bitmask
        -
        -
        Returns:
        -
        Bitmask of enabled features
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonGeneratorDelegate.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonGeneratorDelegate.html deleted file mode 100644 index f0c0e0802c..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonGeneratorDelegate.html +++ /dev/null @@ -1,2958 +0,0 @@ - - - - - - -JsonGeneratorDelegate (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class JsonGeneratorDelegate

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonGeneratorDelegate

        -
        public JsonGeneratorDelegate(JsonGenerator d)
        -
      • -
      - - - -
        -
      • -

        JsonGeneratorDelegate

        -
        public JsonGeneratorDelegate(JsonGenerator d,
        -                             boolean delegateCopyMethods)
        -
        -
        Parameters:
        -
        d - Underlying generator to delegate calls to
        -
        delegateCopyMethods - Flag assigned to delagateCopyMethod - and which defines whether copy methods are handled locally (false), or - delegated to configured
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getCurrentValue

        -
        public Object getCurrentValue()
        -
        Description copied from class: JsonGenerator
        -
        Helper method, usually equivalent to: - - getOutputContext().getCurrentValue(); - -

        - Note that "current value" is NOT populated (or used) by Streaming generator; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Specified by:
        -
        getCurrentValue in class JsonGenerator
        -
        Returns:
        -
        "Current value" for the current context this generator has
        -
        -
      • -
      - - - -
        -
      • -

        setCurrentValue

        -
        public void setCurrentValue(Object v)
        -
        Description copied from class: JsonGenerator
        -
        Helper method, usually equivalent to: - - getOutputContext().setCurrentValue(v); - - used to assign "current value" for the current context of this generator. - It is usually assigned and used by higher level data-binding functionality - (instead of streaming parsers/generators) but is stored at streaming level.
        -
        -
        Specified by:
        -
        setCurrentValue in class JsonGenerator
        -
        Parameters:
        -
        v - "Current value" to assign to the current output context of this generator
        -
        -
      • -
      - - - -
        -
      • -

        getSchema

        -
        public FormatSchema getSchema()
        -
        Description copied from class: JsonGenerator
        -
        Method for accessing Schema that this generator uses, if any. - Default implementation returns null.
        -
        -
        Overrides:
        -
        getSchema in class JsonGenerator
        -
        Returns:
        -
        FormatSchema this generator is configured to use, if any; null if none
        -
        -
      • -
      - - - -
        -
      • -

        version

        -
        public Version version()
        -
        Description copied from class: JsonGenerator
        -
        Accessor for finding out version of the bundle that provided this generator instance.
        -
        -
        Specified by:
        -
        version in interface Versioned
        -
        Specified by:
        -
        version in class JsonGenerator
        -
        Returns:
        -
        Version of the component
        -
        -
      • -
      - - - -
        -
      • -

        getOutputTarget

        -
        public Object getOutputTarget()
        -
        Description copied from class: JsonGenerator
        -
        Method that can be used to get access to object that is used - as target for generated output; this is usually either - OutputStream or Writer, depending on what - generator was constructed with. - Note that returned value may be null in some cases; including - case where implementation does not want to exposed raw - source to caller. - In cases where output has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of generator and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Specified by:
        -
        getOutputTarget in class JsonGenerator
        -
        Returns:
        -
        Output target this generator was configured with
        -
        -
      • -
      - - - -
        -
      • -

        getOutputBuffered

        -
        public int getOutputBuffered()
        -
        Description copied from class: JsonGenerator
        -
        Method for verifying amount of content that is buffered by generator - but not yet flushed to the underlying target (stream, writer), - in units (byte, char) that the generator implementation uses for buffering; - or -1 if this information is not available. - Unit used is often the same as the unit of underlying target (that is, - byte for OutputStream, - char for Writer), - but may differ if buffering is done before encoding. - Default JSON-backed implementations do use matching units.
        -
        -
        Specified by:
        -
        getOutputBuffered in class JsonGenerator
        -
        Returns:
        -
        Amount of content buffered in internal units, if amount known and - accessible; -1 if not accessible.
        -
        -
      • -
      - - - -
        -
      • -

        canWriteTypeId

        -
        public boolean canWriteTypeId()
        -
        Description copied from class: JsonGenerator
        -
        Introspection method that may be called to see if the underlying - data format supports some kind of Type Ids natively (many do not; - for example, JSON doesn't). - This method must be called prior to calling - JsonGenerator.writeTypeId(java.lang.Object). -

        - Default implementation returns false; overridden by data formats - that do support native Type Ids. Caller is expected to either - use a non-native notation (explicit property or such), or fail, - in case it can not use native type ids.

        -
        -
        Overrides:
        -
        canWriteTypeId in class JsonGenerator
        -
        Returns:
        -
        True if this generator is capable of writing "native" Type Ids - (which is typically determined by capabilities of the underlying format), - false if not
        -
        -
      • -
      - - - -
        -
      • -

        canWriteObjectId

        -
        public boolean canWriteObjectId()
        -
        Description copied from class: JsonGenerator
        -
        Introspection method that may be called to see if the underlying - data format supports some kind of Object Ids natively (many do not; - for example, JSON doesn't). - This method must be called prior to calling - JsonGenerator.writeObjectId(java.lang.Object) or JsonGenerator.writeObjectRef(java.lang.Object). -

        - Default implementation returns false; overridden by data formats - that do support native Object Ids. Caller is expected to either - use a non-native notation (explicit property or such), or fail, - in case it can not use native object ids.

        -
        -
        Overrides:
        -
        canWriteObjectId in class JsonGenerator
        -
        Returns:
        -
        True if this generator is capable of writing "native" Object Ids - (which is typically determined by capabilities of the underlying format), - false if not
        -
        -
      • -
      - - - -
        -
      • -

        canWriteBinaryNatively

        -
        public boolean canWriteBinaryNatively()
        -
        Description copied from class: JsonGenerator
        -
        Introspection method that may be called to see if the underlying - data format supports "native" binary data; that is, an efficient - output of binary content without encoding. -

        - Default implementation returns false; overridden by data formats - that do support native binary content.

        -
        -
        Overrides:
        -
        canWriteBinaryNatively in class JsonGenerator
        -
        Returns:
        -
        True if this generator is capable of writing "raw" Binary - Content - (this is typically determined by capabilities of the underlying format); - false if not
        -
        -
      • -
      - - - -
        -
      • -

        canOmitFields

        -
        public boolean canOmitFields()
        -
        Description copied from class: JsonGenerator
        -
        Introspection method to call to check whether it is ok to omit - writing of Object fields or not. Most formats do allow omission, - but certain positional formats (such as CSV) require output of - placeholders, even if no real values are to be emitted.
        -
        -
        Overrides:
        -
        canOmitFields in class JsonGenerator
        -
        Returns:
        -
        True if this generator is allowed to only write values - of some Object fields and omit the rest; false if not
        -
        -
      • -
      - - - -
        -
      • -

        canWriteFormattedNumbers

        -
        public boolean canWriteFormattedNumbers()
        -
        Description copied from class: JsonGenerator
        -
        Introspection method to call to check whether it is possible - to write numbers using JsonGenerator.writeNumber(java.lang.String) - using possible custom format, or not. Typically textual formats - allow this (and JSON specifically does), whereas binary formats - do not allow this (except by writing them as Strings). - Usual reason for calling this method is to check whether custom - formatting of numbers may be applied by higher-level code (databinding) - or not.
        -
        -
        Overrides:
        -
        canWriteFormattedNumbers in class JsonGenerator
        -
        Returns:
        -
        True if this generator is capable of writing "formatted" - numbers (and if so, need to be passed using - JsonGenerator.writeNumber(String), that is, passed as String); - false if not
        -
        -
      • -
      - - - -
        -
      • -

        getWriteCapabilities

        -
        public JacksonFeatureSet<StreamWriteCapability> getWriteCapabilities()
        -
        Description copied from class: JsonGenerator
        -
        Accessor for getting metadata on capabilities of this generator, based on - underlying data format being read (directly or indirectly).
        -
        -
        Specified by:
        -
        getWriteCapabilities in class JsonGenerator
        -
        Returns:
        -
        Set of read capabilities for content to generate via this generator
        -
        -
      • -
      - - - -
        -
      • -

        isEnabled

        -
        public boolean isEnabled(StreamWriteFeature f)
        -
        Description copied from class: JsonGenerator
        -
        Method for checking whether given feature is enabled. - Check StreamWriteFeature for list of available features.
        -
        -
        Specified by:
        -
        isEnabled in class JsonGenerator
        -
        Parameters:
        -
        f - Feature to check
        -
        Returns:
        -
        True if feature is enabled; false if not
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        setHighestNonEscapedChar

        -
        public JsonGenerator setHighestNonEscapedChar(int charCode)
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to request that generator escapes - all character codes above specified code point (if positive value); - or, to not escape any characters except for ones that must be - escaped for the data format (if -1). - To force escaping of all non-ASCII characters, for example, - this method would be called with value of 127. -

        - Note that generators are NOT required to support setting of value - higher than 127, because there are other ways to affect quoting - (or lack thereof) of character codes between 0 and 127. - Not all generators support concept of escaping, either; if so, - calling this method will have no effect. -

        - Default implementation does nothing; sub-classes need to redefine - it according to rules of supported data format.

        -
        -
        Overrides:
        -
        setHighestNonEscapedChar in class JsonGenerator
        -
        Parameters:
        -
        charCode - Either -1 to indicate that no additional escaping - is to be done; or highest code point not to escape (meaning higher - ones will be), if positive value.
        -
        Returns:
        -
        This generator, to allow call chaining
        -
        -
      • -
      - - - -
        -
      • -

        getHighestNonEscapedChar

        -
        public int getHighestNonEscapedChar()
        -
        Description copied from class: JsonGenerator
        -
        Accessor method for testing what is the highest unescaped character - configured for this generator. This may be either positive value - (when escaping configuration has been set and is in effect), or - 0 to indicate that no additional escaping is in effect. - Some generators may not support additional escaping: for example, - generators for binary formats that do not use escaping should - simply return 0.
        -
        -
        Overrides:
        -
        getHighestNonEscapedChar in class JsonGenerator
        -
        Returns:
        -
        Currently active limitation for highest non-escaped character, - if defined; or 0 to indicate no additional escaping is performed.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray()
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of a Array value - (for JSON this is character '['; plus possible white space decoration - if pretty-printing is enabled). -

        - Array values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartArray in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(Object forValue)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any); - null may be passed if not known or not applicable. - This value is accessible from context as "current value"
        -
        -
        Specified by:
        -
        writeStartArray in class JsonGenerator
        -
        Parameters:
        -
        forValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(Object forValue,
        -                            int size)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any) - and how many elements will be written for the array before calling - JsonGenerator.writeEndArray().
        -
        -
        Specified by:
        -
        writeStartArray in class JsonGenerator
        -
        Parameters:
        -
        forValue - Java Object that Array being written represents, if any - (or null if not known or not applicable)
        -
        size - Number of elements this Array will have: actual - number of values written (before matching call to - JsonGenerator.writeEndArray() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndArray

        -
        public void writeEndArray()
        -                   throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing closing marker of a JSON Array value - (character ']'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Array.

        -
        -
        Specified by:
        -
        writeEndArray in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject()
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - (character '{'; plus possible white space decoration - if pretty-printing is enabled). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartObject in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object forValue)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartObject in class JsonGenerator
        -
        Parameters:
        -
        forValue - Java Object that Object being written represents, if any - (or null if not known or not applicable)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(Object forValue,
        -                             int size)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing starting marker of an Object value - to represent the given Java Object value. - Argument is offered as metadata, but more - importantly it should be assigned as the "current value" - for the Object content that gets constructed and initialized. - In addition, caller knows number of key/value pairs ("properties") - that will get written for the Object value: this is relevant for - some format backends (but not, as an example, for JSON). -

        - Object values can be written in any context where values - are allowed: meaning everywhere except for when - a field name is expected.

        -
        -
        Specified by:
        -
        writeStartObject in class JsonGenerator
        -
        Parameters:
        -
        forValue - Object value to be written (assigned as "current value" for - the Object context that gets created)
        -
        size - Number of key/value pairs this Object will have: actual - number of entries written (before matching call to - JsonGenerator.writeEndObject() MUST match; generator MAY verify - this is the case (and SHOULD if format itself encodes length)
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndObject

        -
        public void writeEndObject()
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing closing marker of an Object value - (character '}'; plus possible white space decoration - if pretty-printing is enabled). -

        - Marker can be written if the innermost structured type - is Object, and the last written event was either a - complete value, or START-OBJECT marker (see JSON specification - for more details).

        -
        -
        Specified by:
        -
        writeEndObject in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public void writeFieldName(String name)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for writing a field name (JSON String surrounded by - double quotes: syntactically identical to a JSON String value), - possibly decorated by white space if pretty-printing is enabled. -

        - Field names can only be written in Object context (check out - JSON specification for details), when field name is expected - (field names alternate with values).

        -
        -
        Specified by:
        -
        writeFieldName in class JsonGenerator
        -
        Parameters:
        -
        name - Field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldName

        -
        public void writeFieldName(SerializableString name)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeFieldName(String), main difference - being that it may perform better as some of processing (such as - quoting of certain characters, or encoding into external encoding - if supported by generator) can be done just once and reused for - later calls. -

        - Default implementation simple uses unprocessed name container in - serialized String; implementations are strongly encouraged to make - use of more efficient methods argument object has.

        -
        -
        Specified by:
        -
        writeFieldName in class JsonGenerator
        -
        Parameters:
        -
        name - Pre-encoded field name to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeFieldId

        -
        public void writeFieldId(long id)
        -                  throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Alternative to JsonGenerator.writeFieldName(String) that may be used - in cases where property key is of numeric type; either where - underlying format supports such notion (some binary formats do, - unlike JSON), or for convenient conversion into String presentation. - Default implementation will simply convert id into String - and call JsonGenerator.writeFieldName(String).
        -
        -
        Specified by:
        -
        writeFieldId in class JsonGenerator
        -
        Parameters:
        -
        id - Field id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArray

        -
        public void writeArray(int[] array,
        -                       int offset,
        -                       int length)
        -                throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_INT, JsonToken.END_ARRAY)
        -
        -
        Overrides:
        -
        writeArray in class JsonGenerator
        -
        Parameters:
        -
        array - Array that contains values to write
        -
        offset - Offset of the first element to write, within array
        -
        length - Number of elements in array to write, from `offset` to `offset + len - 1`
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArray

        -
        public void writeArray(long[] array,
        -                       int offset,
        -                       int length)
        -                throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_INT, JsonToken.END_ARRAY)
        -
        -
        Overrides:
        -
        writeArray in class JsonGenerator
        -
        Parameters:
        -
        array - Array that contains values to write
        -
        offset - Offset of the first element to write, within array
        -
        length - Number of elements in array to write, from `offset` to `offset + len - 1`
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArray

        -
        public void writeArray(double[] array,
        -                       int offset,
        -                       int length)
        -                throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_FLOAT, JsonToken.END_ARRAY)
        -
        -
        Overrides:
        -
        writeArray in class JsonGenerator
        -
        Parameters:
        -
        array - Array that contains values to write
        -
        offset - Offset of the first element to write, within array
        -
        length - Number of elements in array to write, from `offset` to `offset + len - 1`
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArray

        -
        public void writeArray(String[] array,
        -                       int offset,
        -                       int length)
        -                throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_STRING, JsonToken.END_ARRAY)
        -
        -
        Overrides:
        -
        writeArray in class JsonGenerator
        -
        Parameters:
        -
        array - Array that contains values to write
        -
        offset - Offset of the first element to write, within array
        -
        length - Number of elements in array to write, from `offset` to `offset + len - 1`
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(String text)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Specified by:
        -
        writeString in class JsonGenerator
        -
        Parameters:
        -
        text - String value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(Reader reader,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification. - If len is < 0, then write all contents of the reader. - Otherwise, write only len characters. -

        - Note: actual length of content available may exceed len but - can not be less than it: if not enough content available, a - JsonGenerationException will be thrown.

        -
        -
        Overrides:
        -
        writeString in class JsonGenerator
        -
        Parameters:
        -
        reader - Reader to use for reading Text value to write
        -
        len - Maximum Length of Text value to read (in chars, non-negative) - if known; -1 to indicate "read and write it all"
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer; or if length (len) is specified but - reader does not provide enough content
        -
        -
      • -
      - - - -
        -
      • -

        writeString

        -
        public void writeString(char[] text,
        -                        int offset,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting a String value. Depending on context - this means either array element, (object) field value or - a stand alone String; but in all cases, String will be - surrounded in double quotes, and contents will be properly - escaped as required by JSON specification.
        -
        -
        Specified by:
        -
        writeString in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first character of String value to write
        -
        len - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeRawUTF8String

        -
        public void writeRawUTF8String(byte[] text,
        -                               int offset,
        -                               int length)
        -                        throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeString(String) but that takes as - its input a UTF-8 encoded String that is to be output as-is, without additional - escaping (type of which depends on data format; backslashes for JSON). - However, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - If so, implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Specified by:
        -
        writeRawUTF8String in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        length - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeUTF8String

        -
        public void writeUTF8String(byte[] text,
        -                            int offset,
        -                            int length)
        -                     throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeString(String) but that takes as its input - a UTF-8 encoded String which has not been escaped using whatever - escaping scheme data format requires (for JSON that is backslash-escaping - for control characters and double-quotes; for other formats something else). - This means that textual JSON backends need to check if value needs - JSON escaping, but otherwise can just be copied as is to output. - Also, quoting that data format requires (like double-quotes for JSON) will be added - around the value if and as necessary. -

        - Note that some backends may choose not to support this method: for - example, if underlying destination is a Writer - using this method would require UTF-8 decoding. - In this case - generator implementation may instead choose to throw a - UnsupportedOperationException due to ineffectiveness - of having to decode input.

        -
        -
        Specified by:
        -
        writeUTF8String in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that contains String value to write
        -
        offset - Offset in buffer of the first byte of String value to write
        -
        length - Length of the String value (in characters) to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(String text)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - Textual contents to include as-is in output.
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(String text,
        -                     int offset,
        -                     int len)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - String that has contents to include as-is in output
        -
        offset - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(SerializableString raw)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException. -

        - The default implementation delegates to JsonGenerator.writeRaw(String); - other backends that support raw inclusion of text are encouraged - to implement it in more efficient manner (especially if they - use UTF-8 encoding).

        -
        -
        Overrides:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        raw - Pre-encoded textual contents to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(char[] text,
        -                     int offset,
        -                     int len)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        text - Buffer that has contents to include as-is in output
        -
        offset - Offset within text of the first character to output
        -
        len - Length of content (from text, starting at offset offset) to output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRaw

        -
        public void writeRaw(char c)
        -              throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such). - If such separators are desired, use - JsonGenerator.writeRawValue(String) instead. -

        - Note that not all generator implementations necessarily support - such by-pass methods: those that do not will throw - UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeRaw in class JsonGenerator
        -
        Parameters:
        -
        c - Character to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeRawValue

        -
        public void writeRawValue(String text)
        -                   throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will force generator to copy - input text verbatim without any modifications, but assuming - it must constitute a single legal JSON value (number, string, - boolean, null, Array or List). Assuming this, proper separators - are added if and as needed (comma or colon), and generator - state updated to reflect this.
        -
        -
        Specified by:
        -
        writeRawValue in class JsonGenerator
        -
        Parameters:
        -
        text - Textual contents to included in output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        writeBinary

        -
        public void writeBinary(Base64Variant b64variant,
        -                        byte[] data,
        -                        int offset,
        -                        int len)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that will output given chunk of binary data as base64 - encoded, as a complete String value (surrounded by double quotes). - This method defaults -

        - Note: because JSON Strings can not contain unescaped linefeeds, - if linefeeds are included (as per last argument), they must be - escaped. This adds overhead for decoding without improving - readability. - Alternatively if linefeeds are not included, - resulting String value may violate the requirement of base64 - RFC which mandates line-length of 76 characters and use of - linefeeds. However, all JsonParser implementations - are required to accept such "long line base64"; as do - typical production-level base64 decoders.

        -
        -
        Specified by:
        -
        writeBinary in class JsonGenerator
        -
        Parameters:
        -
        b64variant - Base64 variant to use: defines details such as - whether padding is used (and if so, using which character); - what is the maximum line length before adding linefeed, - and also the underlying alphabet to use.
        -
        data - Buffer that contains binary data to write
        -
        offset - Offset in data of the first byte of data to write
        -
        len - Length of data to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeBinary

        -
        public int writeBinary(Base64Variant b64variant,
        -                       InputStream data,
        -                       int dataLength)
        -                throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method similar to JsonGenerator.writeBinary(Base64Variant,byte[],int,int), - but where input is provided through a stream, allowing for incremental - writes without holding the whole input in memory.
        -
        -
        Specified by:
        -
        writeBinary in class JsonGenerator
        -
        Parameters:
        -
        b64variant - Base64 variant to use
        -
        data - InputStream to use for reading binary data to write. - Will not be closed after successful write operation
        -
        dataLength - (optional) number of bytes that will be available; - or -1 to be indicate it is not known. - If a positive length is given, data MUST provide at least - that many bytes: if not, an exception will be thrown. - Note that implementations - need not support cases where length is not known in advance; this - depends on underlying data format: JSON output does NOT require length, - other formats may.
        -
        Returns:
        -
        Number of bytes read from data and written as binary payload
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(short v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(int v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(long v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(BigInteger v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting given value as JSON number. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(double v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(float v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(BigDecimal v)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting indicate JSON numeric value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        v - Number value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNumber

        -
        public void writeNumber(String encodedValue)
        -                 throws IOException,
        -                        UnsupportedOperationException
        -
        Description copied from class: JsonGenerator
        -
        Write method that can be used for custom numeric types that can - not be (easily?) converted to "standard" Java number types. - Because numbers are not surrounded by double quotes, regular - JsonGenerator.writeString(java.lang.String) method can not be used; nor - JsonGenerator.writeRaw(java.lang.String) because that does not properly handle - value separators needed in Array or Object contexts. -

        - Note: because of lack of type safety, some generator - implementations may not be able to implement this - method. For example, if a binary JSON format is used, - it may require type information for encoding; similarly - for generator-wrappers around Java objects or JSON nodes. - If implementation does not implement this method, - it needs to throw UnsupportedOperationException.

        -
        -
        Specified by:
        -
        writeNumber in class JsonGenerator
        -
        Parameters:
        -
        encodedValue - Textual (possibly format) number representation to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        UnsupportedOperationException - If underlying data format does not - support numbers serialized textually AND if generator is not allowed - to just output a String instead (Schema-based formats may require actual - number, for example)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        writeBoolean

        -
        public void writeBoolean(boolean state)
        -                  throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting literal JSON boolean value (one of - Strings 'true' and 'false'). - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeBoolean in class JsonGenerator
        -
        Parameters:
        -
        state - Boolean value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeNull

        -
        public void writeNull()
        -               throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for outputting literal JSON null value. - Can be called in any context where a value is expected - (Array value, Object field value, root-level value). - Additional white space may be added around the value - if pretty-printing is enabled.
        -
        -
        Specified by:
        -
        writeNull in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeOmittedField

        -
        public void writeOmittedField(String fieldName)
        -                       throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to indicate that a property in this position was - skipped. It is usually only called for generators that return - false from JsonGenerator.canOmitFields(). -

        - Default implementation does nothing.

        -
        -
        Overrides:
        -
        writeOmittedField in class JsonGenerator
        -
        Parameters:
        -
        fieldName - Name of the field that is being omitted
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectId

        -
        public void writeObjectId(Object id)
        -                   throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to output so-called native Object Id. - Note that it may only be called after ensuring this is legal - (with JsonGenerator.canWriteObjectId()), as not all data formats - have native type id support; and some may only allow them in - certain positions or locations.
        -
        -
        Overrides:
        -
        writeObjectId in class JsonGenerator
        -
        Parameters:
        -
        id - Native Object Id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        JsonGenerationException - if Object ID output is not allowed - (either at all, or specifically in this position in output)
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectRef

        -
        public void writeObjectRef(Object id)
        -                    throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to output references to native Object Ids. - Note that it may only be called after ensuring this is legal - (with JsonGenerator.canWriteObjectId()), as not all data formats - have native type id support; and some may only allow them in - certain positions or locations. - If output is not allowed by the data format in this position, - a JsonGenerationException will be thrown.
        -
        -
        Overrides:
        -
        writeObjectRef in class JsonGenerator
        -
        Parameters:
        -
        id - Referenced value, for which Object Id is expected to be written
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        JsonGenerationException - if Object ID output is not allowed - (either at all, or specifically in this position in output)
        -
        -
      • -
      - - - -
        -
      • -

        writeTypeId

        -
        public void writeTypeId(Object id)
        -                 throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to output so-called native Type Id. - Note that it may only be called after ensuring this is legal - (with JsonGenerator.canWriteTypeId()), as not all data formats - have native type id support; and some may only allow them in - certain positions or locations. - If output is not allowed by the data format in this position, - a JsonGenerationException will be thrown.
        -
        -
        Overrides:
        -
        writeTypeId in class JsonGenerator
        -
        Parameters:
        -
        id - Native Type Id to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEmbeddedObject

        -
        public void writeEmbeddedObject(Object object)
        -                         throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called on backends that support passing opaque native - values that some data formats support; not used with JSON backend, - more common with binary formats. -

        - NOTE: this is NOT the method to call for serializing regular POJOs, - see JsonGenerator.writeObject(java.lang.Object) instead.

        -
        -
        Overrides:
        -
        writeEmbeddedObject in class JsonGenerator
        -
        Parameters:
        -
        object - Native format-specific value to write
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        copyCurrentEvent

        -
        public void copyCurrentEvent(JsonParser p)
        -                      throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for copying contents of the current event that - the given parser instance points to. - Note that the method will not copy any other events, - such as events contained within JSON Array or Object structures. -

        - Calling this method will not advance the given - parser, although it may cause parser to internally process - more data (if it lazy loads contents of value events, for example)

        -
        -
        Overrides:
        -
        copyCurrentEvent in class JsonGenerator
        -
        Parameters:
        -
        p - Parser that points to the event to copy
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        copyCurrentStructure

        -
        public void copyCurrentStructure(JsonParser p)
        -                          throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method for copying contents of the current event - and following events that it encloses - the given parser instance points to. -

        - So what constitutes enclosing? Here is the list of - events that have associated enclosed events that will - get copied: -

          -
        • JsonToken.START_OBJECT: - all events up to and including matching (closing) - JsonToken.END_OBJECT will be copied -
        • -
        • JsonToken.START_ARRAY - all events up to and including matching (closing) - JsonToken.END_ARRAY will be copied -
        • -
        • JsonToken.FIELD_NAME the logical value (which - can consist of a single scalar value; or a sequence of related - events for structured types (JSON Arrays, Objects)) will - be copied along with the name itself. So essentially the - whole field entry (name and value) will be copied. -
        • -
        -

        - After calling this method, parser will point to the - last event that was copied. This will either be - the event parser already pointed to (if there were no - enclosed events), or the last enclosed event copied.

        -
        -
        Overrides:
        -
        copyCurrentStructure in class JsonGenerator
        -
        Parameters:
        -
        p - Parser that points to the value to copy
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getObjectWriteContext

        -
        public ObjectWriteContext getObjectWriteContext()
        -
        Description copied from class: JsonGenerator
        -
        Accessor for context object provided by higher-level databinding - functionality (or, in some cases, simple placeholder of the same) - that allows some level of interaction including ability to trigger - serialization of Object values through generator instance.
        -
        -
        Specified by:
        -
        getObjectWriteContext in class JsonGenerator
        -
        Returns:
        -
        Object write context (ObjectWriteContext) associated with this generator
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to flush any buffered content to the underlying - target (output stream, writer), and to flush the target itself - as well.
        -
        -
        Specified by:
        -
        flush in interface Flushable
        -
        Specified by:
        -
        flush in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws IOException
        -
        Description copied from class: JsonGenerator
        -
        Method called to close this generator, so that no more content - can be written. -

        - Whether the underlying target (stream, writer) gets closed depends - on whether this generator either manages the target (i.e. is the - only one with access to the target -- case if caller passes a - reference to the resource such as File, but not stream); or - has feature StreamWriteFeature.AUTO_CLOSE_TARGET enabled. - If either of above is true, the target is also closed. Otherwise - (not managing, feature not enabled), target is not closed.

        -
        -
        Specified by:
        -
        close in interface Closeable
        -
        Specified by:
        -
        close in interface AutoCloseable
        -
        Specified by:
        -
        close in class JsonGenerator
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
        Description copied from class: JsonGenerator
        -
        Method that can be called to determine whether this generator - is closed or not. If it is closed, no more output can be done.
        -
        -
        Specified by:
        -
        isClosed in class JsonGenerator
        -
        Returns:
        -
        True if this generator has been closed; false if not
        -
        -
      • -
      - - - -
        -
      • -

        delegate

        -
        public JsonGenerator delegate()
        -
        -
        Returns:
        -
        Underlying generator that calls are delegated to
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonParserDelegate.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonParserDelegate.html deleted file mode 100644 index 2d03820fc5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonParserDelegate.html +++ /dev/null @@ -1,3065 +0,0 @@ - - - - - - -JsonParserDelegate (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class JsonParserDelegate

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        delegate

        -
        protected JsonParser delegate
        -
        Delegate object that method calls are delegated to.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonParserDelegate

        -
        public JsonParserDelegate(JsonParser d)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getObjectReadContext

        -
        public ObjectReadContext getObjectReadContext()
        -
        Description copied from class: JsonParser
        -
        Accessor for context object provided by higher level data-binding - functionality (or, in some cases, simple placeholder of the same) - that allows some level of interaction including ability to trigger - deserialization of Object values through generator instance. -

        - Context object is used by parser to implement some methods, - like readValueAs(...)

        -
        -
        Specified by:
        -
        getObjectReadContext in class JsonParser
        -
        Returns:
        -
        Object write context (ObjectReadContext) associated with this parser
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentValue

        -
        public Object getCurrentValue()
        -
        Description copied from class: JsonParser
        -
        Helper method, usually equivalent to: - - getParsingContext().getCurrentValue(); - -

        - Note that "current value" is NOT populated (or used) by Streaming parser; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Specified by:
        -
        getCurrentValue in class JsonParser
        -
        Returns:
        -
        "Current value" for the current input context this parser has
        -
        -
      • -
      - - - -
        -
      • -

        setCurrentValue

        -
        public void setCurrentValue(Object v)
        -
        Description copied from class: JsonParser
        -
        Helper method, usually equivalent to: - - getParsingContext().setCurrentValue(v); -
        -
        -
        Specified by:
        -
        setCurrentValue in class JsonParser
        -
        Parameters:
        -
        v - "Current value" to assign to the current input context of this parser
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        isEnabled

        -
        public boolean isEnabled(StreamReadFeature f)
        -
        Description copied from class: JsonParser
        -
        Method for checking whether specified StreamReadFeature is enabled.
        -
        -
        Specified by:
        -
        isEnabled in class JsonParser
        -
        Parameters:
        -
        f - Feature to check
        -
        Returns:
        -
        True if feature is enabled; false otherwise
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getSchema

        -
        public FormatSchema getSchema()
        -
        Description copied from class: JsonParser
        -
        Method for accessing Schema that this parser uses, if any. - Default implementation returns null.
        -
        -
        Overrides:
        -
        getSchema in class JsonParser
        -
        Returns:
        -
        FormatSchema assigned to this parser, if any; null if none
        -
        -
      • -
      - - - -
        -
      • -

        version

        -
        public Version version()
        -
        Description copied from class: JsonParser
        -
        Accessor for getting version of the core package, given a parser instance. - Left for sub-classes to implement.
        -
        -
        Specified by:
        -
        version in interface Versioned
        -
        Specified by:
        -
        version in class JsonParser
        -
        Returns:
        -
        Version of the component
        -
        -
      • -
      - - - -
        -
      • -

        getInputSource

        -
        public Object getInputSource()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to get access to object that is used - to access input being parsed; this is usually either - InputStream or Reader, depending on what - parser was constructed with. - Note that returned value may be null in some cases; including - case where parser implementation does not want to exposed raw - source to caller. - In cases where input has been decorated, object returned here - is the decorated version; this allows some level of interaction - between users of parser and decorator object. -

        - In general use of this accessor should be considered as - "last effort", i.e. only used if no other mechanism is applicable.

        -
        -
        Specified by:
        -
        getInputSource in class JsonParser
        -
        Returns:
        -
        Input source this parser was configured with
        -
        -
      • -
      - - - -
        -
      • -

        canParseAsync

        -
        public boolean canParseAsync()
        -
        Description copied from class: JsonParser
        -
        Method that can be called to determine if this parser instance - uses non-blocking ("asynchronous") input access for decoding or not. - Access mode is determined by earlier calls via JsonFactory; - it may not be changed after construction. -

        - If non-blocking decoding is true, it is possible to call - JsonParser.getNonBlockingInputFeeder() to obtain object to use - for feeding input; otherwise (false returned) - input is read by blocking.

        -
        -
        Overrides:
        -
        canParseAsync in class JsonParser
        -
        Returns:
        -
        True if this is a non-blocking ("asynchronous") parser
        -
        -
      • -
      - - - -
        -
      • -

        getNonBlockingInputFeeder

        -
        public NonBlockingInputFeeder getNonBlockingInputFeeder()
        -
        Description copied from class: JsonParser
        -
        Method that will either return a feeder instance (if parser uses - non-blocking, aka asynchronous access); or null for - parsers that use blocking I/O.
        -
        -
        Overrides:
        -
        getNonBlockingInputFeeder in class JsonParser
        -
        Returns:
        -
        Input feeder to use with non-blocking (async) parsing
        -
        -
      • -
      - - - -
        -
      • -

        getReadCapabilities

        -
        public JacksonFeatureSet<StreamReadCapability> getReadCapabilities()
        -
        Description copied from class: JsonParser
        -
        Accessor for getting metadata on capabilities of this parser, based on - underlying data format being read (directly or indirectly).
        -
        -
        Overrides:
        -
        getReadCapabilities in class JsonParser
        -
        Returns:
        -
        Set of read capabilities for content to read via this parser
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws IOException
        -
        Description copied from class: JsonParser
        -
        Closes the parser so that no further iteration or data access - can be made; will also close the underlying input source - if parser either owns the input source, or feature - StreamReadFeature.AUTO_CLOSE_SOURCE is enabled. - Whether parser owns the input source depends on factory - method that was used to construct instance (so check - JsonFactory for details, - but the general - idea is that if caller passes in closable resource (such - as InputStream or Reader) parser does NOT - own the source; but if it passes a reference (such as - File or URL and creates - stream or reader it does own them.
        -
        -
        Specified by:
        -
        close in interface Closeable
        -
        Specified by:
        -
        close in interface AutoCloseable
        -
        Specified by:
        -
        close in class JsonParser
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
        Description copied from class: JsonParser
        -
        Method that can be called to determine whether this parser - is closed or not. If it is closed, no new tokens can be - retrieved by calling JsonParser.nextToken() (and the underlying - stream may be closed). Closing may be due to an explicit - call to JsonParser.close() or because parser has encountered - end of input.
        -
        -
        Specified by:
        -
        isClosed in class JsonParser
        -
        Returns:
        -
        True if this parser instance has been closed
        -
        -
      • -
      - - - -
        -
      • -

        currentToken

        -
        public JsonToken currentToken()
        -
        Description copied from class: JsonParser
        -
        Accessor to find which token parser currently points to, if any; - null will be returned if none. - If return value is non-null, data associated with the token - is available via other accessor methods.
        -
        -
        Specified by:
        -
        currentToken in class JsonParser
        -
        Returns:
        -
        Type of the token this parser currently points to, - if any: null before any tokens have been read, and - after end-of-input has been encountered, as well as - if the current token has been explicitly cleared.
        -
        -
      • -
      - - - -
        -
      • -

        currentTokenId

        -
        public int currentTokenId()
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.currentToken() but that returns an - int instead of JsonToken (enum value). -

        - Use of int directly is typically more efficient on switch statements, - so this method may be useful when building low-overhead codecs. - Note, however, that effect may not be big enough to matter: make sure - to profile performance before deciding to use this method.

        -
        -
        Specified by:
        -
        currentTokenId in class JsonParser
        -
        Returns:
        -
        int matching one of constants from JsonTokenId.
        -
        -
      • -
      - - - -
        -
      • -

        currentName

        -
        public String currentName()
        -                   throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be called to get the name associated with - the current token: for JsonToken.FIELD_NAMEs it will - be the same as what JsonParser.getText() returns; - for field values it will be the preceding field name; - and for others (array values, root-level values) null.
        -
        -
        Specified by:
        -
        currentName in class JsonParser
        -
        Returns:
        -
        Name of the current field in the parsing context
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        hasCurrentToken

        -
        public boolean hasCurrentToken()
        -
        Description copied from class: JsonParser
        -
        Method for checking whether parser currently points to - a token (and data for that token is available). - Equivalent to check for parser.getCurrentToken() != null.
        -
        -
        Specified by:
        -
        hasCurrentToken in class JsonParser
        -
        Returns:
        -
        True if the parser just returned a valid - token via JsonParser.nextToken(); false otherwise (parser - was just constructed, encountered end-of-input - and returned null from JsonParser.nextToken(), or the token - has been consumed)
        -
        -
      • -
      - - - -
        -
      • -

        hasTokenId

        -
        public boolean hasTokenId(int id)
        -
        Description copied from class: JsonParser
        -
        Method that is functionally equivalent to: - - return currentTokenId() == id - - but may be more efficiently implemented. -

        - Note that no traversal or conversion is performed; so in some - cases calling method like JsonParser.isExpectedStartArrayToken() - is necessary instead.

        -
        -
        Specified by:
        -
        hasTokenId in class JsonParser
        -
        Parameters:
        -
        id - Token id to match (from (@link JsonTokenId})
        -
        Returns:
        -
        True if the parser current points to specified token
        -
        -
      • -
      - - - -
        -
      • -

        hasToken

        -
        public boolean hasToken(JsonToken t)
        -
        Description copied from class: JsonParser
        -
        Method that is functionally equivalent to: - - return currentToken() == t - - but may be more efficiently implemented. -

        - Note that no traversal or conversion is performed; so in some - cases calling method like JsonParser.isExpectedStartArrayToken() - is necessary instead.

        -
        -
        Specified by:
        -
        hasToken in class JsonParser
        -
        Parameters:
        -
        t - Token to match
        -
        Returns:
        -
        True if the parser current points to specified token
        -
        -
      • -
      - - - -
        -
      • -

        getCurrentLocation

        -
        public JsonLocation getCurrentLocation()
        -
        Description copied from class: JsonParser
        -
        Method that returns location of the last processed character; - usually for error reporting purposes. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - report specific boundary locations (start or end locations of tokens) - and others only return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getCurrentLocation in class JsonParser
        -
        Returns:
        -
        Location of the last processed input unit (byte or character)
        -
        -
      • -
      - - - -
        -
      • -

        getParsingContext

        -
        public TokenStreamContext getParsingContext()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to access current parsing context reader - is in. There are 3 different types: root, array and object contexts, - with slightly different available information. Contexts are - hierarchically nested, and can be used for example for figuring - out part of the input document that correspond to specific - array or object (for highlighting purposes, or error reporting). - Contexts can also be used for simple xpath-like matching of - input, if so desired.
        -
        -
        Specified by:
        -
        getParsingContext in class JsonParser
        -
        Returns:
        -
        Stream output context (TokenStreamContext) associated with this parser
        -
        -
      • -
      - - - -
        -
      • -

        isExpectedStartArrayToken

        -
        public boolean isExpectedStartArrayToken()
        -
        Description copied from class: JsonParser
        -
        Specialized accessor that can be used to verify that the current - token indicates start array (usually meaning that current token - is JsonToken.START_ARRAY) when start array is expected. - For some specialized parsers this can return true for other cases - as well; this is usually done to emulate arrays in cases underlying - format is ambiguous (XML, for example, has no format-level difference - between Objects and Arrays; it just has elements). -

        - Default implementation is equivalent to: -

        -   currentToken() == JsonToken.START_ARRAY
        -
        - but may be overridden by custom parser implementations.
        -
        -
        Specified by:
        -
        isExpectedStartArrayToken in class JsonParser
        -
        Returns:
        -
        True if the current token can be considered as a - start-array marker (such JsonToken.START_ARRAY); - false if not
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        isNaN

        -
        public boolean isNaN()
        -              throws IOException
        -
        Description copied from class: JsonParser
        -
        Access for checking whether current token is a numeric value token, but - one that is of "not-a-number" (NaN) variety (including both "NaN" AND - positive/negative infinity!): not supported by all formats, - but often supported for JsonToken.VALUE_NUMBER_FLOAT. - NOTE: roughly equivalent to calling !Double.isFinite() - on value you would get from calling JsonParser.getDoubleValue().
        -
        -
        Specified by:
        -
        isNaN in class JsonParser
        -
        Returns:
        -
        True if the current token is of type JsonToken.VALUE_NUMBER_FLOAT - but represents a "Not a Number"; false for other tokens and regular - floating-point numbers
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        clearCurrentToken

        -
        public void clearCurrentToken()
        -
        Description copied from class: JsonParser
        -
        Method called to "consume" the current token by effectively - removing it so that JsonParser.hasCurrentToken() returns false, and - JsonParser.currentToken() null). - Cleared token value can still be accessed by calling - JsonParser.getLastClearedToken() (if absolutely needed), but - usually isn't. -

        - Method was added to be used by the optional data binder, since - it has to be able to consume last token used for binding (so that - it will not be used again).

        -
        -
        Specified by:
        -
        clearCurrentToken in class JsonParser
        -
        -
      • -
      - - - -
        -
      • -

        getLastClearedToken

        -
        public JsonToken getLastClearedToken()
        -
        Description copied from class: JsonParser
        -
        Method that can be called to get the last token that was - cleared using JsonParser.clearCurrentToken(). This is not necessarily - the latest token read. - Will return null if no tokens have been cleared, - or if parser has been closed.
        -
        -
        Specified by:
        -
        getLastClearedToken in class JsonParser
        -
        Returns:
        -
        Last cleared token, if any; null otherwise
        -
        -
      • -
      - - - -
        -
      • -

        nextToken

        -
        public JsonToken nextToken()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Main iteration method, which will advance stream enough - to determine type of the next token, if any. If none - remaining (stream has no content other than possible - white space before ending), null will be returned.
        -
        -
        Specified by:
        -
        nextToken in class JsonParser
        -
        Returns:
        -
        Next token from the stream, if any found, or null - to indicate end-of-input
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextValue

        -
        public JsonToken nextValue()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Iteration method that will advance stream enough - to determine type of the next token that is a value type - (including JSON Array and Object start/end markers). - Or put another way, nextToken() will be called once, - and if JsonToken.FIELD_NAME is returned, another - time to get the value for the field. - Method is most useful for iterating over value entries - of JSON objects; field name will still be available - by calling JsonParser.currentName() when parser points to - the value.
        -
        -
        Specified by:
        -
        nextValue in class JsonParser
        -
        Returns:
        -
        Next non-field-name token from the stream, if any found, - or null to indicate end-of-input (or, for non-blocking - parsers, JsonToken.NOT_AVAILABLE if no tokens were - available yet)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        finishToken

        -
        public void finishToken()
        -                 throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that may be used to force full handling of the current token - so that even if lazy processing is enabled, the whole contents are - read for possible retrieval. This is usually used to ensure that - the token end location is available, as well as token contents - (similar to what calling, say JsonParser.getTextCharacters(), would - achieve). -

        - Note that for many dataformat implementations this method - will not do anything; this is the default implementation unless - overridden by sub-classes.

        -
        -
        Specified by:
        -
        finishToken in class JsonParser
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        nextFieldName

        -
        public boolean nextFieldName(SerializableString str)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - verifies whether it is JsonToken.FIELD_NAME with specified name - and returns result of that comparison. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName());
        -
        - but may be faster for parser to verify, and can therefore be used if caller - expects to get such a property name from input next.
        -
        -
        Specified by:
        -
        nextFieldName in class JsonParser
        -
        Parameters:
        -
        str - Property name to compare next token to (if next token is - JsonToken.FIELD_NAME)
        -
        Returns:
        -
        True if parser advanced to JsonToken.FIELD_NAME with - specified name; false otherwise (different token or non-matching name)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextFieldName

        -
        public int nextFieldName(FieldNameMatcher matcher)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that tries to match next token from stream as JsonToken.FIELD_NAME, - and if so, further match it to one of pre-specified (field) names. - If match succeeds, field index (non-negative `int`) is returned; otherwise one of - marker constants from FieldNameMatcher.
        -
        -
        Specified by:
        -
        nextFieldName in class JsonParser
        -
        Parameters:
        -
        matcher - Matcher that will handle actual matching
        -
        Returns:
        -
        Index of the matched field name, if non-negative, or a negative error - code otherwise (see FieldNameMatcher for details)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getText

        -
        public String getText()
        -               throws IOException
        -
        Description copied from class: JsonParser
        -
        Method for accessing textual representation of the current token; - if no current token (before first call to JsonParser.nextToken(), or - after encountering end-of-input), returns null. - Method can be called for any token type.
        -
        -
        Specified by:
        -
        getText in class JsonParser
        -
        Returns:
        -
        Textual value associated with the current token (one returned - by JsonParser.nextToken() or other iteration methods)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        hasTextCharacters

        -
        public boolean hasTextCharacters()
        -
        Description copied from class: JsonParser
        -
        Method that can be used to determine whether calling of - JsonParser.getTextCharacters() would be the most efficient - way to access textual content for the event parser currently - points to. -

        - Default implementation simply returns false since only actual - implementation class has knowledge of its internal buffering - state. - Implementations are strongly encouraged to properly override - this method, to allow efficient copying of content by other - code.

        -
        -
        Specified by:
        -
        hasTextCharacters in class JsonParser
        -
        Returns:
        -
        True if parser currently has character array that can - be efficiently returned via JsonParser.getTextCharacters(); false - means that it may or may not exist
        -
        -
      • -
      - - - -
        -
      • -

        getTextCharacters

        -
        public char[] getTextCharacters()
        -                         throws IOException
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.getText(), but that will return - underlying (unmodifiable) character array that contains - textual value, instead of constructing a String object - to contain this information. - Note, however, that: -
          -
        • Textual contents are not guaranteed to start at - index 0 (rather, call JsonParser.getTextOffset()) to - know the actual offset -
        • -
        • Length of textual contents may be less than the - length of returned buffer: call JsonParser.getTextLength() - for actual length of returned content. -
        • -
        -

        - Note that caller MUST NOT modify the returned - character array in any way -- doing so may corrupt - current parser state and render parser instance useless. -

        - The only reason to call this method (over JsonParser.getText()) - is to avoid construction of a String object (which - will make a copy of contents).

        -
        -
        Specified by:
        -
        getTextCharacters in class JsonParser
        -
        Returns:
        -
        Buffer that contains the current textual value (but not necessarily - at offset 0, and not necessarily until the end of buffer)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getText

        -
        public int getText(Writer writer)
        -            throws IOException,
        -                   UnsupportedOperationException
        -
        Description copied from class: JsonParser
        -
        Method to read the textual representation of the current token in chunks and - pass it to the given Writer. - Conceptually same as calling: -
        -  writer.write(parser.getText());
        -
        - but should typically be more efficient as longer content does need to - be combined into a single String to return, and write - can occur directly from intermediate buffers Jackson uses.
        -
        -
        Overrides:
        -
        getText in class JsonParser
        -
        Parameters:
        -
        writer - Writer to write textual content to
        -
        Returns:
        -
        The number of characters written to the Writer
        -
        Throws:
        -
        IOException - for low-level read issues or writes using passed - writer, or - JsonParseException for decoding problems
        -
        UnsupportedOperationException
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getByteValue

        -
        public byte getByteValue()
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java byte primitive type. - Note that in addition to "natural" input range of [-128, 127], - this also allows "unsigned 8-bit byte" values [128, 255]: - but for this range value will be translated by truncation, leading - to sign change. -

        - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling JsonParser.getDoubleValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the resulting integer value falls outside range of - [-128, 255], - a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getByteValue in class JsonParser
        -
        Returns:
        -
        Current number value as byte (if numeric token within - range of [-128, 255]); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getShortValue

        -
        public short getShortValue()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java short primitive type. - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling JsonParser.getDoubleValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the resulting integer value falls outside range of - Java short, a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getShortValue in class JsonParser
        -
        Returns:
        -
        Current number value as short (if numeric token within - Java 16-bit signed short range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getDoubleValue

        -
        public double getDoubleValue()
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_FLOAT and - it can be expressed as a Java double primitive type. - It can also be called for JsonToken.VALUE_NUMBER_INT; - if so, it is equivalent to calling JsonParser.getLongValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the value falls - outside of range of Java double, a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getDoubleValue in class JsonParser
        -
        Returns:
        -
        Current number value as double (if numeric token within - Java double range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getFloatValue

        -
        public float getFloatValue()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_FLOAT and - it can be expressed as a Java float primitive type. - It can also be called for JsonToken.VALUE_NUMBER_INT; - if so, it is equivalent to calling JsonParser.getLongValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the value falls - outside of range of Java float, a InputCoercionException - will be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getFloatValue in class JsonParser
        -
        Returns:
        -
        Current number value as float (if numeric token within - Java float range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getIntValue

        -
        public int getIntValue()
        -                throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java int primitive type. - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling JsonParser.getDoubleValue() - and then casting; except for possible overflow/underflow - exception. -

        - Note: if the resulting integer value falls outside range of - Java int, a InputCoercionException - may be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getIntValue in class JsonParser
        -
        Returns:
        -
        Current number value as int (if numeric token within - Java 32-bit signed int range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getLongValue

        -
        public long getLongValue()
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a Java long primitive type. - It can also be called for JsonToken.VALUE_NUMBER_FLOAT; - if so, it is equivalent to calling JsonParser.getDoubleValue() - and then casting to int; except for possible overflow/underflow - exception. -

        - Note: if the token is an integer, but its value falls - outside of range of Java long, a InputCoercionException - may be thrown to indicate numeric overflow/underflow.

        -
        -
        Specified by:
        -
        getLongValue in class JsonParser
        -
        Returns:
        -
        Current number value as long (if numeric token within - Java 32-bit signed long range); otherwise exception thrown
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getNumberValue

        -
        public Number getNumberValue()
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Generic number value accessor method that will work for - all kinds of numeric values. It will return the optimal - (simplest/smallest possible) wrapper object that can - express the numeric value just parsed.
        -
        -
        Specified by:
        -
        getNumberValue in class JsonParser
        -
        Returns:
        -
        Numeric value of the current token in its most optimal - representation
        -
        Throws:
        -
        IOException - Problem with access: JsonParseException if - the current token is not numeric, or if decoding of the value fails - (invalid format for numbers); plain IOException if underlying - content read fails (possible if values are extracted lazily)
        -
        -
      • -
      - - - -
        -
      • -

        getNumberValueExact

        -
        public Number getNumberValueExact()
        -                           throws IOException
        -
        Description copied from class: JsonParser
        -
        Method similar to JsonParser.getNumberValue() with the difference that - for floating-point numbers value returned may be BigDecimal - if the underlying format does not store floating-point numbers using - native representation: for example, textual formats represent numbers - as Strings (which are 10-based), and conversion to Double - is potentially lossy operation. -

        - Default implementation simply returns JsonParser.getNumberValue()

        -
        -
        Specified by:
        -
        getNumberValueExact in class JsonParser
        -
        Returns:
        -
        Numeric value of the current token using most accurate representation
        -
        Throws:
        -
        IOException - Problem with access: JsonParseException if - the current token is not numeric, or if decoding of the value fails - (invalid format for numbers); plain IOException if underlying - content read fails (possible if values are extracted lazily)
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt()
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - Java int value. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - default value of 0 will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsInt in class JsonParser
        -
        Returns:
        -
        int value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsInt

        -
        public int getValueAsInt(int defaultValue)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - int. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to an int (including structured type - markers like start/end Object/Array) - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsInt in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to int is not possible
        -
        Returns:
        -
        int value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsLong

        -
        public long getValueAsLong()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - long. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to a long (including structured type - markers like start/end Object/Array) - default value of 0L will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsLong in class JsonParser
        -
        Returns:
        -
        long value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsLong

        -
        public long getValueAsLong(long defaultValue)
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - long. - Numbers are coerced using default Java rules; booleans convert to 0 (false) - and 1 (true), and Strings are parsed using default Java language integer - parsing rules. -

        - If representation can not be converted to a long (including structured type - markers like start/end Object/Array) - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsLong in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to long is not possible
        -
        Returns:
        -
        long value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsDouble

        -
        public double getValueAsDouble()
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a Java - double. - Numbers are coerced using default Java rules; booleans convert to 0.0 (false) - and 1.0 (true), and Strings are parsed using default Java language floating - point parsing rules. -

        - If representation can not be converted to a double (including structured types - like Objects and Arrays), - default value of 0.0 will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsDouble in class JsonParser
        -
        Returns:
        -
        double value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsDouble

        -
        public double getValueAsDouble(double defaultValue)
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - Java double. - Numbers are coerced using default Java rules; booleans convert to 0.0 (false) - and 1.0 (true), and Strings are parsed using default Java language floating - point parsing rules. -

        - If representation can not be converted to a double (including structured types - like Objects and Arrays), - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsDouble in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to double is not possible
        -
        Returns:
        -
        double value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsBoolean

        -
        public boolean getValueAsBoolean()
        -                          throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - boolean. - JSON booleans map naturally; integer numbers other than 0 map to true, and - 0 maps to false - and Strings 'true' and 'false' map to corresponding values. -

        - If representation can not be converted to a boolean value (including structured types - like Objects and Arrays), - default value of false will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsBoolean in class JsonParser
        -
        Returns:
        -
        boolean value current token is converted to, if possible; exception thrown - otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsBoolean

        -
        public boolean getValueAsBoolean(boolean defaultValue)
        -                          throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - boolean. - JSON booleans map naturally; integer numbers other than 0 map to true, and - 0 maps to false - and Strings 'true' and 'false' map to corresponding values. -

        - If representation can not be converted to a boolean value (including structured types - like Objects and Arrays), - specified def will be returned; no exceptions are thrown.

        -
        -
        Overrides:
        -
        getValueAsBoolean in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to boolean is not possible
        -
        Returns:
        -
        boolean value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString()
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), default value of - null will be returned; no exceptions are thrown.
        -
        -
        Overrides:
        -
        getValueAsString in class JsonParser
        -
        Returns:
        -
        String value current token is converted to, if possible; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getValueAsString

        -
        public String getValueAsString(String defaultValue)
        -                        throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that will try to convert value of current token to a - String. - JSON Strings map naturally; scalar values get converted to - their textual representation. - If representation can not be converted to a String value (including structured types - like Objects and Arrays and null token), specified default value - will be returned; no exceptions are thrown.
        -
        -
        Specified by:
        -
        getValueAsString in class JsonParser
        -
        Parameters:
        -
        defaultValue - Default value to return if conversion to String is not possible
        -
        Returns:
        -
        String value current token is converted to, if possible; def otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getEmbeddedObject

        -
        public Object getEmbeddedObject()
        -                         throws IOException
        -
        Description copied from class: JsonParser
        -
        Accessor that can be called if (and only if) the current token - is JsonToken.VALUE_EMBEDDED_OBJECT. For other token types, - null is returned. -

        - Note: only some specialized parser implementations support - embedding of objects (usually ones that are facades on top - of non-streaming sources, such as object trees). One exception - is access to binary content (whether via base64 encoding or not) - which typically is accessible using this method, as well as - JsonParser.getBinaryValue().

        -
        -
        Overrides:
        -
        getEmbeddedObject in class JsonParser
        -
        Returns:
        -
        Embedded value (usually of "native" type supported by format) - for the current token, if any; null otherwise
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryValue

        -
        public byte[] getBinaryValue(Base64Variant b64variant)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be used to read (and consume -- results - may not be accessible using other methods after the call) - base64-encoded binary data - included in the current textual JSON value. - It works similar to getting String value via JsonParser.getText() - and decoding result (except for decoding part), - but should be significantly more performant. -

        - Note that non-decoded textual contents of the current token - are not guaranteed to be accessible after this method - is called. Current implementation, for example, clears up - textual content during decoding. - Decoded binary content, however, will be retained until - parser is advanced to the next event.

        -
        -
        Specified by:
        -
        getBinaryValue in class JsonParser
        -
        Parameters:
        -
        b64variant - Expected variant of base64 encoded - content (see Base64Variants for definitions - of "standard" variants).
        -
        Returns:
        -
        Decoded binary data
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getTokenLocation

        -
        public JsonLocation getTokenLocation()
        -
        Description copied from class: JsonParser
        -
        Method that return the starting location of the current - token; that is, position of the first character from input - that starts the current token. -

        - Note that the location is not guaranteed to be accurate (although most - implementation will try their best): some implementations may only - return JsonLocation.NA due to not having access - to input location information (when delegating actual decoding work - to other library)

        -
        -
        Specified by:
        -
        getTokenLocation in class JsonParser
        -
        Returns:
        -
        Starting location of the token parser currently points to
        -
        -
      • -
      - - - -
        -
      • -

        readValueAs

        -
        public <T> T readValueAs(Class<T> valueType)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to deserialize stream content into a non-container - type (it can be an array type, however): typically a bean, array - or a wrapper type (like Boolean). -
        - Note: method can only be called if the parser has - been constructed with a linkage to - ObjectReadContext; this is true if constructed by - databinding layer above, or by factory method that takes in - context object. -

        - This method may advance the event stream, for structured values - the current token will be the closing end marker (END_ARRAY, - END_OBJECT) of the bound structure. For non-structured values - (and for JsonToken.VALUE_EMBEDDED_OBJECT) - stream is not advanced. -

        - Note: this method should NOT be used if the result type is a - container (Collection or Map. - The reason is that due to type erasure, key and value types - can not be introspected when using this method.

        -
        -
        Specified by:
        -
        readValueAs in class JsonParser
        -
        Type Parameters:
        -
        T - Nominal type parameter to specify expected node type to - reduce need to cast result value
        -
        Parameters:
        -
        valueType - Type to bind content to
        -
        Returns:
        -
        Java value read from content
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or decoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        readValueAs

        -
        public <T> T readValueAs(TypeReference<T> valueTypeRef)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to deserialize stream content into a Java type, reference - to which is passed as argument. Type is passed using so-called - "super type token" - and specifically needs to be used if the root type is a - parameterized (generic) container type. -
        - Note: method can only be called if the parser has - been constructed with a linkage to - ObjectReadContext; this is true if constructed by - databinding layer above, or by factory method that takes in - context object. -

        - This method may advance the event stream, for structured types - the current token will be the closing end marker (END_ARRAY, - END_OBJECT) of the bound structure. For non-structured types - (and for JsonToken.VALUE_EMBEDDED_OBJECT) - stream is not advanced.

        -
        -
        Specified by:
        -
        readValueAs in class JsonParser
        -
        Type Parameters:
        -
        T - Nominal type parameter to specify expected node type to - reduce need to cast result value
        -
        Parameters:
        -
        valueTypeRef - Type to bind content to
        -
        Returns:
        -
        Java value read from content
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or decoding - issue at format layer
        -
        -
      • -
      - - - - - - - -
        -
      • -

        readValueAsTree

        -
        public <T extends TreeNode> T readValueAsTree()
        -                                       throws IOException
        -
        Description copied from class: JsonParser
        -
        Method to deserialize stream content into equivalent "tree model", - represented by root TreeNode of resulting model. - For Array values it will an array node (with child nodes), - for Object values object node (with child nodes), and for other types - matching leaf node type. Empty or whitespace documents are null. -
        - Note: method can only be called if the parser has - been constructed with a linkage to - ObjectReadContext; this is true if constructed by - databinding layer above, or by factory method that takes in - context object.
        -
        -
        Specified by:
        -
        readValueAsTree in class JsonParser
        -
        Type Parameters:
        -
        T - Nominal type parameter for result node type (to reduce need for casting)
        -
        Returns:
        -
        root of the document, or null if empty or whitespace.
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or decoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        canReadObjectId

        -
        public boolean canReadObjectId()
        -
        Description copied from class: JsonParser
        -
        Introspection method that may be called to see if the underlying - data format supports some kind of Object Ids natively (many do not; - for example, JSON doesn't). -

        - Default implementation returns true; overridden by data formats - that do support native Object Ids. Caller is expected to either - use a non-native notation (explicit property or such), or fail, - in case it can not use native object ids.

        -
        -
        Overrides:
        -
        canReadObjectId in class JsonParser
        -
        Returns:
        -
        True if the format being read supports native Object Ids; - false if not
        -
        -
      • -
      - - - -
        -
      • -

        canReadTypeId

        -
        public boolean canReadTypeId()
        -
        Description copied from class: JsonParser
        -
        Introspection method that may be called to see if the underlying - data format supports some kind of Type Ids natively (many do not; - for example, JSON doesn't). -

        - Default implementation returns true; overridden by data formats - that do support native Type Ids. Caller is expected to either - use a non-native notation (explicit property or such), or fail, - in case it can not use native type ids.

        -
        -
        Overrides:
        -
        canReadTypeId in class JsonParser
        -
        Returns:
        -
        True if the format being read supports native Type Ids; - false if not
        -
        -
      • -
      - - - -
        -
      • -

        getObjectId

        -
        public Object getObjectId()
        -                   throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be called to check whether current token - (one that was just read) has an associated Object id, and if - so, return it. - Note that while typically caller should check with JsonParser.canReadObjectId() - first, it is not illegal to call this method even if that method returns - true; but if so, it will return null. This may be used to simplify calling - code. -

        - Default implementation will simply return null.

        -
        -
        Overrides:
        -
        getObjectId in class JsonParser
        -
        Returns:
        -
        Native Object id associated with the current token, if any; null if none
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        getTypeId

        -
        public Object getTypeId()
        -                 throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that can be called to check whether current token - (one that was just read) has an associated type id, and if - so, return it. - Note that while typically caller should check with JsonParser.canReadTypeId() - first, it is not illegal to call this method even if that method returns - true; but if so, it will return null. This may be used to simplify calling - code. -

        - Default implementation will simply return null.

        -
        -
        Overrides:
        -
        getTypeId in class JsonParser
        -
        Returns:
        -
        Native Type Id associated with the current token, if any; null if none
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        delegate

        -
        public JsonParser delegate()
        -
        Accessor for getting the immediate JsonParser this parser delegates calls to.
        -
        -
        Returns:
        -
        Underlying parser calls are delegated to
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonParserSequence.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonParserSequence.html deleted file mode 100644 index 39e07dafa8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonParserSequence.html +++ /dev/null @@ -1,756 +0,0 @@ - - - - - - -JsonParserSequence (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class JsonParserSequence

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _parsers

        -
        protected final JsonParser[] _parsers
        -
        Parsers other than the first one (which is initially assigned - as delegate)
        -
      • -
      - - - -
        -
      • -

        _checkForExistingToken

        -
        protected final boolean _checkForExistingToken
        -
        Configuration that determines whether state of parsers is first verified - to see if parser already points to a token (that is, - JsonParser.hasCurrentToken() returns true), and if so - that token is first return before JsonParser.nextToken() is called. - If enabled, this check is made; if disabled, no check is made and - JsonParser.nextToken() is always called for all parsers. -

        - Default setting is false (for backwards-compatibility) - so that possible existing token is not considered for parsers.

        -
      • -
      - - - -
        -
      • -

        _nextParserIndex

        -
        protected int _nextParserIndex
        -
        Index of the next parser in _parsers.
        -
      • -
      - - - -
        -
      • -

        _hasToken

        -
        protected boolean _hasToken
        -
        Flag used to indicate that `JsonParser.nextToken()` should not be called, - due to parser already pointing to a token.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonParserSequence

        -
        protected JsonParserSequence(boolean checkForExistingToken,
        -                             JsonParser[] parsers)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        createFlattened

        -
        public static JsonParserSequence createFlattened(boolean checkForExistingToken,
        -                                                 JsonParser first,
        -                                                 JsonParser second)
        -
        Method that will construct a sequence (possibly a sequence) that - contains all given sub-parsers. - All parsers given are checked to see if they are sequences: and - if so, they will be "flattened", that is, contained parsers are - directly added in a new sequence instead of adding sequences - within sequences. This is done to minimize delegation depth, - ideally only having just a single level of delegation.
        -
        -
        Parameters:
        -
        checkForExistingToken - Flag passed to be assigned as - _checkForExistingToken for resulting sequence
        -
        first - First parser to traverse
        -
        second - Second parser to traverse
        -
        Returns:
        -
        Sequence instance constructed
        -
        -
      • -
      - - - -
        -
      • -

        addFlattenedActiveParsers

        -
        protected void addFlattenedActiveParsers(List<JsonParser> listToAddIn)
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws IOException
        -
        Description copied from class: JsonParser
        -
        Closes the parser so that no further iteration or data access - can be made; will also close the underlying input source - if parser either owns the input source, or feature - StreamReadFeature.AUTO_CLOSE_SOURCE is enabled. - Whether parser owns the input source depends on factory - method that was used to construct instance (so check - JsonFactory for details, - but the general - idea is that if caller passes in closable resource (such - as InputStream or Reader) parser does NOT - own the source; but if it passes a reference (such as - File or URL and creates - stream or reader it does own them.
        -
        -
        Specified by:
        -
        close in interface Closeable
        -
        Specified by:
        -
        close in interface AutoCloseable
        -
        Overrides:
        -
        close in class JsonParserDelegate
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem
        -
        -
      • -
      - - - -
        -
      • -

        nextToken

        -
        public JsonToken nextToken()
        -                    throws IOException
        -
        Description copied from class: JsonParser
        -
        Main iteration method, which will advance stream enough - to determine type of the next token, if any. If none - remaining (stream has no content other than possible - white space before ending), null will be returned.
        -
        -
        Overrides:
        -
        nextToken in class JsonParserDelegate
        -
        Returns:
        -
        Next token from the stream, if any found, or null - to indicate end-of-input
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        nextFieldName

        -
        public boolean nextFieldName(SerializableString str)
        -                      throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that fetches next token (as if calling JsonParser.nextToken()) and - verifies whether it is JsonToken.FIELD_NAME with specified name - and returns result of that comparison. - It is functionally equivalent to: -
        -  return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName());
        -
        - but may be faster for parser to verify, and can therefore be used if caller - expects to get such a property name from input next.
        -
        -
        Overrides:
        -
        nextFieldName in class JsonParserDelegate
        -
        Parameters:
        -
        str - Property name to compare next token to (if next token is - JsonToken.FIELD_NAME)
        -
        Returns:
        -
        True if parser advanced to JsonToken.FIELD_NAME with - specified name; false otherwise (different token or non-matching name)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        nextFieldName

        -
        public int nextFieldName(FieldNameMatcher matcher)
        -                  throws IOException
        -
        Description copied from class: JsonParser
        -
        Method that tries to match next token from stream as JsonToken.FIELD_NAME, - and if so, further match it to one of pre-specified (field) names. - If match succeeds, field index (non-negative `int`) is returned; otherwise one of - marker constants from FieldNameMatcher.
        -
        -
        Overrides:
        -
        nextFieldName in class JsonParserDelegate
        -
        Parameters:
        -
        matcher - Matcher that will handle actual matching
        -
        Returns:
        -
        Index of the matched field name, if non-negative, or a negative error - code otherwise (see FieldNameMatcher for details)
        -
        Throws:
        -
        IOException - for low-level read issues, or - JsonParseException for decoding problems
        -
        -
      • -
      - - - -
        -
      • -

        containedParsersCount

        -
        public int containedParsersCount()
        -
        Method that is most useful for debugging or testing; - returns actual number of underlying parsers sequence - was constructed with (nor just ones remaining active)
        -
        -
        Returns:
        -
        Number of actual underlying parsers this sequence has
        -
        -
      • -
      - - - -
        -
      • -

        switchToNext

        -
        protected boolean switchToNext()
        -
        Method that will switch active delegate parser from the current one - to the next parser in sequence, if there is another parser left: - if so, the next parser will become the active delegate parser.
        -
        -
        Returns:
        -
        True if switch succeeded; false otherwise
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonpCharacterEscapes.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonpCharacterEscapes.html deleted file mode 100644 index 9fce29a7aa..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/JsonpCharacterEscapes.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - -JsonpCharacterEscapes (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class JsonpCharacterEscapes

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public class JsonpCharacterEscapes
    -extends CharacterEscapes
    -
    Convenience CharacterEscapes implementation that escapes - Unicode characters `0x2028` and `0x2029` (in addition to characters - escaped otherwise), which are apparently considered linefeeds as - per newer Javascript specifications, and consequently problematic - when using JSONP (see https://en.wikipedia.org/wiki/JSONP).
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JsonpCharacterEscapes

        -
        public JsonpCharacterEscapes()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getEscapeSequence

        -
        public SerializableString getEscapeSequence(int ch)
        -
        Description copied from class: CharacterEscapes
        -
        Method generators can call to get lookup table for determining - exact escape sequence to use for given character. - It can be called for any character, but typically is called for - either for ASCII characters for which custom escape - sequence is needed; or for any non-ASCII character.
        -
        -
        Specified by:
        -
        getEscapeSequence in class CharacterEscapes
        -
        Parameters:
        -
        ch - Character to look escape sequence for
        -
        Returns:
        -
        Escape sequence to use for the character, if any; null if not
        -
        -
      • -
      - - - -
        -
      • -

        getEscapeCodesForAscii

        -
        public int[] getEscapeCodesForAscii()
        -
        Description copied from class: CharacterEscapes
        -
        Method generators can call to get lookup table for determining - escape handling for first 128 characters of Unicode (ASCII - characters. Caller is not to modify contents of this array, since - this is expected to be a shared copy.
        -
        -
        Specified by:
        -
        getEscapeCodesForAscii in class CharacterEscapes
        -
        Returns:
        -
        Array with size of at least 128, where first 128 entries - have either one of ESCAPE_xxx constants, or non-zero positive - integer (meaning of which is data format specific; for JSON it means - that combination of backslash and character with that value is to be used) - to indicate that specific escape sequence is to be used.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/MinimalPrettyPrinter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/MinimalPrettyPrinter.html deleted file mode 100644 index 9bfedb4ccc..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/MinimalPrettyPrinter.html +++ /dev/null @@ -1,729 +0,0 @@ - - - - - - -MinimalPrettyPrinter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class MinimalPrettyPrinter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.util.MinimalPrettyPrinter
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PrettyPrinter, Serializable
    -
    -
    -
    -
    public class MinimalPrettyPrinter
    -extends Object
    -implements PrettyPrinter, Serializable
    -
    PrettyPrinter implementation that adds no indentation, - just implements everything necessary for value output to work - as expected, and provide simpler extension points to allow - for creating simple custom implementations that add specific - decoration or overrides. Since behavior then is very similar - to using no pretty printer at all, usually sub-classes are used. -

    - Beyond purely minimal implementation, there is limited amount of - configurability which may be useful for actual use: for example, - it is possible to redefine separator used between root-level - values (default is single space; can be changed to line-feed). -

    - Note: does NOT implement Instantiatable since this is - a stateless implementation; that is, a single instance can be - shared between threads.

    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _rootValueSeparator

        -
        protected String _rootValueSeparator
        -
      • -
      - - - -
        -
      • -

        _separators

        -
        protected Separators _separators
        -
        -
        Since:
        -
        2.9
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        MinimalPrettyPrinter

        -
        public MinimalPrettyPrinter()
        -
      • -
      - - - -
        -
      • -

        MinimalPrettyPrinter

        -
        public MinimalPrettyPrinter(String rootValueSeparator)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setRootValueSeparator

        -
        public void setRootValueSeparator(String sep)
        -
      • -
      - - - - - - - -
        -
      • -

        writeRootValueSeparator

        -
        public void writeRootValueSeparator(JsonGenerator g)
        -                             throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after a root-level value has been completely - output, and before another value is to be output. -

        - Default handling (without pretty-printing) will output a space, to - allow values to be parsed correctly. Pretty-printer is - to output some other suitable and nice-looking separator - (tab(s), space(s), linefeed(s) or any combination thereof).

        -
        -
        Specified by:
        -
        writeRootValueSeparator in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartObject

        -
        public void writeStartObject(JsonGenerator g)
        -                      throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called when an Object value is to be output, before - any fields are output. -

        - Default handling (without pretty-printing) will output - the opening curly bracket. - Pretty-printer is - to output a curly bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Specified by:
        -
        writeStartObject in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        beforeObjectEntries

        -
        public void beforeObjectEntries(JsonGenerator g)
        -                         throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after object start marker has been output, - and right before the field name of the first entry is - to be output. - It is not called for objects without entries. -

        - Default handling does not output anything, but pretty-printer - is free to add any white space decoration.

        -
        -
        Specified by:
        -
        beforeObjectEntries in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectFieldValueSeparator

        -
        public void writeObjectFieldValueSeparator(JsonGenerator g)
        -                                    throws IOException
        -
        Method called after an object field has been output, but - before the value is output. -

        - Default handling will just output a single - colon to separate the two, without additional spaces.

        -
        -
        Specified by:
        -
        writeObjectFieldValueSeparator in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeObjectEntrySeparator

        -
        public void writeObjectEntrySeparator(JsonGenerator g)
        -                               throws IOException
        -
        Method called after an object entry (field:value) has been completely - output, and before another value is to be output. -

        - Default handling (without pretty-printing) will output a single - comma to separate the two.

        -
        -
        Specified by:
        -
        writeObjectEntrySeparator in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndObject

        -
        public void writeEndObject(JsonGenerator g,
        -                           int nrOfEntries)
        -                    throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after an Object value has been completely output - (minus closing curly bracket). -

        - Default handling (without pretty-printing) will output - the closing curly bracket. - Pretty-printer is - to output a curly bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Specified by:
        -
        writeEndObject in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        nrOfEntries - Number of direct members of the Object that - have been output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeStartArray

        -
        public void writeStartArray(JsonGenerator g)
        -                     throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called when an Array value is to be output, before - any member/child values are output. -

        - Default handling (without pretty-printing) will output - the opening bracket. - Pretty-printer is - to output a bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Specified by:
        -
        writeStartArray in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        beforeArrayValues

        -
        public void beforeArrayValues(JsonGenerator g)
        -                       throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after array start marker has been output, - and right before the first value is to be output. - It is not called for arrays with no values. -

        - Default handling does not output anything, but pretty-printer - is free to add any white space decoration.

        -
        -
        Specified by:
        -
        beforeArrayValues in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeArrayValueSeparator

        -
        public void writeArrayValueSeparator(JsonGenerator g)
        -                              throws IOException
        -
        Method called after an array value has been completely - output, and before another value is to be output. -

        - Default handling (without pretty-printing) will output a single - comma to separate values.

        -
        -
        Specified by:
        -
        writeArrayValueSeparator in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      - - - -
        -
      • -

        writeEndArray

        -
        public void writeEndArray(JsonGenerator g,
        -                          int nrOfValues)
        -                   throws IOException
        -
        Description copied from interface: PrettyPrinter
        -
        Method called after an Array value has been completely output - (minus closing bracket). -

        - Default handling (without pretty-printing) will output - the closing bracket. - Pretty-printer is - to output a bracket as well, but can surround that - with other (white-space) decoration.

        -
        -
        Specified by:
        -
        writeEndArray in interface PrettyPrinter
        -
        Parameters:
        -
        g - Generator used for output
        -
        nrOfValues - Number of direct members of the array that - have been output
        -
        Throws:
        -
        IOException - if there is either an underlying I/O problem or encoding - issue at format layer
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Named.StringAsNamed.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Named.StringAsNamed.html deleted file mode 100644 index e23c3d823c..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Named.StringAsNamed.html +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - -Named.StringAsNamed (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class Named.StringAsNamed

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • com.fasterxml.jackson.core.util.Named.StringAsNamed
    • -
    -
  • -
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _name

        -
        protected final String _name
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringAsNamed

        -
        public StringAsNamed(String n)
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Named.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Named.html deleted file mode 100644 index 0582c8e120..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Named.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - -Named (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Interface Named

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    Base64Variant, Named.StringAsNamed
    -
    -
    -
    -
    public interface Named
    -
    Simple tag interface used primarily to allow databind to pass entities with - name without needing to expose more details of implementation. -

    - NOTE: in Jackson 2.x, was part of `jackson-databind`: demoted here for 3.0.

    -
    -
    Since:
    -
    3.0
    -
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/RequestPayload.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/RequestPayload.html deleted file mode 100644 index 903c53763b..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/RequestPayload.html +++ /dev/null @@ -1,389 +0,0 @@ - - - - - - -RequestPayload (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class RequestPayload

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public class RequestPayload
    -extends Object
    -implements Serializable
    -
    Container object used to contain optional information on content - being parsed, passed to JsonParseException in case of - exception being thrown; this may be useful for caller to display - information on failure.
    -
    -
    Since:
    -
    2.8
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _payloadAsBytes

        -
        protected byte[] _payloadAsBytes
        -
      • -
      - - - -
        -
      • -

        _payloadAsText

        -
        protected CharSequence _payloadAsText
        -
      • -
      - - - -
        -
      • -

        _charset

        -
        protected Charset _charset
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        RequestPayload

        -
        public RequestPayload(byte[] bytes,
        -                      Charset charset)
        -
      • -
      - - - -
        -
      • -

        RequestPayload

        -
        public RequestPayload(CharSequence str)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getRawPayload

        -
        public Object getRawPayload()
        -
        Returns the raw request payload object i.e, either byte[] or String
        -
        -
        Returns:
        -
        Object which is a raw request payload i.e, either byte[] or - String
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Separators.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Separators.html deleted file mode 100644 index 326d529558..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Separators.html +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - -Separators (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class Separators

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Separators

        -
        public Separators()
        -
      • -
      - - - -
        -
      • -

        Separators

        -
        public Separators(char objectFieldValueSeparator,
        -                  char objectEntrySeparator,
        -                  char arrayValueSeparator)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        createDefaultInstance

        -
        public static Separators createDefaultInstance()
        -
      • -
      - - - -
        -
      • -

        withObjectFieldValueSeparator

        -
        public Separators withObjectFieldValueSeparator(char sep)
        -
      • -
      - - - -
        -
      • -

        withObjectEntrySeparator

        -
        public Separators withObjectEntrySeparator(char sep)
        -
      • -
      - - - -
        -
      • -

        withArrayValueSeparator

        -
        public Separators withArrayValueSeparator(char sep)
        -
      • -
      - - - -
        -
      • -

        getObjectFieldValueSeparator

        -
        public char getObjectFieldValueSeparator()
        -
      • -
      - - - -
        -
      • -

        getObjectEntrySeparator

        -
        public char getObjectEntrySeparator()
        -
      • -
      - - - -
        -
      • -

        getArrayValueSeparator

        -
        public char getArrayValueSeparator()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/SimpleTokenReadContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/SimpleTokenReadContext.html deleted file mode 100644 index e2bde7140f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/SimpleTokenReadContext.html +++ /dev/null @@ -1,719 +0,0 @@ - - - - - - -SimpleTokenReadContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class SimpleTokenReadContext

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _parent

        -
        protected final SimpleTokenReadContext _parent
        -
        Parent context for this context; null for root context.
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        _currentName

        -
        protected String _currentName
        -
      • -
      - - - -
        -
      • -

        _currentValue

        -
        protected Object _currentValue
        -
      • -
      - - - -
        -
      • -

        _lineNr

        -
        protected int _lineNr
        -
      • -
      - - - -
        -
      • -

        _columnNr

        -
        protected int _columnNr
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        reset

        -
        protected void reset(int type,
        -                     int lineNr,
        -                     int colNr)
        -
      • -
      - - - -
        -
      • -

        getCurrentValue

        -
        public Object getCurrentValue()
        -
        Description copied from class: TokenStreamContext
        -
        Method for accessing currently active value being used by data-binding - (as the source of streaming data to write, or destination of data being - read), at this level in hierarchy. -

        - Note that "current value" is NOT populated (or used) by Streaming parser or generator; - it is only used by higher-level data-binding functionality. - The reason it is included here is that it can be stored and accessed hierarchically, - and gets passed through data-binding.

        -
        -
        Overrides:
        -
        getCurrentValue in class TokenStreamContext
        -
        Returns:
        -
        Currently active value, if one has been assigned.
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        createChildArrayContext

        -
        public SimpleTokenReadContext createChildArrayContext(int lineNr,
        -                                                      int colNr)
        -
      • -
      - - - -
        -
      • -

        createChildObjectContext

        -
        public SimpleTokenReadContext createChildObjectContext(int lineNr,
        -                                                       int colNr)
        -
      • -
      - - - -
        -
      • -

        currentName

        -
        public String currentName()
        -
        Description copied from class: TokenStreamContext
        -
        Method for accessing name associated with the current location. - Non-null for FIELD_NAME and value events that directly - follow field names; null for root level and array values.
        -
        -
        Specified by:
        -
        currentName in class TokenStreamContext
        -
        Returns:
        -
        Current field name within context, if any; null if none
        -
        Since:
        -
        3.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getParent

        -
        public SimpleTokenReadContext getParent()
        -
        Description copied from class: TokenStreamContext
        -
        Accessor for finding parent context of this context; will - return null for root context.
        -
        -
        Specified by:
        -
        getParent in class TokenStreamContext
        -
        Returns:
        -
        Parent context of this context, if any; null for Root contexts
        -
        -
      • -
      - - - -
        -
      • -

        getStartLocation

        -
        public JsonLocation getStartLocation(Object srcRef)
        -
        Description copied from class: TokenStreamContext
        -
        Optional method that may be used to access starting location of this context: - for example, in case of JSON `Object` context, offset at which `[` token was - read or written. Often used for error reporting purposes. - Implementations that do not keep track of such location are expected to return - JsonLocation.NA; this is what the default implementation does. -

        - NOTE: demoted from JsonReadContext in 2.9, to allow use for - "non-standard" read contexts.

        -
        -
        Overrides:
        -
        getStartLocation in class TokenStreamContext
        -
        Parameters:
        -
        srcRef - Source reference needed to construct location instance
        -
        Returns:
        -
        Location pointing to the point where the context - start marker was found (or written); never `null`.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getDupDetector

        -
        public DupDetector getDupDetector()
        -
      • -
      - - - -
        -
      • -

        valueRead

        -
        public int valueRead()
        -
        Method to call to advance index within current context: to be called - when a new token found within current context (field name for objects, - value for root and array contexts)
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/SimpleTokenWriteContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/SimpleTokenWriteContext.html deleted file mode 100644 index e1e24e25e7..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/SimpleTokenWriteContext.html +++ /dev/null @@ -1,659 +0,0 @@ - - - - - - -SimpleTokenWriteContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class SimpleTokenWriteContext

-
-
- -
-
    -
  • -
    -
    -
    public final class SimpleTokenWriteContext
    -extends TokenStreamContext
    -
    Basic implementation of TokenStreamContext useful for most - format backends (with notable exception of JSON that needs bit more - advanced state).
    -
    -
    Since:
    -
    3.0
    -
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Snapshottable.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Snapshottable.html deleted file mode 100644 index 18914668e7..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/Snapshottable.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - -Snapshottable (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Interface Snapshottable<T>

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    BinaryTSFactory, DecorableTSFactory, JsonFactory, TextualTSFactory, TokenStreamFactory
    -
    -
    -
    -
    public interface Snapshottable<T>
    -
    Interface that defines one method (see snapshot()) for ensuring that we get - an instance that does not allow modifying state of `this` instance. Instance returned - may be `this` if (and only if) it is immutable through its API (or, for some limited - circumstances, if usage is guaranteed not to modify it after this point -- such usage - is discouraged however); or, if that can not be guaranteed, a newly created copy - with same configuration and state as `this`. -

    - Interface is intended to be used for persisting state for serialization, or to support - "re-build" of otherwise immutable objects like factories. Some of the helper objects - factories use and rely on have mutable state which can not be shared: instead, to support - re-building, a state object may be created to contain copies (snapshots). - Intent, therefore, is that caller does not need to know about immutability (or lack thereof) - of an entity but can simply call snapshot().

    -
    -
    Since:
    -
    3.0
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        snapshot

        -
        T snapshot()
        -
        Method to call to get an instance that may not be modified through any other object, - including `this`. That instance may be `this` if (and only if) this instance is effectively - immutable (unmodifiable) through its API: if this is not the case, a new copy with same - configuration must be created and returned.
        -
      • -
      - - - -
        -
      • -

        takeSnapshot

        -
        static <T> T takeSnapshot(Snapshottable<T> src)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/TextBuffer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/TextBuffer.html deleted file mode 100644 index 74598415ad..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/TextBuffer.html +++ /dev/null @@ -1,894 +0,0 @@ - - - - - - -TextBuffer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class TextBuffer

-
-
- -
-
    -
  • -
    -
    -
    public final class TextBuffer
    -extends Object
    -
    TextBuffer is a class similar to StringBuffer, with - following differences: -
      -
    • TextBuffer uses segments character arrays, to avoid having - to do additional array copies when array is not big enough. - This means that only reallocating that is necessary is done only once: - if and when caller - wants to access contents in a linear array (char[], String). -
    • -
    • TextBuffer can also be initialized in "shared mode", in which - it will just act as a wrapper to a single char array managed - by another object (like parser that owns it) -
    • -
    • TextBuffer is not synchronized. -
    • -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - - - - - -
        -
      • -

        TextBuffer

        -
        protected TextBuffer(BufferRecycler allocator,
        -                     char[] initialSegment)
        -
        -
        Since:
        -
        2.10
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        fromInitial

        -
        public static TextBuffer fromInitial(char[] initialSegment)
        -
        Factory method for constructing an instance with no allocator, and - with initial full segment.
        -
        -
        Since:
        -
        2.10
        -
        -
      • -
      - - - -
        -
      • -

        releaseBuffers

        -
        public void releaseBuffers()
        -
        Method called to indicate that the underlying buffers should now - be recycled if they haven't yet been recycled. Although caller - can still use this text buffer, it is not advisable to call this - method if that is likely, since next time a buffer is needed, - buffers need to reallocated. -

        - Note: since Jackson 2.11, calling this method will NOT clear already - aggregated contents (that is, _currentSegment, to retain - current token text if (but only if!) already aggregated.

        -
      • -
      - - - -
        -
      • -

        resetWithEmpty

        -
        public void resetWithEmpty()
        -
        Method called to clear out any content text buffer may have, and - initializes buffer to use non-shared data.
        -
      • -
      - - - -
        -
      • -

        resetWith

        -
        public void resetWith(char ch)
        -
        -
        Since:
        -
        2.9
        -
        -
      • -
      - - - -
        -
      • -

        resetWithShared

        -
        public void resetWithShared(char[] buf,
        -                            int start,
        -                            int len)
        -
        Method called to initialize the buffer with a shared copy of data; - this means that buffer will just have pointers to actual data. It - also means that if anything is to be appended to the buffer, it - will first have to unshare it (make a local copy).
        -
      • -
      - - - -
        -
      • -

        resetWithCopy

        -
        public void resetWithCopy(char[] buf,
        -                          int start,
        -                          int len)
        -
      • -
      - - - -
        -
      • -

        resetWithCopy

        -
        public void resetWithCopy(String text,
        -                          int start,
        -                          int len)
        -
        -
        Since:
        -
        2.9
        -
        -
      • -
      - - - -
        -
      • -

        resetWithString

        -
        public void resetWithString(String value)
        -
      • -
      - - - -
        -
      • -

        getBufferWithoutReset

        -
        public char[] getBufferWithoutReset()
        -
        -
        Since:
        -
        2.9
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        -
        Returns:
        -
        Number of characters currently stored by this collector
        -
        -
      • -
      - - - -
        -
      • -

        getTextOffset

        -
        public int getTextOffset()
        -
      • -
      - - - -
        -
      • -

        hasTextAsCharacters

        -
        public boolean hasTextAsCharacters()
        -
        Method that can be used to check whether textual contents can - be efficiently accessed using getTextBuffer().
        -
      • -
      - - - -
        -
      • -

        getTextBuffer

        -
        public char[] getTextBuffer()
        -
        Accessor that may be used to get the contents of this buffer in a single - char array regardless of whether they were collected in a segmented - fashion or not.
        -
      • -
      - - - -
        -
      • -

        contentsAsString

        -
        public String contentsAsString()
        -
      • -
      - - - -
        -
      • -

        contentsAsArray

        -
        public char[] contentsAsArray()
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        contentsAsInt

        -
        public int contentsAsInt(boolean neg)
        -
        Specialized convenience method that will decode a 32-bit int, - of at most 9 digits (and possible leading minus sign).
        -
        -
        Parameters:
        -
        neg - Whether contents start with a minus sign
        -
        Since:
        -
        2.9
        -
        -
      • -
      - - - -
        -
      • -

        contentsAsLong

        -
        public long contentsAsLong(boolean neg)
        -
        Specialized convenience method that will decode a 64-bit int, - of at most 18 digits (and possible leading minus sign).
        -
        -
        Parameters:
        -
        neg - Whether contents start with a minus sign
        -
        Since:
        -
        2.9
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ensureNotShared

        -
        public void ensureNotShared()
        -
        Method called to make sure that buffer is not using shared input - buffer; if it is, it will copy such contents to private buffer.
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(char c)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(char[] c,
        -                   int start,
        -                   int len)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(String str,
        -                   int offset,
        -                   int len)
        -
      • -
      - - - -
        -
      • -

        getCurrentSegment

        -
        public char[] getCurrentSegment()
        -
      • -
      - - - -
        -
      • -

        emptyAndGetCurrentSegment

        -
        public char[] emptyAndGetCurrentSegment()
        -
      • -
      - - - -
        -
      • -

        getCurrentSegmentSize

        -
        public int getCurrentSegmentSize()
        -
      • -
      - - - -
        -
      • -

        setCurrentLength

        -
        public void setCurrentLength(int len)
        -
      • -
      - - - -
        -
      • -

        setCurrentAndReturn

        -
        public String setCurrentAndReturn(int len)
        -
        -
        Since:
        -
        2.6
        -
        -
      • -
      - - - -
        -
      • -

        finishCurrentSegment

        -
        public char[] finishCurrentSegment()
        -
      • -
      - - - -
        -
      • -

        expandCurrentSegment

        -
        public char[] expandCurrentSegment()
        -
        Method called to expand size of the current segment, to - accommodate for more contiguous content. Usually only - used when parsing tokens like names if even then.
        -
      • -
      - - - -
        -
      • -

        expandCurrentSegment

        -
        public char[] expandCurrentSegment(int minSize)
        -
        Method called to expand size of the current segment, to - accommodate for more contiguous content. Usually only - used when parsing tokens like names if even then.
        -
        -
        Parameters:
        -
        minSize - Required minimum strength of the current segment
        -
        Since:
        -
        2.4.0
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public String toString()
        -
        Note: calling this method may not be as efficient as calling - contentsAsString(), since it's not guaranteed that resulting - String is cached.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/VersionUtil.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/VersionUtil.html deleted file mode 100644 index cffb1f8a29..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/VersionUtil.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - -VersionUtil (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - - -
-
com.fasterxml.jackson.core.util
-

Class VersionUtil

-
-
- -
-
    -
  • -
    -
    -
    public class VersionUtil
    -extends Object
    -
    Functionality for supporting exposing of component Versions. - Also contains other misc methods that have no other place to live in. -

    - Note that this class can be used in two roles: first, as a static - utility class for loading purposes, and second, as a singleton - loader of per-module version information.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        VersionUtil

        -
        protected VersionUtil()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        versionFor

        -
        public static Version versionFor(Class<?> cls)
        -
        Helper method that will try to load version information for specified - class. Implementation is as follows: - - First, tries to load version info from a class named - "PackageVersion" in the same package as the class. - - If no version information is found, Version.unknownVersion() is returned.
        -
      • -
      - - - -
        -
      • -

        packageVersionFor

        -
        public static Version packageVersionFor(Class<?> cls)
        -
        Loads version information by introspecting a class named - "PackageVersion" in the same package as the given class. -

        - If the class could not be found or does not have a public - static Version field named "VERSION", returns null.

        -
      • -
      - - - -
        -
      • -

        parseVersion

        -
        public static Version parseVersion(String s,
        -                                   String groupId,
        -                                   String artifactId)
        -
        Method used by PackageVersion classes to decode version injected by Maven build.
        -
      • -
      - - - -
        -
      • -

        parseVersionPart

        -
        protected static int parseVersionPart(String s)
        -
      • -
      - - - -
        -
      • -

        throwInternal

        -
        public static final void throwInternal()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/BufferRecycler.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/BufferRecycler.html deleted file mode 100644 index c0c7e3e5e0..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/BufferRecycler.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.BufferRecycler (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.BufferRecycler

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/BufferRecyclers.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/BufferRecyclers.html deleted file mode 100644 index ac65b35d26..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/BufferRecyclers.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.BufferRecyclers (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.BufferRecyclers

-
-
No usage of com.fasterxml.jackson.core.util.BufferRecyclers
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/ByteArrayBuilder.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/ByteArrayBuilder.html deleted file mode 100644 index 32de7cf793..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/ByteArrayBuilder.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.ByteArrayBuilder (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.ByteArrayBuilder

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultIndenter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultIndenter.html deleted file mode 100644 index 3bd1f7da5b..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultIndenter.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.DefaultIndenter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.DefaultIndenter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.FixedSpaceIndenter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.FixedSpaceIndenter.html deleted file mode 100644 index 17b919c414..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.FixedSpaceIndenter.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.FixedSpaceIndenter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.DefaultPrettyPrinter.FixedSpaceIndenter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.Indenter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.Indenter.html deleted file mode 100644 index 58e948a7f6..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.Indenter.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.util.DefaultPrettyPrinter.Indenter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.util.DefaultPrettyPrinter.Indenter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.NopIndenter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.NopIndenter.html deleted file mode 100644 index 3036b15947..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.NopIndenter.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.NopIndenter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.DefaultPrettyPrinter.NopIndenter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.html deleted file mode 100644 index c8bf8b9f6f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/DefaultPrettyPrinter.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.DefaultPrettyPrinter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.DefaultPrettyPrinter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Instantiatable.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Instantiatable.html deleted file mode 100644 index db91d1b899..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Instantiatable.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.util.Instantiatable (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.util.Instantiatable

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/InternCache.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/InternCache.html deleted file mode 100644 index 7982b37b6a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/InternCache.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.InternCache (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.InternCache

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JacksonFeature.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JacksonFeature.html deleted file mode 100644 index f6bfecb6e4..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JacksonFeature.html +++ /dev/null @@ -1,315 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.util.JacksonFeature (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.util.JacksonFeature

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JacksonFeatureSet.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JacksonFeatureSet.html deleted file mode 100644 index ce73c394f8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JacksonFeatureSet.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.JacksonFeatureSet (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.JacksonFeatureSet

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonGeneratorDelegate.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonGeneratorDelegate.html deleted file mode 100644 index 2554686ef8..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonGeneratorDelegate.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.JsonGeneratorDelegate (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.JsonGeneratorDelegate

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonParserDelegate.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonParserDelegate.html deleted file mode 100644 index 6ab72947a2..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonParserDelegate.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.JsonParserDelegate (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.JsonParserDelegate

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonParserSequence.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonParserSequence.html deleted file mode 100644 index 26890adb1f..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonParserSequence.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.JsonParserSequence (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.JsonParserSequence

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonpCharacterEscapes.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonpCharacterEscapes.html deleted file mode 100644 index 4f58ae00d0..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/JsonpCharacterEscapes.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.JsonpCharacterEscapes (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.JsonpCharacterEscapes

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/MinimalPrettyPrinter.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/MinimalPrettyPrinter.html deleted file mode 100644 index 57ab1f3844..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/MinimalPrettyPrinter.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.MinimalPrettyPrinter (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.MinimalPrettyPrinter

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Named.StringAsNamed.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Named.StringAsNamed.html deleted file mode 100644 index 2412aeafc7..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Named.StringAsNamed.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.Named.StringAsNamed (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.Named.StringAsNamed

-
-
No usage of com.fasterxml.jackson.core.util.Named.StringAsNamed
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Named.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Named.html deleted file mode 100644 index 63ecceb78c..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Named.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.util.Named (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.util.Named

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/RequestPayload.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/RequestPayload.html deleted file mode 100644 index 413513f365..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/RequestPayload.html +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.RequestPayload (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.RequestPayload

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Separators.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Separators.html deleted file mode 100644 index e009feb8f2..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Separators.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.Separators (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.Separators

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/SimpleTokenReadContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/SimpleTokenReadContext.html deleted file mode 100644 index 1893948f99..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/SimpleTokenReadContext.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.SimpleTokenReadContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.SimpleTokenReadContext

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/SimpleTokenWriteContext.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/SimpleTokenWriteContext.html deleted file mode 100644 index 699172f91d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/SimpleTokenWriteContext.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.SimpleTokenWriteContext (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.SimpleTokenWriteContext

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Snapshottable.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Snapshottable.html deleted file mode 100644 index faea10db09..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/Snapshottable.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - - - -Uses of Interface com.fasterxml.jackson.core.util.Snapshottable (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Interface
com.fasterxml.jackson.core.util.Snapshottable

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/TextBuffer.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/TextBuffer.html deleted file mode 100644 index 87805cc3fc..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/TextBuffer.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.TextBuffer (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.TextBuffer

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/VersionUtil.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/VersionUtil.html deleted file mode 100644 index 5ab0d88061..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/class-use/VersionUtil.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - -Uses of Class com.fasterxml.jackson.core.util.VersionUtil (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Class
com.fasterxml.jackson.core.util.VersionUtil

-
-
No usage of com.fasterxml.jackson.core.util.VersionUtil
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-frame.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-frame.html deleted file mode 100644 index 8933b670be..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-frame.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.util (Jackson-core 3.0.0-SNAPSHOT API) - - - - - -

com.fasterxml.jackson.core.util

- - - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-summary.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-summary.html deleted file mode 100644 index fccd8ffc1d..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-summary.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.util (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Package com.fasterxml.jackson.core.util

-
-
Utility classes used by Jackson Core functionality.
-
-

See: Description

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    DefaultPrettyPrinter.Indenter -
    Interface that defines objects that can produce indentation used - to separate object entries and array values.
    -
    Instantiatable<T> -
    Add-on interface used to indicate things that may be "blueprint" objects - which can not be used as is, but are used for creating usable per-process - (serialization, deserialization) instances, using - Instantiatable.createInstance() method.
    -
    JacksonFeature -
    Basic API implemented by Enums used for simple Jackson "features": on/off - settings and capabilities exposed as something that can be internally - represented as bit sets.
    -
    Named -
    Simple tag interface used primarily to allow databind to pass entities with - name without needing to expose more details of implementation.
    -
    Snapshottable<T> -
    Interface that defines one method (see Snapshottable.snapshot()) for ensuring that we get - an instance that does not allow modifying state of `this` instance.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    BufferRecycler -
    This is a small utility class, whose main functionality is to allow - simple reuse of raw byte/char buffers.
    -
    BufferRecyclers -
    Helper entity used to control access to simple buffer recyling scheme used for - some encoding, decoding tasks.
    -
    ByteArrayBuilder -
    Helper class that is similar to ByteArrayOutputStream - in usage, but more geared to Jackson use cases internally.
    -
    DefaultIndenter -
    Default linefeed-based indenter, used by DefaultPrettyPrinter (unless - overridden).
    -
    DefaultPrettyPrinter -
    Default PrettyPrinter implementation that uses 2-space - indentation with platform-default linefeeds.
    -
    DefaultPrettyPrinter.FixedSpaceIndenter -
    This is a very simple indenter that only adds a - single space for indentation.
    -
    DefaultPrettyPrinter.NopIndenter -
    Dummy implementation that adds no indentation whatsoever
    -
    InternCache -
    Singleton class that adds a simple first-level cache in front of - regular String.intern() functionality.
    -
    JacksonFeatureSet<F extends JacksonFeature> -
    Container similar to EnumSet meant for storing sets of - JacksonFeatures (usually Enums): main - difference being that these sets are immutable.
    -
    JsonGeneratorDelegate 
    JsonParserDelegate -
    Helper class that implements - delegation pattern for JsonParser, - to allow for simple overridability of basic parsing functionality.
    -
    JsonParserSequence -
    Helper class that can be used to sequence multiple physical - JsonParsers to create a single logical sequence of - tokens, as a single JsonParser.
    -
    JsonpCharacterEscapes -
    Convenience CharacterEscapes implementation that escapes - Unicode characters `0x2028` and `0x2029` (in addition to characters - escaped otherwise), which are apparently considered linefeeds as - per newer Javascript specifications, and consequently problematic - when using JSONP (see https://en.wikipedia.org/wiki/JSONP).
    -
    MinimalPrettyPrinter -
    PrettyPrinter implementation that adds no indentation, - just implements everything necessary for value output to work - as expected, and provide simpler extension points to allow - for creating simple custom implementations that add specific - decoration or overrides.
    -
    Named.StringAsNamed 
    RequestPayload -
    Container object used to contain optional information on content - being parsed, passed to JsonParseException in case of - exception being thrown; this may be useful for caller to display - information on failure.
    -
    Separators -
    Value class used with some PrettyPrinter - implements
    -
    SimpleTokenReadContext 
    SimpleTokenWriteContext -
    Basic implementation of TokenStreamContext useful for most - format backends (with notable exception of JSON that needs bit more - advanced state).
    -
    TextBuffer -
    TextBuffer is a class similar to StringBuffer, with - following differences: - - TextBuffer uses segments character arrays, to avoid having - to do additional array copies when array is not big enough.
    -
    VersionUtil -
    Functionality for supporting exposing of component Versions.
    -
    -
  • -
- - - -

Package com.fasterxml.jackson.core.util Description

-
Utility classes used by Jackson Core functionality.
-
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-tree.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-tree.html deleted file mode 100644 index f0861ffdb5..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-tree.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - -com.fasterxml.jackson.core.util Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Hierarchy For Package com.fasterxml.jackson.core.util

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-use.html b/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-use.html deleted file mode 100644 index c395d5fb4a..0000000000 --- a/docs/javadoc/3.0.2021-01/com/fasterxml/jackson/core/util/package-use.html +++ /dev/null @@ -1,574 +0,0 @@ - - - - - - -Uses of Package com.fasterxml.jackson.core.util (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - - - - -
-

Uses of Package
com.fasterxml.jackson.core.util

-
-
- -
- - - - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/constant-values.html b/docs/javadoc/3.0.2021-01/constant-values.html deleted file mode 100644 index 03d6f063b3..0000000000 --- a/docs/javadoc/3.0.2021-01/constant-values.html +++ /dev/null @@ -1,1473 +0,0 @@ - - - - - - -Constant Field Values (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - -
- - - - - - - -
- - -
-

Constant Field Values

-

Contents

- -
-
- - -

com.fasterxml.*

- - - - - - - -
- -
- - - - - - - -
- - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/deprecated-list.html b/docs/javadoc/3.0.2021-01/deprecated-list.html deleted file mode 100644 index 2972926907..0000000000 --- a/docs/javadoc/3.0.2021-01/deprecated-list.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - -Deprecated List (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - -
- - - - - - - -
- - -
-

Deprecated API

-

Contents

- -
-
- - - -
- -
- - - - - - - -
- - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/help-doc.html b/docs/javadoc/3.0.2021-01/help-doc.html deleted file mode 100644 index 811ed52e2c..0000000000 --- a/docs/javadoc/3.0.2021-01/help-doc.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - -API Help (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - -
- - - - - - - -
- - -
-

How This API Document Is Organized

-
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
-
-
-
    -
  • -

    Overview

    -

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    -
  • -
  • -

    Package

    -

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    -
      -
    • Interfaces (italic)
    • -
    • Classes
    • -
    • Enums
    • -
    • Exceptions
    • -
    • Errors
    • -
    • Annotation Types
    • -
    -
  • -
  • -

    Class/Interface

    -

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    -
      -
    • Class inheritance diagram
    • -
    • Direct Subclasses
    • -
    • All Known Subinterfaces
    • -
    • All Known Implementing Classes
    • -
    • Class/interface declaration
    • -
    • Class/interface description
    • -
    -
      -
    • Nested Class Summary
    • -
    • Field Summary
    • -
    • Constructor Summary
    • -
    • Method Summary
    • -
    -
      -
    • Field Detail
    • -
    • Constructor Detail
    • -
    • Method Detail
    • -
    -

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    -
  • -
  • -

    Annotation Type

    -

    Each annotation type has its own separate page with the following sections:

    -
      -
    • Annotation Type declaration
    • -
    • Annotation Type description
    • -
    • Required Element Summary
    • -
    • Optional Element Summary
    • -
    • Element Detail
    • -
    -
  • -
  • -

    Enum

    -

    Each enum has its own separate page with the following sections:

    -
      -
    • Enum declaration
    • -
    • Enum description
    • -
    • Enum Constant Summary
    • -
    • Enum Constant Detail
    • -
    -
  • -
  • -

    Use

    -

    Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.

    -
  • -
  • -

    Tree (Class Hierarchy)

    -

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    -
      -
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • -
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • -
    -
  • -
  • -

    Deprecated API

    -

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    -
  • -
  • -

    Index

    -

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    -
  • -
  • -

    Prev/Next

    -

    These links take you to the next or previous class, interface, package, or related page.

    -
  • -
  • -

    Frames/No Frames

    -

    These links show and hide the HTML frames. All pages are available with or without frames.

    -
  • -
  • -

    All Classes

    -

    The All Classes link shows all classes and interfaces except non-static nested types.

    -
  • -
  • -

    Serialized Form

    -

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    -
  • -
  • -

    Constant Field Values

    -

    The Constant Field Values page lists the static final fields and their values.

    -
  • -
-This help file applies to API documentation generated using the standard doclet.
- -
- - - - - - - -
- - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/index-all.html b/docs/javadoc/3.0.2021-01/index-all.html deleted file mode 100644 index f7a723c250..0000000000 --- a/docs/javadoc/3.0.2021-01/index-all.html +++ /dev/null @@ -1,9031 +0,0 @@ - - - - - - -Index (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - -
- - - - - - - -
- - -
A B C D E F G H I J L M N O P Q R S T U V W _  - - -

A

-
-
acceptsPaddingOnRead() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
addFlattenedActiveParsers(List<JsonParser>) - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
 
-
addName(String) - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
addName(String, int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
addName(String, int, int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
addName(String, int, int, int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
addName(String, int[], int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
allocBase64Buffer() - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
allocBase64Buffer(int) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
allocByteBuffer(int) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
allocByteBuffer(int, int) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
allocCharBuffer(int) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
allocCharBuffer(int, int) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
allocConcatBuffer() - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
allocNameCopyBuffer(int) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
allocReadIOBuffer() - Method in class com.fasterxml.jackson.core.io.IOContext
-
-
- Note: the method can only be called once during its life cycle.
-
-
allocReadIOBuffer(int) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
allocTokenBuffer() - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
allocTokenBuffer(int) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
allocWriteEncodingBuffer() - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
allocWriteEncodingBuffer(int) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
append(char) - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
append(CharSequence) - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
append(CharSequence, int, int) - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
append(char) - Method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
append(JsonPointer) - Method in class com.fasterxml.jackson.core.JsonPointer
-
-
Mutant factory method that will return - - `tail` if `this` instance is "empty" pointer, OR - - `this` instance if `tail` is "empty" pointer, OR - - Newly constructed JsonPointer instance that starts with all segments - of `this`, followed by all segments of `tail`.
-
-
append(int) - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
append(char) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
append(char[], int, int) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
append(String, int, int) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
appendDesc(StringBuilder) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
appendFourBytes(int) - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
appendQuoted(StringBuilder, String) - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
appendQuoted(char[], int) - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
appendQuoted(char[], int) - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Method that will append quoted characters of this String into given - buffer.
-
-
appendQuotedUTF8(byte[], int) - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
appendQuotedUTF8(byte[], int) - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Method that will append quoted UTF-8 bytes of this String into given - buffer, if there is enough room; if not, returns -1.
-
-
appendThreeBytes(int) - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
appendTwoBytes(int) - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
appendUnquoted(char[], int) - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
appendUnquoted(char[], int) - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Method that will append unquoted characters of this String into given - buffer.
-
-
appendUnquotedUTF8(byte[], int) - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
appendUnquotedUTF8(byte[], int) - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Method that will append unquoted ('raw') UTF-8 bytes of this String into given - buffer.
-
-
ArrayTreeNode - Interface in com.fasterxml.jackson.core.tree
-
-
Tag interface (for now) for Array nodes
-
-
asBitmask() - Method in class com.fasterxml.jackson.core.util.JacksonFeatureSet
-
-
Accessor for underlying bitmask
-
-
asByteArray() - Method in enum com.fasterxml.jackson.core.JsonToken
-
 
-
asCharArray() - Method in enum com.fasterxml.jackson.core.JsonToken
-
 
-
asProperty - Variable in class com.fasterxml.jackson.core.type.WritableTypeId
-
-
If type id is to be embedded as a regular property, name of the property; - otherwise `null`.
-
-
asQuotedChars() - Method in class com.fasterxml.jackson.core.io.SerializedString
-
-
Accessor for accessing value that has been quoted (escaped) using JSON - quoting rules (using backslash-prefixed codes) into a char array.
-
-
asQuotedChars() - Method in interface com.fasterxml.jackson.core.SerializableString
-
 
-
asQuotedUTF8() - Method in class com.fasterxml.jackson.core.io.SerializedString
-
-
Accessor for accessing value that has been quoted (escaped) using JSON - quoting rules (using backslash-prefixed codes), and encoded using - UTF-8 encoding into a byte array.
-
-
asQuotedUTF8() - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Returns UTF-8 encoded version of JSON-quoted String.
-
-
asString() - Method in enum com.fasterxml.jackson.core.JsonToken
-
 
-
asToken() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method that can be used for efficient type detection - when using stream abstraction for traversing nodes.
-
-
asUnquotedUTF8() - Method in class com.fasterxml.jackson.core.io.SerializedString
-
-
Accessor for accessing value as is (without JSON quoting (ecaping)) - encoded as UTF-8 byte array.
-
-
asUnquotedUTF8() - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Returns UTF-8 encoded version of unquoted String.
-
-
at(JsonPointer) - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method for locating node specified by given JSON pointer instances.
-
-
at(String) - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Convenience method that is functionally equivalent to:
-
-
available() - Method in class com.fasterxml.jackson.core.io.MergedStream
-
 
-
- - - -

B

-
-
balloc(int) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
Base() - Constructor for class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
Base() - Constructor for class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
BASE64_VALUE_INVALID - Static variable in class com.fasterxml.jackson.core.Base64Variant
-
-
Marker used to denote ascii characters that do not correspond - to a 6-bit value (in this variant), and is not used as a padding - character.
-
-
BASE64_VALUE_PADDING - Static variable in class com.fasterxml.jackson.core.Base64Variant
-
-
Marker used to denote ascii character (in decoding table) that - is the padding character using this variant (if any).
-
-
Base64Variant - Class in com.fasterxml.jackson.core
-
-
Class used to define specific details of which - variant of Base64 encoding/decoding is to be used.
-
-
Base64Variant(String, String, boolean, char, int) - Constructor for class com.fasterxml.jackson.core.Base64Variant
-
 
-
Base64Variant(Base64Variant, String, int) - Constructor for class com.fasterxml.jackson.core.Base64Variant
-
-
"Copy constructor" that can be used when the base alphabet is identical - to one used by another variant except for the maximum line length - (and obviously, name).
-
-
Base64Variant(Base64Variant, String, boolean, char, int) - Constructor for class com.fasterxml.jackson.core.Base64Variant
-
-
"Copy constructor" that can be used when the base alphabet is identical - to one used by another variant, but other details (padding, maximum - line length) differ
-
-
Base64Variant.PaddingReadBehaviour - Enum in com.fasterxml.jackson.core
-
-
Defines how the Base64Variant deals with Padding while reading
-
-
Base64Variants - Class in com.fasterxml.jackson.core
-
-
Container for commonly used Base64 variants: - - Base64Variants.MIME - Base64Variants.MIME_NO_LINEFEEDS - Base64Variants.PEM - Base64Variants.MODIFIED_FOR_URL - - See entries for full description of differences.
-
-
Base64Variants() - Constructor for class com.fasterxml.jackson.core.Base64Variants
-
 
-
BD_MAX_INT - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
BD_MAX_LONG - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
BD_MIN_INT - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
BD_MIN_LONG - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
beforeArrayValues(JsonGenerator) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called after array start marker has been output, - and right before the first value is to be output.
-
-
beforeArrayValues(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
beforeArrayValues(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
beforeObjectEntries(JsonGenerator) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called after object start marker has been output, - and right before the field name of the first entry is - to be output.
-
-
beforeObjectEntries(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
beforeObjectEntries(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
BI_MAX_INT - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
BI_MAX_LONG - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
BI_MIN_INT - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
BI_MIN_LONG - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
BinaryNameMatcher - Class in com.fasterxml.jackson.core.sym
-
-
Simplified static symbol table used instead of global quad-based canonicalizer - when we have smaller set of symbols (like properties of a POJO class).
-
-
BinaryTSFactory - Class in com.fasterxml.jackson.core.base
-
-
Intermediate TokenStreamFactory sub-class used as the base for - binary (non-textual) data formats.
-
-
BinaryTSFactory(int, int) - Constructor for class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
BinaryTSFactory(DecorableTSFactory.DecorableTSFBuilder<?, ?>) - Constructor for class com.fasterxml.jackson.core.base.BinaryTSFactory
-
-
Constructors used by builders for instantiation.
-
-
BinaryTSFactory(BinaryTSFactory) - Constructor for class com.fasterxml.jackson.core.base.BinaryTSFactory
-
-
Copy constructor.
-
-
bits() - Method in enum com.fasterxml.jackson.core.JsonEncoding
-
 
-
booleanNode(boolean) - Method in interface com.fasterxml.jackson.core.TreeCodec
-
 
-
bucketCount() - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
bucketCount() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
bucketCount() - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Method for checking number of primary hash buckets this symbol - table uses.
-
-
BufferRecycler - Class in com.fasterxml.jackson.core.util
-
-
This is a small utility class, whose main functionality is to allow - simple reuse of raw byte/char buffers.
-
-
BufferRecycler() - Constructor for class com.fasterxml.jackson.core.util.BufferRecycler
-
-
Default constructor used for creating instances of this default - implementation.
-
-
BufferRecycler(int, int) - Constructor for class com.fasterxml.jackson.core.util.BufferRecycler
-
-
Alternate constructor to be used by sub-classes, to allow customization - of number of low-level buffers in use.
-
-
BufferRecyclers - Class in com.fasterxml.jackson.core.util
-
-
Helper entity used to control access to simple buffer recyling scheme used for - some encoding, decoding tasks.
-
-
BufferRecyclers() - Constructor for class com.fasterxml.jackson.core.util.BufferRecyclers
-
 
-
build() - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
build() - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
-
Method for constructing actual TokenStreamFactory instance, given - configuration.
-
-
builder() - Static method in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Main factory method to use for constructing JsonFactory instances with - different configuration.
-
-
BYTE_BASE64_CODEC_BUFFER - Static variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
-
Buffer used for concatenating binary data that is either being - encoded as base64 output, or decoded from base64 input.
-
-
BYTE_READ_IO_BUFFER - Static variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
-
Buffer used for reading byte-based input.
-
-
BYTE_WRITE_CONCAT_BUFFER - Static variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
-
Buffer used for temporarily concatenating output; used for - example when requesting output as byte array.
-
-
BYTE_WRITE_ENCODING_BUFFER - Static variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
-
Buffer used for temporarily storing encoded content; used - for example by UTF-8 encoding writer
-
-
ByteArrayBuilder - Class in com.fasterxml.jackson.core.util
-
-
Helper class that is similar to ByteArrayOutputStream - in usage, but more geared to Jackson use cases internally.
-
-
ByteArrayBuilder() - Constructor for class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
ByteArrayBuilder(BufferRecycler) - Constructor for class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
ByteArrayBuilder(int) - Constructor for class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
ByteArrayBuilder(BufferRecycler, int) - Constructor for class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
ByteArrayFeeder - Interface in com.fasterxml.jackson.core.async
-
-
NonBlockingInputFeeder implementation used when feeding data - as byte arrays.
-
-
ByteBufferFeeder - Interface in com.fasterxml.jackson.core.async
-
-
NonBlockingInputFeeder implementation used when feeding data - as ByteBuffer contents.
-
-
byteBufferLength(int) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
ByteQuadsCanonicalizer - Class in com.fasterxml.jackson.core.sym
-
-
Replacement for BytesToNameCanonicalizer which aims at more localized - memory access due to flattening of name quad data.
-
-
ByteSourceJsonBootstrapper - Class in com.fasterxml.jackson.core.json
-
-
This class is used to determine the encoding of byte stream - that is to contain JSON content.
-
-
ByteSourceJsonBootstrapper(IOContext, InputStream) - Constructor for class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
 
-
ByteSourceJsonBootstrapper(IOContext, byte[], int, int) - Constructor for class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
 
-
- - - -

C

-
-
calcHash(int) - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
calcHash(int, int) - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
calcHash(int, int, int) - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
calcHash(int[], int) - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
calcHash(int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
calcHash(int, int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
calcHash(int, int, int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
calcHash(int[], int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
calcHash(char[], int, int) - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Implementation of a hashing method for variable length - Strings.
-
-
calcHash(String) - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
calloc(int) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
canHandleBinaryNatively() - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
canHandleBinaryNatively() - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
canHandleBinaryNatively() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Introspection method that higher-level functionality may call - to see whether underlying data format can read and write binary - data natively; that is, embedded it as-is without using encodings - such as Base64.
-
-
canOmitFields() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Introspection method to call to check whether it is ok to omit - writing of Object fields or not.
-
-
canOmitFields() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
canParseAsync() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
canParseAsync() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
canParseAsync() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be called to determine if this parser instance - uses non-blocking ("asynchronous") input access for decoding or not.
-
-
canParseAsync() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Introspection method that can be used to check whether this - factory can create non-blocking parsers: parsers that do not - use blocking I/O abstractions but instead use a - NonBlockingInputFeeder.
-
-
canParseAsync() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
canReadObjectId() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Introspection method that may be called to see if the underlying - data format supports some kind of Object Ids natively (many do not; - for example, JSON doesn't).
-
-
canReadObjectId() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
canReadTypeId() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Introspection method that may be called to see if the underlying - data format supports some kind of Type Ids natively (many do not; - for example, JSON doesn't).
-
-
canReadTypeId() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
canUseCharArrays() - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
-
Introspection method that can be used by base factory to check - whether access using char[] is something that actual - parser implementations can take advantage of, over having to - use Reader.
-
-
canUseSchema(FormatSchema) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Method that can be used to quickly check whether given schema - is something that parsers and/or generators constructed by this - factory could use.
-
-
canUseSchema(FormatSchema) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method that can be used to quickly check whether given schema - is something that parsers and/or generators constructed by this - factory could use.
-
-
canWriteBinaryNatively() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Introspection method that may be called to see if the underlying - data format supports "native" binary data; that is, an efficient - output of binary content without encoding.
-
-
canWriteBinaryNatively() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
canWriteFormattedNumbers() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
canWriteFormattedNumbers() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Introspection method to call to check whether it is possible - to write numbers using JsonGenerator.writeNumber(java.lang.String) - using possible custom format, or not.
-
-
canWriteFormattedNumbers() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
canWriteObjectId() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Introspection method that may be called to see if the underlying - data format supports some kind of Object Ids natively (many do not; - for example, JSON doesn't).
-
-
canWriteObjectId() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
canWriteTypeId() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Introspection method that may be called to see if the underlying - data format supports some kind of Type Ids natively (many do not; - for example, JSON doesn't).
-
-
canWriteTypeId() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
CHAR_CONCAT_BUFFER - Static variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
-
Buffer used by generators; for byte-backed generators for buffering of - String values to output (before encoding into UTF-8), - and for char-backed generators as actual concatenation buffer.
-
-
CHAR_NAME_COPY_BUFFER - Static variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
-
For parsers, temporary buffer into which char[] for names is copied - when requested as such; for WriterBasedGenerator used for buffering - during writeString(Reader) operation (not commonly used).
-
-
CHAR_NULL - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
CHAR_TEXT_BUFFER - Static variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
-
Used through TextBuffer: directly by parsers (to concatenate - String values) - and indirectly via - SegmentedStringWriter - when serializing (databind level ObjectMapper and - ObjectWriter).
-
-
CHAR_TOKEN_BUFFER - Static variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
-
Buffer used as input buffer for tokenization for character-based parsers.
-
-
CharacterEscapes - Class in com.fasterxml.jackson.core.io
-
-
Abstract base class that defines interface for customizing character - escaping aspects for String values, for formats that use escaping.
-
-
CharacterEscapes() - Constructor for class com.fasterxml.jackson.core.io.CharacterEscapes
-
 
-
characterEscapes(CharacterEscapes) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
-
Method for defining custom escapes factory uses for JsonGenerators - it creates.
-
-
characterEscapes() - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
charBufferLength(int) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
charLength() - Method in class com.fasterxml.jackson.core.io.SerializedString
-
-
Returns length of the String as characters
-
-
charLength() - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Returns length of the (unquoted) String as characters.
-
-
CharsToNameCanonicalizer - Class in com.fasterxml.jackson.core.sym
-
-
This class is a kind of specialized type-safe Map, from char array to - String value.
-
-
charToHex(int) - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
CharTypes - Class in com.fasterxml.jackson.core.io
-
 
-
CharTypes() - Constructor for class com.fasterxml.jackson.core.io.CharTypes
-
 
-
checkValue(TokenFilter) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
-
Method called to check whether value is to be included at current output - position, either as Object property, Array element, or root value.
-
-
child() - Method in class com.fasterxml.jackson.core.json.DupDetector
-
 
-
clearAndGetParent() - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
-
Method that can be used to both clear the accumulated references - (specifically value set with JsonReadContext.setCurrentValue(Object)) - that should not be retained, and returns parent (as would - JsonReadContext.getParent() do).
-
-
clearAndGetParent() - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
-
Method that can be used to both clear the accumulated references - (specifically value set with JsonWriteContext.setCurrentValue(Object)) - that should not be retained, and returns parent (as would - JsonWriteContext.getParent() do).
-
-
clearAndGetParent() - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
-
Method that can be used to both clear the accumulated references - (specifically value set with SimpleTokenReadContext.setCurrentValue(Object)) - that should not be retained, and returns parent (as would - SimpleTokenReadContext.getParent() do).
-
-
clearAndGetParent() - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
-
Method that can be used to both clear the accumulated references - (specifically value set with SimpleTokenWriteContext.setCurrentValue(Object)) - that should not be retained, and returns parent (as would - SimpleTokenWriteContext.getParent() do).
-
-
clearCurrentToken() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
clearCurrentToken() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
clearCurrentToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method called to "consume" the current token by effectively - removing it so that JsonParser.hasCurrentToken() returns false, and - JsonParser.currentToken() null).
-
-
clearCurrentToken() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
clearLocation() - Method in exception com.fasterxml.jackson.core.JacksonException
-
-
Method that allows to remove context information from this exception's message.
-
-
close() - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
close() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
-
Method that can be called to get the name associated with - the current event.
-
-
close() - Method in class com.fasterxml.jackson.core.io.MergedStream
-
 
-
close() - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
close() - Method in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
close() - Method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
close() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
close() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
close() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method called to close this generator, so that no more content - can be written.
-
-
close() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Closes the parser so that no further iteration or data access - can be made; will also close the underlying input source - if parser either owns the input source, or feature - StreamReadFeature.AUTO_CLOSE_SOURCE is enabled.
-
-
close() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
close() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
close() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
close() - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
 
-
closeArray(JsonGenerator) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
closeObject(JsonGenerator) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
collectDefaults() - Static method in enum com.fasterxml.jackson.core.json.JsonReadFeature
-
-
Method that calculates bit set (flags) of all features that - are enabled by default.
-
-
collectDefaults() - Static method in enum com.fasterxml.jackson.core.json.JsonWriteFeature
-
-
Method that calculates bit set (flags) of all features that - are enabled by default.
-
-
collectDefaults() - Static method in enum com.fasterxml.jackson.core.StreamReadFeature
-
-
Method that calculates bit set (flags) of all features that - are enabled by default.
-
-
collectDefaults() - Static method in enum com.fasterxml.jackson.core.StreamWriteFeature
-
-
Method that calculates bit set (flags) of all features that - are enabled by default.
-
-
collectDefaults() - Static method in enum com.fasterxml.jackson.core.TokenStreamFactory.Feature
-
-
Method that calculates bit set (flags) of all features that - are enabled by default.
-
-
collisionCount() - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Method mostly needed by unit tests; calculates number of - entries that are in collision list.
-
-
com.fasterxml.jackson.core - package com.fasterxml.jackson.core
-
-
Main public API classes of the core streaming JSON - processor: most importantly JsonFactory - used for constructing - JSON parser (JsonParser) - and generator - (JsonGenerator) - instances.
-
-
com.fasterxml.jackson.core.async - package com.fasterxml.jackson.core.async
-
-
Package that contains abstractions needed to support optional - non-blocking decoding (parsing) functionality.
-
-
com.fasterxml.jackson.core.base - package com.fasterxml.jackson.core.base
-
-
Base classes used by concrete Parser and Generator implementations; - contain functionality that is not specific to JSON or input - abstraction (byte vs char).
-
-
com.fasterxml.jackson.core.exc - package com.fasterxml.jackson.core.exc
-
-
Package for some of JsonProcessingException - subtypes contained by streaming API.
-
-
com.fasterxml.jackson.core.filter - package com.fasterxml.jackson.core.filter
-
 
-
com.fasterxml.jackson.core.io - package com.fasterxml.jackson.core.io
-
 
-
com.fasterxml.jackson.core.json - package com.fasterxml.jackson.core.json
-
-
JSON-specific parser and generator implementation classes that - Jackson defines and uses.
-
-
com.fasterxml.jackson.core.json.async - package com.fasterxml.jackson.core.json.async
-
-
Non-blocking ("async") JSON parser implementation.
-
-
com.fasterxml.jackson.core.sym - package com.fasterxml.jackson.core.sym
-
-
Internal implementation classes for efficient handling of - of symbols in JSON (field names in Objects)
-
-
com.fasterxml.jackson.core.tree - package com.fasterxml.jackson.core.tree
-
-
Package that contains abstractions that are used dealing - with Tree Models (other than - TreeNode).
-
-
com.fasterxml.jackson.core.type - package com.fasterxml.jackson.core.type
-
-
Contains classes needed for type introspection, mostly used by data binding - functionality.
-
-
com.fasterxml.jackson.core.util - package com.fasterxml.jackson.core.util
-
-
Utility classes used by Jackson Core functionality.
-
-
compareTo(TypeReference<T>) - Method in class com.fasterxml.jackson.core.type.TypeReference
-
-
The only reason we define this method (and require implementation - of Comparable) is to prevent constructing a - reference without type information.
-
-
compareTo(Version) - Method in class com.fasterxml.jackson.core.Version
-
 
-
compile(String) - Static method in class com.fasterxml.jackson.core.JsonPointer
-
-
Factory method that parses given input and construct matching pointer - instance, if it represents a valid JSON Pointer: if not, a - IllegalArgumentException is thrown.
-
-
completeAndCoalesce(int) - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
-
Method that will complete "manual" output process, coalesce - content (if necessary) and return results as a contiguous buffer.
-
-
configure(StreamWriteFeature, boolean) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
configure(JsonReadFeature, boolean) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
configure(JsonWriteFeature, boolean) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
configure(StreamWriteFeature, boolean) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for enabling or disabling specified feature: - check StreamWriteFeature for list of available features.
-
-
configure(TokenStreamFactory.Feature, boolean) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
configure(StreamReadFeature, boolean) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
configure(StreamWriteFeature, boolean) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
configure(StreamWriteFeature, boolean) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
construct(List<String>) - Static method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
construct(Locale, List<String>) - Static method in class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
-
Factory method for constructing case-sensitive matcher that only supports - matching from `String`.
-
-
constructCaseInsensitive(Locale, List<Named>, boolean) - Static method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
constructCaseInsensitive(Locale, List<Named>, boolean) - Static method in class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
 
-
constructCaseInsensitive(Locale, List<String>) - Static method in class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
 
-
constructCIFieldNameMatcher(List<Named>, boolean, Locale) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
constructCIFieldNameMatcher(List<Named>, boolean, Locale) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Factory method for constructing case-insensitive FieldNameMatcher - for given names.
-
-
constructFieldNameMatcher(List<Named>, boolean) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
constructFieldNameMatcher(List<Named>, boolean) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Factory method for constructing case-sensitive FieldNameMatcher - for given names.
-
-
constructFrom(List<Named>, boolean) - Static method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
constructFrom(Locale, List<Named>, boolean) - Static method in class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
-
Factory method for constructing case-sensitive matcher that only supports - matching from `String`.
-
-
constructParser(ObjectReadContext, int, int, ByteQuadsCanonicalizer, CharsToNameCanonicalizer, int) - Method in class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
 
-
constructReader() - Method in class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
 
-
constructTextBuffer() - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
containedParsersCount() - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
-
Method that is most useful for debugging or testing; - returns actual number of underlying parsers sequence - was constructed with (nor just ones remaining active)
-
-
containedType(int) - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
-
Method for accessing definitions of contained ("child") - types.
-
-
containedTypeCount() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
-
Method for checking how many contained types this type - has.
-
-
contentsAsArray() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
contentsAsDecimal() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Convenience method for converting contents of the buffer - into a BigDecimal.
-
-
contentsAsDouble() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Convenience method for converting contents of the buffer - into a Double value.
-
-
contentsAsInt(boolean) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Specialized convenience method that will decode a 32-bit int, - of at most 9 digits (and possible leading minus sign).
-
-
contentsAsLong(boolean) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Specialized convenience method that will decode a 64-bit int, - of at most 18 digits (and possible leading minus sign).
-
-
contentsAsString() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
contentsToWriter(Writer) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
convertNumberToBigDecimal() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
convertNumberToBigInteger() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
convertNumberToDouble() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
convertNumberToInt() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
convertNumberToLong() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
convertSurrogate(int) - Method in class com.fasterxml.jackson.core.io.UTF8Writer
-
-
Method called to calculate UTF codepoint, from a surrogate pair.
-
-
copy() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Method for constructing a new JsonFactory that has - the same settings as this instance, but is otherwise - independent (i.e.
-
-
copy() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method similar to TokenStreamFactory.snapshot(), but one that forces creation of actual - new copy that does NOT share any state, even non-visible to calling code, - such as symbol table reuse.
-
-
copyCurrentEvent(JsonParser) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for copying contents of the current event that - the given parser instance points to.
-
-
copyCurrentEvent(JsonParser) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
copyCurrentStructure(JsonParser) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for copying contents of the current event - and following events that it encloses - the given parser instance points to.
-
-
copyCurrentStructure(JsonParser) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
copyHexBytes() - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
copyHexChars() - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
createArrayNode() - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
createArrayNode() - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
-
Method for construct Array nodes for Tree Model instances.
-
-
createArrayNode() - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
createArrayNode() - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
-
Method for construct Array nodes for Tree Model instances.
-
-
createArrayNode() - Method in interface com.fasterxml.jackson.core.TreeCodec
-
 
-
createChildArrayContext(TokenFilter, Object, boolean) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
createChildArrayContext(int, int) - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
createChildArrayContext(Object) - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
createChildArrayContext(int, int) - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
createChildArrayContext(Object) - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
createChildObjectContext(TokenFilter, Object, boolean) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
createChildObjectContext(int, int) - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
createChildObjectContext(Object) - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
createChildObjectContext(int, int) - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
createChildObjectContext(Object) - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
createDefaultInstance() - Static method in class com.fasterxml.jackson.core.util.Separators
-
 
-
createFlattened(boolean, JsonParser, JsonParser) - Static method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
-
Method that will construct a sequence (possibly a sequence) that - contains all given sub-parsers.
-
-
createGenerator(ObjectWriteContext, OutputStream, JsonEncoding) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createGenerator(ObjectWriteContext, Writer) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createGenerator(ObjectWriteContext, File, JsonEncoding) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createGenerator(ObjectWriteContext, OutputStream, JsonEncoding) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createGenerator(ObjectWriteContext, Writer) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createGenerator(ObjectWriteContext, File, JsonEncoding) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createGenerator(OutputStream) - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
createGenerator(OutputStream, JsonEncoding) - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
createGenerator(Writer) - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
createGenerator(ObjectWriteContext, OutputStream) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing generator that writes contents - using specified OutputStream.
-
-
createGenerator(ObjectWriteContext, OutputStream, JsonEncoding) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing generator that writes contents - using specified OutputStream with specified textual encoding - (if applicable).
-
-
createGenerator(ObjectWriteContext, Writer) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing generator that writes contents - using specified Writer.
-
-
createGenerator(ObjectWriteContext, File, JsonEncoding) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing generator that writes contents - to specified file, overwriting contents it might have (or creating - it if such file does not yet exist).
-
-
createGenerator(ObjectWriteContext, DataOutput) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing generator that writes content into specified DataOutput, - using UTF-8 encoding (with formats where encoding is user-configurable).
-
-
createGenerator(OutputStream, JsonEncoding) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Deprecated.
-
-
createGenerator(OutputStream) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Deprecated.
-
-
createGenerator(Writer) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Deprecated.
-
-
createGenerator(File, JsonEncoding) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Deprecated.
-
-
createGenerator(DataOutput, JsonEncoding) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Deprecated.
-
-
createGenerator(DataOutput) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Deprecated.
-
-
createInstance() - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
createInstance() - Method in interface com.fasterxml.jackson.core.util.Instantiatable
-
-
Method called to ensure that we have a non-blueprint object to use; - it is either this object (if stateless), or a newly created object - with separate state.
-
-
createNonBlockingByteArrayParser(ObjectReadContext) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
createNonBlockingByteArrayParser(ObjectReadContext) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Optional method for constructing parser for non-blocking parsing - via ByteArrayFeeder - interface (accessed using JsonParser.getNonBlockingInputFeeder() - from constructed instance).
-
-
createObjectNode() - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
createObjectNode() - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
-
Method for construct Object nodes for Tree Model instances.
-
-
createObjectNode() - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
createObjectNode() - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
-
Method for construct Object nodes for Tree Model instances.
-
-
createObjectNode() - Method in interface com.fasterxml.jackson.core.TreeCodec
-
 
-
createParser(ObjectReadContext, File) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createParser(ObjectReadContext, URL) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createParser(ObjectReadContext, InputStream) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createParser(ObjectReadContext, Reader) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createParser(ObjectReadContext, byte[], int, int) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createParser(ObjectReadContext, String) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createParser(ObjectReadContext, char[], int, int) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createParser(ObjectReadContext, DataInput) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
createParser(ObjectReadContext, File) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createParser(ObjectReadContext, URL) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createParser(ObjectReadContext, InputStream) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createParser(ObjectReadContext, Reader) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createParser(ObjectReadContext, byte[], int, int) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createParser(ObjectReadContext, String) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createParser(ObjectReadContext, char[], int, int) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createParser(ObjectReadContext, DataInput) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
createParser(InputStream) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
createParser(Reader) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
createParser(String) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
createParser(byte[]) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
createParser(byte[], int, int) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
createParser(ObjectReadContext, File) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing parser instance to decode - contents of specified file.
-
-
createParser(ObjectReadContext, URL) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing JSON parser instance to decode - contents of resource reference by given URL.
-
-
createParser(ObjectReadContext, InputStream) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing JSON parser instance to parse - the contents accessed via specified input stream.
-
-
createParser(ObjectReadContext, Reader) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing parser for parsing - the contents accessed via specified Reader.
-
-
createParser(ObjectReadContext, byte[]) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing parser for parsing - the contents of given byte array.
-
-
createParser(ObjectReadContext, byte[], int, int) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing parser for parsing - the contents of given byte array.
-
-
createParser(ObjectReadContext, String) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing parser for parsing contents of given String.
-
-
createParser(ObjectReadContext, char[]) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing parser for parsing contents of given char array.
-
-
createParser(ObjectReadContext, char[], int, int) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing parser for parsing contents of given char array.
-
-
createParser(File) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
- -
-
createParser(URL) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
- -
-
createParser(InputStream) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
- -
-
createParser(Reader) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
- -
-
createParser(byte[]) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
- -
-
createParser(byte[], int, int) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
- -
-
createParser(String) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
- -
-
createParser(char[]) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
- -
-
createParser(char[], int, int) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
- -
-
createParser(ObjectReadContext, DataInput) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Optional method for constructing parser for reading contents from specified DataInput - instance.
-
-
createRoot() - Static method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Factory method to call to create a symbol table instance with a - randomized seed value.
-
-
createRoot(int) - Static method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
createRoot() - Static method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Method called to create root canonicalizer for a JsonFactory - instance.
-
-
createRoot(int) - Static method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
createRootContext(TokenFilter) - Static method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
createRootContext(int, int, DupDetector) - Static method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
createRootContext(DupDetector) - Static method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
createRootContext(DupDetector) - Static method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
createRootContext(int, int, DupDetector) - Static method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
createRootContext(DupDetector) - Static method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
createRootContext(DupDetector) - Static method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
currentFieldName(FieldNameMatcher) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
currentFieldName(FieldNameMatcher) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that verifies that the current token (see JsonParser.currentToken() is - JsonToken.FIELD_NAME and if so, further match it to one of pre-specified (field) names.
-
-
currentFieldName(FieldNameMatcher) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
currentFieldNameInBuffer() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
currentName() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
currentName() - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
currentName() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
-
Method that can be called to get the name associated with - the current event.
-
-
currentName() - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
currentName() - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
currentName() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be called to get the name associated with - the current token: for JsonToken.FIELD_NAMEs it will - be the same as what JsonParser.getText() returns; - for field values it will be the preceding field name; - and for others (array values, root-level values) null.
-
-
currentName() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Method for accessing name associated with the current location.
-
-
currentName() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
currentName() - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
currentName() - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
currentToken() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
currentToken() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
currentToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Accessor to find which token parser currently points to, if any; - null will be returned if none.
-
-
currentToken() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
currentTokenId() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
currentTokenId() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
currentTokenId() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method similar to JsonParser.currentToken() but that returns an - int instead of JsonToken (enum value).
-
-
currentTokenId() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
- - - -

D

-
-
DataOutputAsStream - Class in com.fasterxml.jackson.core.io
-
-
Helper class to support use of DataOutput for output, directly, - without caller having to provide for implementation.
-
-
DataOutputAsStream(DataOutput) - Constructor for class com.fasterxml.jackson.core.io.DataOutputAsStream
-
 
-
decode(String) - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Convenience method for decoding contents of a Base64-encoded String, - using this variant's settings.
-
-
decode(String, ByteArrayBuilder) - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Convenience method for decoding contents of a Base64-encoded String, - using this variant's settings - and appending decoded binary data using provided ByteArrayBuilder.
-
-
decodeBase64Byte(byte) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
decodeBase64Char(char) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
decodeBase64Char(int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
DecorableTSFactory - Class in com.fasterxml.jackson.core.base
-
-
Intermediate base TokenStreamFactory implementation that offers support for - streams that allow decoration of low-level input sources and output targets.
-
-
DecorableTSFactory(int, int) - Constructor for class com.fasterxml.jackson.core.base.DecorableTSFactory
-
 
-
DecorableTSFactory(DecorableTSFactory.DecorableTSFBuilder<?, ?>) - Constructor for class com.fasterxml.jackson.core.base.DecorableTSFactory
-
-
Constructors used by builders for instantiation.
-
-
DecorableTSFactory(DecorableTSFactory) - Constructor for class com.fasterxml.jackson.core.base.DecorableTSFactory
-
-
Copy constructor.
-
-
DecorableTSFactory.DecorableTSFBuilder<F extends TokenStreamFactory,T extends TokenStreamFactory.TSFBuilder<F,T>> - Class in com.fasterxml.jackson.core.base
-
-
Since factory instances are immutable, a Builder class is needed for creating - configurations for differently configured factory instances.
-
-
DecorableTSFBuilder(int, int) - Constructor for class com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder
-
 
-
DecorableTSFBuilder(DecorableTSFactory) - Constructor for class com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder
-
 
-
decorate(IOContext, InputStream) - Method in class com.fasterxml.jackson.core.io.InputDecorator
-
-
Method called by JsonFactory instance when - creating parser given an InputStream, when this decorator - has been registered.
-
-
decorate(IOContext, byte[], int, int) - Method in class com.fasterxml.jackson.core.io.InputDecorator
-
-
Method called by JsonFactory instance when - creating parser on given "raw" byte source.
-
-
decorate(IOContext, DataInput) - Method in class com.fasterxml.jackson.core.io.InputDecorator
-
-
Method called by JsonFactory instance when - creating parser given an DataInput, when this decorator - has been registered.
-
-
decorate(IOContext, Reader) - Method in class com.fasterxml.jackson.core.io.InputDecorator
-
-
Method called by JsonFactory instance when - creating parser given an Reader, when this decorator - has been registered.
-
-
decorate(IOContext, OutputStream) - Method in class com.fasterxml.jackson.core.io.OutputDecorator
-
-
Method called by JsonFactory instance when - creating generator for given OutputStream, when this decorator - has been registered.
-
-
decorate(IOContext, Writer) - Method in class com.fasterxml.jackson.core.io.OutputDecorator
-
-
Method called by JsonFactory instance when - creating generator for given Writer, when this decorator - has been registered.
-
-
DEFAULT_BINARY_WRITE_CAPABILITIES - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Default set of StreamReadCapabilityies for typical binary formats, - to use either as-is, or as a base with possible differences.
-
-
DEFAULT_FACTORY_FEATURE_FLAGS - Static variable in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Bitfield (set of flags) of all factory features that are enabled by default.
-
-
DEFAULT_OUTPUT_ESCAPES - Static variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
This is the default set of escape codes, over 7-bit ASCII range - (first 128 character codes), used for single-byte UTF-8 characters.
-
-
DEFAULT_QUOTE_CHAR - Static variable in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
DEFAULT_READ_CAPABILITIES - Static variable in class com.fasterxml.jackson.core.JsonParser
-
-
Set of default StreamReadCapabilityies enabled: usable as basis - for format-specific instances or placeholder if non-null instance needed.
-
-
DEFAULT_ROOT_VALUE_SEPARATOR - Static variable in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
DEFAULT_ROOT_VALUE_SEPARATOR - Static variable in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Default String used for separating root values is single space.
-
-
DEFAULT_ROOT_VALUE_SEPARATOR - Static variable in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
Constant that specifies default "root-level" separator to use between - root values: a single space character.
-
-
DEFAULT_SEPARATORS - Static variable in interface com.fasterxml.jackson.core.PrettyPrinter
-
 
-
DEFAULT_STREAM_READ_FEATURE_FLAGS - Static variable in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Bitfield (set of flags) of all parser features that are enabled - by default.
-
-
DEFAULT_STREAM_WRITE_FEATURE_FLAGS - Static variable in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Bitfield (set of flags) of all generator features that are enabled - by default.
-
-
DEFAULT_TEXTUAL_WRITE_CAPABILITIES - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Default set of StreamReadCapabilityies for typical textual formats, - to use either as-is, or as a base with possible differences.
-
-
DEFAULT_WRITE_CAPABILITIES - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Default set of StreamReadCapabilityies that may be used as - basis for format-specific readers (or as bogus instance if non-null - set needs to be passed).
-
-
DefaultIndenter - Class in com.fasterxml.jackson.core.util
-
-
Default linefeed-based indenter, used by DefaultPrettyPrinter (unless - overridden).
-
-
DefaultIndenter() - Constructor for class com.fasterxml.jackson.core.util.DefaultIndenter
-
-
Indent with two spaces and the system's default line feed
-
-
DefaultIndenter(String, String) - Constructor for class com.fasterxml.jackson.core.util.DefaultIndenter
-
-
Create an indenter which uses the indent string to indent one level - and the eol string to separate lines.
-
-
DefaultPrettyPrinter - Class in com.fasterxml.jackson.core.util
-
-
Default PrettyPrinter implementation that uses 2-space - indentation with platform-default linefeeds.
-
-
DefaultPrettyPrinter() - Constructor for class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
DefaultPrettyPrinter(String) - Constructor for class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
Constructor that specifies separator String to use between root values; - if null, no separator is printed.
-
-
DefaultPrettyPrinter(SerializableString) - Constructor for class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
Constructor that specifies separator String to use between root values; - if null, no separator is printed.
-
-
DefaultPrettyPrinter(DefaultPrettyPrinter) - Constructor for class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
DefaultPrettyPrinter(DefaultPrettyPrinter, SerializableString) - Constructor for class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
DefaultPrettyPrinter.FixedSpaceIndenter - Class in com.fasterxml.jackson.core.util
-
-
This is a very simple indenter that only adds a - single space for indentation.
-
-
DefaultPrettyPrinter.Indenter - Interface in com.fasterxml.jackson.core.util
-
-
Interface that defines objects that can produce indentation used - to separate object entries and array values.
-
-
DefaultPrettyPrinter.NopIndenter - Class in com.fasterxml.jackson.core.util
-
-
Dummy implementation that adds no indentation whatsoever
-
-
delegate - Variable in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
-
Delegate object that method calls are delegated to.
-
-
delegate() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
delegate - Variable in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
-
Delegate object that method calls are delegated to.
-
-
delegate() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
-
Accessor for getting the immediate JsonParser this parser delegates calls to.
-
-
delegateCopyMethods - Variable in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
- -
-
detectEncoding() - Method in class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
-
Method that should be called after constructing an instace.
-
-
disable(StreamReadFeature) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
disable(JsonReadFeature) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
disable(JsonReadFeature, JsonReadFeature...) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
disable(JsonWriteFeature) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
disable(JsonWriteFeature, JsonWriteFeature...) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
disable(StreamReadFeature) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method for disabling specified feature - (check StreamReadFeature for list of features)
-
-
disable(TokenStreamFactory.Feature) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
disable(StreamReadFeature) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
disable(StreamReadFeature, StreamReadFeature...) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
disable(StreamWriteFeature) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
disable(StreamWriteFeature, StreamWriteFeature...) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
disable(StreamReadFeature) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
DupDetector - Class in com.fasterxml.jackson.core.json
-
-
Helper class used if - StreamReadFeature.STRICT_DUPLICATE_DETECTION - is enabled.
-
-
- - - -

E

-
-
EMPTY - Static variable in class com.fasterxml.jackson.core.JsonPointer
-
-
Marker instance used to represent segment that matches current - node or position (that is, returns true for - JsonPointer.matches()).
-
-
empty() - Static method in class com.fasterxml.jackson.core.JsonPointer
-
-
Accessor for an "empty" expression, that is, one you can get by - calling JsonPointer.compile(java.lang.String) with "" (empty String).
-
-
empty() - Static method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
empty() - Static method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
EMPTY_CONTEXT - Static variable in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
EMPTY_CONTEXT - Static variable in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
EMPTY_WRITE_CONTEXT - Static variable in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Shareable stateles "empty" ObjectWriteContext Object, passed in - cases where caller had not passed actual context -- "null object" of sort.
-
-
emptyAndGetCurrentSegment() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
enable(StreamReadFeature) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
enable(JsonReadFeature) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
enable(JsonReadFeature, JsonReadFeature...) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
enable(JsonWriteFeature) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
enable(JsonWriteFeature, JsonWriteFeature...) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
enable(StreamReadFeature) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method for enabling specified parser feature - (check StreamReadFeature for list of features)
-
-
enable(TokenStreamFactory.Feature) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
enable(StreamReadFeature) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
enable(StreamReadFeature, StreamReadFeature...) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
enable(StreamWriteFeature) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
enable(StreamWriteFeature, StreamWriteFeature...) - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
enable(StreamReadFeature) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
enabledByDefault() - Method in enum com.fasterxml.jackson.core.json.JsonReadFeature
-
 
-
enabledByDefault() - Method in enum com.fasterxml.jackson.core.json.JsonWriteFeature
-
 
-
enabledByDefault() - Method in enum com.fasterxml.jackson.core.StreamReadCapability
-
 
-
enabledByDefault() - Method in enum com.fasterxml.jackson.core.StreamReadFeature
-
 
-
enabledByDefault() - Method in enum com.fasterxml.jackson.core.StreamWriteCapability
-
 
-
enabledByDefault() - Method in enum com.fasterxml.jackson.core.StreamWriteFeature
-
 
-
enabledByDefault() - Method in enum com.fasterxml.jackson.core.TokenStreamFactory.Feature
-
 
-
enabledByDefault() - Method in interface com.fasterxml.jackson.core.util.JacksonFeature
-
-
Accessor for checking whether this feature is enabled by default.
-
-
enabledIn(int) - Method in enum com.fasterxml.jackson.core.json.JsonReadFeature
-
 
-
enabledIn(int) - Method in enum com.fasterxml.jackson.core.json.JsonWriteFeature
-
 
-
enabledIn(int) - Method in enum com.fasterxml.jackson.core.StreamReadCapability
-
 
-
enabledIn(int) - Method in enum com.fasterxml.jackson.core.StreamReadFeature
-
 
-
enabledIn(int) - Method in enum com.fasterxml.jackson.core.StreamWriteCapability
-
 
-
enabledIn(int) - Method in enum com.fasterxml.jackson.core.StreamWriteFeature
-
 
-
enabledIn(int) - Method in enum com.fasterxml.jackson.core.TokenStreamFactory.Feature
-
 
-
enabledIn(int) - Method in interface com.fasterxml.jackson.core.util.JacksonFeature
-
-
Convenience method for checking whether feature is enabled in given bitmask.
-
-
encode(byte[]) - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Convenience method for converting given byte array as base64 encoded - String using this variant's settings.
-
-
encode(byte[], boolean) - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Convenience method for converting given byte array as base64 encoded String - using this variant's settings, optionally enclosed in double-quotes.
-
-
encode(byte[], boolean, String) - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Convenience method for converting given byte array as base64 encoded String - using this variant's settings, optionally enclosed in double-quotes.
-
-
encodeAsUTF8(CharSequence) - Method in class com.fasterxml.jackson.core.io.JsonStringEncoder
-
-
Will encode given String as UTF-8 (without any quoting), return - resulting byte array.
-
-
encodeBase64BitsAsByte(int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
encodeBase64BitsAsChar(int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
encodeBase64Chunk(int, char[], int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Method that encodes given right-aligned (LSB) 24-bit value - into 4 base64 characters, stored in given result buffer.
-
-
encodeBase64Chunk(StringBuilder, int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
encodeBase64Chunk(int, byte[], int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Method that encodes given right-aligned (LSB) 24-bit value - into 4 base64 bytes (ascii), stored in given result buffer.
-
-
encodeBase64Partial(int, int, char[], int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Method that outputs partial chunk (which only encodes one - or two bytes of data).
-
-
encodeBase64Partial(StringBuilder, int, int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
encodeBase64Partial(int, int, byte[], int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Method that outputs partial chunk (which only encodes one - or two bytes of data).
-
-
endOfInput() - Method in interface com.fasterxml.jackson.core.async.NonBlockingInputFeeder
-
-
Method that should be called after last chunk of data to parse has been fed - (with feedInput in sub-class); can be called regardless of what NonBlockingInputFeeder.needMoreInput() - returns.
-
-
endOfInput() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
ensureFieldNameWritten(JsonGenerator) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
-
Method called to ensure that field name, if present, has been written
-
-
ensureLoaded(int) - Method in class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
 
-
ensureNotShared() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Method called to make sure that buffer is not using shared input - buffer; if it is, it will copy such contents to private buffer.
-
-
equals(Object) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
equals(Object) - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
equals(Object) - Method in class com.fasterxml.jackson.core.JsonLocation
-
 
-
equals(Object) - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
equals(Object) - Method in class com.fasterxml.jackson.core.util.Named.StringAsNamed
-
 
-
equals(Object) - Method in class com.fasterxml.jackson.core.Version
-
 
-
ESCAPE_CUSTOM - Static variable in class com.fasterxml.jackson.core.io.CharacterEscapes
-
-
Value used for lookup tables to indicate that matching characters - will need custom escapes; and that another call - to CharacterEscapes.getEscapeSequence(int) is needed to figure out exact escape - sequence to output.
-
-
ESCAPE_NONE - Static variable in class com.fasterxml.jackson.core.io.CharacterEscapes
-
-
Value used for lookup tables to indicate that matching characters - do not need to be escaped.
-
-
ESCAPE_STANDARD - Static variable in class com.fasterxml.jackson.core.io.CharacterEscapes
-
-
Value used for lookup tables to indicate that matching characters - are to be escaped using standard escaping; for JSON this means - (for example) using "backslash - u" escape method.
-
-
expandCurrentSegment() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Method called to expand size of the current segment, to - accommodate for more contiguous content.
-
-
expandCurrentSegment(int) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Method called to expand size of the current segment, to - accommodate for more contiguous content.
-
-
expectComma() - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
extra - Variable in class com.fasterxml.jackson.core.type.WritableTypeId
-
-
Optional additional information that generator may add during "prefix write", - to be available on matching "suffix write".
-
-
- - - -

F

-
-
factoryFeaturesMask() - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
feedInput(byte[], int, int) - Method in interface com.fasterxml.jackson.core.async.ByteArrayFeeder
-
-
Method that can be called to feed more data, if (and only if) - NonBlockingInputFeeder.needMoreInput() returns true.
-
-
feedInput(ByteBuffer) - Method in interface com.fasterxml.jackson.core.async.ByteBufferFeeder
-
-
Method that can be called to feed more data, if (and only if) - NonBlockingInputFeeder.needMoreInput() returns true.
-
-
feedInput(byte[], int, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
FieldNameMatcher - Class in com.fasterxml.jackson.core.sym
-
-
Interface for implementations used for efficient matching of field names from - input stream (via parser) to higher-level abstractions like properties that - databind uses.
-
-
FieldNameMatcher(Locale, FieldNameMatcher, String[]) - Constructor for class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
fieldNames() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method for accessing names of all fields for this node, iff - this node is an Object node.
-
-
filterFinishArray() - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Method called to indicate that output of non-filtered Array (one that may - have been included either completely, or in part) is completed, - in cases where filter other that TokenFilter.INCLUDE_ALL was returned.
-
-
filterFinishObject() - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Method called to indicate that output of non-filtered Object (one that may - have been included either completely, or in part) is completed, - in cases where filter other that TokenFilter.INCLUDE_ALL was returned.
-
-
FilteringGeneratorDelegate - Class in com.fasterxml.jackson.core.filter
-
-
Specialized JsonGeneratorDelegate that allows use of - TokenFilter for outputting a subset of content that - caller tries to generate.
-
-
FilteringGeneratorDelegate(JsonGenerator, TokenFilter, TokenFilter.Inclusion, boolean) - Constructor for class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
FilteringParserDelegate - Class in com.fasterxml.jackson.core.filter
-
-
Specialized JsonParserDelegate that allows use of - TokenFilter for outputting a subset of content that - is visible to caller
-
-
FilteringParserDelegate(JsonParser, TokenFilter, TokenFilter.Inclusion, boolean) - Constructor for class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
filterStartArray() - Method in class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
-
 
-
filterStartArray() - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Method called to check whether Array value at current output - location should be included in output.
-
-
filterStartObject() - Method in class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
-
 
-
filterStartObject() - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Method called to check whether Object value at current output - location should be included in output.
-
-
findChildOf(TokenFilterContext) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
findLocation() - Method in class com.fasterxml.jackson.core.json.DupDetector
-
 
-
findName(int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
findName(int, int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
findName(int, int, int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
findName(int[], int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
findSymbol(char[], int, int, int) - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
finishCurrentSegment() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
-
Method called when the current segment buffer is full; will - append to current contents, allocate a new segment buffer - and return it
-
-
finishCurrentSegment() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
finishToken() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
finishToken() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
finishToken() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
finishToken() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
finishToken() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
finishToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that may be used to force full handling of the current token - so that even if lazy processing is enabled, the whole contents are - read for possible retrieval.
-
-
finishToken() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
FixedSpaceIndenter() - Constructor for class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.FixedSpaceIndenter
-
 
-
flush() - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
flush() - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
flush() - Method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
flush() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
flush() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
flush() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method called to flush any buffered content to the underlying - target (output stream, writer), and to flush the target itself - as well.
-
-
flush() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
flush() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
FORMAT_NAME_JSON - Static variable in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Name used to identify JSON format - (and returned by JsonFactory.getFormatName()
-
-
FormatFeature - Interface in com.fasterxml.jackson.core
-
-
Marker interface that is to be implemented by data format - specific features.
-
-
formatReadFeaturesMask() - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
FormatSchema - Interface in com.fasterxml.jackson.core
-
-
Simple tag interface used to mark schema objects that are used by some - JsonParser and JsonGenerator implementations to further - specify structure of expected format.
-
-
formatWriteFeaturesMask() - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
forPath(TokenStreamContext, boolean) - Static method in class com.fasterxml.jackson.core.JsonPointer
-
-
Factory method that will construct a pointer instance that describes - path to location given TokenStreamContext points to.
-
-
forValue - Variable in class com.fasterxml.jackson.core.type.WritableTypeId
-
-
Java object for which type id is being written.
-
-
forValueType - Variable in class com.fasterxml.jackson.core.type.WritableTypeId
-
-
(optional) Super-type of WritableTypeId.forValue to use for type id generation (if no - explicit id passed): used instead of actual class of WritableTypeId.forValue in cases - where we do not want to use the "real" type but something more generic, usually - to work around specific problem with implementation type, or its deserializer.
-
-
fromBitmask(int) - Static method in class com.fasterxml.jackson.core.util.JacksonFeatureSet
-
 
-
fromDefaults(F[]) - Static method in class com.fasterxml.jackson.core.util.JacksonFeatureSet
-
-
"Default" factory which will calculate settings based on default-enabled - status of all features.
-
-
fromInitial(byte[], int) - Static method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
fromInitial(char[]) - Static method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Factory method for constructing an instance with no allocator, and - with initial full segment.
-
-
fromString(String) - Static method in interface com.fasterxml.jackson.core.util.Named
-
 
-
- - - -

G

-
-
GeneratorBase - Class in com.fasterxml.jackson.core.base
-
-
This base class implements part of API that a JSON generator exposes - to applications, adds shared internal methods that sub-classes - can use and adds some abstract methods sub-classes must implement.
-
-
GeneratorBase(ObjectWriteContext, int) - Constructor for class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
get(String) - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method for accessing value of the specified field of - an object node.
-
-
get(int) - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method for accessing value of the specified element of - an array node.
-
-
get7BitOutputEscapes() - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
-
Accessor for getting a read-only encoding table for first 128 Unicode - code points (single-byte UTF-8 characters).
-
-
get7BitOutputEscapes(int) - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
-
Alternative to CharTypes.get7BitOutputEscapes() when a non-standard quote character - is used.
-
-
getAndClear() - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
-
Main access method that will construct a String that contains - all the contents, release all internal buffers we may have, - and return result String.
-
-
getArrayValueSeparator() - Method in class com.fasterxml.jackson.core.util.Separators
-
 
-
getArtifactId() - Method in class com.fasterxml.jackson.core.Version
-
 
-
getBigIntegerValue() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getBigIntegerValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can not be used as a Java long primitive type due to its - magnitude.
-
-
getBigIntegerValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getBinaryValue(Base64Variant) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getBinaryValue(Base64Variant) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getBinaryValue(Base64Variant) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getBinaryValue(Base64Variant) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getBinaryValue(Base64Variant) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getBinaryValue(Base64Variant) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be used to read (and consume -- results - may not be accessible using other methods after the call) - base64-encoded binary data - included in the current textual JSON value.
-
-
getBinaryValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Convenience alternative to JsonParser.getBinaryValue(Base64Variant) - that defaults to using - Base64Variants.getDefaultVariant() as the default encoding.
-
-
getBinaryValue(Base64Variant) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getBooleanValue() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getBooleanValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Convenience accessor that can be called when the current - token is JsonToken.VALUE_TRUE or - JsonToken.VALUE_FALSE, to return matching boolean - value.
-
-
getBooleanValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getBufferRecycler() - Static method in class com.fasterxml.jackson.core.util.BufferRecyclers
-
-
Main accessor to call for accessing possibly recycled BufferRecycler instance.
-
-
getBufferWithoutReset() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
getByteOffset() - Method in class com.fasterxml.jackson.core.JsonLocation
-
 
-
getByteValue() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getByteValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java byte primitive type.
-
-
getByteValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getCharacterEscapes() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Method for accessing custom escapes factory uses for JsonGenerators - it creates.
-
-
getCharacterEscapes() - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Method for accessing custom escapes factory uses for JsonGenerators - it creates.
-
-
getCharacterEscapes() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for accessing custom escapes generator uses for JsonGenerators - it creates.
-
-
getCharacterEscapes() - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
getCharacterEscapes() - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
getCharacterEscapes() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
getCharOffset() - Method in class com.fasterxml.jackson.core.JsonLocation
-
 
-
getColumnNr() - Method in class com.fasterxml.jackson.core.JsonLocation
-
 
-
getContentType() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
-
Method for accessing content type of this type, if type has - such a thing: simple types do not, structured types do - (like arrays, Collections and Maps)
-
-
getCurrentIndex() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
 
-
getCurrentLocation() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
getCurrentLocation() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getCurrentLocation() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getCurrentLocation() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getCurrentLocation() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getCurrentLocation() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that returns location of the last processed character; - usually for error reporting purposes.
-
-
getCurrentLocation() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getCurrentName() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Deprecated. -
Since 3.0 use JsonParser.currentName() instead
-
-
-
getCurrentName() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Deprecated. -
Since 3.0 use TokenStreamContext.currentName() instead
-
-
-
getCurrentSegment() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
getCurrentSegment() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
getCurrentSegmentLength() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
getCurrentSegmentSize() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
getCurrentToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Deprecated. -
Since 3.0 use JsonParser.currentToken() instead.
-
-
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Helper method, usually equivalent to: - - getOutputContext().getCurrentValue(); -
-
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Helper method, usually equivalent to: - - getParsingContext().getCurrentValue(); -
-
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Method for accessing currently active value being used by data-binding - (as the source of streaming data to write, or destination of data being - read), at this level in hierarchy.
-
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
getCurrentValue() - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
getDecimalValue() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getDecimalValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_FLOAT or - JsonToken.VALUE_NUMBER_INT.
-
-
getDecimalValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getDefaultVariant() - Static method in class com.fasterxml.jackson.core.Base64Variants
-
-
Method used to get the default variant -- Base64Variants.MIME_NO_LINEFEEDS -- for cases - where caller does not explicitly specify the variant.
-
-
getDoubleValue() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getDoubleValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_FLOAT and - it can be expressed as a Java double primitive type.
-
-
getDoubleValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getDupDetector() - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
getDupDetector() - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
getDupDetector() - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
getDupDetector() - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
getEmbeddedObject() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getEmbeddedObject() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Accessor that can be called if (and only if) the current token - is JsonToken.VALUE_EMBEDDED_OBJECT.
-
-
getEmbeddedObject() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getEncoding() - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
getEntryCount() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
 
-
getEol() - Method in class com.fasterxml.jackson.core.util.DefaultIndenter
-
 
-
getEscapeCodesForAscii() - Method in class com.fasterxml.jackson.core.io.CharacterEscapes
-
-
Method generators can call to get lookup table for determining - escape handling for first 128 characters of Unicode (ASCII - characters.
-
-
getEscapeCodesForAscii() - Method in class com.fasterxml.jackson.core.util.JsonpCharacterEscapes
-
 
-
getEscapeSequence(int) - Method in class com.fasterxml.jackson.core.io.CharacterEscapes
-
-
Method generators can call to get lookup table for determining - exact escape sequence to use for given character.
-
-
getEscapeSequence(int) - Method in class com.fasterxml.jackson.core.util.JsonpCharacterEscapes
-
 
-
getFilter() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
getFilter() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
getFilter() - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
getFilterContext() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
getFloatValue() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getFloatValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_FLOAT and - it can be expressed as a Java float primitive type.
-
-
getFloatValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getFormatName() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Method that returns short textual id identifying format - this factory supports.
-
-
getFormatName() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method that returns short textual id identifying format - this factory supports.
-
-
getFormatReadFeatures(int) - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
getFormatReadFeatures(int) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
getFormatReadFeatures() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
 
-
getFormatReadFeatureType() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
getFormatReadFeatureType() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for accessing kind of FormatFeature that a parser - JsonParser produced by this factory would accept, if any; - null returned if none.
-
-
getFormatWriteFeatures(int) - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
getFormatWriteFeatures(int) - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
getFormatWriteFeatures() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
 
-
getFormatWriteFeatureType() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
getFormatWriteFeatureType() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for accessing kind of FormatFeature that a parser - JsonGenerator produced by this factory would accept, if any; - null returned if none.
-
-
getGeneratorFactory() - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
getGeneratorFactory() - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
getGroupId() - Method in class com.fasterxml.jackson.core.Version
-
 
-
getHighestNonEscapedChar() - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
getHighestNonEscapedChar() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Accessor method for testing what is the highest unescaped character - configured for this generator.
-
-
getHighestNonEscapedChar() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
getIndent() - Method in class com.fasterxml.jackson.core.util.DefaultIndenter
-
 
-
getInputCodeComment() - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
getInputCodeLatin1() - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
getInputCodeLatin1JsNames() - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
getInputCodeUtf8() - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
getInputCodeUtf8JsNames() - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
getInputCodeWS() - Static method in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
getInputDecorator() - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory
-
 
-
getInputSource() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getInputSource() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getInputSource() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getInputSource() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getInputSource() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be used to get access to object that is used - to access input being parsed; this is usually either - InputStream or Reader, depending on what - parser was constructed with.
-
-
getInputSource() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getInputType() - Method in exception com.fasterxml.jackson.core.exc.InputCoercionException
-
-
Accessor for getting information about input type (in form of token, giving "shape" - of input) for which coercion failed.
-
-
getInstance() - Static method in class com.fasterxml.jackson.core.io.JsonStringEncoder
-
-
Factory method for getting an instance; this is either recycled per-thread instance, - or a newly constructed one.
-
-
getIntValue() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getIntValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java int primitive type.
-
-
getIntValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getJavaName() - Method in enum com.fasterxml.jackson.core.JsonEncoding
-
-
Method for accessing encoding name that JDK will support.
-
-
getKeyType() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
-
Method for accessing key type for this type, assuming type - has such a concept (only Map types do)
-
-
getLastClearedToken() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getLastClearedToken() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
getLastClearedToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be called to get the last token that was - cleared using JsonParser.clearCurrentToken().
-
-
getLastClearedToken() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getLineNr() - Method in class com.fasterxml.jackson.core.JsonLocation
-
 
-
getLocation() - Method in exception com.fasterxml.jackson.core.JacksonException
-
-
Accessor for location information related to position within input - or output (depending on operation), if available; if not available - may return JsonLocation.NA (but never null).
-
-
getLongValue() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getLongValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a Java long primitive type.
-
-
getLongValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getMajorVersion() - Method in class com.fasterxml.jackson.core.Version
-
 
-
getMask() - Method in enum com.fasterxml.jackson.core.json.JsonReadFeature
-
 
-
getMask() - Method in enum com.fasterxml.jackson.core.json.JsonWriteFeature
-
 
-
getMask() - Method in enum com.fasterxml.jackson.core.StreamReadCapability
-
 
-
getMask() - Method in enum com.fasterxml.jackson.core.StreamReadFeature
-
 
-
getMask() - Method in enum com.fasterxml.jackson.core.StreamWriteCapability
-
 
-
getMask() - Method in enum com.fasterxml.jackson.core.StreamWriteFeature
-
 
-
getMask() - Method in enum com.fasterxml.jackson.core.TokenStreamFactory.Feature
-
 
-
getMask() - Method in interface com.fasterxml.jackson.core.util.JacksonFeature
-
-
Returns bit mask for this feature instance; must be a single bit, - that is of form 1 << N.
-
-
getMatchCount() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
-
Accessor for finding number of matches, where specific token and sub-tree - starting (if structured type) are passed.
-
-
getMatchCount() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Accessor for finding number of matches, where specific token and sub-tree - starting (if structured type) are passed.
-
-
getMatchingIndex() - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
getMatchingProperty() - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
getMaxLineLength() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
getMessage() - Method in exception com.fasterxml.jackson.core.exc.StreamReadException
-
-
Overriding the getMessage() to include the request body
-
-
getMessage() - Method in exception com.fasterxml.jackson.core.JacksonException
-
-
Default method overridden so that we can add location information
-
-
getMessageSuffix() - Method in exception com.fasterxml.jackson.core.JacksonException
-
-
Accessor that sub-classes can override to append additional - information right after the main message, but before - source location information.
-
-
getMinorVersion() - Method in class com.fasterxml.jackson.core.Version
-
 
-
getName() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
getName() - Method in interface com.fasterxml.jackson.core.util.Named
-
 
-
getName() - Method in class com.fasterxml.jackson.core.util.Named.StringAsNamed
-
 
-
getNextChar(String, JsonToken) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getNonBlockingInputFeeder() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
getNonBlockingInputFeeder() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will either return a feeder instance (if parser uses - non-blocking, aka asynchronous access); or null for - parsers that use blocking I/O.
-
-
getNonBlockingInputFeeder() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getNumberType() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getNumberType() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
If current token is of type - JsonToken.VALUE_NUMBER_INT or - JsonToken.VALUE_NUMBER_FLOAT, returns - one of JsonParser.NumberType constants; otherwise returns null.
-
-
getNumberType() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getNumberValue() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getNumberValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Generic number value accessor method that will work for - all kinds of numeric values.
-
-
getNumberValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getNumberValueExact() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getNumberValueExact() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getNumberValueExact() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method similar to JsonParser.getNumberValue() with the difference that - for floating-point numbers value returned may be BigDecimal - if the underlying format does not store floating-point numbers using - native representation: for example, textual formats represent numbers - as Strings (which are 10-based), and conversion to Double - is potentially lossy operation.
-
-
getNumberValueExact() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getObjectEntrySeparator() - Method in class com.fasterxml.jackson.core.util.Separators
-
 
-
getObjectFieldValueSeparator() - Method in class com.fasterxml.jackson.core.util.Separators
-
 
-
getObjectId() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be called to check whether current token - (one that was just read) has an associated Object id, and if - so, return it.
-
-
getObjectId() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getObjectReadContext() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getObjectReadContext() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Accessor for context object provided by higher level data-binding - functionality (or, in some cases, simple placeholder of the same) - that allows some level of interaction including ability to trigger - deserialization of Object values through generator instance.
-
-
getObjectReadContext() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getObjectWriteContext() - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
getObjectWriteContext() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Accessor for context object provided by higher-level databinding - functionality (or, in some cases, simple placeholder of the same) - that allows some level of interaction including ability to trigger - serialization of Object values through generator instance.
-
-
getObjectWriteContext() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
getOriginalMessage() - Method in exception com.fasterxml.jackson.core.JacksonException
-
-
Method that allows accessing the original "message" argument, - without additional decorations (like location information) - that overridden JacksonException.getMessage() adds.
-
-
getOutputBuffered() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
getOutputBuffered() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
getOutputBuffered() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for verifying amount of content that is buffered by generator - but not yet flushed to the underlying target (stream, writer), - in units (byte, char) that the generator implementation uses for buffering; - or -1 if this information is not available.
-
-
getOutputBuffered() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
getOutputContext() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
getOutputContext() - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
getOutputContext() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Accessor for context object that provides information about low-level - logical position withing output token stream.
-
-
getOutputContext() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
getOutputDecorator() - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory
-
 
-
getOutputTarget() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
getOutputTarget() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
getOutputTarget() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that can be used to get access to object that is used - as target for generated output; this is usually either - OutputStream or Writer, depending on what - generator was constructed with.
-
-
getOutputTarget() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
getPaddingByte() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
getPaddingChar() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
getParent() - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
getParent() - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
getParent() - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
getParent() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Accessor for finding parent context of this context; will - return null for root context.
-
-
getParent() - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
getParent() - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
getParserFactory() - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
getParserFactory() - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
getParsingContext() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
getParsingContext() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
getParsingContext() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be used to access current parsing context reader - is in.
-
-
getParsingContext() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getPatchLevel() - Method in class com.fasterxml.jackson.core.Version
-
 
-
getPrettyPrinter() - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
getPrettyPrinter() - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
-
Accessor for getting PrettyPrinter instance to use for a new generator.
-
-
getProcessor() - Method in exception com.fasterxml.jackson.core.exc.StreamReadException
-
 
-
getProcessor() - Method in exception com.fasterxml.jackson.core.JacksonException
-
-
Method that allows accessing underlying processor that triggered - this exception; typically either JsonParser or JsonGenerator - for exceptions that originate from streaming API, but other abstractions - when thrown by databinding.
-
-
getProcessor() - Method in exception com.fasterxml.jackson.core.JsonGenerationException
-
 
-
getRawClass() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
-
Accessor for type-erased Class of resolved type.
-
-
getRawPayload() - Method in class com.fasterxml.jackson.core.util.RequestPayload
-
-
Returns the raw request payload object i.e, either byte[] or String
-
-
getReadCapabilities() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getReadCapabilities() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
getReadCapabilities() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Accessor for getting metadata on capabilities of this parser, based on - underlying data format being read (directly or indirectly).
-
-
getReadCapabilities() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getReferencedType() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
-
Method for accessing type of value that instances of this - type references, if any.
-
-
getRequestPayload() - Method in exception com.fasterxml.jackson.core.exc.StreamReadException
-
-
Method that may be called to find payload that was being parsed, if - one was specified for parser that threw this Exception.
-
-
getRequestPayloadAsString() - Method in exception com.fasterxml.jackson.core.exc.StreamReadException
-
-
The method returns the String representation of the request payload if - one was specified for parser that threw this Exception.
-
-
getRootValueSeparator() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
getRootValueSeparator(SerializableString) - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
getRootValueSeparator(SerializableString) - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
getSchema() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for accessing Schema that this generator uses, if any.
-
-
getSchema() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method for accessing Schema that this parser uses, if any.
-
-
getSchema() - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
getSchema() - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
getSchema() - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
getSchema() - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
getSchema() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
getSchema() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getSchemaType() - Method in interface com.fasterxml.jackson.core.FormatSchema
-
-
Method that can be used to get an identifier that can be used for diagnostics - purposes, to indicate what kind of data format this schema is used for: typically - it is a short name of format itself, but it can also contain additional information - in cases where data format supports multiple types of schemas.
-
-
getShortValue() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getShortValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Numeric accessor that can be called when the current - token is of type JsonToken.VALUE_NUMBER_INT and - it can be expressed as a value of Java short primitive type.
-
-
getShortValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getSource() - Method in class com.fasterxml.jackson.core.json.DupDetector
-
 
-
getSourceRef() - Method in class com.fasterxml.jackson.core.JsonLocation
-
-
Reference to the original resource being read, if one available.
-
-
getSourceReference() - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
getStartLocation(Object) - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
getStartLocation(Object) - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Optional method that may be used to access starting location of this context: - for example, in case of JSON `Object` context, offset at which `[` token was - read or written.
-
-
getStartLocation(Object) - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
getStreamReadFeatures(int) - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
getStreamReadFeatures(int) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
getStreamReadFeatures() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
 
-
getStreamWriteFeatures(int) - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
getStreamWriteFeatures(int) - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
getStreamWriteFeatures() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
 
-
getTargetType() - Method in exception com.fasterxml.jackson.core.exc.InputCoercionException
-
-
Accessor for getting information about target type (in form of Java Class) - for which coercion failed.
-
-
getText() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Method for accessing textual representation of the current event; - if no current event (before first call to JsonParser.nextToken(), or - after encountering end-of-input), returns null.
-
-
getText(Writer) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getText() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Method for accessing textual representation of the current event; - if no current event (before first call to ReaderBasedJsonParser.nextToken(), or - after encountering end-of-input), returns null.
-
-
getText(Writer) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getText() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getText(Writer) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getText() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getText(Writer) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getText() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method for accessing textual representation of the current token; - if no current token (before first call to JsonParser.nextToken(), or - after encountering end-of-input), returns null.
-
-
getText(Writer) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method to read the textual representation of the current token in chunks and - pass it to the given Writer.
-
-
getText() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getText(Writer) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getTextBuffer() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Accessor that may be used to get the contents of this buffer in a single - char array regardless of whether they were collected in a segmented - fashion or not.
-
-
getTextCharacters() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getTextCharacters() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getTextCharacters() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getTextCharacters() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getTextCharacters() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method similar to JsonParser.getText(), but that will return - underlying (unmodifiable) character array that contains - textual value, instead of constructing a String object - to contain this information.
-
-
getTextCharacters() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getTextLength() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getTextLength() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getTextLength() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getTextLength() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getTextLength() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Accessor used with JsonParser.getTextCharacters(), to know length - of String stored in returned buffer.
-
-
getTextLength() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getTextOffset() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getTextOffset() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getTextOffset() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getTextOffset() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getTextOffset() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Accessor used with JsonParser.getTextCharacters(), to know offset - of the first text content character within buffer.
-
-
getTextOffset() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getTextOffset() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
getTokenBeingDecoded() - Method in exception com.fasterxml.jackson.core.io.JsonEOFException
-
-
Accessor for possibly available information about token that was being - decoded while encountering end of input.
-
-
getTokenCharacterOffset() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getTokenColumnNr() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getTokenLineNr() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
getTokenLocation() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getTokenLocation() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getTokenLocation() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getTokenLocation() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getTokenLocation() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that return the starting location of the current - token; that is, position of the first character from input - that starts the current token.
-
-
getTokenLocation() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getType() - Method in class com.fasterxml.jackson.core.type.TypeReference
-
 
-
getTypeId() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be called to check whether current token - (one that was just read) has an associated type id, and if - so, return it.
-
-
getTypeId() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValue() - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
getValue() - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Returns unquoted String that this object represents (and offers - serialized forms for)
-
-
getValueAsBoolean(boolean) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getValueAsBoolean() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a - boolean.
-
-
getValueAsBoolean(boolean) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a - boolean.
-
-
getValueAsBoolean() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValueAsBoolean(boolean) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValueAsDouble(double) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getValueAsDouble() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a Java - double.
-
-
getValueAsDouble(double) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a - Java double.
-
-
getValueAsDouble() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValueAsDouble(double) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValueAsInt() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getValueAsInt(int) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getValueAsInt() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getValueAsInt(int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getValueAsInt() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getValueAsInt(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getValueAsInt() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a - Java int value.
-
-
getValueAsInt(int) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a - int.
-
-
getValueAsInt() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValueAsInt(int) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValueAsLong() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getValueAsLong(long) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getValueAsLong() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a - long.
-
-
getValueAsLong(long) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a - long.
-
-
getValueAsLong() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValueAsLong(long) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValueAsString() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getValueAsString(String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
getValueAsString() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getValueAsString(String) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
getValueAsString() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getValueAsString(String) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
getValueAsString() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getValueAsString(String) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
getValueAsString() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getValueAsString(String) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
getValueAsString() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a - String.
-
-
getValueAsString(String) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will try to convert value of current token to a - String.
-
-
getValueAsString() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getValueAsString(String) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
getWriteCapabilities() - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
getWriteCapabilities() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Accessor for getting metadata on capabilities of this generator, based on - underlying data format being read (directly or indirectly).
-
-
getWriteCapabilities() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
growArrayBy(int[], int) - Static method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
- - - -

H

-
-
hasCurrentIndex() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Method that may be called to verify whether this context has valid index: - will return `false` before the first entry of Object context or before - first element of Array context; otherwise returns `true`.
-
-
hasCurrentName() - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
hasCurrentName() - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
hasCurrentName() - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
hasCurrentName() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
 
-
hasCurrentName() - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
hasCurrentName() - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
hasCurrentToken() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
hasCurrentToken() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
hasCurrentToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method for checking whether parser currently points to - a token (and data for that token is available).
-
-
hasCurrentToken() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
hasGenericTypes() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
-
Method that can be used to find out if the type directly declares generic - parameters (for its direct super-class and/or super-interfaces).
-
-
HASH_MULT - Static variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
hashCode() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
hashCode() - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
hashCode() - Method in class com.fasterxml.jackson.core.JsonLocation
-
 
-
hashCode() - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
hashCode() - Method in class com.fasterxml.jackson.core.util.Named.StringAsNamed
-
 
-
hashCode() - Method in class com.fasterxml.jackson.core.Version
-
 
-
HashedMatcherBase - Class in com.fasterxml.jackson.core.sym
-
-
Intermediate base class for matchers that use hash-array based approach - with Strings.
-
-
HashedMatcherBase(Locale, String[], int[], int, FieldNameMatcher, String[]) - Constructor for class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
 
-
HashedMatcherBase(HashedMatcherBase, String[]) - Constructor for class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
 
-
HashedMatcherBase(HashedMatcherBase, FieldNameMatcher) - Constructor for class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
 
-
hashSeed() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
hashSeed() - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
hasPathSegment() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Method that may be called to check if this context is either: - - Object, with at least one entry written (partially or completely) - - Array, with at least one entry written (partially or completely) - - - and if so, return `true`; otherwise return `false`.
-
-
hasRawClass(Class<?>) - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
hasTextAsCharacters() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Method that can be used to check whether textual contents can - be efficiently accessed using TextBuffer.getTextBuffer().
-
-
hasTextCharacters() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
hasTextCharacters() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
hasTextCharacters() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
hasTextCharacters() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be used to determine whether calling of - JsonParser.getTextCharacters() would be the most efficient - way to access textual content for the event parser currently - points to.
-
-
hasTextCharacters() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
hasToken(JsonToken) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
hasToken(JsonToken) - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
hasToken(JsonToken) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that is functionally equivalent to: - - return currentToken() == t - - but may be more efficiently implemented.
-
-
hasToken(JsonToken) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
hasTokenId(int) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
hasTokenId(int) - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
hasTokenId(int) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that is functionally equivalent to: - - return currentTokenId() == id - - but may be more efficiently implemented.
-
-
hasTokenId(int) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
HB - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
HC - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
 
-
head() - Method in class com.fasterxml.jackson.core.JsonPointer
-
-
Accessor for getting a pointer instance that is identical to this - instance except that the last segment has been dropped.
-
-
HEX_CHARS - Static variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
highestNonEscapedChar(int) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
-
Method that allows specifying threshold beyond which all characters are - automatically escaped (without checking possible custom escaping settings - a la JsonFactoryBuilder.characterEscapes(com.fasterxml.jackson.core.io.CharacterEscapes): for example, to force escaping of all non-ASCII - characters (set to 127), or all non-Latin-1 character (set to 255).
-
-
highestNonEscapedChar() - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
- - - -

I

-
-
id() - Method in enum com.fasterxml.jackson.core.JsonToken
-
 
-
id - Variable in class com.fasterxml.jackson.core.type.WritableTypeId
-
-
Actual type id to use: usually {link java.lang.String}.
-
-
ID_EMBEDDED_OBJECT - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.VALUE_EMBEDDED_OBJECT
-
-
ID_END_ARRAY - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.END_ARRAY
-
-
ID_END_OBJECT - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.END_OBJECT
-
-
ID_FALSE - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.VALUE_FALSE
-
-
ID_FIELD_NAME - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.FIELD_NAME
-
-
ID_NO_TOKEN - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent the case where no JsonToken - is available: either because JsonParser has not been - advanced to first token, or because no more tokens will be - available (end-of-input or explicit closing of parser}.
-
-
ID_NOT_AVAILABLE - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.NOT_AVAILABLE, used in - cases where a token may become available when more input - is available: this occurs in non-blocking use cases.
-
-
ID_NULL - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.VALUE_NULL
-
-
ID_NUMBER_FLOAT - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.VALUE_NUMBER_FLOAT
-
-
ID_NUMBER_INT - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.VALUE_NUMBER_INT
-
-
ID_START_ARRAY - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.START_ARRAY
-
-
ID_START_OBJECT - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.START_OBJECT
-
-
ID_STRING - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.VALUE_STRING
-
-
ID_TRUE - Static variable in interface com.fasterxml.jackson.core.JsonTokenId
-
-
Id used to represent JsonToken.VALUE_TRUE
-
-
illegalSurrogate(int) - Static method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
illegalSurrogateDesc(int) - Static method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
inArray() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Method that returns true if this context is an Array context; - that is, content is being read from or written to a JSON Array.
-
-
include - Variable in class com.fasterxml.jackson.core.type.WritableTypeId
-
-
Property used to indicate style of inclusion for this type id, in cases where - no native type id may be used (either because format has none, like JSON; or - because use of native type ids is disabled [with YAML]).
-
-
INCLUDE_ALL - Static variable in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Marker value that should be used to indicate inclusion of a structured - value (sub-tree representing Object or Array), or value of a named - property (regardless of type).
-
-
includeBinary() - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - Binary value - should be included in output or not.
-
-
includeBoolean(boolean) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - boolean value - should be included in output or not.
-
-
includeElement(int) - Method in class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
-
 
-
includeElement(int) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Method called to check whether array element with specified index (zero-based), - at current output location, should be included in output.
-
-
includeEmbeddedValue(Object) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - embedded (Opaque) value - should be included in output or not.
-
-
includeNull() - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - null value - should be included in output or not.
-
-
includeNumber(int) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - int value - should be included in output or not.
-
-
includeNumber(long) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - long value - should be included in output or not.
-
-
includeNumber(float) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - float value - should be included in output or not.
-
-
includeNumber(double) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - double value - should be included in output or not.
-
-
includeNumber(BigDecimal) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - BigDecimal value - should be included in output or not.
-
-
includeNumber(BigInteger) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - BigInteger value - should be included in output or not.
-
-
includeProperty(String) - Method in class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
-
 
-
includeProperty(String) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Method called to check whether property value with specified name, - at current output location, should be included in output.
-
-
includeRawValue() - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - raw (pre-encoded, not quoted by generator) value - should be included in output or not.
-
-
includeRootValue(int) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Method called to check whether root-level value, - at current output location, should be included in output.
-
-
includeString(String) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - String value - should be included in output or not.
-
-
includeString(Reader, int) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made to verify whether leaf-level - "streaming" String value - should be included in output or not.
-
-
includeValue(JsonParser) - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Call made when verifying whether a scaler value is being - read from a parser.
-
-
indentArraysWith(DefaultPrettyPrinter.Indenter) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
indentObjectsWith(DefaultPrettyPrinter.Indenter) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
inLongRange(char[], int, int, boolean) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
-
Helper method for determining if given String representation of - an integral number would fit in 64-bit Java long or not.
-
-
inLongRange(String, boolean) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
-
Similar to NumberInput.inLongRange(char[],int,int,boolean), but - with String argument
-
-
inObject() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Method that returns true if this context is an Object context; - that is, content is being read from or written to a JSON Object.
-
-
InputCoercionException - Exception in com.fasterxml.jackson.core.exc
-
-
Exception type for read-side problems that are not direct decoding ("parsing") - problems (those would be reported as JsonParseExceptions), - but rather result from failed attempts to convert specific Java value out of valid - but incompatible input value.
-
-
InputCoercionException(JsonParser, String, JsonToken, Class<?>) - Constructor for exception com.fasterxml.jackson.core.exc.InputCoercionException
-
-
Constructor that uses current parsing location as location, and - sets processor (accessible via StreamReadException.getProcessor()) to - specified parser.
-
-
inputDecorator() - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder
-
 
-
inputDecorator(InputDecorator) - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder
-
 
-
InputDecorator - Class in com.fasterxml.jackson.core.io
-
-
Handler class that can be used to decorate input sources.
-
-
InputDecorator() - Constructor for class com.fasterxml.jackson.core.io.InputDecorator
-
 
-
inRoot() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Method that returns true if this context is a Root context; - that is, content is being read from or written to without - enclosing array or object structure.
-
-
instance() - Static method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.FixedSpaceIndenter
-
 
-
instance() - Static method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.NopIndenter
-
 
-
instance - Static variable in class com.fasterxml.jackson.core.util.InternCache
-
 
-
instance() - Static method in class com.fasterxml.jackson.core.util.JsonpCharacterEscapes
-
 
-
Instantiatable<T> - Interface in com.fasterxml.jackson.core.util
-
-
Add-on interface used to indicate things that may be "blueprint" objects - which can not be used as is, but are used for creating usable per-process - (serialization, deserialization) instances, using - Instantiatable.createInstance() method.
-
-
INT_0 - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_9 - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_APOS - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_ASTERISK - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_BACKSLASH - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_COLON - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_COMMA - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_CR - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_e - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_E - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_HASH - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_LBRACKET - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_LCURLY - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_LF - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_MINUS - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_PERIOD - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_PLUS - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_QUOTE - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_RBRACKET - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_RCURLY - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_SLASH - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_SPACE - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
INT_TAB - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
intern(String) - Method in class com.fasterxml.jackson.core.util.InternCache
-
 
-
InternCache - Class in com.fasterxml.jackson.core.util
-
-
Singleton class that adds a simple first-level cache in front of - regular String.intern() functionality.
-
-
IOContext - Class in com.fasterxml.jackson.core.io
-
-
To limit number of configuration and state objects to pass, all - contextual objects that need to be passed by the factory to - readers and writers are combined under this object.
-
-
IOContext(BufferRecycler, Object, boolean) - Constructor for class com.fasterxml.jackson.core.io.IOContext
-
 
-
IOContext(BufferRecycler, Object, boolean, JsonEncoding) - Constructor for class com.fasterxml.jackson.core.io.IOContext
-
 
-
isAbstract() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isArray() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method that returns true if this node is an Array node, false - otherwise.
-
-
isArrayType() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isBigEndian() - Method in enum com.fasterxml.jackson.core.JsonEncoding
-
-
Whether encoding is big-endian (if encoding supports such - notion).
-
-
isBoolean() - Method in enum com.fasterxml.jackson.core.JsonToken
-
 
-
isClosed() - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
isClosed() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
isClosed() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that can be called to determine whether this generator - is closed or not.
-
-
isClosed() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be called to determine whether this parser - is closed or not.
-
-
isClosed() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
isClosed() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
isCollectionLikeType() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isConcrete() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isContainerNode() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method that returns true for container nodes: Arrays and Objects.
-
-
isContainerType() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isDup(String) - Method in class com.fasterxml.jackson.core.json.DupDetector
-
 
-
isEmbeddedValue() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method that returns true if this node represents an embedded - "foreign" (or perhaps native?) object (like POJO), not represented - as regular content.
-
-
isEnabled(StreamWriteFeature) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
isEnabled(StreamReadFeature) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
isEnabled(JsonReadFeature) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Checked whether specified parser feature is enabled.
-
-
isEnabled(JsonWriteFeature) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Check whether specified generator feature is enabled.
-
-
isEnabled(JsonWriteFeature) - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
isEnabled(JsonReadFeature) - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
isEnabled(StreamWriteFeature) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for checking whether given feature is enabled.
-
-
isEnabled(StreamReadFeature) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method for checking whether specified StreamReadFeature is enabled.
-
-
isEnabled(TokenStreamFactory.Feature) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
 
-
isEnabled(StreamReadFeature) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Checked whether specified parser feature is enabled.
-
-
isEnabled(StreamWriteFeature) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Check whether specified generator feature is enabled.
-
-
isEnabled(F) - Method in class com.fasterxml.jackson.core.util.JacksonFeatureSet
-
-
Main accessor for checking whether given feature is enabled in this feature set.
-
-
isEnabled(StreamWriteFeature) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
isEnabled(StreamReadFeature) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
isEnumType() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isExpectedNumberIntToken() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
isExpectedNumberIntToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Similar to JsonParser.isExpectedStartArrayToken(), but checks whether stream - currently points to JsonToken.VALUE_NUMBER_INT.
-
-
isExpectedNumberIntToken() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
isExpectedStartArrayToken() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
isExpectedStartArrayToken() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
isExpectedStartArrayToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Specialized accessor that can be used to verify that the current - token indicates start array (usually meaning that current token - is JsonToken.START_ARRAY) when start array is expected.
-
-
isExpectedStartArrayToken() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
isExpectedStartObjectToken() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
isExpectedStartObjectToken() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
isExpectedStartObjectToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Similar to JsonParser.isExpectedStartArrayToken(), but checks whether stream - currently points to JsonToken.START_OBJECT.
-
-
isExpectedStartObjectToken() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
isFinal() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isInline() - Method in class com.fasterxml.jackson.core.util.DefaultIndenter
-
 
-
isInline() - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.FixedSpaceIndenter
-
 
-
isInline() - Method in interface com.fasterxml.jackson.core.util.DefaultPrettyPrinter.Indenter
-
 
-
isInline() - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.NopIndenter
-
 
-
isInterface() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isMapLikeType() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isMissingNode() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method that returns true for "virtual" nodes which represent - missing entries constructed by path accessor methods when - there is no actual node matching given criteria.
-
-
isNaN() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
isNaN() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Access for checking whether current token is a numeric value token, but - one that is of "not-a-number" (NaN) variety (including both "NaN" AND - positive/negative infinity!): not supported by all formats, - but often supported for JsonToken.VALUE_NUMBER_FLOAT.
-
-
isNaN() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
isNull() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method that returns true if this node is a node that represents - logical null value.
-
-
isNumeric() - Method in enum com.fasterxml.jackson.core.JsonToken
-
 
-
isObject() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method that returns true if this node is an Object node, false - otherwise.
-
-
isPrimitive() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isReferenceType() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
-
Whether this type is a referential type, meaning that values are - basically pointers to "real" values (or null) and not regular - values themselves.
-
-
isResourceManaged() - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
isScalarValue() - Method in enum com.fasterxml.jackson.core.JsonToken
-
-
Method that can be used to check whether this token represents - a valid non-structured value.
-
-
isSnapshot() - Method in class com.fasterxml.jackson.core.Version
-
 
-
isStartHandled() - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
isStructEnd() - Method in enum com.fasterxml.jackson.core.JsonToken
-
-
Accessor that is functionally equivalent to: - - this == JsonToken.END_OBJECT || this == JsonToken.END_ARRAY -
-
-
isStructStart() - Method in enum com.fasterxml.jackson.core.JsonToken
-
-
Accessor that is functionally equivalent to: - - this == JsonToken.START_OBJECT || this == JsonToken.START_ARRAY -
-
-
isThrowable() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
isUnknownVersion() - Method in class com.fasterxml.jackson.core.Version
-
 
-
isValueNode() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method that returns true for all value nodes: ones that - are not containers, and that do not represent "missing" nodes - in the path.
-
-
- - - -

J

-
-
JacksonException - Exception in com.fasterxml.jackson.core
-
-
Base class for all Jackson-produced checked exceptions.
-
-
JacksonException(String) - Constructor for exception com.fasterxml.jackson.core.JacksonException
-
 
-
JacksonException(Throwable) - Constructor for exception com.fasterxml.jackson.core.JacksonException
-
 
-
JacksonException(String, JsonLocation, Throwable) - Constructor for exception com.fasterxml.jackson.core.JacksonException
-
 
-
JacksonFeature - Interface in com.fasterxml.jackson.core.util
-
-
Basic API implemented by Enums used for simple Jackson "features": on/off - settings and capabilities exposed as something that can be internally - represented as bit sets.
-
-
JacksonFeatureSet<F extends JacksonFeature> - Class in com.fasterxml.jackson.core.util
-
-
Container similar to EnumSet meant for storing sets of - JacksonFeatures (usually Enums): main - difference being that these sets are immutable.
-
-
JacksonFeatureSet(int) - Constructor for class com.fasterxml.jackson.core.util.JacksonFeatureSet
-
-
Constructor for creating instance with specific bitmask, wherein - 1 bit means matching JacksonFeature is enabled and - 0 disabled.
-
-
JsonEncoding - Enum in com.fasterxml.jackson.core
-
-
Enumeration that defines legal encodings that can be used - for JSON content, based on list of allowed encodings from - JSON specification.
-
-
JsonEOFException - Exception in com.fasterxml.jackson.core.io
-
-
Specialized JsonParseException that is thrown when end-of-input - is reached unexpectedly, either within token being decoded, or during - skipping of intervening white-space that is not between root-level - tokens (that is, is within JSON Object or JSON Array construct).
-
-
JsonEOFException(JsonParser, JsonToken, String) - Constructor for exception com.fasterxml.jackson.core.io.JsonEOFException
-
 
-
JsonFactory - Class in com.fasterxml.jackson.core.json
-
-
JSON-backed TokenStreamFactory implementation that will create - token readers ("parsers") and writers ("generators") for handling - JSON-encoded content.
-
-
JsonFactory() - Constructor for class com.fasterxml.jackson.core.json.JsonFactory
-
-
Default constructor used to create factory instances.
-
-
JsonFactory(JsonFactory) - Constructor for class com.fasterxml.jackson.core.json.JsonFactory
-
-
Copy constructor.
-
-
JsonFactory(JsonFactoryBuilder) - Constructor for class com.fasterxml.jackson.core.json.JsonFactory
-
-
Constructors used by JsonFactoryBuilder for instantiation.
-
-
JsonFactoryBuilder - Class in com.fasterxml.jackson.core.json
-
-
TokenStreamFactory.TSFBuilder - implementation for constructing JsonFactory - instances for reading/writing JSON encoded content.
-
-
JsonFactoryBuilder() - Constructor for class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
JsonFactoryBuilder(JsonFactory) - Constructor for class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
JsonGenerationException - Exception in com.fasterxml.jackson.core
-
-
Exception type for exceptions during JSON writing, such as trying - to output content in wrong context (non-matching end-array or end-object, - for example).
-
-
JsonGenerationException(Throwable, JsonGenerator) - Constructor for exception com.fasterxml.jackson.core.JsonGenerationException
-
 
-
JsonGenerationException(String, JsonGenerator) - Constructor for exception com.fasterxml.jackson.core.JsonGenerationException
-
 
-
JsonGenerationException(String, Throwable, JsonGenerator) - Constructor for exception com.fasterxml.jackson.core.JsonGenerationException
-
 
-
JsonGenerator - Class in com.fasterxml.jackson.core
-
-
Base class that defines public API for writing JSON content.
-
-
JsonGenerator() - Constructor for class com.fasterxml.jackson.core.JsonGenerator
-
 
-
JsonGeneratorBase - Class in com.fasterxml.jackson.core.json
-
-
Intermediate base class shared by JSON-backed generators - like UTF8JsonGenerator and WriterBasedJsonGenerator.
-
-
JsonGeneratorBase(ObjectWriteContext, IOContext, int, int, SerializableString, PrettyPrinter, CharacterEscapes, int) - Constructor for class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
JsonGeneratorDelegate - Class in com.fasterxml.jackson.core.util
-
 
-
JsonGeneratorDelegate(JsonGenerator) - Constructor for class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
JsonGeneratorDelegate(JsonGenerator, boolean) - Constructor for class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
JsonLocation - Class in com.fasterxml.jackson.core
-
-
Object that encapsulates Location information used for reporting - parsing (or potentially generation) errors, as well as current location - within input streams.
-
-
JsonLocation(Object, long, int, int) - Constructor for class com.fasterxml.jackson.core.JsonLocation
-
 
-
JsonLocation(Object, long, long, int, int) - Constructor for class com.fasterxml.jackson.core.JsonLocation
-
 
-
JsonParseException - Exception in com.fasterxml.jackson.core
-
-
Exception type for parsing problems, used when non-well-formed content - (content that does not conform to JSON syntax as per specification) - is encountered.
-
-
JsonParseException(JsonParser, String) - Constructor for exception com.fasterxml.jackson.core.JsonParseException
-
-
Constructor that uses current parsing location as location, and - sets processor (accessible via StreamReadException.getProcessor()) to - specified parser.
-
-
JsonParseException(JsonParser, String, Throwable) - Constructor for exception com.fasterxml.jackson.core.JsonParseException
-
 
-
JsonParseException(JsonParser, String, JsonLocation) - Constructor for exception com.fasterxml.jackson.core.JsonParseException
-
 
-
JsonParseException(JsonParser, String, JsonLocation, Throwable) - Constructor for exception com.fasterxml.jackson.core.JsonParseException
-
 
-
JsonParser - Class in com.fasterxml.jackson.core
-
-
Base class that defines public API for reading JSON content.
-
-
JsonParser() - Constructor for class com.fasterxml.jackson.core.JsonParser
-
 
-
JsonParser.NumberType - Enum in com.fasterxml.jackson.core
-
-
Enumeration of possible "native" (optimal) types that can be - used for numbers.
-
-
JsonParserBase - Class in com.fasterxml.jackson.core.json
-
-
Another intermediate base class aimed at ONLY json-backed parser.
-
-
JsonParserBase(ObjectReadContext, IOContext, int, int) - Constructor for class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
JsonParserDelegate - Class in com.fasterxml.jackson.core.util
-
-
Helper class that implements - delegation pattern for JsonParser, - to allow for simple overridability of basic parsing functionality.
-
-
JsonParserDelegate(JsonParser) - Constructor for class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
JsonParserSequence - Class in com.fasterxml.jackson.core.util
-
-
Helper class that can be used to sequence multiple physical - JsonParsers to create a single logical sequence of - tokens, as a single JsonParser.
-
-
JsonParserSequence(boolean, JsonParser[]) - Constructor for class com.fasterxml.jackson.core.util.JsonParserSequence
-
 
-
JsonpCharacterEscapes - Class in com.fasterxml.jackson.core.util
-
-
Convenience CharacterEscapes implementation that escapes - Unicode characters `0x2028` and `0x2029` (in addition to characters - escaped otherwise), which are apparently considered linefeeds as - per newer Javascript specifications, and consequently problematic - when using JSONP (see https://en.wikipedia.org/wiki/JSONP).
-
-
JsonpCharacterEscapes() - Constructor for class com.fasterxml.jackson.core.util.JsonpCharacterEscapes
-
 
-
JsonPointer - Class in com.fasterxml.jackson.core
-
-
Implementation of - JSON Pointer - specification.
-
-
JsonPointer() - Constructor for class com.fasterxml.jackson.core.JsonPointer
-
-
Constructor used for creating "empty" instance, used to represent - state that matches current node.
-
-
JsonPointer(String, String, JsonPointer) - Constructor for class com.fasterxml.jackson.core.JsonPointer
-
 
-
JsonPointer(String, String, int, JsonPointer) - Constructor for class com.fasterxml.jackson.core.JsonPointer
-
 
-
JsonPointerBasedFilter - Class in com.fasterxml.jackson.core.filter
-
-
Simple TokenFilter implementation that takes a single - JsonPointer and matches a single value accordingly.
-
-
JsonPointerBasedFilter(String) - Constructor for class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
-
 
-
JsonPointerBasedFilter(JsonPointer) - Constructor for class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
-
 
-
JsonProcessingException - Exception in com.fasterxml.jackson.core
-
-
Intermediate base class for all problems encountered when - processing (parsing, generating) JSON content - that are not pure I/O problems.
-
-
JsonProcessingException(String, JsonLocation, Throwable) - Constructor for exception com.fasterxml.jackson.core.JsonProcessingException
-
 
-
JsonProcessingException(String) - Constructor for exception com.fasterxml.jackson.core.JsonProcessingException
-
 
-
JsonProcessingException(String, JsonLocation) - Constructor for exception com.fasterxml.jackson.core.JsonProcessingException
-
 
-
JsonProcessingException(String, Throwable) - Constructor for exception com.fasterxml.jackson.core.JsonProcessingException
-
 
-
JsonProcessingException(Throwable) - Constructor for exception com.fasterxml.jackson.core.JsonProcessingException
-
 
-
JsonReadContext - Class in com.fasterxml.jackson.core.json
-
-
Extension of TokenStreamContext, which implements - core methods needed, and also exposes - more complete API to parser implementation classes.
-
-
JsonReadContext(JsonReadContext, DupDetector, int, int, int) - Constructor for class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
JsonReadFeature - Enum in com.fasterxml.jackson.core.json
-
-
Token reader (parser) features specific to JSON backend.
-
-
JsonStringEncoder - Class in com.fasterxml.jackson.core.io
-
-
Helper class used for efficient encoding of JSON String values (including - JSON field names) into Strings or UTF-8 byte arrays.
-
-
JsonStringEncoder() - Constructor for class com.fasterxml.jackson.core.io.JsonStringEncoder
-
 
-
JsonToken - Enum in com.fasterxml.jackson.core
-
-
Enumeration for basic token types used for returning results - of parsing JSON content.
-
-
JsonTokenId - Interface in com.fasterxml.jackson.core
-
-
Interface defined to contain ids accessible with JsonToken.id().
-
-
JsonWriteContext - Class in com.fasterxml.jackson.core.json
-
-
Extension of TokenStreamContext, which implements - core methods needed, and also exposes - more complete API to generator implementation classes.
-
-
JsonWriteContext(int, JsonWriteContext, DupDetector, Object) - Constructor for class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
JsonWriteFeature - Enum in com.fasterxml.jackson.core.json
-
-
Token writer features specific to JSON backend.
-
-
- - - -

L

-
-
last() - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
LAST_VALID_UNICODE_CHAR - Static variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
-
JSON actually limits available Unicode range in the high end - to the same as xml (to basically limit UTF-8 max byte sequence - length to 4)
-
-
- - - -

M

-
-
MAJOR_ARRAY_ELEMENT_FIRST - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MAJOR_ARRAY_ELEMENT_NEXT - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MAJOR_CLOSED - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
State after non-blocking input source has indicated that no more input - is forthcoming AND we have exhausted all the input
-
-
MAJOR_INITIAL - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
State right after parser has been constructed, before seeing the first byte - to handle possible (but optional) BOM.
-
-
MAJOR_OBJECT_FIELD_FIRST - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MAJOR_OBJECT_FIELD_NEXT - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MAJOR_OBJECT_VALUE - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MAJOR_ROOT - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
State right after parser a root value has been - finished, but next token has not yet been recognized.
-
-
makeChild(int) - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Factory method used to create actual symbol table instance to - use for parsing.
-
-
makeChild(int) - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
"Factory" method; will create a new child instance of this symbol - table.
-
-
mark(int) - Method in class com.fasterxml.jackson.core.io.MergedStream
-
 
-
markSupported() - Method in class com.fasterxml.jackson.core.io.MergedStream
-
 
-
MATCH_END_OBJECT - Static variable in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
-
Marker for case where JsonToken.END_OBJECT encountered.
-
-
MATCH_ODD_TOKEN - Static variable in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
-
Marker for case where token encountered is neither FIELD_NAME - nor END_OBJECT.
-
-
MATCH_UNKNOWN_NAME - Static variable in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
-
Marker for case where field name encountered but not one of matches.
-
-
matchByQuad(int) - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
matchByQuad(int, int) - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
matchByQuad(int, int, int) - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
matchByQuad(int[], int) - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
matchByQuad(int) - Method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
matchByQuad(int, int) - Method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
matchByQuad(int, int, int) - Method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
matchByQuad(int[], int) - Method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
matchByQuad(int) - Method in class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
 
-
matchByQuad(int, int) - Method in class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
 
-
matchByQuad(int, int, int) - Method in class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
 
-
matchByQuad(int[], int) - Method in class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
 
-
matchElement(int) - Method in class com.fasterxml.jackson.core.JsonPointer
-
-
Method that may be called to check whether the pointer head (first segment) - matches specified Array index and if so, return - JsonPointer that represents rest of the path after match.
-
-
matches() - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
matchesElement(int) - Method in class com.fasterxml.jackson.core.JsonPointer
-
-
Method that may be called to see if the pointer would match - Array element (of a JSON Array) with given index.
-
-
matchesProperty(String) - Method in class com.fasterxml.jackson.core.JsonPointer
-
-
Method that may be called to see if the pointer head (first segment) - would match property (of a JSON Object) with given name.
-
-
matchName(String) - Method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
-
Lookup method that does not assume name to be matched to be - String.intern()ed (although passing interned String is likely - to result in more efficient matching).
-
-
matchName(String) - Method in class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
 
-
matchProperty(String) - Method in class com.fasterxml.jackson.core.JsonPointer
-
-
Method that may be called to check whether the pointer head (first segment) - matches specified Object property (by name) and if so, return - JsonPointer that represents rest of the path after match.
-
-
matchSecondary(String) - Method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
-
Secondary lookup method used for matchers that operate with more complex - matching rules, such as case-insensitive matchers.
-
-
MAX_BIG_DECIMAL_SCALE - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
This value is the limit of scale allowed for serializing BigDecimal - in "plain" (non-engineering) notation; intent is to prevent asymmetric - attack whereupon simple eng-notation with big scale is used to generate - huge "plain" serialization.
-
-
MAX_BYTE_I - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
MAX_CONTENT_SNIPPET - Static variable in class com.fasterxml.jackson.core.JsonLocation
-
-
Include at most first 500 characters/bytes from contents; should be enough - to give context, but not cause unfortunate side effects in things like - logs.
-
-
MAX_ENTRIES - Static variable in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
MAX_ERROR_TOKEN_LENGTH - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Maximum number of characters to include in token reported - as part of error messages.
-
-
MAX_INT_D - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
MAX_INT_L - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
MAX_LONG_D - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
MAX_SHORT_I - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
maxCollisionLength() - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Method mostly needed by unit tests; calculates length of the - longest collision chain.
-
-
maybeDirty() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Method called to check to quickly see if a child symbol table - may have gotten additional entries.
-
-
maybeDirty() - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
mayMatchElement() - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
mayMatchProperty() - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
MergedStream - Class in com.fasterxml.jackson.core.io
-
-
Simple InputStream implementation that is used to "unwind" some - data previously read from an input stream; so that as long as some of - that data remains, it's returned; but as long as it's read, we'll - just use data from the underlying original stream.
-
-
MergedStream(IOContext, InputStream, byte[], int, int) - Constructor for class com.fasterxml.jackson.core.io.MergedStream
-
 
-
MIME - Static variable in class com.fasterxml.jackson.core.Base64Variants
-
-
This variant is what most people would think of "the standard" - Base64 encoding.
-
-
MIME_NO_LINEFEEDS - Static variable in class com.fasterxml.jackson.core.Base64Variants
-
-
Slightly non-standard modification of Base64Variants.MIME which does not - use linefeeds (max line length set to infinite).
-
-
MIN_BYTE_I - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
MIN_INT_D - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
MIN_INT_L - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
MIN_LONG_D - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
MIN_SHORT_I - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
MinimalPrettyPrinter - Class in com.fasterxml.jackson.core.util
-
-
PrettyPrinter implementation that adds no indentation, - just implements everything necessary for value output to work - as expected, and provide simpler extension points to allow - for creating simple custom implementations that add specific - decoration or overrides.
-
-
MinimalPrettyPrinter() - Constructor for class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
MinimalPrettyPrinter(String) - Constructor for class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
MINOR_COMMENT_C - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_COMMENT_CLOSING_ASTERISK - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_COMMENT_CPP - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_COMMENT_LEADING_SLASH - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_COMMENT_YAML - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_FIELD_APOS_NAME - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_FIELD_LEADING_COMMA - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_FIELD_LEADING_WS - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_FIELD_NAME - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_FIELD_NAME_ESCAPE - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_FIELD_UNQUOTED_NAME - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_NUMBER_EXPONENT_DIGITS - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_NUMBER_EXPONENT_MARKER - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_NUMBER_FRACTION_DIGITS - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_NUMBER_INTEGER_DIGITS - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_NUMBER_MINUS - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_NUMBER_MINUSZERO - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_NUMBER_ZERO - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_ROOT_BOM - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
State in which part of (UTF-8) BOM has been detected, but not yet completely.
-
-
MINOR_ROOT_GOT_SEPARATOR - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
State between root-level value, having processed at least one white-space - character, and expecting either more, start of a value, or end of input - stream.
-
-
MINOR_ROOT_NEED_SEPARATOR - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
State between root-level value, waiting for at least one white-space - character as separator
-
-
MINOR_VALUE_APOS_STRING - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_EXPECTING_COLON - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_EXPECTING_COMMA - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_LEADING_WS - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_STRING - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_STRING_ESCAPE - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_STRING_UTF8_2 - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_STRING_UTF8_3 - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_STRING_UTF8_4 - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_TOKEN_ERROR - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Special state at which point decoding of a non-quoted token has encountered - a problem; that is, either not matching fully (like "truf" instead of "true", - at "tru"), or not having trailing separator (or end of input), like "trueful".
-
-
MINOR_VALUE_TOKEN_FALSE - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_TOKEN_NON_STD - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_TOKEN_NULL - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_TOKEN_TRUE - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
MINOR_VALUE_WS_AFTER_COMMA - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
missingNode() - Method in interface com.fasterxml.jackson.core.TreeCodec
-
 
-
missingPaddingMessage() - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Helper method that will construct a message to use in exceptions for cases where input ends - prematurely in place where padding would be expected.
-
-
MODIFIED_FOR_URL - Static variable in class com.fasterxml.jackson.core.Base64Variants
-
-
This non-standard variant is usually used when encoded data needs to be - passed via URLs (such as part of GET request).
-
-
- - - -

N

-
-
NA - Static variable in class com.fasterxml.jackson.core.JsonLocation
-
-
Shared immutable "N/A location" that can be returned to indicate - that no location information is available.
-
-
Named - Interface in com.fasterxml.jackson.core.util
-
-
Simple tag interface used primarily to allow databind to pass entities with - name without needing to expose more details of implementation.
-
-
Named.StringAsNamed - Class in com.fasterxml.jackson.core.util
-
 
-
nameLookup() - Method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
-
Accessor to names matching indexes, iff passed during construction.
-
-
NASTY_SMALL_DOUBLE - Static variable in class com.fasterxml.jackson.core.io.NumberInput
-
-
Textual representation of a double constant that can cause nasty problems - with JDK (see http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308).
-
-
NC - Static variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
needMoreInput() - Method in interface com.fasterxml.jackson.core.async.NonBlockingInputFeeder
-
-
Method called to check whether it is ok to feed more data: parser returns true - if it has no more content to parse (and it is ok to feed more); otherwise false - (and no data should yet be fed).
-
-
needMoreInput() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
nextBooleanValue() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
nextBooleanValue() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
nextBooleanValue() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
nextBooleanValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE - returns matching Boolean value; otherwise return null.
-
-
nextFieldName() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
nextFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
nextFieldName(FieldNameMatcher) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
nextFieldName() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
nextFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
nextFieldName(FieldNameMatcher) - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
nextFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
nextFieldName() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
nextFieldName() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
nextFieldName() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
nextFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
nextFieldName(FieldNameMatcher) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
nextFieldName() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that fetches next token (as if calling JsonParser.nextToken()) and - verifies whether it is JsonToken.FIELD_NAME; if it is, - returns same as JsonParser.currentName(), otherwise null.
-
-
nextFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that fetches next token (as if calling JsonParser.nextToken()) and - verifies whether it is JsonToken.FIELD_NAME with specified name - and returns result of that comparison.
-
-
nextFieldName(FieldNameMatcher) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that tries to match next token from stream as JsonToken.FIELD_NAME, - and if so, further match it to one of pre-specified (field) names.
-
-
nextFieldName() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
nextFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
nextFieldName(FieldNameMatcher) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
nextFieldName() - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
 
-
nextFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
 
-
nextFieldName(FieldNameMatcher) - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
 
-
nextIntValue(int) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
nextIntValue(int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
nextIntValue(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
nextIntValue(int) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 32-bit int value; - otherwise returns specified default value - It is functionally equivalent to:
-
-
nextLongValue(long) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
nextLongValue(long) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
nextLongValue(long) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
nextLongValue(long) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_NUMBER_INT returns 64-bit long value; - otherwise returns specified default value - It is functionally equivalent to:
-
-
nextTextValue() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
nextTextValue() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
nextTextValue() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
nextTextValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that fetches next token (as if calling JsonParser.nextToken()) and - if it is JsonToken.VALUE_STRING returns contained String value; - otherwise returns null.
-
-
nextToken() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
nextToken() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
nextToken() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
nextToken() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
nextToken() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
nextToken() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Main iteration method, which will advance stream enough - to determine type of the next token, if any.
-
-
nextToken() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
nextToken() - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
 
-
nextTokenToRead() - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
nextValue() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
nextValue() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
nextValue() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Iteration method that will advance stream enough - to determine type of the next token that is a value type - (including JSON Array and Object start/end markers).
-
-
nextValue() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
NO_BYTES - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
NO_BYTES - Static variable in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
NO_INTS - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
NON_STD_TOKEN_INFINITY - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
NON_STD_TOKEN_MINUS_INFINITY - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
NON_STD_TOKEN_NAN - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
NON_STD_TOKEN_PLUS_INFINITY - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
NON_STD_TOKEN_VALUES - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
NON_STD_TOKENS - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
NonBlockingInputFeeder - Interface in com.fasterxml.jackson.core.async
-
-
Interface used by non-blocking JsonParser - implementations to feed input to parse.
-
-
NonBlockingJsonParser - Class in com.fasterxml.jackson.core.json.async
-
-
Non-blocking parser implementation for JSON content.
-
-
NonBlockingJsonParser(ObjectReadContext, IOContext, int, int, ByteQuadsCanonicalizer) - Constructor for class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
NonBlockingJsonParserBase - Class in com.fasterxml.jackson.core.json.async
-
-
Intermediate base class for non-blocking JSON parsers.
-
-
NonBlockingJsonParserBase(ObjectReadContext, IOContext, int, int, ByteQuadsCanonicalizer) - Constructor for class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
NopIndenter() - Constructor for class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.NopIndenter
-
 
-
notFinite(double) - Static method in class com.fasterxml.jackson.core.io.NumberOutput
-
-
Helper method to verify whether given double value is finite - (regular rational number} or not (NaN or Infinity).
-
-
notFinite(float) - Static method in class com.fasterxml.jackson.core.io.NumberOutput
-
-
Helper method to verify whether given float value is finite - (regular rational number} or not (NaN or Infinity).
-
-
NR_BIGDECIMAL - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
NR_BIGINT - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
NR_DOUBLE - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
NR_FLOAT - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
NOTE! Not used by JSON implementation but used by many of binary codecs
-
-
NR_INT - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
NR_LONG - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
NR_UNKNOWN - Static variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
nullNode() - Method in interface com.fasterxml.jackson.core.TreeCodec
-
 
-
NumberInput - Class in com.fasterxml.jackson.core.io
-
 
-
NumberInput() - Constructor for class com.fasterxml.jackson.core.io.NumberInput
-
 
-
NumberOutput - Class in com.fasterxml.jackson.core.io
-
 
-
NumberOutput() - Constructor for class com.fasterxml.jackson.core.io.NumberOutput
-
 
-
numberType() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
If this node is a numeric type (as per JsonToken.isNumeric()), - returns native type that node uses to store the numeric value; - otherwise returns null.
-
-
- - - -

O

-
-
ObjectReadContext - Interface in com.fasterxml.jackson.core
-
-
Defines API for accessing configuration and state exposed by - higher level databind - functionality during read (token stream to Object deserialization) process.
-
-
ObjectReadContext.Base - Class in com.fasterxml.jackson.core
-
-
Default no-op implementation.
-
-
ObjectTreeNode - Interface in com.fasterxml.jackson.core.tree
-
-
Tag interface (for now) for Object nodes
-
-
ObjectWriteContext - Interface in com.fasterxml.jackson.core
-
-
Defines API for accessing configuration and state exposed by - higher level databind - functionality during write (Object to token stream serialization) process.
-
-
ObjectWriteContext.Base - Class in com.fasterxml.jackson.core
-
-
Default no-op implementation.
-
-
outputDecorator() - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder
-
 
-
outputDecorator(OutputDecorator) - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder
-
 
-
OutputDecorator - Class in com.fasterxml.jackson.core.io
-
-
Handler class that can be used to decorate output destinations.
-
-
OutputDecorator() - Constructor for class com.fasterxml.jackson.core.io.OutputDecorator
-
 
-
outputInt(int, char[], int) - Static method in class com.fasterxml.jackson.core.io.NumberOutput
-
 
-
outputInt(int, byte[], int) - Static method in class com.fasterxml.jackson.core.io.NumberOutput
-
 
-
outputLong(long, char[], int) - Static method in class com.fasterxml.jackson.core.io.NumberOutput
-
 
-
outputLong(long, byte[], int) - Static method in class com.fasterxml.jackson.core.io.NumberOutput
-
 
-
- - - -

P

-
-
PackageVersion - Class in com.fasterxml.jackson.core.json
-
-
Automatically generated from PackageVersion.java.in during - packageVersion-generate execution of maven-replacer-plugin in - pom.xml.
-
-
PackageVersion() - Constructor for class com.fasterxml.jackson.core.json.PackageVersion
-
 
-
packageVersionFor(Class<?>) - Static method in class com.fasterxml.jackson.core.util.VersionUtil
-
-
Loads version information by introspecting a class named - "PackageVersion" in the same package as the given class.
-
-
PADDING_CHAR_NONE - Static variable in class com.fasterxml.jackson.core.Base64Variant
-
-
Placeholder used by "no padding" variant, to be used when a character - value is needed.
-
-
paddingReadBehaviour() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
parseAsDouble(String, double) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
 
-
parseAsInt(String, int) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
 
-
parseAsLong(String, long) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
 
-
parseBigDecimal(String) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
 
-
parseBigDecimal(char[]) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
 
-
parseBigDecimal(char[], int, int) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
 
-
parseDouble(String) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
 
-
parseEscapedName(int[], int, int, int, int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Slower parsing method which is generally branched to when - an escape sequence is detected (or alternatively for long - names, one crossing input buffer boundary).
-
-
parseEscapedName(int[], int, int, int, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Slower parsing method which is generally branched to when an escape - sequence is detected (or alternatively for long names, one crossing - input buffer boundary).
-
-
parseInt(char[], int, int) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
-
Fast method for parsing integers that are known to fit into - regular 32-bit signed int type.
-
-
parseInt(String) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
-
Helper method to (more) efficiently parse integer numbers from - String values.
-
-
parseLong(char[], int, int) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
 
-
parseLong(String) - Static method in class com.fasterxml.jackson.core.io.NumberInput
-
 
-
parseLongName(int, int, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
parseMediumName(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
parseMediumName2(int, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
ParserBase - Class in com.fasterxml.jackson.core.base
-
-
Intermediate base class used by many (but not all) Jackson JsonParser - implementations.
-
-
ParserBase(ObjectReadContext, IOContext, int) - Constructor for class com.fasterxml.jackson.core.base.ParserBase
-
 
-
ParserMinimalBase - Class in com.fasterxml.jackson.core.base
-
-
Intermediate base class used by all Jackson JsonParser - implementations, but does not add any additional fields that depend - on particular method of obtaining input.
-
-
ParserMinimalBase(ObjectReadContext) - Constructor for class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
ParserMinimalBase(ObjectReadContext, int) - Constructor for class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
parseVersion(String, String, String) - Static method in class com.fasterxml.jackson.core.util.VersionUtil
-
-
Method used by PackageVersion classes to decode version injected by Maven build.
-
-
parseVersionPart(String) - Static method in class com.fasterxml.jackson.core.util.VersionUtil
-
 
-
path(String) - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method for accessing value of the specified field of - an object node.
-
-
path(int) - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method for accessing value of the specified element of - an array node.
-
-
pathAsPointer() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Factory method for constructing a JsonPointer that points to the current - location within the stream that this context is for, excluding information about - "root context" (only relevant for multi-root-value cases)
-
-
pathAsPointer(boolean) - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Factory method for constructing a JsonPointer that points to the current - location within the stream that this context is for, optionally including - "root value index"
-
-
PEM - Static variable in class com.fasterxml.jackson.core.Base64Variants
-
-
This variant is the one that predates Base64Variants.MIME: it is otherwise - identical, except that it mandates shorter line length.
-
-
PrettyPrinter - Interface in com.fasterxml.jackson.core
-
-
Interface for objects that implement pretty printer functionality, such - as indentation.
-
-
primaryCount() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Method mostly needed by unit tests; calculates number of - entries that are in the primary slot set.
-
-
primaryQuadCount() - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
putQuotedUTF8(ByteBuffer) - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
putQuotedUTF8(ByteBuffer) - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Method for appending JSON-escaped UTF-8 encoded String value into given - ByteBuffer, if it fits.
-
-
putUnquotedUTF8(ByteBuffer) - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
putUnquotedUTF8(ByteBuffer) - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Method for appending unquoted ('raw') UTF-8 encoded String value into given - ByteBuffer, if it fits.
-
-
- - - -

Q

-
-
quoteAsCharArray(CharSequence) - Method in class com.fasterxml.jackson.core.io.JsonStringEncoder
-
-
Method that will quote text contents using JSON standard quoting, - and return results as a character array
-
-
quoteAsString(CharSequence, StringBuilder) - Method in class com.fasterxml.jackson.core.io.JsonStringEncoder
-
-
Method that will quote text contents using JSON standard quoting, - and append results to a supplied StringBuilder.
-
-
quoteAsUTF8(CharSequence) - Method in class com.fasterxml.jackson.core.io.JsonStringEncoder
-
-
Will quote given JSON String value using standard quoting, encode - results as UTF-8, and return result as a byte array.
-
-
quoteChar(char) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
-
Method that allows specifying an alternate - character used for quoting field names (if field name quoting has not - been disabled with JsonWriteFeature.QUOTE_FIELD_NAMES) - and JSON String values.
-
-
quoteChar() - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
- - - -

R

-
-
read() - Method in class com.fasterxml.jackson.core.io.MergedStream
-
 
-
read(byte[]) - Method in class com.fasterxml.jackson.core.io.MergedStream
-
 
-
read(byte[], int, int) - Method in class com.fasterxml.jackson.core.io.MergedStream
-
 
-
read() - Method in class com.fasterxml.jackson.core.io.UTF32Reader
-
-
Although this method is implemented by the base class, AND it should - never be called by main code, let's still implement it bit more - efficiently just in case
-
-
read(char[], int, int) - Method in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
readBinaryValue(Base64Variant, OutputStream) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
readBinaryValue(Base64Variant, OutputStream) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
readBinaryValue(Base64Variant, OutputStream) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
readBinaryValue(Base64Variant, OutputStream) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
readBinaryValue(OutputStream) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be used as an alternative to JsonParser.getBinaryValue(), - especially when value can be large.
-
-
readBinaryValue(Base64Variant, OutputStream) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Similar to JsonParser.readBinaryValue(OutputStream) but allows explicitly - specifying base64 variant to use.
-
-
readBinaryValue(Base64Variant, OutputStream) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
ReaderBasedJsonParser - Class in com.fasterxml.jackson.core.json
-
-
This is a concrete implementation of JsonParser, which is - based on a Reader to handle low-level character - conversion tasks.
-
-
ReaderBasedJsonParser(ObjectReadContext, IOContext, int, int, Reader, CharsToNameCanonicalizer, char[], int, int, boolean) - Constructor for class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Method called when caller wants to provide input buffer directly, - and it may or may not be recyclable use standard recycle context.
-
-
ReaderBasedJsonParser(ObjectReadContext, IOContext, int, int, Reader, CharsToNameCanonicalizer) - Constructor for class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Method called when input comes as a Reader, and buffer allocation - can be done using default mechanism.
-
-
readResolve() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
readResolve() - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
readResolve() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Method that we need to override to actually make restoration go - through constructors etc.
-
-
readTree(JsonParser) - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
readTree(JsonParser) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
readTree(JsonParser) - Method in interface com.fasterxml.jackson.core.TreeCodec
-
 
-
readValue(JsonParser, Class<T>) - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
readValue(JsonParser, TypeReference<T>) - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
readValue(JsonParser, ResolvedType) - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
readValue(JsonParser, Class<T>) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
readValue(JsonParser, TypeReference<T>) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
readValue(JsonParser, ResolvedType) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
 
-
readValueAs(Class<T>) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
readValueAs(TypeReference<T>) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
readValueAs(ResolvedType) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
readValueAs(Class<T>) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method to deserialize stream content into a non-container - type (it can be an array type, however): typically a bean, array - or a wrapper type (like Boolean).
-
-
readValueAs(TypeReference<T>) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method to deserialize stream content into a Java type, reference - to which is passed as argument.
-
-
readValueAs(ResolvedType) - Method in class com.fasterxml.jackson.core.JsonParser
-
 
-
readValueAs(Class<T>) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
readValueAs(TypeReference<T>) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
readValueAs(ResolvedType) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
readValueAsTree() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
readValueAsTree() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method to deserialize stream content into equivalent "tree model", - represented by root TreeNode of resulting model.
-
-
readValueAsTree() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
rebuild() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
rebuild() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method that can be used to create differently configured stream factories.
-
-
release() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Method called by the using code to indicate it is done with this instance.
-
-
release() - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Method called by the using code to indicate it is done with this instance.
-
-
release() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
-
Clean up method to call to release all buffers this object may be - using.
-
-
releaseBase64Buffer(byte[]) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
releaseBuffered(OutputStream) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
releaseBuffered(OutputStream) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
releaseBuffered(Writer) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
releaseBuffered(OutputStream) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
releaseBuffered(OutputStream) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
releaseBuffered(OutputStream) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be called to push back any content that - has been read but not consumed by the parser.
-
-
releaseBuffered(Writer) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that can be called to push back any content that - has been read but not consumed by the parser.
-
-
releaseBuffers() - Static method in class com.fasterxml.jackson.core.util.BufferRecyclers
-
-
Specialized method that will release all recycled BufferRecycler if - (and only if) recycler tracking has been enabled - (see BufferRecyclers.SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS).
-
-
releaseBuffers() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Method called to indicate that the underlying buffers should now - be recycled if they haven't yet been recycled.
-
-
releaseByteBuffer(int, byte[]) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
releaseCharBuffer(int, char[]) - Method in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
releaseConcatBuffer(char[]) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
releaseNameCopyBuffer(char[]) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
releaseReadIOBuffer(byte[]) - Method in class com.fasterxml.jackson.core.io.IOContext
-
-
Method to call when all the processing buffers can be safely - recycled.
-
-
releaseTokenBuffer(char[]) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
releaseWriteEncodingBuffer(byte[]) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
reportInvalidBase64Char(Base64Variant, int, int) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
reportInvalidBase64Char(Base64Variant, int, int, String) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
reportInvalidNumber(String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Method called to throw an exception for input token that looks like a number - based on first character(s), but is not valid according to rules of format.
-
-
reportOverflowByte(String, JsonToken) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
reportOverflowInt() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Method called to throw an exception for integral (not floating point) input - token with value outside of Java signed 32-bit range when requested as int.
-
-
reportOverflowInt(String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
reportOverflowInt(String, JsonToken) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
reportOverflowLong() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Method called to throw an exception for integral (not floating point) input - token with value outside of Java signed 64-bit range when requested as long.
-
-
reportOverflowLong(String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
reportOverflowLong(String, JsonToken) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
reportOverflowShort(String, JsonToken) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
reportTooManyCollisions(int) - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
reportUnexpectedNumberChar(int, String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
RequestPayload - Class in com.fasterxml.jackson.core.util
-
-
Container object used to contain optional information on content - being parsed, passed to JsonParseException in case of - exception being thrown; this may be useful for caller to display - information on failure.
-
-
RequestPayload(byte[], Charset) - Constructor for class com.fasterxml.jackson.core.util.RequestPayload
-
 
-
RequestPayload(CharSequence) - Constructor for class com.fasterxml.jackson.core.util.RequestPayload
-
 
-
requiresObjectContext() - Method in enum com.fasterxml.jackson.core.type.WritableTypeId.Inclusion
-
 
-
requiresPaddingOnRead() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
requiresPropertyOrdering() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Introspection method that higher-level functionality may call - to see whether underlying data format requires a stable ordering - of object properties or not.
-
-
reset(boolean, int, int, int) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
reset(int, TokenFilter, Object, boolean) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
reset() - Method in class com.fasterxml.jackson.core.io.MergedStream
-
 
-
reset() - Method in class com.fasterxml.jackson.core.json.DupDetector
-
 
-
reset(int, int, int) - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
-
Internal method to allow instance reuse: DO NOT USE unless you absolutely - know what you are doing.
-
-
reset(int, Object) - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
-
Internal method to allow instance reuse: DO NOT USE unless you absolutely - know what you are doing.
-
-
reset() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
reset(int, int, int) - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
resetAndGetFirstSegment() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
-
Method called when starting "manual" output: will clear out - current state and return the first segment buffer to fill
-
-
resetAsNaN(String, double) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
resetFloat(boolean, int, int, int) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
resetInt(boolean, int) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
resetWith(char) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
resetWithCopy(char[], int, int) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
resetWithCopy(String, int, int) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
resetWithEmpty() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Method called to clear out any content text buffer may have, and - initializes buffer to use non-shared data.
-
-
resetWithShared(char[], int, int) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Method called to initialize the buffer with a shared copy of data; - this means that buffer will just have pointers to actual data.
-
-
resetWithString(String) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
ResolvedType - Class in com.fasterxml.jackson.core.type
-
-
Type abstraction that represents Java type that has been resolved - (i.e.
-
-
ResolvedType() - Constructor for class com.fasterxml.jackson.core.type.ResolvedType
-
 
-
rootDetector(JsonParser) - Static method in class com.fasterxml.jackson.core.json.DupDetector
-
 
-
rootDetector(JsonGenerator) - Static method in class com.fasterxml.jackson.core.json.DupDetector
-
 
-
rootFilter - Variable in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
-
Object consulted to determine whether to write parts of content generator - is asked to write or not.
-
-
rootFilter - Variable in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Object consulted to determine whether to write parts of content generator - is asked to write or not.
-
-
rootValueSeparator(String) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
-
Method that allows overriding String used for separating root-level - JSON values (default is single space character)
-
-
rootValueSeparator(SerializableString) - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
-
Method that allows overriding String used for separating root-level - JSON values (default is single space character)
-
-
rootValueSeparator() - Method in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
- - - -

S

-
-
secondaryCount() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Method mostly needed by unit tests; calculates number of entries - in secondary buckets
-
-
secondaryCount() - Method in class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
 
-
secondaryQuadCount() - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
SegmentedStringWriter - Class in com.fasterxml.jackson.core.io
-
-
Efficient alternative to StringWriter, based on using segmented - internal buffer.
-
-
SegmentedStringWriter(BufferRecycler) - Constructor for class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
SEPARATOR - Static variable in class com.fasterxml.jackson.core.JsonPointer
-
-
Character used to separate segments.
-
-
Separators - Class in com.fasterxml.jackson.core.util
-
-
Value class used with some PrettyPrinter - implements
-
-
Separators() - Constructor for class com.fasterxml.jackson.core.util.Separators
-
 
-
Separators(char, char, char) - Constructor for class com.fasterxml.jackson.core.util.Separators
-
 
-
SerializableString - Interface in com.fasterxml.jackson.core
-
-
Interface that defines how Jackson package can interact with efficient - pre-serialized or lazily-serialized and reused String representations.
-
-
SerializedString - Class in com.fasterxml.jackson.core.io
-
-
String token that can lazily serialize String contained and then reuse that - serialization later on.
-
-
SerializedString(String) - Constructor for class com.fasterxml.jackson.core.io.SerializedString
-
 
-
setCharacterEscapes(CharacterEscapes) - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
setCharacterEscapes(CharacterEscapes) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
setCharacterEscapes(CharacterEscapes) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
setCharacterEscapes(CharacterEscapes) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for defining custom escapes factory uses for JsonGenerators - it creates.
-
-
setCurrentAndReturn(int) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
setCurrentLength(int) - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
setCurrentName(String) - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
setCurrentName(String) - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
setCurrentSegmentLength(int) - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Helper method, usually equivalent to: - - getOutputContext().setCurrentValue(v); - - used to assign "current value" for the current context of this generator.
-
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Helper method, usually equivalent to: - - getParsingContext().setCurrentValue(v); -
-
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Method to call to pass value to be returned via TokenStreamContext.getCurrentValue(); typically - called indirectly through JsonParser.setCurrentValue(java.lang.Object) - or JsonGenerator.setCurrentValue(java.lang.Object)).
-
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
setCurrentValue(Object) - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
setEncoding(JsonEncoding) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
setFieldName(String) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
setHighestNonEscapedChar(int) - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
setHighestNonEscapedChar(int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that can be called to request that generator escapes - all character codes above specified code point (if positive value); - or, to not escape any characters except for ones that must be - escaped for the data format (if -1).
-
-
setHighestNonEscapedChar(int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
setRequestPayloadOnError(RequestPayload) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Sets the payload to be passed if JsonParseException is thrown.
-
-
setRequestPayloadOnError(byte[], Charset) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Sets the byte[] request payload and the charset needed to decode it
-
-
setRequestPayloadOnError(String) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Sets the String request payload
-
-
setRootValueSeparator(String) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
setSeparators(Separators) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
sHexValues - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
-
Lookup table for the first 256 Unicode characters (ASCII / UTF-8) - range.
-
-
SHORT_WRITE - Static variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
SimpleNameMatcher - Class in com.fasterxml.jackson.core.sym
-
-
Basic FieldNameMatcher that uses case-sensitive match and does - not require (or expect) that names passed as arguments have been - String.intern()ed.
-
-
SimpleNameMatcher(SimpleNameMatcher, String[]) - Constructor for class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
 
-
SimpleNameMatcher(SimpleNameMatcher, SimpleNameMatcher) - Constructor for class com.fasterxml.jackson.core.sym.SimpleNameMatcher
-
 
-
SimpleTokenReadContext - Class in com.fasterxml.jackson.core.util
-
 
-
SimpleTokenReadContext(int, SimpleTokenReadContext, DupDetector, int, int) - Constructor for class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
SimpleTokenWriteContext - Class in com.fasterxml.jackson.core.util
-
-
Basic implementation of TokenStreamContext useful for most - format backends (with notable exception of JSON that needs bit more - advanced state).
-
-
SimpleTokenWriteContext(int, SimpleTokenWriteContext, DupDetector, Object) - Constructor for class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
sInputCodes - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
-
Lookup table used for determining which input characters - need special handling when contained in text segment.
-
-
sInputCodesComment - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
-
Decoding table used to quickly determine characters that are - relevant within comment content.
-
-
sInputCodesJsNames - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
-
To support non-default (and -standard) unquoted field names mode, - need to have alternate checking.
-
-
sInputCodesUTF8 - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
-
Additionally we can combine UTF-8 decoding info into similar - data table.
-
-
sInputCodesUtf8JsNames - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
-
This table is similar to Latin-1, except that it marks all "high-bit" - code as ok.
-
-
sInputCodesWS - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
-
Decoding table used for skipping white space and comments.
-
-
size() - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
size() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
size() - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
size() - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method that returns number of child nodes this node contains: - for Array nodes, number of child elements, for Object nodes, - number of fields, and for all other nodes 0.
-
-
size() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
size() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
skip(long) - Method in class com.fasterxml.jackson.core.io.MergedStream
-
 
-
skipChildren() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
skipChildren() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Need to override, re-implement similar to how method defined in - ParserMinimalBase, to keep - state correct here.
-
-
skipChildren() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Method that will skip all child tokens of an array or - object token that the parser currently points to, - iff stream points to - JsonToken.START_OBJECT or JsonToken.START_ARRAY.
-
-
skipChildren() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
skipChildren() - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
-
Need to override, re-implement similar to how method defined in - ParserMinimalBase, to keep - state correct here.
-
-
skipParentChecks() - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
skipUTF8BOM(DataInput) - Static method in class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
-
Helper method that may be called to see if given DataInput - has BOM marker, and if so, to skip it.
-
-
slowParseName() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Method called when not even first 8 bytes are guaranteed - to come consecutively.
-
-
snapshot() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
snapshot() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method for constructing a new TokenStreamFactory that has - the same settings as this instance, but is otherwise - independent (i.e.
-
-
snapshot() - Method in interface com.fasterxml.jackson.core.util.Snapshottable
-
-
Method to call to get an instance that may not be modified through any other object, - including `this`.
-
-
Snapshottable<T> - Interface in com.fasterxml.jackson.core.util
-
-
Interface that defines one method (see Snapshottable.snapshot()) for ensuring that we get - an instance that does not allow modifying state of `this` instance.
-
-
sourceDescription() - Method in class com.fasterxml.jackson.core.JsonLocation
-
-
Accessor for getting a textual description of source reference - (Object returned by JsonLocation.getSourceRef()), as included in - description returned by JsonLocation.toString().
-
-
sOutputEscapes128 - Static variable in class com.fasterxml.jackson.core.io.CharTypes
-
-
Lookup table used for determining which output characters in - 7-bit ASCII range need to be quoted.
-
-
spillCount() - Method in class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
 
-
spilloverCount() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Method mostly needed by unit tests; calculates number of entries - in shared spill-over area
-
-
spilloverQuadCount() - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
standardAsciiEscapesForJSON() - Static method in class com.fasterxml.jackson.core.io.CharacterEscapes
-
-
Helper method that can be used to get a copy of standard JSON - escape definitions; this is useful when just wanting to slightly - customize definitions.
-
-
STATUS_EXPECT_NAME - Static variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
STATUS_EXPECT_VALUE - Static variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
STATUS_OK_AFTER_COLON - Static variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
STATUS_OK_AFTER_COMMA - Static variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
STATUS_OK_AFTER_SPACE - Static variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
STATUS_OK_AS_IS - Static variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
StreamReadCapability - Enum in com.fasterxml.jackson.core
-
-
Set of on/off capabilities that a JsonParser for given format - (or in case of buffering, original format) has.
-
-
StreamReadException - Exception in com.fasterxml.jackson.core.exc
-
-
Intermediate base class for all read-side streaming processing problems, including - parsing and input value coercion problems.
-
-
StreamReadException(JsonParser, String) - Constructor for exception com.fasterxml.jackson.core.exc.StreamReadException
-
 
-
StreamReadException(JsonParser, String, Throwable) - Constructor for exception com.fasterxml.jackson.core.exc.StreamReadException
-
 
-
StreamReadException(JsonParser, String, JsonLocation) - Constructor for exception com.fasterxml.jackson.core.exc.StreamReadException
-
 
-
StreamReadException(String, JsonLocation, Throwable) - Constructor for exception com.fasterxml.jackson.core.exc.StreamReadException
-
 
-
StreamReadFeature - Enum in com.fasterxml.jackson.core
-
-
Token reader (parser) features not-specific to any particular format backend.
-
-
streamReadFeatures() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
streamReadFeatures() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Bulk access method for getting state of all standard StreamReadFeatures.
-
-
streamReadFeatures() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
streamReadFeaturesMask() - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
StreamWriteCapability - Enum in com.fasterxml.jackson.core
-
-
Set of on/off capabilities that a JsonGenerator for given format - (or in case of buffering, original format) has.
-
-
StreamWriteFeature - Enum in com.fasterxml.jackson.core
-
-
Token writer (generator) features not-specific to any particular format backend.
-
-
streamWriteFeatures() - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
streamWriteFeatures() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Bulk access method for getting state of all standard (format-agnostic) - StreamWriteFeatures.
-
-
streamWriteFeatures() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
streamWriteFeaturesMask() - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
StringAsNamed(String) - Constructor for class com.fasterxml.jackson.core.util.Named.StringAsNamed
-
 
-
stringNode(String) - Method in interface com.fasterxml.jackson.core.TreeCodec
-
 
-
stringsFromNames(List<Named>, boolean) - Static method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
SURR1_FIRST - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
SURR1_LAST - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
SURR2_FIRST - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
SURR2_LAST - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
switchAndReturnNext() - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
 
-
switchToNext() - Method in class com.fasterxml.jackson.core.util.JsonParserSequence
-
-
Method that will switch active delegate parser from the current one - to the next parser in sequence, if there is another parser left: - if so, the next parser will become the active delegate parser.
-
-
symbolTableForTests() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
SYS_LF - Static variable in class com.fasterxml.jackson.core.util.DefaultIndenter
-
 
-
SYSTEM_LINEFEED_INSTANCE - Static variable in class com.fasterxml.jackson.core.util.DefaultIndenter
-
 
-
SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS - Static variable in class com.fasterxml.jackson.core.util.BufferRecyclers
-
-
System property that is checked to see if recycled buffers (see BufferRecycler) - should be tracked, for purpose of forcing release of all such buffers, typically - during major classloading.
-
-
- - - -

T

-
-
tail() - Method in class com.fasterxml.jackson.core.JsonPointer
-
-
Accessor for getting a "sub-pointer" (or sub-path), instance where current segment - has been removed and pointer includes rest of the segments.
-
-
takeSnapshot(Snapshottable<T>) - Static method in interface com.fasterxml.jackson.core.util.Snapshottable
-
 
-
tertiaryCount() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Method mostly needed by unit tests; calculates number of entries - in tertiary buckets
-
-
tertiaryQuadCount() - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
TextBuffer - Class in com.fasterxml.jackson.core.util
-
-
TextBuffer is a class similar to StringBuffer, with - following differences: - - TextBuffer uses segments character arrays, to avoid having - to do additional array copies when array is not big enough.
-
-
TextBuffer(BufferRecycler) - Constructor for class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
TextBuffer(BufferRecycler, char[]) - Constructor for class com.fasterxml.jackson.core.util.TextBuffer
-
 
-
TextualTSFactory - Class in com.fasterxml.jackson.core.base
-
-
Intermediate TokenStreamFactory sub-class used as the base for - textual data formats.
-
-
TextualTSFactory(int, int) - Constructor for class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
TextualTSFactory(DecorableTSFactory.DecorableTSFBuilder<?, ?>) - Constructor for class com.fasterxml.jackson.core.base.TextualTSFactory
-
-
Constructors used by builders for instantiation.
-
-
TextualTSFactory(TextualTSFactory) - Constructor for class com.fasterxml.jackson.core.base.TextualTSFactory
-
-
Copy constructor.
-
-
throwInternal() - Static method in class com.fasterxml.jackson.core.util.VersionUtil
-
 
-
toByteArray() - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
-
Method called when results are finalized and we can get the - full aggregated result buffer to return to the caller
-
-
toCanonical() - Method in class com.fasterxml.jackson.core.type.ResolvedType
-
-
Method that can be used to serialize type into form from which - it can be fully deserialized from at a later point (using - TypeFactory from mapper package).
-
-
toFullString() - Method in class com.fasterxml.jackson.core.Version
-
 
-
TokenFilter - Class in com.fasterxml.jackson.core.filter
-
-
Strategy class that can be implemented to specify actual inclusion/exclusion - criteria for filtering, used by FilteringGeneratorDelegate.
-
-
TokenFilter() - Constructor for class com.fasterxml.jackson.core.filter.TokenFilter
-
 
-
TokenFilter.Inclusion - Enum in com.fasterxml.jackson.core.filter
-
-
Enumeration that controls how TokenFilter return values are interpreted.
-
-
TokenFilterContext - Class in com.fasterxml.jackson.core.filter
-
-
Alternative variant of TokenStreamContext, used when filtering - content being read or written (based on TokenFilter).
-
-
TokenFilterContext(int, TokenFilterContext, TokenFilter, Object, boolean) - Constructor for class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
TokenStreamContext - Class in com.fasterxml.jackson.core
-
-
Shared base class for streaming processing contexts used during - reading and writing of token streams using Streaming API.
-
-
TokenStreamContext() - Constructor for class com.fasterxml.jackson.core.TokenStreamContext
-
 
-
TokenStreamContext(TokenStreamContext) - Constructor for class com.fasterxml.jackson.core.TokenStreamContext
-
-
Copy constructor used by sub-classes for creating copies for buffering.
-
-
TokenStreamContext(int, int) - Constructor for class com.fasterxml.jackson.core.TokenStreamContext
-
 
-
TokenStreamFactory - Class in com.fasterxml.jackson.core
-
-
The main factory class of Jackson streaming package, used to configure and - construct token reader (aka parser, JsonParser) - and token writer (aka generator, JsonGenerator) - instances.
-
-
TokenStreamFactory(int, int) - Constructor for class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Default constructor used to create factory instances.
-
-
TokenStreamFactory(TokenStreamFactory.TSFBuilder<?, ?>) - Constructor for class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Constructors used by TokenStreamFactory.TSFBuilder for instantiation.
-
-
TokenStreamFactory(TokenStreamFactory) - Constructor for class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Constructor used if a snapshot is created, or possibly for sub-classing or - wrapping (delegating)
-
-
TokenStreamFactory.Feature - Enum in com.fasterxml.jackson.core
-
-
Enumeration that defines all on/off features that can only be - changed for TokenStreamFactory.
-
-
TokenStreamFactory.TSFBuilder<F extends TokenStreamFactory,B extends TokenStreamFactory.TSFBuilder<F,B>> - Class in com.fasterxml.jackson.core
-
-
Since factory instances are immutable, a Builder class is needed for creating - configurations for differently configured factory instances.
-
-
toString() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
toString() - Method in class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
-
 
-
toString() - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
 
-
toString() - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
-
Overridden to provide developer writeable "JsonPath" representation - of the context.
-
-
toString() - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
toString() - Method in exception com.fasterxml.jackson.core.JacksonException
-
 
-
toString() - Method in class com.fasterxml.jackson.core.JsonLocation
-
 
-
toString(StringBuilder) - Method in class com.fasterxml.jackson.core.JsonLocation
-
 
-
toString() - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
toString() - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
toString() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
toString() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Overridden to provide developer readable "JsonPath" representation - of the context.
-
-
toString() - Method in class com.fasterxml.jackson.core.util.Named.StringAsNamed
-
 
-
toString() - Method in class com.fasterxml.jackson.core.util.RequestPayload
-
 
-
toString() - Method in class com.fasterxml.jackson.core.util.TextBuffer
-
-
Note: calling this method may not be as efficient as calling - TextBuffer.contentsAsString(), since it's not guaranteed that resulting - String is cached.
-
-
toString() - Method in class com.fasterxml.jackson.core.Version
-
 
-
totalCount() - Method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
totalCount() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
traverse(ObjectReadContext) - Method in interface com.fasterxml.jackson.core.TreeNode
-
-
Method for constructing a JsonParser instance for - iterating over contents of the tree that this node is root of.
-
-
treeAsTokens(TreeNode) - Method in interface com.fasterxml.jackson.core.ObjectReadContext
-
-
Convenience method for traversing over given TreeNode by exposing - contents as a JsonParser.
-
-
treeAsTokens(TreeNode) - Method in interface com.fasterxml.jackson.core.TreeCodec
-
 
-
TreeCodec - Interface in com.fasterxml.jackson.core
-
-
Interface that defines objects that can read and write - TreeNode instances using Streaming API.
-
-
TreeNode - Interface in com.fasterxml.jackson.core
-
-
Marker interface used to denote JSON Tree nodes, as far as - the core package knows them (which is very little): mostly - needed to allow ObjectReadContext and ObjectWriteContext - to have some level of interoperability.
-
-
TSFBuilder(int, int) - Constructor for class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
TSFBuilder(TokenStreamFactory) - Constructor for class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
TSFBuilder(int, int, int, int, int) - Constructor for class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
TYPE_ARRAY - Static variable in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Indicator for "Array" context.
-
-
TYPE_OBJECT - Static variable in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Indicator for "Object" context.
-
-
TYPE_ROOT - Static variable in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Indicator for "Root Value" context (has not parent)
-
-
typeDesc() - Method in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Method for accessing simple type description of current context; - either ROOT (for root-level values), OBJECT (for field names and - values of JSON Objects) or ARRAY (for values of JSON Arrays)
-
-
TypeReference<T> - Class in com.fasterxml.jackson.core.type
-
-
This generic abstract class is used for obtaining full generics type information - by sub-classing; it must be converted to ResolvedType implementation - (implemented by JavaType from "databind" bundle) to be used.
-
-
TypeReference() - Constructor for class com.fasterxml.jackson.core.type.TypeReference
-
 
-
- - - -

U

-
-
unexpectedPaddingMessage() - Method in class com.fasterxml.jackson.core.Base64Variant
-
-
Helper method that will construct a message to use in exceptions for cases where input ends - prematurely in place where padding is not expected.
-
-
unknownVersion() - Static method in class com.fasterxml.jackson.core.Version
-
-
Method returns canonical "not known" version, which is used as version - in cases where actual version information is not known (instead of null).
-
-
usesPadding() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
usesPaddingChar(char) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
usesPaddingChar(int) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
UTF32Reader - Class in com.fasterxml.jackson.core.io
-
-
Since JDK does not come with UTF-32/UCS-4, let's implement a simple - decoder to use.
-
-
UTF32Reader(IOContext, InputStream, boolean, byte[], int, int, boolean) - Constructor for class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
UTF8_BOM_1 - Static variable in class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
 
-
UTF8_BOM_2 - Static variable in class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
 
-
UTF8_BOM_3 - Static variable in class com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper
-
 
-
UTF8DataInputJsonParser - Class in com.fasterxml.jackson.core.json
-
-
This is a concrete implementation of JsonParser, which is - based on a DataInput as the input source.
-
-
UTF8DataInputJsonParser(ObjectReadContext, IOContext, int, int, DataInput, ByteQuadsCanonicalizer, int) - Constructor for class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
UTF8JsonGenerator - Class in com.fasterxml.jackson.core.json
-
 
-
UTF8JsonGenerator(ObjectWriteContext, IOContext, int, int, OutputStream, SerializableString, CharacterEscapes, PrettyPrinter, int, char) - Constructor for class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
UTF8JsonGenerator(ObjectWriteContext, IOContext, int, int, OutputStream, SerializableString, CharacterEscapes, PrettyPrinter, int, char, byte[], int, boolean) - Constructor for class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
UTF8StreamJsonParser - Class in com.fasterxml.jackson.core.json
-
-
This is a concrete implementation of JsonParser, which is - based on a InputStream as the input source.
-
-
UTF8StreamJsonParser(ObjectReadContext, IOContext, int, int, InputStream, ByteQuadsCanonicalizer, byte[], int, int, int, boolean) - Constructor for class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
UTF8Writer - Class in com.fasterxml.jackson.core.io
-
 
-
UTF8Writer(IOContext, OutputStream) - Constructor for class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
- - - -

V

-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.Base64Variant.PaddingReadBehaviour
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in class com.fasterxml.jackson.core.Base64Variants
-
-
Lookup method for finding one of standard variants by name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.filter.TokenFilter.Inclusion
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.json.JsonReadFeature
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.json.JsonWriteFeature
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.JsonEncoding
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.JsonParser.NumberType
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in class com.fasterxml.jackson.core.JsonPointer
-
-
Alias for JsonPointer.compile(java.lang.String); added to make instances automatically - deserializable by Jackson databind.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.JsonToken
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.StreamReadCapability
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.StreamReadFeature
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.StreamWriteCapability
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.StreamWriteFeature
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.TokenStreamFactory.Feature
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum com.fasterxml.jackson.core.type.WritableTypeId.Inclusion
-
-
Returns the enum constant of this type with the specified name.
-
-
valueRead() - Method in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
-
Method to call to advance index within current context: to be called - when a new token found within current context (field name for objects, - value for root and array contexts)
-
-
values() - Static method in enum com.fasterxml.jackson.core.Base64Variant.PaddingReadBehaviour
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.filter.TokenFilter.Inclusion
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.json.JsonReadFeature
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.json.JsonWriteFeature
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.JsonEncoding
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.JsonParser.NumberType
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.JsonToken
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.StreamReadCapability
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.StreamReadFeature
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.StreamWriteCapability
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.StreamWriteFeature
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.TokenStreamFactory.Feature
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum com.fasterxml.jackson.core.type.WritableTypeId.Inclusion
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
valueShape - Variable in class com.fasterxml.jackson.core.type.WritableTypeId
-
-
Information about intended shape of the value being written (that is, WritableTypeId.forValue); - in case of structured values, start token of the structure; for scalars, value token.
-
-
verifyInternalConsistency() - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
version() - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
version() - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
version() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
VERSION - Static variable in class com.fasterxml.jackson.core.json.PackageVersion
-
 
-
version() - Method in class com.fasterxml.jackson.core.json.PackageVersion
-
 
-
version() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Accessor for finding out version of the bundle that provided this generator instance.
-
-
version() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Accessor for getting version of the core package, given a parser instance.
-
-
version() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
 
-
version() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
version() - Method in class com.fasterxml.jackson.core.util.JsonParserDelegate
-
 
-
Version - Class in com.fasterxml.jackson.core
-
-
Object that encapsulates versioning information of a component.
-
-
Version(int, int, int, String, String, String) - Constructor for class com.fasterxml.jackson.core.Version
-
 
-
version() - Method in interface com.fasterxml.jackson.core.Versioned
-
-
Method called to detect version of the component that implements this interface; - returned version should never be null, but may return specific "not available" - instance (see Version for details).
-
-
Versioned - Interface in com.fasterxml.jackson.core
-
-
Interface that those Jackson components that are explicitly versioned will implement.
-
-
versionFor(Class<?>) - Static method in class com.fasterxml.jackson.core.util.VersionUtil
-
-
Helper method that will try to load version information for specified - class.
-
-
VersionUtil - Class in com.fasterxml.jackson.core.util
-
-
Functionality for supporting exposing of component Versions.
-
-
VersionUtil() - Constructor for class com.fasterxml.jackson.core.util.VersionUtil
-
 
-
- - - -

W

-
-
with(F) - Method in class com.fasterxml.jackson.core.util.JacksonFeatureSet
-
-
Mutant factory for getting a set in which specified feature is enabled: - will either return this instance (if no change), or newly created set (if there - is change).
-
-
withArrayIndenter(DefaultPrettyPrinter.Indenter) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
withArrayValueSeparator(char) - Method in class com.fasterxml.jackson.core.util.Separators
-
 
-
withDupDetector(DupDetector) - Method in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
withDupDetector(DupDetector) - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
withDupDetector(DupDetector) - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
withGenerator(JsonGenerator) - Method in exception com.fasterxml.jackson.core.JsonGenerationException
-
-
Fluent method that may be used to assign originating JsonGenerator, - to be accessed using JsonGenerationException.getProcessor().
-
-
withIndent(String) - Method in class com.fasterxml.jackson.core.util.DefaultIndenter
-
 
-
withLinefeed(String) - Method in class com.fasterxml.jackson.core.util.DefaultIndenter
-
 
-
withObjectEntrySeparator(char) - Method in class com.fasterxml.jackson.core.util.Separators
-
 
-
withObjectFieldValueSeparator(char) - Method in class com.fasterxml.jackson.core.util.Separators
-
 
-
withObjectIndenter(DefaultPrettyPrinter.Indenter) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
without(F) - Method in class com.fasterxml.jackson.core.util.JacksonFeatureSet
-
-
Mutant factory for getting a set in which specified feature is disabled: - will either return this instance (if no change), or newly created set (if there - is change).
-
-
withoutSpacesInObjectEntries() - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
"Mutant factory" method that will return a pretty printer instance - that does not use spaces inside object entries; if 'this' instance already - does this, it is returned; if not, a new instance will be constructed - and returned.
-
-
withPaddingAllowed() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
withPaddingForbidden() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
withPaddingRequired() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
withParser(JsonParser) - Method in exception com.fasterxml.jackson.core.exc.InputCoercionException
-
-
Fluent method that may be used to assign originating JsonParser, - to be accessed using StreamReadException.getProcessor().
-
-
withParser(JsonParser) - Method in exception com.fasterxml.jackson.core.exc.StreamReadException
-
-
Fluent method that may be used to assign originating JsonParser, - to be accessed using StreamReadException.getProcessor().
-
-
withParser(JsonParser) - Method in exception com.fasterxml.jackson.core.JsonParseException
-
-
Fluent method that may be used to assign originating JsonParser, - to be accessed using StreamReadException.getProcessor().
-
-
withReadPadding(Base64Variant.PaddingReadBehaviour) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
withRequestPayload(RequestPayload) - Method in exception com.fasterxml.jackson.core.exc.InputCoercionException
-
 
-
withRequestPayload(RequestPayload) - Method in exception com.fasterxml.jackson.core.exc.StreamReadException
-
-
Fluent method that may be used to assign payload to this exception, - to let recipient access it for diagnostics purposes.
-
-
withRequestPayload(RequestPayload) - Method in exception com.fasterxml.jackson.core.JsonParseException
-
-
Fluent method that may be used to assign payload to this exception, - to let recipient access it for diagnostics purposes.
-
-
withRootSeparator(SerializableString) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
withRootSeparator(String) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
withSeparators(Separators) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
Method for configuring separators for this pretty-printer to use
-
-
withSpacesInObjectEntries() - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
"Mutant factory" method that will return a pretty printer instance - that does use spaces inside object entries; if 'this' instance already - does this, it is returned; if not, a new instance will be constructed - and returned.
-
-
withWritePadding(boolean) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
wrapperWritten - Variable in class com.fasterxml.jackson.core.type.WritableTypeId
-
-
Flag that can be set to indicate that wrapper structure was written (during - prefix-writing); used to determine if suffix requires matching close markers.
-
-
WritableTypeId - Class in com.fasterxml.jackson.core.type
-
-
This is a simple value class used between core streaming and higher level - databinding to pass information about type ids to write.
-
-
WritableTypeId() - Constructor for class com.fasterxml.jackson.core.type.WritableTypeId
-
 
-
WritableTypeId(Object, JsonToken) - Constructor for class com.fasterxml.jackson.core.type.WritableTypeId
-
-
Constructor used when calling a method for generating and writing Type Id; - caller only knows value object and its intended shape.
-
-
WritableTypeId(Object, Class<?>, JsonToken) - Constructor for class com.fasterxml.jackson.core.type.WritableTypeId
-
-
Constructor used when calling a method for generating and writing Type Id, - but where actual type to use for generating id is NOT the type of value - (but its supertype).
-
-
WritableTypeId(Object, JsonToken, Object) - Constructor for class com.fasterxml.jackson.core.type.WritableTypeId
-
-
Constructor used when calling a method for writing Type Id; - caller knows value object, its intended shape as well as id to - use; but not details of wrapping (if any).
-
-
WritableTypeId.Inclusion - Enum in com.fasterxml.jackson.core.type
-
-
Enumeration of values that matches enum `As` from annotation - `JsonTypeInfo`: separate definition to avoid dependency between - streaming core and annotations packages; also allows more flexibility - in case new values needed at this level of internal API.
-
-
write(int) - Method in class com.fasterxml.jackson.core.io.DataOutputAsStream
-
 
-
write(byte[]) - Method in class com.fasterxml.jackson.core.io.DataOutputAsStream
-
 
-
write(byte[], int, int) - Method in class com.fasterxml.jackson.core.io.DataOutputAsStream
-
 
-
write(char[]) - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
write(char[], int, int) - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
write(int) - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
write(String) - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
write(String, int, int) - Method in class com.fasterxml.jackson.core.io.SegmentedStringWriter
-
 
-
write(char[]) - Method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
write(char[], int, int) - Method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
write(int) - Method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
write(String) - Method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
write(String, int, int) - Method in class com.fasterxml.jackson.core.io.UTF8Writer
-
 
-
write(byte[]) - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
write(byte[], int, int) - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
write(int) - Method in class com.fasterxml.jackson.core.util.ByteArrayBuilder
-
 
-
WRITE_BINARY - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
WRITE_BOOLEAN - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
WRITE_NULL - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
WRITE_NUMBER - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
WRITE_RAW - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
WRITE_STRING - Static variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeArray(int[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_INT, JsonToken.END_ARRAY)
-
-
writeArray(long[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_INT, JsonToken.END_ARRAY)
-
-
writeArray(double[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_NUMBER_FLOAT, JsonToken.END_ARRAY)
-
-
writeArray(String[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Value write method that can be called to write a single - array (sequence of JsonToken.START_ARRAY, zero or - more JsonToken.VALUE_STRING, JsonToken.END_ARRAY)
-
-
writeArray(int[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeArray(long[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeArray(double[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeArray(String[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeArrayFieldStart(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - (that will contain a JSON Array value), and the START_ARRAY marker.
-
-
writeArrayValueSeparator(JsonGenerator) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called after an array value has been completely - output, and before another value is to be output.
-
-
writeArrayValueSeparator(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
Method called after an array value has been completely - output, and before another value is to be output.
-
-
writeArrayValueSeparator(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
-
Method called after an array value has been completely - output, and before another value is to be output.
-
-
writeBinary(Base64Variant, InputStream, int) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeBinary(Base64Variant, byte[], int, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeBinary(Base64Variant, InputStream, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeBinary(Base64Variant, byte[], int, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeBinary(Base64Variant, InputStream, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeBinary(Base64Variant, byte[], int, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeBinary(Base64Variant, InputStream, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeBinary(Base64Variant, byte[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that will output given chunk of binary data as base64 - encoded, as a complete String value (surrounded by double quotes).
-
-
writeBinary(byte[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Similar to JsonGenerator.writeBinary(Base64Variant,byte[],int,int), - but default to using the Jackson default Base64 variant - (which is Base64Variants.MIME_NO_LINEFEEDS).
-
-
writeBinary(byte[]) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Similar to JsonGenerator.writeBinary(Base64Variant,byte[],int,int), - but assumes default to using the Jackson default Base64 variant - (which is Base64Variants.MIME_NO_LINEFEEDS).
-
-
writeBinary(InputStream, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Similar to JsonGenerator.writeBinary(Base64Variant,InputStream,int), - but assumes default to using the Jackson default Base64 variant - (which is Base64Variants.MIME_NO_LINEFEEDS).
-
-
writeBinary(Base64Variant, InputStream, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method similar to JsonGenerator.writeBinary(Base64Variant,byte[],int,int), - but where input is provided through a stream, allowing for incremental - writes without holding the whole input in memory.
-
-
writeBinary(Base64Variant, byte[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeBinary(Base64Variant, InputStream, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeBinaryField(String, byte[]) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that contains specified data in base64-encoded form.
-
-
writeBoolean(boolean) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeBoolean(boolean) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeBoolean(boolean) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeBoolean(boolean) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting literal JSON boolean value (one of - Strings 'true' and 'false').
-
-
writeBoolean(boolean) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeBooleanField(String, boolean) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has a boolean value.
-
-
writeEmbeddedObject(Object) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that can be called on backends that support passing opaque native - values that some data formats support; not used with JSON backend, - more common with binary formats.
-
-
writeEmbeddedObject(Object) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeEndArray() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeEndArray() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeEndArray() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeEndArray() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing closing marker of a JSON Array value - (character ']'; plus possible white space decoration - if pretty-printing is enabled).
-
-
writeEndArray(JsonGenerator, int) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called after an Array value has been completely output - (minus closing bracket).
-
-
writeEndArray(JsonGenerator, int) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
writeEndArray() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeEndArray(JsonGenerator, int) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
writeEndObject() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeEndObject() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeEndObject() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeEndObject() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing closing marker of an Object value - (character '}'; plus possible white space decoration - if pretty-printing is enabled).
-
-
writeEndObject(JsonGenerator, int) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called after an Object value has been completely output - (minus closing curly bracket).
-
-
writeEndObject(JsonGenerator, int) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
writeEndObject() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeEndObject(JsonGenerator, int) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
writeFieldId(long) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeFieldId(long) - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
writeFieldId(long) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Alternative to JsonGenerator.writeFieldName(String) that may be used - in cases where property key is of numeric type; either where - underlying format supports such notion (some binary formats do, - unlike JSON), or for convenient conversion into String presentation.
-
-
writeFieldId(long) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeFieldName(String) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeFieldName(String) - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
-
Method that writer is to call before it writes a field name.
-
-
writeFieldName(String) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeFieldName(String) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeFieldName(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing a field name (JSON String surrounded by - double quotes: syntactically identical to a JSON String value), - possibly decorated by white space if pretty-printing is enabled.
-
-
writeFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method similar to JsonGenerator.writeFieldName(String), main difference - being that it may perform better as some of processing (such as - quoting of certain characters, or encoding into external encoding - if supported by generator) can be done just once and reused for - later calls.
-
-
writeFieldName(String) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeFieldName(String) - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
-
Method that writer is to call before it writes a field name.
-
-
writeIndentation(JsonGenerator, int) - Method in class com.fasterxml.jackson.core.util.DefaultIndenter
-
 
-
writeIndentation(JsonGenerator, int) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.FixedSpaceIndenter
-
 
-
writeIndentation(JsonGenerator, int) - Method in interface com.fasterxml.jackson.core.util.DefaultPrettyPrinter.Indenter
-
 
-
writeIndentation(JsonGenerator, int) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter.NopIndenter
-
 
-
writeNull() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNull() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNull() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNull() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting literal JSON null value.
-
-
writeNull() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNullField(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has JSON literal value null.
-
-
writeNumber(short) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNumber(int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNumber(long) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNumber(BigInteger) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNumber(double) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNumber(float) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNumber(BigDecimal) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNumber(String) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNumber(char[], int, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeNumber(short) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNumber(int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNumber(long) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNumber(BigInteger) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNumber(double) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNumber(float) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNumber(BigDecimal) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNumber(String) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNumber(char[], int, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeNumber(short) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNumber(int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNumber(long) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNumber(BigInteger) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNumber(double) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNumber(float) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNumber(BigDecimal) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNumber(String) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNumber(char[], int, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeNumber(short) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting given value as JSON number.
-
-
writeNumber(int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting given value as JSON number.
-
-
writeNumber(long) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting given value as JSON number.
-
-
writeNumber(BigInteger) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting given value as JSON number.
-
-
writeNumber(double) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting indicate JSON numeric value.
-
-
writeNumber(float) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting indicate JSON numeric value.
-
-
writeNumber(BigDecimal) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting indicate JSON numeric value.
-
-
writeNumber(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Write method that can be used for custom numeric types that can - not be (easily?) converted to "standard" Java number types.
-
-
writeNumber(char[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Overloaded version of JsonGenerator.writeNumber(String) with same semantics - but possibly more efficient operation.
-
-
writeNumber(short) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNumber(int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNumber(long) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNumber(BigInteger) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNumber(double) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNumber(float) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNumber(BigDecimal) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNumber(String) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNumber(char[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeNumberField(String, short) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has the specified numeric value.
-
-
writeNumberField(String, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has the specified numeric value.
-
-
writeNumberField(String, long) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has the specified numeric value.
-
-
writeNumberField(String, BigInteger) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has the specified numeric value.
-
-
writeNumberField(String, float) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has the specified numeric value.
-
-
writeNumberField(String, double) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has the specified numeric value.
-
-
writeNumberField(String, BigDecimal) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has the specified numeric value.
-
-
writeObject(Object) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeObject(Object) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing given Java object (POJO) as tokens into - stream this generator manages.
-
-
writeObject(Object) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeObjectEntrySeparator(JsonGenerator) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called after an Object entry (field:value) has been completely - output, and before another value is to be output.
-
-
writeObjectEntrySeparator(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
Method called after an object entry (field:value) has been completely - output, and before another value is to be output.
-
-
writeObjectEntrySeparator(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
-
Method called after an object entry (field:value) has been completely - output, and before another value is to be output.
-
-
writeObjectField(String, Object) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has contents of specific Java object as its value.
-
-
writeObjectFieldStart(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - (that will contain an Object value), and the START_OBJECT marker.
-
-
writeObjectFieldValueSeparator(JsonGenerator) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called after an object field has been output, but - before the value is output.
-
-
writeObjectFieldValueSeparator(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
Method called after an object field has been output, but - before the value is output.
-
-
writeObjectFieldValueSeparator(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
-
Method called after an object field has been output, but - before the value is output.
-
-
writeObjectId(Object) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeObjectId(Object) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that can be called to output so-called native Object Id.
-
-
writeObjectId(Object) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeObjectRef(Object) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeObjectRef(Object) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that can be called to output references to native Object Ids.
-
-
writeObjectRef(Object) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeOmittedField(String) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeOmittedField(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method called to indicate that a property in this position was - skipped.
-
-
writeOmittedField(String) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writePath(JsonGenerator) - Method in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
-
Method called to ensure that parent path from root is written up to - and including this node.
-
-
writeQuotedUTF8(OutputStream) - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
writeQuotedUTF8(OutputStream) - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Method for writing JSON-escaped UTF-8 encoded String value using given - OutputStream.
-
-
writeRaw(String) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeRaw(String, int, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeRaw(SerializableString) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeRaw(char[], int, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeRaw(char) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeRaw(String) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeRaw(String, int, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeRaw(SerializableString) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeRaw(char[], int, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeRaw(char) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeRaw(String) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeRaw(String, int, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeRaw(SerializableString) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeRaw(char[], int, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeRaw(char) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeRaw(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
-
-
writeRaw(String, int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
-
-
writeRaw(char[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
-
-
writeRaw(char) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
-
-
writeRaw(SerializableString) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that will force generator to copy - input text verbatim with no modifications (including - that no escaping is done and no separators are added even - if context [array, object] would otherwise require such).
-
-
writeRaw(String) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeRaw(String, int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeRaw(SerializableString) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeRaw(char[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeRaw(char) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeRawUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeRawUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeRawUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeRawUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method similar to JsonGenerator.writeString(String) but that takes as - its input a UTF-8 encoded String that is to be output as-is, without additional - escaping (type of which depends on data format; backslashes for JSON).
-
-
writeRawUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeRawValue(String) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeRawValue(String, int, int) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeRawValue(char[], int, int) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeRawValue(SerializableString) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeRawValue(String) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeRawValue(String, int, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeRawValue(char[], int, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeRawValue(SerializableString) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeRawValue(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that will force generator to copy - input text verbatim without any modifications, but assuming - it must constitute a single legal JSON value (number, string, - boolean, null, Array or List).
-
-
writeRawValue(String, int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
 
-
writeRawValue(char[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
 
-
writeRawValue(SerializableString) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method similar to JsonGenerator.writeRawValue(String), but potentially more - efficient as it may be able to use pre-encoded content (similar to - JsonGenerator.writeRaw(SerializableString).
-
-
writeRawValue(String) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeRawValue(String, int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeRawValue(char[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
WriterBasedJsonGenerator - Class in com.fasterxml.jackson.core.json
-
-
JsonGenerator that outputs JSON content using a Writer - which handles character encoding.
-
-
WriterBasedJsonGenerator(ObjectWriteContext, IOContext, int, int, Writer, SerializableString, PrettyPrinter, CharacterEscapes, int, char) - Constructor for class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeRootValueSeparator(JsonGenerator) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called after a root-level value has been completely - output, and before another value is to be output.
-
-
writeRootValueSeparator(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
writeRootValueSeparator(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
writeStartArray(Object, int) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeStartArray() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeStartArray(Object) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeStartArray(Object, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeStartArray(Object, int) - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
writeStartArray() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeStartArray(Object) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeStartArray(Object, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeStartArray() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeStartArray(Object) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeStartArray(Object, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeStartArray() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing starting marker of a Array value - (for JSON this is character '['; plus possible white space decoration - if pretty-printing is enabled).
-
-
writeStartArray(Object) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any); - null may be passed if not known or not applicable.
-
-
writeStartArray(Object, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing start marker of an Array value, similar - to JsonGenerator.writeStartArray(), but also specifying what is the - Java object that the Array Object being written represents (if any) - and how many elements will be written for the array before calling - JsonGenerator.writeEndArray().
-
-
writeStartArray(JsonGenerator) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called when an Array value is to be output, before - any member/child values are output.
-
-
writeStartArray(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
writeStartArray() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeStartArray(Object) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeStartArray(Object, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeStartArray(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
writeStartObject(Object, int) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeStartObject() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeStartObject(Object) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeStartObject(Object, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeStartObject(Object, int) - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
writeStartObject() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeStartObject(Object) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeStartObject(Object, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeStartObject() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeStartObject(Object) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeStartObject(Object, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeStartObject() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing starting marker of an Object value - (character '{'; plus possible white space decoration - if pretty-printing is enabled).
-
-
writeStartObject(Object) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing starting marker of an Object value - to represent the given Java Object value.
-
-
writeStartObject(Object, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing starting marker of an Object value - to represent the given Java Object value.
-
-
writeStartObject(JsonGenerator) - Method in interface com.fasterxml.jackson.core.PrettyPrinter
-
-
Method called when an Object value is to be output, before - any fields are output.
-
-
writeStartObject(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
writeStartObject() - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeStartObject(Object) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeStartObject(Object, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeStartObject(JsonGenerator) - Method in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
writeString(SerializableString) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeString(String) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeString(char[], int, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeString(SerializableString) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeString(Reader, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeString(String) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeString(Reader, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeString(char[], int, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeString(SerializableString) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeString(String) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeString(Reader, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeString(char[], int, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeString(SerializableString) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeString(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting a String value.
-
-
writeString(Reader, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting a String value.
-
-
writeString(char[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for outputting a String value.
-
-
writeString(SerializableString) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method similar to JsonGenerator.writeString(String), but that takes - SerializableString which can make this potentially - more efficient to call as generator may be able to reuse - quoted and/or encoded representation.
-
-
writeString(String) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeString(Reader, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeString(char[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeString(SerializableString) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeStringField(String, String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Convenience method for outputting a field entry ("member") - that has a String value.
-
-
writeTree(TreeNode) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
writeTree(TreeNode) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method for writing given JSON tree (expressed as a tree - where given TreeNode is the root) using this generator.
-
-
writeTree(JsonGenerator, TreeNode) - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
writeTree(JsonGenerator, TreeNode) - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
 
-
writeTree(JsonGenerator, TreeNode) - Method in interface com.fasterxml.jackson.core.TreeCodec
-
 
-
writeTree(TreeNode) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeTypeId(Object) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeTypeId(Object) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method that can be called to output so-called native Type Id.
-
-
writeTypeId(Object) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeTypePrefix(WritableTypeId) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Replacement method for JsonGenerator.writeTypeId(Object) which is called - regardless of whether format has native type ids.
-
-
writeTypeSuffix(WritableTypeId) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
 
-
writeUnquotedUTF8(OutputStream) - Method in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
writeUnquotedUTF8(OutputStream) - Method in interface com.fasterxml.jackson.core.SerializableString
-
-
Method for writing unescaped UTF-8 encoded String value using given - OutputStream.
-
-
writeUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
writeUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
writeUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
writeUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Method similar to JsonGenerator.writeString(String) but that takes as its input - a UTF-8 encoded String which has not been escaped using whatever - escaping scheme data format requires (for JSON that is backslash-escaping - for control characters and double-quotes; for other formats something else).
-
-
writeUTF8String(byte[], int, int) - Method in class com.fasterxml.jackson.core.util.JsonGeneratorDelegate
-
 
-
writeValue() - Method in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
writeValue(JsonGenerator, Object) - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
writeValue(JsonGenerator, Object) - Method in interface com.fasterxml.jackson.core.ObjectWriteContext
-
-
Method that may be called to serialize given value, using specified - token stream generator.
-
-
writeValue() - Method in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
- - - -

_

-
-
_addName(int[], int, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
This is the main workhorse method used when we take a symbol - table miss.
-
-
_allowMultipleMatches - Variable in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
-
Flag that determines whether filtering will continue after the first - match is indicated or not: if `false`, output is based on just the first - full match (returning TokenFilter.INCLUDE_ALL) and no more - checks are made; if `true` then filtering will be applied as necessary - until end of content.
-
-
_allowMultipleMatches - Variable in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Flag that determines whether filtering will continue after the first - match is indicated or not: if `false`, output is based on just the first - full match (returning TokenFilter.INCLUDE_ALL) and no more - checks are made; if `true` then filtering will be applied as necessary - until end of content.
-
-
_appendSourceDesc(StringBuilder) - Method in class com.fasterxml.jackson.core.JsonLocation
-
 
-
_arrayIndenter - Variable in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
By default, let's use only spaces to separate array values.
-
-
_artifactId - Variable in class com.fasterxml.jackson.core.Version
-
 
-
_asString(BigDecimal) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Helper method used to serialize a BigDecimal as a String, - for serialization, taking into account configuration settings
-
-
_asString - Variable in class com.fasterxml.jackson.core.JsonPointer
-
-
We will retain representation of the pointer, as a String, - so that JsonPointer.toString() should be as efficient as possible.
-
-
_backupMatcher - Variable in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
_base64Buffer - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Reference to the buffer allocated for temporary use with - base64 encoding or decoding.
-
-
_bigEndian - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
_binaryValue - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
We will hold on to decoded binary data, for duration of - current event, so that multiple calls to - ParserBase.getBinaryValue(com.fasterxml.jackson.core.Base64Variant) will not need to decode data more - than once.
-
-
_buckets - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Overflow buckets; if primary doesn't match, lookup is done - from here.
-
-
_buffer - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
_bufferRecyclable - Variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Flag that indicates whether the input buffer is recycable (and - needs to be returned to recycler once we are done) or not.
-
-
_bufferRecyclable - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
Flag that indicates whether the output buffer is recycable (and - needs to be returned to recycler once we are done) or not.
-
-
_bufferRecyclable - Variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Flag that indicates whether the input buffer is recycable (and - needs to be returned to recycler once we are done) or not.
-
-
_bufferRecycler - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Recycler used for actual allocation/deallocation/reuse
-
-
_byteArrayBuilder - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
ByteArrayBuilder is needed if 'getBinaryValue' is called.
-
-
_byteBuffers - Variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
_byteCount - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
-
Total read byte count; used for error reporting purposes
-
-
_byteSymbolCanonicalizer - Variable in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Alternative to the basic symbol table, some stream-based - parsers use different name canonicalization method.
-
-
_canonicalize - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Whether any canonicalization should be attempted (whether using - intern or not.
-
-
_cfgNumbersAsStrings - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Flag set to indicate that implicit conversion from number - to JSON String is needed (as per - JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS).
-
-
_cfgPrettyPrinter - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Object that handles pretty-printing (usually additional - white space to make results more human-readable) during - output.
-
-
_cfgUnqNames - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Flag that is set if quoting is not to be added around - JSON Object property names.
-
-
_characterEscapes - Variable in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Definition of custom character escapes to use for generators created - by this factory, if any.
-
-
_characterEscapes - Variable in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
_characterEscapes - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Definition of custom character escapes to use for generators created - by this factory, if any.
-
-
_charBuffer - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
Intermediate buffer in which characters of a String are copied - before being encoded.
-
-
_charBufferLength - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
Length of _charBuffer
-
-
_charBuffers - Variable in class com.fasterxml.jackson.core.util.BufferRecycler
-
 
-
_charCount - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
-
Total read character count; used for error reporting purposes
-
-
_charset - Variable in class com.fasterxml.jackson.core.util.RequestPayload
-
 
-
_checkBinaryWrite() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
_checkForExistingToken - Variable in class com.fasterxml.jackson.core.util.JsonParserSequence
-
-
Configuration that determines whether state of parsers is first verified - to see if parser already points to a token (that is, - JsonParser.hasCurrentToken() returns true), and if so - that token is first return before JsonParser.nextToken() is called.
-
-
_checkParentPath() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
_checkParentPath(boolean) - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
_checkPropertyParentPath() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
-
Specialized variant of FilteringGeneratorDelegate._checkParentPath() used when checking - parent for a property name to be included with value: rules are slightly - different.
-
-
_checkRawValueWrite() - Method in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
 
-
_child - Variable in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
_child - Variable in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
_child - Variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
_childToRecycle - Variable in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
_childToRecycle - Variable in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
_closeArrayScope() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_closed - Variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Flag that indicates whether generator is closed or not.
-
-
_closed - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Flag that indicates whether parser is closed or not.
-
-
_closeInput() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_closeInput() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_closeInput() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_closeInput() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_closeInput() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_closeObjectScope() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_columnNr - Variable in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
_columnNr - Variable in class com.fasterxml.jackson.core.JsonLocation
-
 
-
_columnNr - Variable in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
_concatCBuffer - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Reference to the buffer allocated for buffering it for - output, before being encoded: generally this means concatenating - output, then encoding when buffer fills up.
-
-
_constructDefaultPrettyPrinter() - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Overridable factory method called to instantiate an appropriate PrettyPrinter - for case of "just use the default one", when default pretty printer handling enabled.
-
-
_constructError(String) - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Helper method for constructing JsonParseExceptions - based on current state of the parser
-
-
_constructError(String, Object) - Method in class com.fasterxml.jackson.core.JsonParser
-
 
-
_constructError(String, Object, Object) - Method in class com.fasterxml.jackson.core.JsonParser
-
 
-
_constructError(String, Throwable) - Method in class com.fasterxml.jackson.core.JsonParser
-
 
-
_constructHead() - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
_constructHead(int, JsonPointer) - Method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
_constructInputCoercion(String, JsonToken, Class<?>) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_context - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
_copyBuffer - Variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
-
Intermediate buffer in which characters of a String are copied - before being encoded.
-
-
_copyCurrentContents(JsonParser) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
 
-
_count - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Total number of Strings in the symbol table; only used for child tables.
-
-
_createContext(Object, boolean) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Overridable factory method that actually instantiates desired - context object.
-
-
_createContext(Object, boolean, JsonEncoding) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Overridable factory method that actually instantiates desired - context object.
-
-
_createDataOutputWrapper(DataOutput) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
 
-
_createGenerator(ObjectWriteContext, IOContext, OutputStream) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
-
Overridable factory method that actually instantiates generator for - given OutputStream and context object, using UTF-8 encoding.
-
-
_createGenerator(ObjectWriteContext, IOContext, Writer) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
-
Overridable factory method that actually instantiates generator for - given Writer and context object.
-
-
_createGenerator(ObjectWriteContext, IOContext, Writer) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
_createNonBlockingContext(Object) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
_createParser(ObjectReadContext, IOContext, InputStream) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
_createParser(ObjectReadContext, IOContext, byte[], int, int) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
_createParser(ObjectReadContext, IOContext, DataInput) - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
_createParser(ObjectReadContext, IOContext, InputStream) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
_createParser(ObjectReadContext, IOContext, Reader) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
_createParser(ObjectReadContext, IOContext, byte[], int, int) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
_createParser(ObjectReadContext, IOContext, char[], int, int, boolean) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
_createParser(ObjectReadContext, IOContext, DataInput) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
_createParser(ObjectReadContext, IOContext, InputStream) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
_createParser(ObjectReadContext, IOContext, Reader) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
_createParser(ObjectReadContext, IOContext, char[], int, int, boolean) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
_createParser(ObjectReadContext, IOContext, byte[], int, int) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
_createParser(ObjectReadContext, IOContext, DataInput) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
_createUTF8Generator(ObjectWriteContext, IOContext, OutputStream) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
-
Overridable factory method that actually instantiates generator for - given OutputStream and context object, using UTF-8 encoding.
-
-
_createUTF8Generator(ObjectWriteContext, IOContext, OutputStream) - Method in class com.fasterxml.jackson.core.json.JsonFactory
-
 
-
_createWriter(IOContext, OutputStream, JsonEncoding) - Method in class com.fasterxml.jackson.core.base.TextualTSFactory
-
 
-
_currBufferStart - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Since we are fed content that may or may not start at zero offset, we need - to keep track of the first byte within that buffer, to be able to calculate - logical offset within input "stream"
-
-
_currentEscape - Variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
-
When custom escapes are used, this member variable is used - internally to hold a reference to currently used escape
-
-
_currentName - Variable in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
-
Name of the field of which value is to be parsed; only - used for OBJECT contexts
-
-
_currentName - Variable in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
_currentName - Variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
-
Name of the field of which value is to be written; only - used for OBJECT contexts
-
-
_currentName - Variable in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
_currentName - Variable in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
-
Name of the field of which value is to be written; only - used for OBJECT contexts
-
-
_currentValue - Variable in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
 
-
_currentValue - Variable in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
_currentValue - Variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
_currentValue - Variable in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
_currentValue - Variable in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
_currInputProcessed - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Number of characters/bytes that were contained in previous blocks - (blocks that were already processed prior to the current buffer).
-
-
_currInputRow - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Current row location of current point in input buffer, starting - from 1, if available.
-
-
_currInputRowAlt - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Alternate row tracker, used to keep track of position by `\r` marker - (whereas _currInputRow tracks `\n`).
-
-
_currInputRowStart - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Current index of the first character of the current row in input - buffer.
-
-
_currToken - Variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Last token retrieved via JsonParser.nextToken(), if any.
-
-
_currToken - Variable in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Last token retrieved via FilteringParserDelegate.nextToken(), if any.
-
-
_decodeBase64(String, ByteArrayBuilder, Base64Variant) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Helper method that can be used for base64 decoding in cases where - encoded content has already been read as a String.
-
-
_decodeBase64(Base64Variant) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Efficient handling for incremental parsing of base64-encoded - textual content.
-
-
_decodeBase64(Base64Variant) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Efficient handling for incremental parsing of base64-encoded - textual content.
-
-
_decodeBase64(Base64Variant) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Efficient handling for incremental parsing of base64-encoded - textual content.
-
-
_decodeBase64Escape(Base64Variant, int, int) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_decodeBase64Escape(Base64Variant, char, int) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_decodeCharForError(int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_decodeCharForError(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_decodeEscaped() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
-
Method that sub-classes must implement to support escaped sequences - in base64-encoded sections.
-
-
_decodeEscaped() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_decodeEscaped() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_decodeEscaped() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_decodeEscaped() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_decodeSurrogate(int, int) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
 
-
_decorate(IOContext, InputStream) - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory
-
 
-
_decorate(IOContext, Reader) - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory
-
 
-
_decorate(IOContext, DataInput) - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory
-
 
-
_decorate(IOContext, OutputStream) - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory
-
 
-
_decorate(IOContext, Writer) - Method in class com.fasterxml.jackson.core.base.DecorableTSFactory
-
 
-
_dups - Variable in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
_dups - Variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
 
-
_dups - Variable in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
_dups - Variable in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
 
-
_enabled - Variable in class com.fasterxml.jackson.core.util.JacksonFeatureSet
-
 
-
_encoding - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Encoding used by the underlying stream, if known.
-
-
_endOfInput - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Flag that is sent when calling application indicates that there will - be no more input to parse.
-
-
_entityBuffer - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
6 character temporary buffer allocated if needed, for constructing - escape sequences
-
-
_entityBuffer - Variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
-
Short (14 char) temporary buffer allocated if needed, for constructing - escape sequences
-
-
_eofAsNextChar() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_eofAsNextToken() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Helper method called at point when all input has been exhausted and - input feeder has indicated no more input will be forthcoming.
-
-
_expLength - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Length of the exponent part of the number, if any, not - including 'e' marker or sign, just digits.
-
-
_exposedContext - Variable in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
In cases where FilteringParserDelegate._headContext is "ahead" of context exposed to - caller, this context points to what is currently exposed to caller.
-
-
_factoryFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Currently enabled TokenStreamFactory.Features features as a bitmask.
-
-
_factoryFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
-
Set of TokenStreamFactory.Features enabled, as bitmask.
-
-
_failOnDoS - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Flag that indicates whether we should throw an exception if enough - hash collisions are detected (true); or just worked around (false).
-
-
_fieldComplete(String) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_filter - Variable in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
-
Filter to use for items in this state (for properties of Objects, - elements of Arrays, and root-level values of root context)
-
-
_filterContext - Variable in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
-
Although delegate has its own output context it is not sufficient since we actually - have to keep track of excluded (filtered out) structures as well as ones delegate - actually outputs.
-
-
_filterContext() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
 
-
_findName(int, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_findName(int, int, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_findName(int, int, int, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_findSize(int) - Static method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
_finishAndReturnString() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_finishErrorToken() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishErrorTokenWithEOF() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishFieldWithEscape() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishFloatExponent(boolean, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishFloatFraction() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishKeywordToken(String, int, JsonToken) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishKeywordTokenWithEOF(String, int, JsonToken) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishNonStdToken(int, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishNonStdTokenWithEOF(int, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishNumberIntegralPart(char[], int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishNumberLeadingNegZeroes() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishNumberLeadingZeroes() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishNumberMinus(int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_finishString() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_finishString() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_finishString() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_finishString2() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_finishToken() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
-
Method called when decoding of a token has been started, but not yet completed due - to missing input; method is to continue decoding due to at least one more byte - being made available to decode.
-
-
_finishTokenWithEOF() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
-
Method similar to NonBlockingJsonParser._finishToken(), but called when no more input is - available, and end-of-input has been detected.
-
-
_firstName - Variable in class com.fasterxml.jackson.core.json.DupDetector
-
 
-
_flags - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
 
-
_flushBuffer() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
_flushBuffer() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
_formatReadFeatures - Variable in class com.fasterxml.jackson.core.json.JsonParserBase
-
-
Bit flag for JsonReadFeatures that are enabled.
-
-
_formatReadFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Set of format-specific read features enabled, as bitmask.
-
-
_formatReadFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
-
Set of format-specific read FormatFeatures enabled, as bitmask.
-
-
_formatWriteFeatures - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Bit flag composed of bits that indicate which - JsonWriteFeatures - are enabled.
-
-
_formatWriteFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Set of format-specific write features enabled, as bitmask.
-
-
_formatWriteFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
-
Set of format-specific write FormatFeatures enabled, as bitmask.
-
-
_fractLength - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Length of the fractional part (not including decimal - point or exponent), in characters.
-
-
_fromName(Named, boolean) - Static method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
_getBufferRecycler() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Method used by factory to create buffer recycler instances - for parsers and generators.
-
-
_getByteArrayBuilder() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_getCharDesc(int) - Static method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_getSourceReference() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
-
Helper method used to encapsulate logic of including (or not) of - "source reference" when constructing JsonLocation instances.
-
-
_getText2(JsonToken) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_getText2(JsonToken) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_getText2(JsonToken) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_getText2(JsonToken) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_gotFieldId - Variable in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
-
Marker used to indicate that we just wrote a field name - and now expect a value to write
-
-
_gotName - Variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
-
Marker used to indicate that we just wrote a name, and - now expect a value to write
-
-
_groupId - Variable in class com.fasterxml.jackson.core.Version
-
 
-
_handleApos() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_handleApos() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_handleApos() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_handleBase64MissingPadding(Base64Variant) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_handleEOF() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
-
Method called when an EOF is encountered between tokens.
-
-
_handleEOF() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Method sub-classes need to implement
-
-
_handleInvalidNumberStart(int, boolean) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Method called if expected numeric value (due to leading sign) does not - look like a number
-
-
_handleInvalidNumberStart(int, boolean) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Method called if expected numeric value (due to leading sign) does not - look like a number
-
-
_handleInvalidNumberStart(int, boolean) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Method called if expected numeric value (due to leading sign) does not - look like a number
-
-
_handleOddName(int) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Method called when we see non-white space character other - than double quote, when expecting a field name.
-
-
_handleOddName(int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Method called when we see non-white space character other - than double quote, when expecting a field name.
-
-
_handleOddName(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Method called when we see non-white space character other - than double quote, when expecting a field name.
-
-
_handleOddValue(int) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Method for handling cases where first non-space character - of an expected value token is not legal for standard JSON content.
-
-
_handleUnexpectedValue(int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Method for handling cases where first non-space character - of an expected value token is not legal for standard JSON content.
-
-
_handleUnexpectedValue(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Method for handling cases where first non-space character - of an expected value token is not legal for standard JSON content.
-
-
_handleUnrecognizedCharacterEscape(char) - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
_hash(int, int) - Static method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
_hashArea - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Primary hash information area: consists of 2 * _hashSize - entries of 16 bytes (4 ints), arranged in a cascading lookup - structure (details of which may be tweaked depending on expected rates - of collisions).
-
-
_hashSeed - Variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_hashShared - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Flag that indicates whether underlying data structures for - the main hash area are shared or not.
-
-
_hashShared - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Flag that indicates whether underlying data structures for - the main hash area are shared or not.
-
-
_hashSize - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Number of slots for primary entries within ByteQuadsCanonicalizer._hashArea; which is - at most 1/8 of actual size of the underlying array (4-int slots, - primary covers only half of the area; plus, additional area for longer - symbols after hash area).
-
-
_hashToIndex(int) - Method in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Helper method that takes in a "raw" hash value, shuffles it as necessary, - and truncates to be used as the index.
-
-
_hasTextualNull(String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Helper method used to determine whether we are currently pointing to - a String value of "null" (NOT a null token); and, if so, that parser - is to recognize and return it similar to if it was real null token.
-
-
_hasToken - Variable in class com.fasterxml.jackson.core.util.JsonParserSequence
-
-
Flag used to indicate that `JsonParser.nextToken()` should not be called, - due to parser already pointing to a token.
-
-
_head - Variable in class com.fasterxml.jackson.core.JsonPointer
-
-
Reference from currently matching segment (if any) to node - before leaf.
-
-
_headContext - Variable in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
During traversal this is the actual "open" parse tree, which sometimes - is the same as FilteringParserDelegate._exposedContext, and at other times is ahead - of it.
-
-
_icLatin1 - Static variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_icLatin1 - Static variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_icLatin1 - Static variable in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_icLatin1 - Static variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_in - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
_includeScalar() - Method in class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
-
 
-
_includeScalar() - Method in class com.fasterxml.jackson.core.filter.TokenFilter
-
-
Overridable default implementation delegated to all scalar value - inclusion check methods.
-
-
_inclusion - Variable in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
-
Flag that determines whether path leading up to included content should - also be automatically included or not.
-
-
_inclusion - Variable in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Flag that determines whether path leading up to included content should - also be automatically included or not.
-
-
_index - Variable in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Index of the currently processed entry.
-
-
_indexMask - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Mask used to get index from hash values; equal to - _buckets.length - 1, when _buckets.length is - a power of two.
-
-
_inputBuffer - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
-
This buffer is actually provided via NonBlockingInputFeeder
-
-
_inputBuffer - Variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Current buffer from which data is read; generally data is read into - buffer from input source.
-
-
_inputBuffer - Variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Current buffer from which data is read; generally data is read into - buffer from input source, but in some cases pre-loaded buffer - is handed to the parser.
-
-
_inputData - Variable in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_inputDecorator - Variable in class com.fasterxml.jackson.core.base.DecorableTSFactory
-
-
Optional helper object that may decorate input sources, to do - additional processing on input during parsing.
-
-
_inputDecorator - Variable in class com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder
-
-
Optional helper object that may decorate input sources, to do - additional processing on input during parsing.
-
-
_inputEnd - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Index of character after last available one in the buffer.
-
-
_inputPtr - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Pointer to next available character in buffer
-
-
_inputStream - Variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_inputType - Variable in exception com.fasterxml.jackson.core.exc.InputCoercionException
-
-
Input token that represents input value that failed to coerce.
-
-
_intern - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Whether canonical symbol Strings are to be intern()ed before added - to the table or not.
-
-
_intLength - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Length of integer part of the number, in characters
-
-
_ioContext - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
I/O context for this reader.
-
-
_ioContext - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
_isNextTokenNameMaybe(int, String) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_itemFilter - Variable in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
-
State that applies to the item within container, used where applicable.
-
-
_itemFilter - Variable in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
State that applies to the item within container, used where applicable.
-
-
_jdkSerializeValue - Variable in class com.fasterxml.jackson.core.io.SerializedString
-
-
Ugly hack, to work through the requirement that _value is indeed final, - and that JDK serialization won't call ctor(s).
-
-
_lastClearedToken - Variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Last cleared token, if any: that is, value that was in - effect when ParserMinimalBase.clearCurrentToken() was called.
-
-
_lastClearedToken - Variable in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Last cleared token, if any: that is, value that was in - effect when FilteringParserDelegate.clearCurrentToken() was called.
-
-
_lc(Locale, List<String>) - Static method in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
_length - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
_lineNr - Variable in class com.fasterxml.jackson.core.json.JsonReadContext
-
 
-
_lineNr - Variable in class com.fasterxml.jackson.core.JsonLocation
-
 
-
_lineNr - Variable in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
 
-
_loadMore() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_loadMore() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_loadMoreGuaranteed() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_loadMoreGuaranteed() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_locale - Variable in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
-
Since case-handling is Locale-specific in some (rare) cases, need to hold - on to configured Locale.
-
-
_location - Variable in exception com.fasterxml.jackson.core.JacksonException
-
 
-
_longestCollisionList - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
We need to keep track of the longest collision list; this is needed - both to indicate problems with attacks and to allow flushing for - other cases.
-
-
_longIntegerDesc(String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_longNameOffset - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Offset within ByteQuadsCanonicalizer._hashArea that follows main slots and contains - quads for longer names (13 bytes or longer), and points to the - first available int that may be used for appending quads of the next - long name.
-
-
_longNumberDesc(String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_majorState - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Current main decoding state within logical tree
-
-
_majorStateAfterValue - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Value of NonBlockingJsonParserBase._majorState after completing a scalar value
-
-
_majorVersion - Variable in class com.fasterxml.jackson.core.Version
-
 
-
_managedBuffers - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
_managedResource - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Flag that indicates whether underlying input/output source/target - object is fully managed by the owner of this context (parser or - generator).
-
-
_mask - Variable in class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
-
Mask used to get index from raw hash code, within hash area.
-
-
_matchCount - Variable in class com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate
-
-
Number of tokens for which TokenFilter.INCLUDE_ALL - has been returned
-
-
_matchCount - Variable in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Number of tokens for which TokenFilter.INCLUDE_ALL - has been returned.
-
-
_matchFalse() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_matchingElementIndex - Variable in class com.fasterxml.jackson.core.JsonPointer
-
 
-
_matchingPropertyName - Variable in class com.fasterxml.jackson.core.JsonPointer
-
 
-
_matchLongName(FieldNameMatcher, int, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_matchMediumName(FieldNameMatcher, int, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_matchMediumName2(FieldNameMatcher, int, int, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_matchName(FieldNameMatcher, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_matchNull() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_matchSpill(String) - Method in class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
 
-
_matchToken(String, int) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Helper method for checking whether input matches expected token
-
-
_matchToken(String, int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_matchToken(String, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_matchTrue() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_maximumNonEscapedChar - Variable in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Optional threshold used for automatically escaping character above certain character - code value: either 0 to indicate that no threshold is specified, or value - at or above 127 to indicate last character code that is NOT automatically escaped - (but depends on other configuration rules for checking).
-
-
_maximumNonEscapedChar - Variable in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
_maximumNonEscapedChar - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Value between 128 (0x80) and 65535 (0xFFFF) that indicates highest - Unicode code point that will not need escaping; or 0 to indicate - that all characters can be represented without escaping.
-
-
_minorState - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Additional indicator within state; contextually relevant for just that state
-
-
_minorStateAfterSplit - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Secondary minor state indicator used during decoding of escapes and/or - multi-byte Unicode characters
-
-
_minorVersion - Variable in class com.fasterxml.jackson.core.Version
-
 
-
_name - Variable in class com.fasterxml.jackson.core.util.Named.StringAsNamed
-
 
-
_nameCopied - Variable in class com.fasterxml.jackson.core.json.JsonParserBase
-
-
Flag set to indicate whether the field name is available - from the name copy buffer or not (in addition to its String - representation being available via read context)
-
-
_nameCopyBuffer - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Reference temporary buffer Parser instances need if calling - app decides it wants to access name via 'getTextCharacters' method.
-
-
_nameLookup - Variable in class com.fasterxml.jackson.core.sym.FieldNameMatcher
-
 
-
_names - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Array that contains String instances matching - entries in ByteQuadsCanonicalizer._hashArea.
-
-
_names - Variable in class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
 
-
_nameStartCol - Variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_nameStartCol - Variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_nameStartOffset - Variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Value of ParserBase._inputPtr at the time when the first character of - name token was read.
-
-
_nameStartOffset - Variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Value of ParserBase._inputPtr at the time when the first character of - name token was read.
-
-
_nameStartRow - Variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_nameStartRow - Variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_needToHandleName - Variable in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
-
Flag that indicates that the current name of this context - still needs to be read/written, if path from root down to - included leaf is to be exposed.
-
-
_nesting - Variable in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
Number of open levels of nesting.
-
-
_nextByte - Variable in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Sometimes we need buffering for just a single byte we read but - have to "push back"
-
-
_nextParserIndex - Variable in class com.fasterxml.jackson.core.util.JsonParserSequence
-
-
Index of the next parser in JsonParserSequence._parsers.
-
-
_nextSegment - Variable in class com.fasterxml.jackson.core.JsonPointer
-
-
Reference to rest of the pointer beyond currently matching - segment (if any); null if this pointer refers to the matching - segment.
-
-
_nextToken - Variable in class com.fasterxml.jackson.core.json.JsonParserBase
-
-
Secondary token related to the next token after current one; - used if its type is known.
-
-
_nextToken2() - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Offlined handling for cases where there was no buffered token to - return, and the token read next could not be returned as-is, - at least not yet, but where we have not yet established that - buffering is needed.
-
-
_nextTokenWithBuffering(TokenFilterContext) - Method in class com.fasterxml.jackson.core.filter.FilteringParserDelegate
-
-
Method called when a new potentially included context is found.
-
-
_nonByteSource() - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
_nonByteTarget() - Method in class com.fasterxml.jackson.core.base.BinaryTSFactory
-
 
-
_nonStdToken(int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_nonStdTokenType - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
When tokenizing non-standard ("odd") tokens, this is the type to consider; - also works as index to actual textual representation.
-
-
_numberBigDecimal - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_numberBigInt - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_numberDouble - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_numberInt - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_numberLong - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_numberNegative - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Flag that indicates whether numeric value has a negative - value.
-
-
_numTypesValid - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Bitfield that indicates which numeric representations - have been calculated for the current type
-
-
_objectFieldValueSeparatorWithSpaces - Variable in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
_objectIndenter - Variable in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
By default, let's use linefeed-adding indenter for separate - object entries.
-
-
_objectReadContext - Variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Context object provided by higher level functionality like - databinding for two reasons: passing configuration information - during construction, and to allow calling of some databind - operations via parser instance.
-
-
_objectWriteContext - Variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Context object used both to pass some initial settings and to allow - triggering of Object serialization through generator.
-
-
_offsets - Variable in class com.fasterxml.jackson.core.sym.HashedMatcherBase
-
 
-
_optimizedStreamFromURL(URL) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Helper methods used for constructing an optimal stream for - parsers to use, when input is to be read from an URL.
-
-
_origBufferLen - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
-
In addition to current buffer pointer, and end pointer, - we will also need to know number of bytes originally - contained.
-
-
_output - Variable in class com.fasterxml.jackson.core.io.DataOutputAsStream
-
 
-
_outputBuffer - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
Intermediate buffer in which contents are buffered before - being written using UTF8JsonGenerator._outputStream.
-
-
_outputBuffer - Variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
-
Intermediate buffer in which contents are buffered before - being written using WriterBasedJsonGenerator._writer.
-
-
_outputDecorator - Variable in class com.fasterxml.jackson.core.base.DecorableTSFactory
-
-
Optional helper object that may decorate output object, to do - additional processing on output during content generation.
-
-
_outputDecorator - Variable in class com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder
-
-
Optional helper object that may decorate output object, to do - additional processing on output during content generation.
-
-
_outputEnd - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
End marker of the output buffer; one past the last valid position - within the buffer.
-
-
_outputEnd - Variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
-
End marker of the output buffer; one past the last valid position - within the buffer.
-
-
_outputEscapes - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Currently active set of output escape code definitions (whether - and how to escape or not) for 7-bit ASCII range (first 128 - character codes).
-
-
_outputHead - Variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
-
Pointer to the first buffered character to output
-
-
_outputMaxContiguous - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
Maximum number of chars that we know will always fit - in the output buffer after escaping
-
-
_outputStream - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
Underlying output stream used for writing JSON content.
-
-
_outputSurrogates(int, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
_outputTail - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
Pointer to the position right beyond the last character to output - (end marker; may be past the buffer)
-
-
_outputTail - Variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
-
Pointer to the position right beyond the last character to output - (end marker; may point to position right beyond the end of the buffer)
-
-
_overflows - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Lazily constructed structure that is used to keep track of - collision buckets that have overflowed once: this is used - to detect likely attempts at denial-of-service attacks that - uses hash collisions.
-
-
_padLastQuad(int, int) - Static method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Helper method needed to fix [jackson-core#148], masking of 0x00 character
-
-
_parent - Variable in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
-
Parent context for this context; null for root context.
-
-
_parent - Variable in class com.fasterxml.jackson.core.json.JsonReadContext
-
-
Parent context for this context; null for root context.
-
-
_parent - Variable in class com.fasterxml.jackson.core.json.JsonWriteContext
-
-
Parent context for this context; null for root context.
-
-
_parent - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Reference to the root symbol table, for child tables, so - that they can merge table information back as necessary.
-
-
_parent - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Sharing of learnt symbols is done by optional linking of symbol - table instances with their parents.
-
-
_parent - Variable in class com.fasterxml.jackson.core.util.SimpleTokenReadContext
-
-
Parent context for this context; null for root context.
-
-
_parent - Variable in class com.fasterxml.jackson.core.util.SimpleTokenWriteContext
-
-
Parent context for this context; null for root context.
-
-
_parseAposName() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_parseAposName() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_parseAposName() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_parseFloatThatStartsWithPeriod() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_parseFloatThatStartsWithPeriod() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_parseFloatThatStartsWithPeriod() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_parseIntValue() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
 
-
_parseIntValue() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
_parseName() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_parseName(int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_parseName(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_parseNegNumber() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_parseNegNumber() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_parseNegNumber() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_parseNumericValue(int) - Method in class com.fasterxml.jackson.core.base.ParserBase
-
-
Method that will parse actual numeric value out of a syntactically - valid number value.
-
-
_parseNumericValue(int) - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
_parsePosNumber(int) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Initial parsing method for number values.
-
-
_parsePosNumber(int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Initial parsing method for number values.
-
-
_parsePosNumber(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Initial parsing method for number values.
-
-
_parseQuotedTail(String, int) - Static method in class com.fasterxml.jackson.core.JsonPointer
-
-
Method called to parse tail of pointer path, when a potentially - escaped character has been seen.
-
-
_parsers - Variable in class com.fasterxml.jackson.core.util.JsonParserSequence
-
-
Parsers other than the first one (which is initially assigned - as delegate)
-
-
_parseTail(String) - Static method in class com.fasterxml.jackson.core.JsonPointer
-
 
-
_parsingContext - Variable in class com.fasterxml.jackson.core.json.JsonParserBase
-
-
Information about parser context, context in which - the next token is to be parsed (root, array, object).
-
-
_patchLevel - Variable in class com.fasterxml.jackson.core.Version
-
 
-
_pathToMatch - Variable in class com.fasterxml.jackson.core.filter.JsonPointerBasedFilter
-
 
-
_payloadAsBytes - Variable in class com.fasterxml.jackson.core.util.RequestPayload
-
 
-
_payloadAsText - Variable in class com.fasterxml.jackson.core.util.RequestPayload
-
 
-
_pending32 - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_pendingBytes - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_processor - Variable in exception com.fasterxml.jackson.core.exc.StreamReadException
-
 
-
_processor - Variable in exception com.fasterxml.jackson.core.JsonGenerationException
-
 
-
_ptr - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
_quad1 - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_quadBuffer - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Temporary buffer used for name parsing.
-
-
_quadBuffer - Variable in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Temporary buffer used for name parsing.
-
-
_quadBuffer - Variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Temporary buffer used for name parsing.
-
-
_quadLength - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_quads(String) - Static method in class com.fasterxml.jackson.core.sym.BinaryNameMatcher
-
 
-
_quoteChar - Variable in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Character used for quoting field names (if field name quoting has not - been disabled with JsonWriteFeature.QUOTE_FIELD_NAMES) - and JSON String values.
-
-
_quoteChar - Variable in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
-
Character used for quoting field names (if field name quoting has not - been disabled with JsonWriteFeature.QUOTE_FIELD_NAMES) - and JSON String values.
-
-
_quoteChar - Variable in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
Character used for quoting JSON Object property names - and String values.
-
-
_quoteChar - Variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
-
Character used for quoting JSON Object property names - and String values.
-
-
_quoted32 - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_quotedChars - Variable in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
_quotedDigits - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_quotedUTF8Ref - Variable in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
_readBinary(Base64Variant, OutputStream, byte[]) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_readBinary(Base64Variant, OutputStream, byte[]) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_readBinary(Base64Variant, OutputStream, byte[]) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_reader - Variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Reader that can be used for reading more content, if one - buffer from input source, but in some cases pre-loaded buffer - is handed to the parser.
-
-
_readIOBuffer - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Reference to the allocated I/O buffer for low-level input reading, - if any allocated.
-
-
_recyclerRef - Static variable in class com.fasterxml.jackson.core.util.BufferRecyclers
-
-
This ThreadLocal contains a SoftReference - to a BufferRecycler used to provide a low-cost - buffer recycling between reader and writer instances.
-
-
_releaseBuffers() - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Method called to release any buffers generator may be holding, - once generator is being closed.
-
-
_releaseBuffers() - Method in class com.fasterxml.jackson.core.base.ParserBase
-
-
Method called to release internal buffers owned by the base - reader.
-
-
_releaseBuffers() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_releaseBuffers() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Method called to release internal buffers owned by the base - reader.
-
-
_releaseBuffers() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Method called to release internal buffers owned by the base - reader.
-
-
_releaseBuffers() - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
_releaseBuffers() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Method called to release internal buffers owned by the base - reader.
-
-
_releaseBuffers() - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
_reportBase64EOF() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
_reportBase64UnexpectedPadding() - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
_reportCantWriteValueExpectName(String) - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
_reportError(String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_reportError(String, Object) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_reportError(String, Object, Object) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_reportError(String, Object, Object, Object) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_reportError(String) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
-
Helper method used for constructing and throwing - JsonGenerationException with given base message.
-
-
_reportErrorToken(String) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_reportInvalidBase64(char, int, String) - Method in class com.fasterxml.jackson.core.Base64Variant
-
 
-
_reportInvalidChar(int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_reportInvalidChar(int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_reportInvalidChar(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_reportInvalidEOF() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_reportInvalidEOF(String, JsonToken) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_reportInvalidEOFInValue(JsonToken) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_reportInvalidInitial(int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_reportInvalidInitial(int) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_reportInvalidInitial(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_reportInvalidOther(int, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_reportInvalidOther(int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_reportInvalidOther(int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_reportInvalidOther(int, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_reportInvalidToken(String) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_reportInvalidToken(String, String) - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_reportInvalidToken(int, String) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_reportInvalidToken(int, String, String) - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
 
-
_reportInvalidToken(String, int) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_reportInvalidToken(String) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_reportInvalidToken(String, String) - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
 
-
_reportMismatchedEndMarker(int, char) - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
_reportMissingRootWS(int) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_reportTooLongIntegral(int, String) - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
_reportTooManyCollisions() - Method in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
 
-
_reportUnexpectedChar(int, String) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_reportUnsupportedOperation() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
 
-
_reportUnsupportedOperation() - Method in class com.fasterxml.jackson.core.JsonParser
-
-
Helper method to call for operations that are not supported by - parser implementation.
-
-
_reportUnsupportedOperation() - Method in class com.fasterxml.jackson.core.ObjectReadContext.Base
-
 
-
_reportUnsupportedOperation() - Method in class com.fasterxml.jackson.core.ObjectWriteContext.Base
-
 
-
_requestPayload - Variable in exception com.fasterxml.jackson.core.exc.StreamReadException
-
-
Optional payload that can be assigned to pass along for error reporting - or handling purposes.
-
-
_requestPayload - Variable in class com.fasterxml.jackson.core.JsonParser
-
-
Optional container that holds the request payload which will be displayed on JSON parsing error.
-
-
_rootCharSymbols - Variable in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Each factory comes equipped with a shared root symbol table.
-
-
_rootSeparator - Variable in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
String printed between root-level values, if any.
-
-
_rootValueSeparator - Variable in class com.fasterxml.jackson.core.json.JsonFactory
-
-
Separator used between root-level values, if any; null indicates - "do not add separator".
-
-
_rootValueSeparator - Variable in class com.fasterxml.jackson.core.json.JsonFactoryBuilder
-
 
-
_rootValueSeparator - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Separator to use, if any, between root-level values.
-
-
_rootValueSeparator - Variable in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
_secondaryStart - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Offset within ByteQuadsCanonicalizer._hashArea where secondary entries start
-
-
_secondName - Variable in class com.fasterxml.jackson.core.json.DupDetector
-
 
-
_seed - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Seed value we use as the base to make hash codes non-static between - different runs, but still stable for lifetime of a single symbol table - instance.
-
-
_seed - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Seed value we use as the base to make hash codes non-static between - different runs, but still stable for lifetime of a single symbol table - instance.
-
-
_seen - Variable in class com.fasterxml.jackson.core.json.DupDetector
-
-
Lazily constructed set of names already seen within this context.
-
-
_separators - Variable in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
_separators - Variable in class com.fasterxml.jackson.core.util.MinimalPrettyPrinter
-
 
-
_size - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Current size (number of entries); needed to know if and when - rehash.
-
-
_sizeThreshold - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Limit that indicates maximum size this instance can hold before - it needs to be expanded and rehashed.
-
-
_skipCR() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
We actually need to check the character value here - (to see if we have \n following \r).
-
-
_skipCR() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
We actually need to check the character value here - (to see if we have \n following \r).
-
-
_skipString() - Method in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Method called to skim through rest of unparsed String value, - if it is not needed.
-
-
_skipString() - Method in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Method called to skim through rest of unparsed String value, - if it is not needed.
-
-
_skipString() - Method in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Method called to skim through rest of unparsed String value, - if it is not needed.
-
-
_snapshotInfo - Variable in class com.fasterxml.jackson.core.Version
-
-
Additional information for snapshot versions; null for non-snapshot - (release) versions.
-
-
_source - Variable in class com.fasterxml.jackson.core.json.DupDetector
-
-
We need to store a back-reference here to parser/generator.
-
-
_sourceRef - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Reference to the source object, which can be used for displaying - location information
-
-
_spacesInObjectEntries - Variable in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
-
By default we will add spaces around colons used to - separate object fields and values.
-
-
_spilloverEnd - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Pointer to the offset within spill-over area where there is room - for more spilled over entries (if any).
-
-
_startAposString() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startArrayScope() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_startFalseToken() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startFloat(char[], int, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startFloatThatStartsWithPeriod() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startHandled - Variable in class com.fasterxml.jackson.core.filter.TokenFilterContext
-
-
Flag that indicates that start token has been read/written, - so that matching close token needs to be read/written as well - when context is getting closed.
-
-
_startNegativeNumber() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startNullToken() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startNumberLeadingZero() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startObjectScope() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_startPositiveNumber(int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startString() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startTrueToken() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_startUnexpectedValue(boolean, int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
-
 
-
_streamReadFeatures - Variable in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
-
Bit flag composed of bits that indicate which - StreamReadFeatures - are enabled.
-
-
_streamReadFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Currently enabled StreamReadFeatures as a bitmask.
-
-
_streamReadFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
-
Set of StreamReadFeatures enabled, as bitmask.
-
-
_streamWriteFeatures - Variable in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Bit flag composed of bits that indicate which - StreamWriteFeatures - are enabled.
-
-
_streamWriteFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory
-
-
Currently enabled StreamWriteFeatures as a bitmask.
-
-
_streamWriteFeatures - Variable in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
-
Set of StreamWriteFeatures enabled, as bitmask.
-
-
_surrogate - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
-
Although input is fine with full Unicode set, Java still uses - 16-bit chars, so we may have to split high-order chars into - surrogate pairs.
-
-
_symbols - Variable in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
-
Symbol table that contains field names encountered so far
-
-
_symbols - Variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
 
-
_symbols - Variable in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Symbol table that contains field names encountered so far
-
-
_symbols - Variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Symbol table that contains field names encountered so far
-
-
_symbols - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Primary matching symbols; it's expected most match occur from - here.
-
-
_tableInfo - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Member that is only used by the root table instance: root - passes immutable state info child instances, and children - may return new state if they add entries to the table.
-
-
_tableInfo - Variable in class com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer
-
-
Member that is only used by the root table instance: root - passes immutable state info child instances, and children - may return new state if they add entries to the table.
-
-
_targetType - Variable in exception com.fasterxml.jackson.core.exc.InputCoercionException
-
-
Target type that input value failed to coerce to.
-
-
_tertiaryShift - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Constant that determines size of buckets for tertiary entries: - 1 << _tertiaryShift is the size, and shift value - is also used for translating from primary offset into - tertiary bucket (shift right by 4 + _tertiaryShift).
-
-
_tertiaryStart - Variable in class com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer
-
-
Offset within ByteQuadsCanonicalizer._hashArea where tertiary entries start
-
-
_textBuffer - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Buffer that contains contents of String values, including - field names if necessary (name split across boundary, - contains escape sequence, or access needed to char array)
-
-
_this() - Method in class com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder
-
 
-
_throwInternal() - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_throwInternal() - Method in class com.fasterxml.jackson.core.JsonGenerator
-
 
-
_throwInvalidSpace(int) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_throwUnquotedSpace(int, String) - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
-
Method called to report a problem with unquoted control character.
-
-
_tmpBuf - Variable in class com.fasterxml.jackson.core.io.UTF32Reader
-
 
-
_token - Variable in exception com.fasterxml.jackson.core.io.JsonEOFException
-
-
Type of token that was being decoded, if parser had enough information - to recognize type (such as starting double-quote for Strings)
-
-
_tokenCBuffer - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Reference to the buffer allocated for tokenization purposes, - in which character input is read, and from which it can be - further returned.
-
-
_tokenIncomplete - Variable in class com.fasterxml.jackson.core.json.ReaderBasedJsonParser
-
-
Flag that indicates that the current token has not yet - been fully processed, and needs to be finished for - some access (or skipped to obtain the next token)
-
-
_tokenIncomplete - Variable in class com.fasterxml.jackson.core.json.UTF8DataInputJsonParser
-
-
Flag that indicates that the current token has not yet - been fully processed, and needs to be finished for - some access (or skipped to obtain the next token)
-
-
_tokenIncomplete - Variable in class com.fasterxml.jackson.core.json.UTF8StreamJsonParser
-
-
Flag that indicates that the current token has not yet - been fully processed, and needs to be finished for - some access (or skipped to obtain the next token)
-
-
_tokenInputCol - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Column on input row that current token starts; 0-based (although - in the end it'll be converted to 1-based)
-
-
_tokenInputRow - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Input row on which current token starts, 1-based
-
-
_tokenInputTotal - Variable in class com.fasterxml.jackson.core.base.ParserBase
-
-
Total number of bytes/characters read before start of current token.
-
-
_tokenWriteContext - Variable in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
-
Object that keeps track of the current contextual state of the generator.
-
-
_totalBytes - Variable in class com.fasterxml.jackson.core.JsonLocation
-
 
-
_totalChars - Variable in class com.fasterxml.jackson.core.JsonLocation
-
 
-
_type - Variable in class com.fasterxml.jackson.core.TokenStreamContext
-
-
Indicates logical type of context as one of TYPE_xxx consants.
-
-
_type - Variable in class com.fasterxml.jackson.core.type.TypeReference
-
 
-
_unquotedUTF8Ref - Variable in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
_unsupported() - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
 
-
_unsupported(String, Object...) - Method in class com.fasterxml.jackson.core.TokenStreamFactory
-
 
-
_updateTokenLocation() - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_validJsonTokenList() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
_validJsonValueList() - Method in class com.fasterxml.jackson.core.json.JsonParserBase
-
 
-
_value - Variable in class com.fasterxml.jackson.core.io.SerializedString
-
 
-
_valueComplete(JsonToken) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_valueCompleteInt(int, String) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_valueNonStdNumberComplete(int) - Method in class com.fasterxml.jackson.core.json.async.NonBlockingJsonParserBase
-
 
-
_verifyAlloc(Object) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
_verifyOffsets(int, int, int) - Method in class com.fasterxml.jackson.core.JsonGenerator
-
 
-
_verifyPrettyValueWrite(String, int) - Method in class com.fasterxml.jackson.core.json.JsonGeneratorBase
-
 
-
_verifyRelease(byte[], byte[]) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
_verifyRelease(char[], char[]) - Method in class com.fasterxml.jackson.core.io.IOContext
-
 
-
_verifyValueWrite(String) - Method in class com.fasterxml.jackson.core.base.GeneratorBase
-
-
Method called before trying to write a value (scalar or structured), - to verify that this is legal in current output state, as well as to - output separators if and as necessary.
-
-
_verifyValueWrite(String) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
_verifyValueWrite(String) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
_withSpaces(boolean) - Method in class com.fasterxml.jackson.core.util.DefaultPrettyPrinter
-
 
-
_wrapError(String, Throwable) - Method in class com.fasterxml.jackson.core.base.ParserMinimalBase
-
 
-
_writeBinary(Base64Variant, byte[], int, int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
_writeBinary(Base64Variant, InputStream, byte[], int) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
_writeBinary(Base64Variant, InputStream, byte[]) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
_writeBinary(Base64Variant, byte[], int, int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
_writeBinary(Base64Variant, InputStream, byte[], int) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
_writeBinary(Base64Variant, InputStream, byte[]) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
_writeEncodingBuffer - Variable in class com.fasterxml.jackson.core.io.IOContext
-
-
Reference to the allocated I/O buffer used for low-level - encoding-related buffering.
-
-
_writeFieldName(String, boolean) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
_writeFieldName(SerializableString, boolean) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
_writePPFieldName(String) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
-
Specialized version of _writeFieldName, off-lined - to keep the "fast path" as simple (and hopefully fast) as possible.
-
-
_writePPFieldName(SerializableString) - Method in class com.fasterxml.jackson.core.json.UTF8JsonGenerator
-
 
-
_writePPFieldName(String, boolean) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
-
Specialized version of _writeFieldName, off-lined - to keep the "fast path" as simple (and hopefully fast) as possible.
-
-
_writePPFieldName(SerializableString, boolean) - Method in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
_writer - Variable in class com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
-
 
-
-A B C D E F G H I J L M N O P Q R S T U V W _ 
- -
- - - - - - - -
- - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/index.html b/docs/javadoc/3.0.2021-01/index.html deleted file mode 100644 index 97c14173eb..0000000000 --- a/docs/javadoc/3.0.2021-01/index.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - -Jackson-core 3.0.0-SNAPSHOT API - - - - - - - - - -<noscript> -<div>JavaScript is disabled on your browser.</div> -</noscript> -<h2>Frame Alert</h2> -<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> - - - diff --git a/docs/javadoc/3.0.2021-01/javadoc.sh b/docs/javadoc/3.0.2021-01/javadoc.sh deleted file mode 100755 index 82e214cadc..0000000000 --- a/docs/javadoc/3.0.2021-01/javadoc.sh +++ /dev/null @@ -1 +0,0 @@ -/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/../bin/javadoc @options @packages \ No newline at end of file diff --git a/docs/javadoc/3.0.2021-01/options b/docs/javadoc/3.0.2021-01/options deleted file mode 100644 index 30243eb027..0000000000 --- a/docs/javadoc/3.0.2021-01/options +++ /dev/null @@ -1,28 +0,0 @@ --encoding -'UTF-8' --protected --sourcepath -'/Users/tatu/jackson/jackson-core/src/main/java:/Users/tatu/jackson/jackson-core/target/generated-sources' --author --bottom -'Copyright © 2008–2021 FasterXML. All rights reserved.' --charset -'UTF-8' --d -'/Users/tatu/jackson/jackson-core/target/site/apidocs' --docencoding -'UTF-8' --doctitle -'Jackson-core 3.0.0-SNAPSHOT API' --link -'https://docs.oracle.com/en/java/javase/11/docs/api' --link -'http://fasterxml.github.com/jackson-annotations/javadoc/3.0' --link -'http://fasterxml.github.com/jackson-core/javadoc/3.0' --linkoffline -'https://docs.oracle.com/javase/8/docs/api' '/Users/tatu/jackson/jackson-core/target/javadoc-bundle-options' --use --version --windowtitle -'Jackson-core 3.0.0-SNAPSHOT API' \ No newline at end of file diff --git a/docs/javadoc/3.0.2021-01/overview-frame.html b/docs/javadoc/3.0.2021-01/overview-frame.html deleted file mode 100644 index 3d64a6650a..0000000000 --- a/docs/javadoc/3.0.2021-01/overview-frame.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - -Overview List (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - -

 

- - diff --git a/docs/javadoc/3.0.2021-01/overview-summary.html b/docs/javadoc/3.0.2021-01/overview-summary.html deleted file mode 100644 index 40aa9d7a11..0000000000 --- a/docs/javadoc/3.0.2021-01/overview-summary.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - -Overview (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - -
- - - - - - - -
- - -
-

Jackson-core 3.0.0-SNAPSHOT API

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Packages 
PackageDescription
com.fasterxml.jackson.core -
Main public API classes of the core streaming JSON - processor: most importantly JsonFactory - used for constructing - JSON parser (JsonParser) - and generator - (JsonGenerator) - instances.
-
com.fasterxml.jackson.core.async -
Package that contains abstractions needed to support optional - non-blocking decoding (parsing) functionality.
-
com.fasterxml.jackson.core.base -
Base classes used by concrete Parser and Generator implementations; - contain functionality that is not specific to JSON or input - abstraction (byte vs char).
-
com.fasterxml.jackson.core.exc -
Package for some of JsonProcessingException - subtypes contained by streaming API.
-
com.fasterxml.jackson.core.filter 
com.fasterxml.jackson.core.io 
com.fasterxml.jackson.core.json -
JSON-specific parser and generator implementation classes that - Jackson defines and uses.
-
com.fasterxml.jackson.core.json.async -
Non-blocking ("async") JSON parser implementation.
-
com.fasterxml.jackson.core.sym -
Internal implementation classes for efficient handling of - of symbols in JSON (field names in Objects)
-
com.fasterxml.jackson.core.tree -
Package that contains abstractions that are used dealing - with Tree Models (other than - TreeNode).
-
com.fasterxml.jackson.core.type -
Contains classes needed for type introspection, mostly used by data binding - functionality.
-
com.fasterxml.jackson.core.util -
Utility classes used by Jackson Core functionality.
-
-
- -
- - - - - - - -
- - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/overview-tree.html b/docs/javadoc/3.0.2021-01/overview-tree.html deleted file mode 100644 index b834f9587c..0000000000 --- a/docs/javadoc/3.0.2021-01/overview-tree.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - -Class Hierarchy (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - -
- - - - - - - -
- - - -
-

Class Hierarchy

- -

Interface Hierarchy

- -

Enum Hierarchy

- -
- -
- - - - - - - -
- - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/package-list b/docs/javadoc/3.0.2021-01/package-list deleted file mode 100644 index 2a32c8edf0..0000000000 --- a/docs/javadoc/3.0.2021-01/package-list +++ /dev/null @@ -1,12 +0,0 @@ -com.fasterxml.jackson.core -com.fasterxml.jackson.core.async -com.fasterxml.jackson.core.base -com.fasterxml.jackson.core.exc -com.fasterxml.jackson.core.filter -com.fasterxml.jackson.core.io -com.fasterxml.jackson.core.json -com.fasterxml.jackson.core.json.async -com.fasterxml.jackson.core.sym -com.fasterxml.jackson.core.tree -com.fasterxml.jackson.core.type -com.fasterxml.jackson.core.util diff --git a/docs/javadoc/3.0.2021-01/packages b/docs/javadoc/3.0.2021-01/packages deleted file mode 100644 index a6cb8beb4c..0000000000 --- a/docs/javadoc/3.0.2021-01/packages +++ /dev/null @@ -1,12 +0,0 @@ -com.fasterxml.jackson.core.sym -com.fasterxml.jackson.core.tree -com.fasterxml.jackson.core -com.fasterxml.jackson.core.util -com.fasterxml.jackson.core.async -com.fasterxml.jackson.core.io -com.fasterxml.jackson.core.json -com.fasterxml.jackson.core.json.async -com.fasterxml.jackson.core.type -com.fasterxml.jackson.core.exc -com.fasterxml.jackson.core.filter -com.fasterxml.jackson.core.base \ No newline at end of file diff --git a/docs/javadoc/3.0.2021-01/script.js b/docs/javadoc/3.0.2021-01/script.js deleted file mode 100644 index b346356931..0000000000 --- a/docs/javadoc/3.0.2021-01/script.js +++ /dev/null @@ -1,30 +0,0 @@ -function show(type) -{ - count = 0; - for (var key in methods) { - var row = document.getElementById(key); - if ((methods[key] & type) != 0) { - row.style.display = ''; - row.className = (count++ % 2) ? rowColor : altColor; - } - else - row.style.display = 'none'; - } - updateTabs(type); -} - -function updateTabs(type) -{ - for (var value in tabs) { - var sNode = document.getElementById(tabs[value][0]); - var spanNode = sNode.firstChild; - if (value == type) { - sNode.className = activeTableTab; - spanNode.innerHTML = tabs[value][1]; - } - else { - sNode.className = tableTab; - spanNode.innerHTML = "" + tabs[value][1] + ""; - } - } -} diff --git a/docs/javadoc/3.0.2021-01/serialized-form.html b/docs/javadoc/3.0.2021-01/serialized-form.html deleted file mode 100644 index 72e0e2bc57..0000000000 --- a/docs/javadoc/3.0.2021-01/serialized-form.html +++ /dev/null @@ -1,1013 +0,0 @@ - - - - - - -Serialized Form (Jackson-core 3.0.0-SNAPSHOT API) - - - - - - - - -
- - - - - - - -
- - -
-

Serialized Form

-
-
- -
- -
- - - - - - - -
- - -

Copyright © 2008–2021 FasterXML. All rights reserved.

- - diff --git a/docs/javadoc/3.0.2021-01/stylesheet.css b/docs/javadoc/3.0.2021-01/stylesheet.css deleted file mode 100644 index 98055b22d6..0000000000 --- a/docs/javadoc/3.0.2021-01/stylesheet.css +++ /dev/null @@ -1,574 +0,0 @@ -/* Javadoc style sheet */ -/* -Overall document style -*/ - -@import url('resources/fonts/dejavu.css'); - -body { - background-color:#ffffff; - color:#353833; - font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; - font-size:14px; - margin:0; -} -a:link, a:visited { - text-decoration:none; - color:#4A6782; -} -a:hover, a:focus { - text-decoration:none; - color:#bb7a2a; -} -a:active { - text-decoration:none; - color:#4A6782; -} -a[name] { - color:#353833; -} -a[name]:hover { - text-decoration:none; - color:#353833; -} -pre { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; -} -h1 { - font-size:20px; -} -h2 { - font-size:18px; -} -h3 { - font-size:16px; - font-style:italic; -} -h4 { - font-size:13px; -} -h5 { - font-size:12px; -} -h6 { - font-size:11px; -} -ul { - list-style-type:disc; -} -code, tt { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; - margin-top:8px; - line-height:1.4em; -} -dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; -} -table tr td dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - vertical-align:top; - padding-top:4px; -} -sup { - font-size:8px; -} -/* -Document title and Copyright styles -*/ -.clear { - clear:both; - height:0px; - overflow:hidden; -} -.aboutLanguage { - float:right; - padding:0px 21px; - font-size:11px; - z-index:200; - margin-top:-9px; -} -.legalCopy { - margin-left:.5em; -} -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; - text-decoration:none; -} -.bar a:hover, .bar a:focus { - color:#bb7a2a; -} -.tab { - background-color:#0066FF; - color:#ffffff; - padding:8px; - width:5em; - font-weight:bold; -} -/* -Navigation bar styles -*/ -.bar { - background-color:#4D7A97; - color:#FFFFFF; - padding:.8em .5em .4em .8em; - height:auto;/*height:1.8em;*/ - font-size:11px; - margin:0; -} -.topNav { - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.bottomNav { - margin-top:10px; - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.subNav { - background-color:#dee3e9; - float:left; - width:100%; - overflow:hidden; - font-size:12px; -} -.subNav div { - clear:left; - float:left; - padding:0 0 5px 6px; - text-transform:uppercase; -} -ul.navList, ul.subNavList { - float:left; - margin:0 25px 0 0; - padding:0; -} -ul.navList li{ - list-style:none; - float:left; - padding: 5px 6px; - text-transform:uppercase; -} -ul.subNavList li{ - list-style:none; - float:left; -} -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; - text-decoration:none; - text-transform:uppercase; -} -.topNav a:hover, .bottomNav a:hover { - text-decoration:none; - color:#bb7a2a; - text-transform:uppercase; -} -.navBarCell1Rev { - background-color:#F8981D; - color:#253441; - margin: auto 5px; -} -.skipNav { - position:absolute; - top:auto; - left:-9999px; - overflow:hidden; -} -/* -Page header and footer styles -*/ -.header, .footer { - clear:both; - margin:0 20px; - padding:5px 0 0 0; -} -.indexHeader { - margin:10px; - position:relative; -} -.indexHeader span{ - margin-right:15px; -} -.indexHeader h1 { - font-size:13px; -} -.title { - color:#2c4557; - margin:10px 0; -} -.subTitle { - margin:5px 0 0 0; -} -.header ul { - margin:0 0 15px 0; - padding:0; -} -.footer ul { - margin:20px 0 5px 0; -} -.header ul li, .footer ul li { - list-style:none; - font-size:13px; -} -/* -Heading styles -*/ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList li.blockList h3 { - padding:0; - margin:15px 0; -} -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} -/* -Page layout container styles -*/ -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear:both; - padding:10px 20px; - position:relative; -} -.indexContainer { - margin:10px; - position:relative; - font-size:12px; -} -.indexContainer h2 { - font-size:13px; - padding:0 0 3px 0; -} -.indexContainer ul { - margin:0; - padding:0; -} -.indexContainer ul li { - list-style:none; - padding-top:2px; -} -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size:12px; - font-weight:bold; - margin:10px 0 0 0; - color:#4E4E4E; -} -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin:5px 0 10px 0px; - font-size:14px; - font-family:'DejaVu Sans Mono',monospace; -} -.serializedFormContainer dl.nameValue dt { - margin-left:1px; - font-size:1.1em; - display:inline; - font-weight:bold; -} -.serializedFormContainer dl.nameValue dd { - margin:0 0 0 1px; - font-size:1.1em; - display:inline; -} -/* -List styles -*/ -ul.horizontal li { - display:inline; - font-size:0.9em; -} -ul.inheritance { - margin:0; - padding:0; -} -ul.inheritance li { - display:inline; - list-style:none; -} -ul.inheritance li ul.inheritance { - margin-left:15px; - padding-left:15px; - padding-top:1px; -} -ul.blockList, ul.blockListLast { - margin:10px 0 10px 0; - padding:0; -} -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style:none; - margin-bottom:15px; - line-height:1.4; -} -ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - padding:0px 20px 5px 10px; - border:1px solid #ededed; - background-color:#f8f8f8; -} -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding:0 0 5px 8px; - background-color:#ffffff; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left:0; - padding-left:0; - padding-bottom:15px; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style:none; - border-bottom:none; - padding-bottom:0; -} -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top:0; - margin-bottom:1px; -} -/* -Table styles -*/ -.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { - width:100%; - border-left:1px solid #EEE; - border-right:1px solid #EEE; - border-bottom:1px solid #EEE; -} -.overviewSummary, .memberSummary { - padding:0px; -} -.overviewSummary caption, .memberSummary caption, .typeSummary caption, -.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { - position:relative; - text-align:left; - background-repeat:no-repeat; - color:#253441; - font-weight:bold; - clear:none; - overflow:hidden; - padding:0px; - padding-top:10px; - padding-left:1px; - margin:0px; - white-space:pre; -} -.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, -.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, -.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, -.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, -.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, -.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, -.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, -.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { - color:#FFFFFF; -} -.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, -.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - padding-bottom:7px; - display:inline-block; - float:left; - background-color:#F8981D; - border: none; - height:16px; -} -.memberSummary caption span.activeTableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#F8981D; - height:16px; -} -.memberSummary caption span.tableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#4D7A97; - height:16px; -} -.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { - padding-top:0px; - padding-left:0px; - padding-right:0px; - background-image:none; - float:none; - display:inline; -} -.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, -.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { - display:none; - width:5px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .activeTableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .tableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - background-color:#4D7A97; - float:left; - -} -.overviewSummary td, .memberSummary td, .typeSummary td, -.useSummary td, .constantsSummary td, .deprecatedSummary td { - text-align:left; - padding:0px 0px 12px 10px; -} -th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, -td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ - vertical-align:top; - padding-right:0px; - padding-top:8px; - padding-bottom:3px; -} -th.colFirst, th.colLast, th.colOne, .constantsSummary th { - background:#dee3e9; - text-align:left; - padding:8px 3px 3px 7px; -} -td.colFirst, th.colFirst { - white-space:nowrap; - font-size:13px; -} -td.colLast, th.colLast { - font-size:13px; -} -td.colOne, th.colOne { - font-size:13px; -} -.overviewSummary td.colFirst, .overviewSummary th.colFirst, -.useSummary td.colFirst, .useSummary th.colFirst, -.overviewSummary td.colOne, .overviewSummary th.colOne, -.memberSummary td.colFirst, .memberSummary th.colFirst, -.memberSummary td.colOne, .memberSummary th.colOne, -.typeSummary td.colFirst{ - width:25%; - vertical-align:top; -} -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} -.tableSubHeadingColor { - background-color:#EEEEFF; -} -.altColor { - background-color:#FFFFFF; -} -.rowColor { - background-color:#EEEEEF; -} -/* -Content styles -*/ -.description pre { - margin-top:0; -} -.deprecatedContent { - margin:0; - padding:10px 0; -} -.docSummary { - padding:0; -} - -ul.blockList ul.blockList ul.blockList li.blockList h3 { - font-style:normal; -} - -div.block { - font-size:14px; - font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; -} - -td.colLast div { - padding-top:0px; -} - - -td.colLast a { - padding-bottom:3px; -} -/* -Formatting effect styles -*/ -.sourceLineNo { - color:green; - padding:0 30px 0 0; -} -h1.hidden { - visibility:hidden; - overflow:hidden; - font-size:10px; -} -.block { - display:block; - margin:3px 10px 2px 0px; - color:#474747; -} -.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, -.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, -.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { - font-weight:bold; -} -.deprecationComment, .emphasizedPhrase, .interfaceName { - font-style:italic; -} - -div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, -div.block div.block span.interfaceName { - font-style:normal; -} - -div.contentContainer ul.blockList li.blockList h2{ - padding-bottom:0px; -} diff --git a/mvnw b/mvnw index 5643201c7d..41c0f0c23d 100755 --- a/mvnw +++ b/mvnw @@ -36,10 +36,6 @@ if [ -z "$MAVEN_SKIP_RC" ] ; then - if [ -f /usr/local/etc/mavenrc ] ; then - . /usr/local/etc/mavenrc - fi - if [ -f /etc/mavenrc ] ; then . /etc/mavenrc fi @@ -149,7 +145,7 @@ if [ -z "$JAVACMD" ] ; then JAVACMD="$JAVA_HOME/bin/java" fi else - JAVACMD="`\\unset -f command; \\command -v java`" + JAVACMD="`which java`" fi fi @@ -216,9 +212,9 @@ else echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." fi if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" else - jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" fi while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; @@ -237,9 +233,9 @@ else echo "Found wget ... using wget" fi if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + wget "$jarUrl" -O "$wrapperJarPath" else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" fi elif command -v curl > /dev/null; then if [ "$MVNW_VERBOSE" = true ]; then @@ -309,8 +305,6 @@ WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ $MAVEN_OPTS \ - $MAVEN_DEBUG_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" \ - "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd index 8a15b7f311..86115719e5 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -46,8 +46,8 @@ if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") @REM Execute a user defined script before this one if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre @REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* -if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre @setlocal @@ -120,9 +120,9 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B ) @@ -134,7 +134,7 @@ if exist %WRAPPER_JAR% ( ) ) else ( if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" ) if "%MVNW_VERBOSE%" == "true" ( echo Couldn't find %WRAPPER_JAR%, downloading it ... @@ -158,13 +158,7 @@ if exist %WRAPPER_JAR% ( @REM work with both Windows and non-Windows executions. set MAVEN_CMD_LINE_ARGS=%* -%MAVEN_JAVA_EXE% ^ - %JVM_CONFIG_MAVEN_PROPS% ^ - %MAVEN_OPTS% ^ - %MAVEN_DEBUG_OPTS% ^ - -classpath %WRAPPER_JAR% ^ - "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ - %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* if ERRORLEVEL 1 goto error goto end @@ -174,15 +168,15 @@ set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost @REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" -if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause +if "%MAVEN_BATCH_PAUSE%" == "on" pause -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% -cmd /C exit /B %ERROR_CODE% +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml index 62e4546c29..9ec24dc7dc 100644 --- a/pom.xml +++ b/pom.xml @@ -8,16 +8,14 @@ com.fasterxml.jackson jackson-base - 3.0.0-SNAPSHOT + 2.13.2-SNAPSHOT - com.fasterxml.jackson.core jackson-core Jackson-core - 3.0.0-SNAPSHOT + 2.13.2-SNAPSHOT bundle Core Jackson processing abstractions (aka Streaming API), implementation for JSON - 2008 The Apache Software License, Version 2.0 @@ -25,19 +23,30 @@ repo + 2008 https://github.com/FasterXML/jackson-core - scm:git:https://github.com/FasterXML/jackson-core.git + scm:git:git@github.com:FasterXML/jackson-core.git scm:git:git@github.com:FasterXML/jackson-core.git http://github.com/FasterXML/jackson-core HEAD + + 1.6 + 1.6 + + 1.6 + 1.6 + com.fasterxml.jackson.core;version=${project.version}, com.fasterxml.jackson.core.*;version=${project.version} + com/fasterxml/jackson/core/json ${project.groupId}.json @@ -57,10 +66,12 @@ com.fasterxml.jackson.core.*;version=${project.version} + + - org.jacoco - jacoco-maven-plugin - + org.jacoco + jacoco-maven-plugin + prepare-agent @@ -76,6 +87,18 @@ com.fasterxml.jackson.core.*;version=${project.version} + + + maven-enforcer-plugin + + + enforce-properties + validate + enforce + + + + org.apache.maven.plugins maven-site-plugin @@ -96,12 +119,13 @@ com.fasterxml.jackson.core.*;version=${project.version} --> - + + com.google.code.maven-replacer-plugin replacer - @@ -113,7 +137,7 @@ com.fasterxml.jackson.core.*;version=${project.version} org.codehaus.mojo build-helper-maven-plugin - + de.jjohannes gradle-module-metadata-maven-plugin diff --git a/release-notes/CREDITS b/release-notes/CREDITS deleted file mode 100644 index 0656efdc93..0000000000 --- a/release-notes/CREDITS +++ /dev/null @@ -1,11 +0,0 @@ -Here are people who have contributed to the development of Jackson JSON processor -core component, version 3.x -(version numbers in brackets indicate release in which the problem was fixed) - -(note: for older credits, check out `CREDITS-2.x`) - -Tatu Saloranta, tatu.saloranta@iki.fi: author - -Sven Döring (sdoeringNew@github) - * Contributed #680: Allow use of `java.nio.file.Path` as parser source, generator target - (3.0.0) diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index d0cdec4ce5..5b03d5fb08 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -274,7 +274,3 @@ Ferenc Csaky (ferenc-csaky@github) Fabian Meumertzheim (fmeum@github) * Reported #692: UTF32Reader ArrayIndexOutOfBoundsException (2.13.0) - -Ilya Golovin (ilgo0413@github) - * Contributed #684: Add "JsonPointer#appendProperty" and "JsonPointer#appendIndex" - (2.14.0) diff --git a/release-notes/VERSION b/release-notes/VERSION deleted file mode 100644 index 6868d53868..0000000000 --- a/release-notes/VERSION +++ /dev/null @@ -1,41 +0,0 @@ -Project: jackson-core -Versions: 3.x (for earlier see VERSION-2.x) - -Contains core streaming reader (`JsonParser`) and writer (`JsonGenerator`) abstractions, -factory for constructing readers/writers (JsonFactory), as well as a minimal set -of interfaces needed for streaming level to make callbacks and call-throughs, -via `ObjectCodec` and `TreeNode`. - -Also includes implementation of this API for JSON. -Forms the base for other data formats as well, despite naming that suggests -JSON-specificity: naming is due to history, as Jackson started out as pure -JSON library. - ------------------------------------------------------------------------- -=== Releases === ------------------------------------------------------------------------- - -3.0.0 (not yet released) - -#378: Change default for `TokenStreamFactory.Feature.INTERN_PROPERTY_NAMES` to `false` -#402: Remove dataformat-auto-detection functionality -#411: Rename `JsonStreamContext` as `TokenStreamContext` -#413: Remove `ObjectCodec`: replace with `ObjectWriteContext` / `ObjectReadContext` -#432: Add new `TreeNode` subtypes: `ArrayTreeNode`, `ObjectTreeNode` -#433: Add Builder pattern for creating configured Stream factories -#456: Add `JsonParser.readAsValue(ResolvedType)` -#492: Ensure primitive type names in error message enclosed in backticks -#551: Remove `JsonGenerator.setPrettyPrinter()` from 3.0 -#663: Rename `JsonEOFException` as `UnexpectedEndOfInputException` -#670: Replace references to "field" with "property" in `JsonGenerator`, `JsonParser`, method names; - `JsonToken` values (`JsonToken.FIELD_NAME` -> `JsonToken.PROPERTY_NAME`) -#671: Replace `getCurrentLocation()`/`getTokenLocation()` with - `currentLocation()`/`currentTokenLocation()` -#676: Remove `JsonGenerator.canWriteBinaryNatively()`, `canWriteFormattedNumbers()` - (replaced by `StreamWriteCapability` equivalents) -#680: Allow use of `java.nio.file.Path` as parser source, generator target - (contributed by Sven D) -#689: Remove existing "request payload" functionality -- Rename `JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT` as `AUTO_CLOSE_CONTENT` -- Add `TreeCodec.nullNode()`, `TreeNode.isNull()` methods -- Change the way `JsonLocation.NA` is included in exception messages diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 730ed082af..c0d91f6038 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -14,11 +14,6 @@ JSON library. === Releases === ------------------------------------------------------------------------ -2.14.0 (not yet released) - -#684: Add "JsonPointer#appendProperty" and "JsonPointer#appendIndex" - (contributed by Ilya G) - 2.13.1 (19-Dec-2021) #713: Incorrect parsing of single-quoted surrounded String values containing double quotes diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java index dc31ff6131..7680c03c1a 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java @@ -7,7 +7,6 @@ import java.util.Arrays; import com.fasterxml.jackson.core.util.ByteArrayBuilder; -import com.fasterxml.jackson.core.util.Named; /** * Class used to define specific details of which @@ -18,7 +17,7 @@ * @author Tatu Saloranta */ public final class Base64Variant - implements Named, java.io.Serializable + implements java.io.Serializable { /** * Defines how the Base64Variant deals with Padding while reading @@ -316,7 +315,6 @@ protected Object readResolve() { /********************************************************** */ - @Override public String getName() { return _name; } /** @@ -618,6 +616,8 @@ public String encode(byte[] input, boolean addQuotes) * @param linefeed Linefeed to use for encoded content * * @return Base64 encoded String of encoded {@code input} bytes + * + * @since 2.10 */ public String encode(byte[] input, boolean addQuotes, String linefeed) { @@ -664,15 +664,17 @@ public String encode(byte[] input, boolean addQuotes, String linefeed) * @param input Base64-encoded input String to decode * * @return Byte array of decoded contents + * + * @since 2.3 * * @throws IllegalArgumentException if input is not valid base64 encoded data */ + @SuppressWarnings("resource") public byte[] decode(String input) throws IllegalArgumentException { - try (ByteArrayBuilder b = new ByteArrayBuilder()) { - decode(input, b); - return b.toByteArray(); - } + ByteArrayBuilder b = new ByteArrayBuilder(); + decode(input, b); + return b.toByteArray(); } /** @@ -687,6 +689,8 @@ public byte[] decode(String input) throws IllegalArgumentException * @param str Input to decode * @param builder Builder used for assembling decoded content * + * @since 2.3 + * * @throws IllegalArgumentException if input is not valid base64 encoded data */ public void decode(String str, ByteArrayBuilder builder) throws IllegalArgumentException @@ -872,6 +876,8 @@ protected String unexpectedPaddingMessage() { * prematurely in place where padding would be expected. * * @return Exception message for indicating "missing padding" case + * + * @since 2.10 */ public String missingPaddingMessage() { // !!! TODO: why is this 'public'? return String.format("Unexpected end of base64-encoded String: base64 variant '%s' expects padding (one or more '%c' characters) at the end. This Base64Variant might have been incorrectly configured", diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variants.java b/src/main/java/com/fasterxml/jackson/core/Base64Variants.java index c97ee00f16..4970c4e185 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variants.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variants.java @@ -46,7 +46,10 @@ public final class Base64Variants *

* Writes padding on output; requires padding when reading (may change later with a call to {@link Base64Variant#withWritePadding}) */ - public final static Base64Variant MIME = new Base64Variant("MIME", STD_BASE64_ALPHABET, true, '=', 76); + public final static Base64Variant MIME; + static { + MIME = new Base64Variant("MIME", STD_BASE64_ALPHABET, true, '=', 76); + } /** * Slightly non-standard modification of {@link #MIME} which does not @@ -56,7 +59,10 @@ public final class Base64Variants *

* Writes padding on output; requires padding when reading (may change later with a call to {@link Base64Variant#withWritePadding}) */ - public final static Base64Variant MIME_NO_LINEFEEDS = new Base64Variant(MIME, "MIME-NO-LINEFEEDS", Integer.MAX_VALUE); + public final static Base64Variant MIME_NO_LINEFEEDS; + static { + MIME_NO_LINEFEEDS = new Base64Variant(MIME, "MIME-NO-LINEFEEDS", Integer.MAX_VALUE); + } /** * This variant is the one that predates {@link #MIME}: it is otherwise diff --git a/src/main/java/com/fasterxml/jackson/core/FormatFeature.java b/src/main/java/com/fasterxml/jackson/core/FormatFeature.java index d5bab4b5d8..0eb44cdc8d 100644 --- a/src/main/java/com/fasterxml/jackson/core/FormatFeature.java +++ b/src/main/java/com/fasterxml/jackson/core/FormatFeature.java @@ -8,11 +8,30 @@ * they can implement interfaces; and as such we may be able to use limited * amount of generic functionality. *

- * At this point this type is more of an extra marker feature, as its core API is now + * Since 2.12 this is more of an extra marker feature, as its core API is now * defined in more general {@link JacksonFeature}. + * + * @since 2.6 */ public interface FormatFeature - extends JacksonFeature + extends JacksonFeature // since 2.12 { - // Same API as JacksonFeature, no additions + /** + * Accessor for checking whether this feature is enabled by default. + */ + @Override + public boolean enabledByDefault(); + + /** + * Returns bit mask for this feature instance; must be a single bit, + * that is of form (1 << N) + */ + @Override + public int getMask(); + + /** + * Convenience method for checking whether feature is enabled in given bitmask + */ + @Override + public boolean enabledIn(int flags); } diff --git a/src/main/java/com/fasterxml/jackson/core/JacksonException.java b/src/main/java/com/fasterxml/jackson/core/JacksonException.java index 4c74db472e..9948d27972 100644 --- a/src/main/java/com/fasterxml/jackson/core/JacksonException.java +++ b/src/main/java/com/fasterxml/jackson/core/JacksonException.java @@ -3,55 +3,33 @@ /** * Base class for all Jackson-produced checked exceptions. *

- * Note that in Jackson 2.x this exception extended {@link java.io.IOException} - * but in 3.x {@link RuntimeException} + * For Jackson 2.x this base type is not widely used (instead, its main subtype + * {@link JsonProcessingException} is): it is provided more for forwards-compatibility + * purposes as 3.x will base all other types directly on it and deprecate + * {@link JsonProcessingException} (as well as chance its type to unchecked). + * + * @since 2.12 */ -public abstract class JacksonException - extends RuntimeException +public abstract class JacksonException extends java.io.IOException { - private final static long serialVersionUID = 3L; // eclipse complains otherwise - - protected JsonLocation _location; - - /* - /********************************************************************** - /* Life-cycle - /********************************************************************** - */ + private final static long serialVersionUID = 123; // eclipse complains otherwise protected JacksonException(String msg) { super(msg); } - protected JacksonException(Throwable rootCause) { - super(rootCause); + protected JacksonException(Throwable t) { + super(t); } protected JacksonException(String msg, Throwable rootCause) { super(msg, rootCause); - } - - protected JacksonException(String msg, JsonLocation loc, Throwable rootCause) { - super(msg, rootCause); - _location = (loc == null) ? JsonLocation.NA : loc; - } - - // @since 3.0 - public JacksonException withCause(Throwable cause) { - initCause(cause); - return this; - } - - /** - * Method that allows to remove context information from this exception's message. - * Useful when you are parsing security-sensitive data and don't want original data excerpts - * to be present in Jackson parser error messages. - * - * @return This exception instance to allow call chaining - */ - public JacksonException clearLocation() { - _location = null; - return this; + // 23-Sep-2020, tatu: before 2.12, had null checks for some reason... + // But I don't think that is actually required; Javadocs for + // `java.lang.Throwable` constructor claim {@code null} is fine. +/* if (rootCause != null) { + initCause(rootCause); + }*/ } /* @@ -63,7 +41,7 @@ public JacksonException clearLocation() { /** * Accessor for location information related to position within input * or output (depending on operation), if available; if not available - * may return {@link JsonLocation#NA} (but never {@code null}). + * may return {@code null}. *

* Accuracy of location information depends on backend (format) as well * as (in some cases) operation being performed. @@ -71,7 +49,7 @@ public JacksonException clearLocation() { * @return Location in input or output that triggered the problem reported, if * available; {@code null} otherwise. */ - public JsonLocation getLocation() { return _location; } + public abstract JsonLocation getLocation(); /** * Method that allows accessing the original "message" argument, @@ -81,7 +59,7 @@ public JacksonException clearLocation() { * @return Original, unmodified {@code message} argument used to construct * this exception instance */ - public String getOriginalMessage() { return super.getMessage(); } + public abstract String getOriginalMessage(); /** * Method that allows accessing underlying processor that triggered @@ -94,69 +72,8 @@ public JacksonException clearLocation() { * to set it; this means that caller needs to take care to check for nulls. * Subtypes override this method with co-variant return type, for more * type-safe access. - *

- * NOTE: In Jackson 2.x, accessor was {@code getProcessor()}: in 3.0 changed to - * non-getter to avoid having to annotate for serialization. * * @return Originating processor, if available; {@code null} if not. */ - public abstract Object processor(); - - /* - /********************************************************************** - /* Methods for sub-classes to use, override - /********************************************************************** - */ - - /** - * Accessor that sub-classes can override to append additional - * information right after the main message, but before - * source location information. - *

- * NOTE: In Jackson 2.x, accessor was {@code getMessageSuffix()}: in 3.0 changed to - * non-getter to indicate it is not a "regular" getter (although it would not - * be serialized anyway due to lower visibility). - * - * @return Message suffix configured to be used, if any; {@code null} if none - */ - protected String messageSuffix() { return null; } - - /* - /********************************************************************** - /* Overrides of standard methods - /********************************************************************** - */ - - /** - * Default method overridden so that we can add location information - * - * @return Message constructed based on possible optional prefix; explicit - * {@code message} passed to constructor as well trailing location description - * (separate from message by linefeed) - */ - @Override public String getMessage() { - String msg = super.getMessage(); - if (msg == null) { - msg = "N/A"; - } - JsonLocation loc = getLocation(); - String suffix = messageSuffix(); - // mild optimization, if nothing extra is needed: - if ((loc != null) || suffix != null) { - StringBuilder sb = new StringBuilder(100); - sb.append(msg); - if (suffix != null) { - sb.append(suffix); - } - if (loc != null) { - sb.append('\n'); - sb.append(" at "); - sb = loc.toString(sb); - } - msg = sb.toString(); - } - return msg; - } - - @Override public String toString() { return getClass().getName()+": "+getMessage(); } + public abstract Object getProcessor(); } diff --git a/src/main/java/com/fasterxml/jackson/core/JsonFactory.java b/src/main/java/com/fasterxml/jackson/core/JsonFactory.java new file mode 100644 index 0000000000..384e336343 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/JsonFactory.java @@ -0,0 +1,2048 @@ +/* Jackson JSON-processor. + * + * Copyright (c) 2007- Tatu Saloranta, tatu.saloranta@iki.fi + */ +package com.fasterxml.jackson.core; + +import java.io.*; +import java.lang.ref.SoftReference; +import java.net.URL; + +import com.fasterxml.jackson.core.format.InputAccessor; +import com.fasterxml.jackson.core.format.MatchStrength; +import com.fasterxml.jackson.core.io.*; +import com.fasterxml.jackson.core.json.*; +import com.fasterxml.jackson.core.json.async.NonBlockingJsonParser; +import com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer; +import com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer; +import com.fasterxml.jackson.core.util.BufferRecycler; +import com.fasterxml.jackson.core.util.BufferRecyclers; +import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; +import com.fasterxml.jackson.core.util.JacksonFeature; + +/** + * The main factory class of Jackson package, used to configure and + * construct reader (aka parser, {@link JsonParser}) + * and writer (aka generator, {@link JsonGenerator}) + * instances. + *

+ * Factory instances are thread-safe and reusable after configuration + * (if any). Typically applications and services use only a single + * globally shared factory instance, unless they need differently + * configured factories. Factory reuse is important if efficiency matters; + * most recycling of expensive construct is done on per-factory basis. + *

+ * Creation of a factory instance is a light-weight operation, + * and since there is no need for pluggable alternative implementations + * (as there is no "standard" JSON processor API to implement), + * the default constructor is used for constructing factory + * instances. + * + * @author Tatu Saloranta + */ +@SuppressWarnings("resource") +public class JsonFactory + extends TokenStreamFactory + implements Versioned, + java.io.Serializable // since 2.1 (for Android, mostly) +{ + private static final long serialVersionUID = 2; + + /* + /********************************************************** + /* Helper types + /********************************************************** + */ + + /** + * Enumeration that defines all on/off features that can only be + * changed for {@link JsonFactory}. + */ + public enum Feature + implements JacksonFeature // since 2.12 + { + // // // Symbol handling (interning etc) + + /** + * Feature that determines whether JSON object field names are + * to be canonicalized using {@link String#intern} or not: + * if enabled, all field names will be intern()ed (and caller + * can count on this being true for all such names); if disabled, + * no intern()ing is done. There may still be basic + * canonicalization (that is, same String will be used to represent + * all identical object property names for a single document). + *

+ * Note: this setting only has effect if + * {@link #CANONICALIZE_FIELD_NAMES} is true -- otherwise no + * canonicalization of any sort is done. + *

+ * This setting is enabled by default. + */ + INTERN_FIELD_NAMES(true), + + /** + * Feature that determines whether JSON object field names are + * to be canonicalized (details of how canonicalization is done + * then further specified by + * {@link #INTERN_FIELD_NAMES}). + *

+ * This setting is enabled by default. + */ + CANONICALIZE_FIELD_NAMES(true), + + /** + * Feature that determines what happens if we encounter a case in symbol + * handling where number of hash collisions exceeds a safety threshold + * -- which almost certainly means a denial-of-service attack via generated + * duplicate hash codes. + * If feature is enabled, an {@link IllegalStateException} is + * thrown to indicate the suspected denial-of-service attack; if disabled, processing continues but + * canonicalization (and thereby intern()ing) is disabled) as protective + * measure. + *

+ * This setting is enabled by default. + * + * @since 2.4 + */ + FAIL_ON_SYMBOL_HASH_OVERFLOW(true), + + /** + * Feature that determines whether we will use {@link BufferRecycler} with + * {@link ThreadLocal} and {@link SoftReference}, for efficient reuse of + * underlying input/output buffers. + * This usually makes sense on normal J2SE/J2EE server-side processing; + * but may not make sense on platforms where {@link SoftReference} handling + * is broken (like Android), or if there are retention issues due to + * {@link ThreadLocal} (see + * jackson-core#189 + * for a possible case) + *

+ * This setting is enabled by default. + * + * @since 2.6 + */ + USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING(true) + + ; + + /** + * Whether feature is enabled or disabled by default. + */ + private final boolean _defaultState; + + /** + * Method that calculates bit set (flags) of all features that + * are enabled by default. + * + * @return Bit field of features enabled by default + */ + public static int collectDefaults() { + int flags = 0; + for (Feature f : values()) { + if (f.enabledByDefault()) { flags |= f.getMask(); } + } + return flags; + } + + private Feature(boolean defaultState) { _defaultState = defaultState; } + + @Override + public boolean enabledByDefault() { return _defaultState; } + @Override + public boolean enabledIn(int flags) { return (flags & getMask()) != 0; } + @Override + public int getMask() { return (1 << ordinal()); } + } + + /* + /********************************************************** + /* Constants + /********************************************************** + */ + + /** + * Name used to identify JSON format + * (and returned by {@link #getFormatName()} + */ + public final static String FORMAT_NAME_JSON = "JSON"; + + /** + * Bitfield (set of flags) of all factory features that are enabled by default. + */ + protected final static int DEFAULT_FACTORY_FEATURE_FLAGS = JsonFactory.Feature.collectDefaults(); + + /** + * Bitfield (set of flags) of all parser features that are enabled + * by default. + */ + protected final static int DEFAULT_PARSER_FEATURE_FLAGS = JsonParser.Feature.collectDefaults(); + + /** + * Bitfield (set of flags) of all generator features that are enabled + * by default. + */ + protected final static int DEFAULT_GENERATOR_FEATURE_FLAGS = JsonGenerator.Feature.collectDefaults(); + + public final static SerializableString DEFAULT_ROOT_VALUE_SEPARATOR = DefaultPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR; + + /** + * @since 2.10 + */ + public final static char DEFAULT_QUOTE_CHAR = '"'; + + /* + /********************************************************** + /* Buffer, symbol table management + /********************************************************** + */ + + /** + * Each factory comes equipped with a shared root symbol table. + * It should not be linked back to the original blueprint, to + * avoid contents from leaking between factories. + */ + protected final transient CharsToNameCanonicalizer _rootCharSymbols = CharsToNameCanonicalizer.createRoot(); + + /** + * Alternative to the basic symbol table, some stream-based + * parsers use different name canonicalization method. + *

+ * TODO: should clean up this; looks messy having 2 alternatives + * with not very clear differences. + * + * @since 2.6 + */ + protected final transient ByteQuadsCanonicalizer _byteSymbolCanonicalizer = ByteQuadsCanonicalizer.createRoot(); + + /* + /********************************************************** + /* Configuration, simple feature flags + /********************************************************** + */ + + /** + * Currently enabled factory features. + */ + protected int _factoryFeatures = DEFAULT_FACTORY_FEATURE_FLAGS; + + /** + * Currently enabled parser features. + */ + protected int _parserFeatures = DEFAULT_PARSER_FEATURE_FLAGS; + + /** + * Currently enabled generator features. + */ + protected int _generatorFeatures = DEFAULT_GENERATOR_FEATURE_FLAGS; + + /* + /********************************************************** + /* Configuration, helper objects + /********************************************************** + */ + + /** + * Object that implements conversion functionality between + * Java objects and JSON content. For base JsonFactory implementation + * usually not set by default, but can be explicitly set. + * Sub-classes (like @link org.codehaus.jackson.map.MappingJsonFactory} + * usually provide an implementation. + */ + protected ObjectCodec _objectCodec; + + /** + * Definition of custom character escapes to use for generators created + * by this factory, if any. If null, standard data format specific + * escapes are used. + */ + protected CharacterEscapes _characterEscapes; + + /** + * Optional helper object that may decorate input sources, to do + * additional processing on input during parsing. + */ + protected InputDecorator _inputDecorator; + + /** + * Optional helper object that may decorate output object, to do + * additional processing on output during content generation. + */ + protected OutputDecorator _outputDecorator; + + /** + * Separator used between root-level values, if any; null indicates + * "do not add separator". + * Default separator is a single space character. + * + * @since 2.1 + */ + protected SerializableString _rootValueSeparator = DEFAULT_ROOT_VALUE_SEPARATOR; + + /** + * Optional threshold used for automatically escaping character above certain character + * code value: either {@code 0} to indicate that no threshold is specified, or value + * at or above 127 to indicate last character code that is NOT automatically escaped + * (but depends on other configuration rules for checking). + * + * @since 2.10 + */ + protected int _maximumNonEscapedChar; + + /** + * Character used for quoting field names (if field name quoting has not + * been disabled with {@link JsonWriteFeature#QUOTE_FIELD_NAMES}) + * and JSON String values. + */ + protected final char _quoteChar; + + /* + /********************************************************** + /* Construction + /********************************************************** + */ + + /** + * Default constructor used to create factory instances. + * Creation of a factory instance is a light-weight operation, + * but it is still a good idea to reuse limited number of + * factory instances (and quite often just a single instance): + * factories are used as context for storing some reused + * processing objects (such as symbol tables parsers use) + * and this reuse only works within context of a single + * factory instance. + */ + public JsonFactory() { this((ObjectCodec) null); } + + public JsonFactory(ObjectCodec oc) { + _objectCodec = oc; + _quoteChar = DEFAULT_QUOTE_CHAR; + } + + /** + * Constructor used when copy()ing a factory instance. + * + * @param src Original factory to copy settings from + * @param codec Databinding-level codec to use, if any + * + * @since 2.2.1 + */ + protected JsonFactory(JsonFactory src, ObjectCodec codec) + { + _objectCodec = codec; + + // General + _factoryFeatures = src._factoryFeatures; + _parserFeatures = src._parserFeatures; + _generatorFeatures = src._generatorFeatures; + _inputDecorator = src._inputDecorator; + _outputDecorator = src._outputDecorator; + + // JSON-specific + _characterEscapes = src._characterEscapes; + _rootValueSeparator = src._rootValueSeparator; + _maximumNonEscapedChar = src._maximumNonEscapedChar; + _quoteChar = src._quoteChar; + } + + /** + * Constructor used by {@link JsonFactoryBuilder} for instantiation. + * + * @param b Builder that contains settings to use + * + * @since 2.10 + */ + public JsonFactory(JsonFactoryBuilder b) { + _objectCodec = null; + + // General + _factoryFeatures = b._factoryFeatures; + _parserFeatures = b._streamReadFeatures; + _generatorFeatures = b._streamWriteFeatures; + _inputDecorator = b._inputDecorator; + _outputDecorator = b._outputDecorator; + + // JSON-specific + _characterEscapes = b._characterEscapes; + _rootValueSeparator = b._rootValueSeparator; + _maximumNonEscapedChar = b._maximumNonEscapedChar; + _quoteChar = b._quoteChar; + } + + /** + * Constructor for subtypes; needed to work around the fact that before 3.0, + * this factory has cumbersome dual role as generic type as well as actual + * implementation for json. + * + * @param b Builder that contains settings to use + * @param bogus Argument only needed to separate constructor signature; ignored + */ + protected JsonFactory(TSFBuilder b, boolean bogus) { + _objectCodec = null; + + _factoryFeatures = b._factoryFeatures; + _parserFeatures = b._streamReadFeatures; + _generatorFeatures = b._streamWriteFeatures; + _inputDecorator = b._inputDecorator; + _outputDecorator = b._outputDecorator; + + // JSON-specific: need to assign even if not really used + _characterEscapes = null; + _rootValueSeparator = null; + _maximumNonEscapedChar = 0; + _quoteChar = DEFAULT_QUOTE_CHAR; + } + + /** + * Method that allows construction of differently configured factory, starting + * with settings of this factory. + * + * @return Builder instance to use + * + * @since 2.10 + */ + public TSFBuilder rebuild() { + // 13-Jun-2018, tatu: Verify sub-classing to prevent strange bugs in format impls + _requireJSONFactory("Factory implementation for format (%s) MUST override `rebuild()` method"); + return new JsonFactoryBuilder(this); + } + + /** + * Main factory method to use for constructing {@link JsonFactory} instances with + * different configuration: creates and returns a builder for collecting configuration + * settings; instance created by calling {@code build()} after all configuration + * set. + *

+ * NOTE: signature unfortunately does not expose true implementation type; this + * will be fixed in 3.0. + * + * @return Builder instance to use + */ + public static TSFBuilder builder() { + return new JsonFactoryBuilder(); + } + + /** + * Method for constructing a new {@link JsonFactory} that has + * the same settings as this instance, but is otherwise + * independent (i.e. nothing is actually shared, symbol tables + * are separate). + * Note that {@link ObjectCodec} reference is not copied but is + * set to null; caller typically needs to set it after calling + * this method. Reason for this is that the codec is used for + * callbacks, and assumption is that there is strict 1-to-1 + * mapping between codec, factory. Caller has to, then, explicitly + * set codec after making the copy. + * + * @return Copy of this factory instance + * + * @since 2.1 + */ + public JsonFactory copy() + { + _checkInvalidCopy(JsonFactory.class); + // as per above, do clear ObjectCodec + return new JsonFactory(this, null); + } + + protected void _checkInvalidCopy(Class exp) + { + if (getClass() != exp) { + throw new IllegalStateException("Failed copy(): "+getClass().getName() + +" (version: "+version()+") does not override copy(); it has to"); + } + } + + /* + /********************************************************** + /* Serializable overrides + /********************************************************** + */ + + /** + * Method that we need to override to actually make restoration go + * through constructors etc: needed to allow JDK serializability of + * factory instances. + *

+ * Note: must be overridden by sub-classes as well. + * + * @return Newly constructed instance + */ + protected Object readResolve() { + return new JsonFactory(this, _objectCodec); + } + + /* + /********************************************************** + /* Capability introspection + /********************************************************** + */ + + /** + * Introspection method that higher-level functionality may call + * to see whether underlying data format requires a stable ordering + * of object properties or not. + * This is usually used for determining + * whether to force a stable ordering (like alphabetic ordering by name) + * if no ordering if explicitly specified. + *

+ * Default implementation returns false as JSON does NOT + * require stable ordering. Formats that require ordering include positional + * textual formats like CSV, and schema-based binary formats + * like Avro. + * + * @return Whether format supported by this factory + * requires Object properties to be ordered. + * + * @since 2.3 + */ + @Override + public boolean requiresPropertyOrdering() { return false; } + + /** + * Introspection method that higher-level functionality may call + * to see whether underlying data format can read and write binary + * data natively; that is, embeded it as-is without using encodings + * such as Base64. + *

+ * Default implementation returns false as JSON does not + * support native access: all binary content must use Base64 encoding. + * Most binary formats (like Smile and Avro) support native binary content. + * + * @return Whether format supported by this factory + * supports native binary content + * + * @since 2.3 + */ + @Override + public boolean canHandleBinaryNatively() { return false; } + + /** + * Introspection method that can be used by base factory to check + * whether access using char[] is something that actual + * parser implementations can take advantage of, over having to + * use {@link java.io.Reader}. Sub-types are expected to override + * definition; default implementation (suitable for JSON) alleges + * that optimization are possible; and thereby is likely to try + * to access {@link java.lang.String} content by first copying it into + * recyclable intermediate buffer. + * + * @return Whether access to decoded textual content can be efficiently + * accessed using parser method {@code getTextCharacters()}. + * + * @since 2.4 + */ + public boolean canUseCharArrays() { return true; } + + /** + * Introspection method that can be used to check whether this + * factory can create non-blocking parsers: parsers that do not + * use blocking I/O abstractions but instead use a + * {@link com.fasterxml.jackson.core.async.NonBlockingInputFeeder}. + * + * @return Whether this factory supports non-blocking ("async") parsing or + * not (and consequently whether {@code createNonBlockingXxx()} method(s) work) + * + * @since 2.9 + */ + @Override + public boolean canParseAsync() { + // 31-May-2017, tatu: Jackson 2.9 does support async parsing for JSON, + // but not all other formats, so need to do this: + return _isJSONFactory(); + } + + @Override + public Class getFormatReadFeatureType() { + return null; + } + + @Override + public Class getFormatWriteFeatureType() { + return null; + } + + /* + /********************************************************** + /* Format detection functionality + /********************************************************** + */ + + /** + * Method that can be used to quickly check whether given schema + * is something that parsers and/or generators constructed by this + * factory could use. Note that this means possible use, at the level + * of data format (i.e. schema is for same data format as parsers and + * generators this factory constructs); individual schema instances + * may have further usage restrictions. + * + * @param schema Schema instance to check + * + * @return Whether parsers and generators constructed by this factory + * can use specified format schema instance + */ + @Override + public boolean canUseSchema(FormatSchema schema) { + if (schema == null){ + return false; + } + String ourFormat = getFormatName(); + return (ourFormat != null) && ourFormat.equals(schema.getSchemaType()); + } + + /** + * Method that returns short textual id identifying format + * this factory supports. + *

+ * Note: sub-classes should override this method; default + * implementation will return null for all sub-classes + * + * @return Name of the format handled by parsers, generators this factory creates + */ + @Override + public String getFormatName() + { + /* Somewhat nasty check: since we can't make this abstract + * (due to backwards compatibility concerns), need to prevent + * format name "leakage" + */ + if (getClass() == JsonFactory.class) { + return FORMAT_NAME_JSON; + } + return null; + } + + public MatchStrength hasFormat(InputAccessor acc) throws IOException + { + // since we can't keep this abstract, only implement for "vanilla" instance + if (getClass() == JsonFactory.class) { + return hasJSONFormat(acc); + } + return null; + } + + /** + * Method that can be called to determine if a custom + * {@link ObjectCodec} is needed for binding data parsed + * using {@link JsonParser} constructed by this factory + * (which typically also implies the same for serialization + * with {@link JsonGenerator}). + * + * @return True if custom codec is needed with parsers and + * generators created by this factory; false if a general + * {@link ObjectCodec} is enough + * + * @since 2.1 + */ + public boolean requiresCustomCodec() { + return false; + } + + protected MatchStrength hasJSONFormat(InputAccessor acc) throws IOException { + return ByteSourceJsonBootstrapper.hasJSONFormat(acc); + } + + /* + /********************************************************** + /* Versioned + /********************************************************** + */ + + @Override + public Version version() { + return PackageVersion.VERSION; + } + + /* + /********************************************************** + /* Configuration, factory features + /********************************************************** + */ + + /** + * Method for enabling or disabling specified parser feature + * (check {@link JsonParser.Feature} for list of features) + * + * @param f Feature to enable/disable + * @param state Whether to enable or disable the feature + * + * @return This factory instance (to allow call chaining) + * + * @deprecated since 2.10 use {@link JsonFactoryBuilder#configure(JsonFactory.Feature, boolean)} instead + */ + @Deprecated + public final JsonFactory configure(JsonFactory.Feature f, boolean state) { + return state ? enable(f) : disable(f); + } + + /** + * Method for enabling specified parser feature + * (check {@link JsonFactory.Feature} for list of features) + * + * @param f Feature to enable + * + * @return This factory instance (to allow call chaining) + * + * @deprecated since 2.10 use {@link JsonFactoryBuilder#configure(JsonFactory.Feature, boolean)} instead + */ + @Deprecated + public JsonFactory enable(JsonFactory.Feature f) { + _factoryFeatures |= f.getMask(); + return this; + } + + /** + * Method for disabling specified parser features + * (check {@link JsonFactory.Feature} for list of features) + * + * @param f Feature to disable + * + * @return This factory instance (to allow call chaining) + * + * @deprecated since 2.10 use {@link JsonFactoryBuilder#configure(JsonFactory.Feature, boolean)} instead + */ + @Deprecated + public JsonFactory disable(JsonFactory.Feature f) { + _factoryFeatures &= ~f.getMask(); + return this; + } + + /** + * Checked whether specified parser feature is enabled. + * + * @param f Feature to check + * + * @return True if the specified feature is enabled + */ + public final boolean isEnabled(JsonFactory.Feature f) { + return (_factoryFeatures & f.getMask()) != 0; + } + + @Override + public final int getParserFeatures() { + return _parserFeatures; + } + + @Override + public final int getGeneratorFeatures() { + return _generatorFeatures; + } + + // MUST be overridden by sub-classes that support format-specific parser features + @Override + public int getFormatParserFeatures() { + return 0; + } + + // MUST be overridden by sub-classes that support format-specific generator features + @Override + public int getFormatGeneratorFeatures() { + return 0; + } + + /* + /********************************************************** + /* Configuration, parser configuration + /********************************************************** + */ + + /** + * Method for enabling or disabling specified parser feature + * (check {@link JsonParser.Feature} for list of features) + * + * @param f Feature to enable/disable + * @param state Whether to enable or disable the feature + * + * @return This factory instance (to allow call chaining) + */ + public final JsonFactory configure(JsonParser.Feature f, boolean state) { + return state ? enable(f) : disable(f); + } + + /** + * Method for enabling specified parser feature + * (check {@link JsonParser.Feature} for list of features) + * + * @param f Feature to enable + * + * @return This factory instance (to allow call chaining) + */ + public JsonFactory enable(JsonParser.Feature f) { + _parserFeatures |= f.getMask(); + return this; + } + + /** + * Method for disabling specified parser features + * (check {@link JsonParser.Feature} for list of features) + * + * @param f Feature to disable + * + * @return This factory instance (to allow call chaining) + */ + public JsonFactory disable(JsonParser.Feature f) { + _parserFeatures &= ~f.getMask(); + return this; + } + + /** + * Method for checking if the specified parser feature is enabled. + * + * @param f Feature to check + * + * @return True if specified feature is enabled + */ + @Override + public final boolean isEnabled(JsonParser.Feature f) { + return (_parserFeatures & f.getMask()) != 0; + } + + /** + * Method for checking if the specified stream read feature is enabled. + * + * @param f Feature to check + * + * @return True if specified feature is enabled + * + * @since 2.10 + */ + public final boolean isEnabled(StreamReadFeature f) { + return (_parserFeatures & f.mappedFeature().getMask()) != 0; + } + + /** + * Method for getting currently configured input decorator (if any; + * there is no default decorator). + * + * @return InputDecorator configured, if any + */ + public InputDecorator getInputDecorator() { + return _inputDecorator; + } + + /** + * Method for overriding currently configured input decorator + * + * @param d Decorator to configure for this factory, if any ({@code null} if none) + * + * @return This factory instance (to allow call chaining) + * + * @deprecated Since 2.10 use {@link JsonFactoryBuilder#inputDecorator(InputDecorator)} instead + */ + @Deprecated + public JsonFactory setInputDecorator(InputDecorator d) { + _inputDecorator = d; + return this; + } + + /* + /********************************************************** + /* Configuration, generator settings + /********************************************************** + */ + + /** + * Method for enabling or disabling specified generator feature + * (check {@link JsonGenerator.Feature} for list of features) + * + * @param f Feature to enable/disable + * @param state Whether to enable or disable the feature + * + * @return This factory instance (to allow call chaining) + */ + public final JsonFactory configure(JsonGenerator.Feature f, boolean state) { + return state ? enable(f) : disable(f); + } + + /** + * Method for enabling specified generator features + * (check {@link JsonGenerator.Feature} for list of features) + * + * @param f Feature to enable + * + * @return This factory instance (to allow call chaining) + */ + public JsonFactory enable(JsonGenerator.Feature f) { + _generatorFeatures |= f.getMask(); + return this; + } + + /** + * Method for disabling specified generator feature + * (check {@link JsonGenerator.Feature} for list of features) + * + * @param f Feature to disable + * + * @return This factory instance (to allow call chaining) + */ + public JsonFactory disable(JsonGenerator.Feature f) { + _generatorFeatures &= ~f.getMask(); + return this; + } + + /** + * Check whether specified generator feature is enabled. + * + * @param f Feature to check + * + * @return Whether specified feature is enabled + */ + @Override + public final boolean isEnabled(JsonGenerator.Feature f) { + return (_generatorFeatures & f.getMask()) != 0; + } + + /** + * Check whether specified stream write feature is enabled. + * + * @param f Feature to check + * + * @return Whether specified feature is enabled + * + * @since 2.10 + */ + public final boolean isEnabled(StreamWriteFeature f) { + return (_generatorFeatures & f.mappedFeature().getMask()) != 0; + } + + /** + * Method for accessing custom escapes factory uses for {@link JsonGenerator}s + * it creates. + * + * @return Configured {@code CharacterEscapes}, if any; {@code null} if none + */ + public CharacterEscapes getCharacterEscapes() { return _characterEscapes; } + + /** + * Method for defining custom escapes factory uses for {@link JsonGenerator}s + * it creates. + * + * @param esc CharaterEscapes to set (or {@code null} for "none") + * + * @return This factory instance (to allow call chaining) + */ + public JsonFactory setCharacterEscapes(CharacterEscapes esc) { + _characterEscapes = esc; + return this; + } + + /** + * Method for getting currently configured output decorator (if any; + * there is no default decorator). + * + * @return OutputDecorator configured for generators factory creates, if any; + * {@code null} if none. + */ + public OutputDecorator getOutputDecorator() { + return _outputDecorator; + } + + /** + * Method for overriding currently configured output decorator + * + * @return This factory instance (to allow call chaining) + * + * @param d Output decorator to use, if any + * + * @deprecated Since 2.10 use {@link JsonFactoryBuilder#outputDecorator(OutputDecorator)} instead + */ + @Deprecated + public JsonFactory setOutputDecorator(OutputDecorator d) { + _outputDecorator = d; + return this; + } + + /** + * Method that allows overriding String used for separating root-level + * JSON values (default is single space character) + * + * @param sep Separator to use, if any; null means that no separator is + * automatically added + * + * @return This factory instance (to allow call chaining) + */ + public JsonFactory setRootValueSeparator(String sep) { + _rootValueSeparator = (sep == null) ? null : new SerializedString(sep); + return this; + } + + /** + * @return Root value separator configured, if any + */ + public String getRootValueSeparator() { + return (_rootValueSeparator == null) ? null : _rootValueSeparator.getValue(); + } + + /* + /********************************************************** + /* Configuration, other + /********************************************************** + */ + + /** + * Method for associating a {@link ObjectCodec} (typically + * a com.fasterxml.jackson.databind.ObjectMapper) + * with this factory (and more importantly, parsers and generators + * it constructs). This is needed to use data-binding methods + * of {@link JsonParser} and {@link JsonGenerator} instances. + * + * @param oc Codec to use + * + * @return This factory instance (to allow call chaining) + */ + public JsonFactory setCodec(ObjectCodec oc) { + _objectCodec = oc; + return this; + } + + public ObjectCodec getCodec() { return _objectCodec; } + + /* + /********************************************************** + /* Parser factories, traditional (blocking) I/O sources + /********************************************************** + */ + + /** + * Method for constructing JSON parser instance to parse + * contents of specified file. + * + *

+ * Encoding is auto-detected from contents according to JSON + * specification recommended mechanism. Json specification + * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + * so auto-detection implemented only for this charsets. + * For other charsets use {@link #createParser(java.io.Reader)}. + * + *

+ * Underlying input stream (needed for reading contents) + * will be owned (and managed, i.e. closed as need be) by + * the parser, since caller has no access to it. + * + * @param f File that contains JSON content to parse + * + * @since 2.1 + */ + @Override + public JsonParser createParser(File f) throws IOException, JsonParseException { + // true, since we create InputStream from File + IOContext ctxt = _createContext(_createContentReference(f), true); + InputStream in = new FileInputStream(f); + return _createParser(_decorate(in, ctxt), ctxt); + } + + /** + * Method for constructing JSON parser instance to parse + * contents of resource reference by given URL. + *

+ * Encoding is auto-detected from contents according to JSON + * specification recommended mechanism. Json specification + * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + * so auto-detection implemented only for this charsets. + * For other charsets use {@link #createParser(java.io.Reader)}. + *

+ * Underlying input stream (needed for reading contents) + * will be owned (and managed, i.e. closed as need be) by + * the parser, since caller has no access to it. + * + * @param url URL pointing to resource that contains JSON content to parse + * + * @since 2.1 + */ + @Override + public JsonParser createParser(URL url) throws IOException, JsonParseException { + // true, since we create InputStream from URL + IOContext ctxt = _createContext(_createContentReference(url), true); + InputStream in = _optimizedStreamFromURL(url); + return _createParser(_decorate(in, ctxt), ctxt); + } + + /** + * Method for constructing JSON parser instance to parse + * the contents accessed via specified input stream. + *

+ * The input stream will not be owned by + * the parser, it will still be managed (i.e. closed if + * end-of-stream is reacher, or parser close method called) + * if (and only if) {@link com.fasterxml.jackson.core.StreamReadFeature#AUTO_CLOSE_SOURCE} + * is enabled. + *

+ * + * Note: no encoding argument is taken since it can always be + * auto-detected as suggested by JSON RFC. Json specification + * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + * so auto-detection implemented only for this charsets. + * For other charsets use {@link #createParser(java.io.Reader)}. + * + * @param in InputStream to use for reading JSON content to parse + * + * @since 2.1 + */ + @Override + public JsonParser createParser(InputStream in) throws IOException, JsonParseException { + IOContext ctxt = _createContext(_createContentReference(in), false); + return _createParser(_decorate(in, ctxt), ctxt); + } + + /** + * Method for constructing parser for parsing + * the contents accessed via specified Reader. +

+ * The read stream will not be owned by + * the parser, it will still be managed (i.e. closed if + * end-of-stream is reacher, or parser close method called) + * if (and only if) {@link com.fasterxml.jackson.core.StreamReadFeature#AUTO_CLOSE_SOURCE} + * is enabled. + * + * @param r Reader to use for reading JSON content to parse + * + * @since 2.1 + */ + @Override + public JsonParser createParser(Reader r) throws IOException, JsonParseException { + // false -> we do NOT own Reader (did not create it) + IOContext ctxt = _createContext(_createContentReference(r), false); + return _createParser(_decorate(r, ctxt), ctxt); + } + + /** + * Method for constructing parser for parsing + * the contents of given byte array. + * + * @since 2.1 + */ + @Override + public JsonParser createParser(byte[] data) throws IOException, JsonParseException { + IOContext ctxt = _createContext(_createContentReference(data), true); + if (_inputDecorator != null) { + InputStream in = _inputDecorator.decorate(ctxt, data, 0, data.length); + if (in != null) { + return _createParser(in, ctxt); + } + } + return _createParser(data, 0, data.length, ctxt); + } + + /** + * Method for constructing parser for parsing + * the contents of given byte array. + * + * @param data Buffer that contains data to parse + * @param offset Offset of the first data byte within buffer + * @param len Length of contents to parse within buffer + * + * @since 2.1 + */ + @Override + public JsonParser createParser(byte[] data, int offset, int len) throws IOException, JsonParseException { + IOContext ctxt = _createContext(_createContentReference(data, offset, len), true); + // [JACKSON-512]: allow wrapping with InputDecorator + if (_inputDecorator != null) { + InputStream in = _inputDecorator.decorate(ctxt, data, offset, len); + if (in != null) { + return _createParser(in, ctxt); + } + } + return _createParser(data, offset, len, ctxt); + } + + /** + * Method for constructing parser for parsing + * contents of given String. + * + * @since 2.1 + */ + @Override + public JsonParser createParser(String content) throws IOException, JsonParseException { + final int strLen = content.length(); + // Actually, let's use this for medium-sized content, up to 64kB chunk (32kb char) + if ((_inputDecorator != null) || (strLen > 0x8000) || !canUseCharArrays()) { + // easier to just wrap in a Reader than extend InputDecorator; or, if content + // is too long for us to copy it over + return createParser(new StringReader(content)); + } + IOContext ctxt = _createContext(_createContentReference(content), true); + char[] buf = ctxt.allocTokenBuffer(strLen); + content.getChars(0, strLen, buf, 0); + return _createParser(buf, 0, strLen, ctxt, true); + } + + /** + * Method for constructing parser for parsing + * contents of given char array. + * + * @since 2.4 + */ + @Override + public JsonParser createParser(char[] content) throws IOException { + return createParser(content, 0, content.length); + } + + /** + * Method for constructing parser for parsing contents of given char array. + * + * @since 2.4 + */ + @Override + public JsonParser createParser(char[] content, int offset, int len) throws IOException { + if (_inputDecorator != null) { // easier to just wrap in a Reader than extend InputDecorator + return createParser(new CharArrayReader(content, offset, len)); + } + return _createParser(content, offset, len, + _createContext(_createContentReference(content, offset, len), true), + // important: buffer is NOT recyclable, as it's from caller + false); + } + + /** + * Optional method for constructing parser for reading contents from specified {@link DataInput} + * instance. + *

+ * If this factory does not support {@link DataInput} as source, + * will throw {@link UnsupportedOperationException} + * + * @since 2.8 + */ + @Override + public JsonParser createParser(DataInput in) throws IOException { + IOContext ctxt = _createContext(_createContentReference(in), false); + return _createParser(_decorate(in, ctxt), ctxt); + } + + /* + /********************************************************** + /* Parser factories, non-blocking (async) sources + /********************************************************** + */ + + /** + * 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). + *

+ * If this factory does not support non-blocking parsing (either at all, + * or from byte array), + * will throw {@link UnsupportedOperationException}. + *

+ * Note that JSON-backed factory only supports parsing of UTF-8 encoded JSON content + * (and US-ASCII since it is proper subset); other encodings are not supported + * at this point. + * + * @since 2.9 + */ + @Override + 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?) supported for this format (%s)"); + IOContext ctxt = _createNonBlockingContext(null); + ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChild(_factoryFeatures); + return new NonBlockingJsonParser(ctxt, _parserFeatures, can); + } + + /* + /********************************************************** + /* Generator factories + /********************************************************** + */ + + /** + * Method for constructing JSON generator for writing JSON content + * using specified output stream. + * Encoding to use must be specified, and needs to be one of available + * types (as per JSON specification). + *

+ * Underlying stream is NOT owned by the generator constructed, + * so that generator will NOT close the output stream when + * {@link JsonGenerator#close} is called (unless auto-closing + * feature, + * {@link com.fasterxml.jackson.core.JsonGenerator.Feature#AUTO_CLOSE_TARGET} + * is enabled). + * Using application needs to close it explicitly if this is the case. + *

+ * Note: there are formats that use fixed encoding (like most binary data formats) + * and that ignore passed in encoding. + * + * @param out OutputStream to use for writing JSON content + * @param enc Character encoding to use + * + * @since 2.1 + */ + @Override + public JsonGenerator createGenerator(OutputStream out, JsonEncoding enc) + throws IOException + { + // false -> we won't manage the stream unless explicitly directed to + IOContext ctxt = _createContext(_createContentReference(out), false); + ctxt.setEncoding(enc); + if (enc == JsonEncoding.UTF8) { + return _createUTF8Generator(_decorate(out, ctxt), ctxt); + } + Writer w = _createWriter(out, enc, ctxt); + return _createGenerator(_decorate(w, ctxt), ctxt); + } + + /** + * Convenience method for constructing generator that uses default + * encoding of the format (UTF-8 for JSON and most other data formats). + *

+ * Note: there are formats that use fixed encoding (like most binary data formats). + * + * @since 2.1 + */ + @Override + public JsonGenerator createGenerator(OutputStream out) throws IOException { + return createGenerator(out, JsonEncoding.UTF8); + } + + /** + * Method for constructing JSON generator for writing JSON content + * using specified Writer. + *

+ * Underlying stream is NOT owned by the generator constructed, + * so that generator will NOT close the Reader when + * {@link JsonGenerator#close} is called (unless auto-closing + * feature, + * {@link com.fasterxml.jackson.core.JsonGenerator.Feature#AUTO_CLOSE_TARGET} is enabled). + * Using application needs to close it explicitly. + * + * @since 2.1 + * + * @param w Writer to use for writing JSON content + */ + @Override + public JsonGenerator createGenerator(Writer w) throws IOException { + IOContext ctxt = _createContext(_createContentReference(w), false); + return _createGenerator(_decorate(w, ctxt), ctxt); + } + + /** + * Method for constructing JSON generator for writing JSON content + * to specified file, overwriting contents it might have (or creating + * it if such file does not yet exist). + * Encoding to use must be specified, and needs to be one of available + * types (as per JSON specification). + *

+ * Underlying stream is owned by the generator constructed, + * i.e. generator will handle closing of file when + * {@link JsonGenerator#close} is called. + * + * @param f File to write contents to + * @param enc Character encoding to use + * + * @since 2.1 + */ + @Override + public JsonGenerator createGenerator(File f, JsonEncoding enc) throws IOException + { + OutputStream out = new FileOutputStream(f); + // true -> yes, we have to manage the stream since we created it + IOContext ctxt = _createContext(_createContentReference(out), true); + ctxt.setEncoding(enc); + if (enc == JsonEncoding.UTF8) { + return _createUTF8Generator(_decorate(out, ctxt), ctxt); + } + Writer w = _createWriter(out, enc, ctxt); + return _createGenerator(_decorate(w, ctxt), ctxt); + } + + /** + * Method for constructing generator for writing content using specified + * {@link DataOutput} instance. + * + * @since 2.8 + */ + @Override + public JsonGenerator createGenerator(DataOutput out, JsonEncoding enc) throws IOException { + return createGenerator(_createDataOutputWrapper(out), enc); + } + + /** + * Convenience method for constructing generator that uses default + * encoding of the format (UTF-8 for JSON and most other data formats). + *

+ * Note: there are formats that use fixed encoding (like most binary data formats). + * + * @since 2.8 + */ + @Override + public JsonGenerator createGenerator(DataOutput out) throws IOException { + return createGenerator(_createDataOutputWrapper(out), JsonEncoding.UTF8); + } + + /* + /********************************************************** + /* Deprecated parser factory methods: to be removed from 3.x + /********************************************************** + */ + + /** + * Method for constructing JSON parser instance to parse + * contents of specified file. + *

+ * Encoding is auto-detected from contents according to JSON + * specification recommended mechanism. Json specification + * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + * so auto-detection implemented only for this charsets. + * For other charsets use {@link #createParser(java.io.Reader)}. + * + *

+ * Underlying input stream (needed for reading contents) + * will be owned (and managed, i.e. closed as need be) by + * the parser, since caller has no access to it. + * + * @param f File that contains JSON content to parse + * + * @return Parser constructed + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * @throws JsonParseException if parser initialization fails due to content decoding problem + * + * @deprecated Since 2.2, use {@link #createParser(File)} instead. + */ + @Deprecated + public JsonParser createJsonParser(File f) throws IOException, JsonParseException { + return createParser(f); + } + + /** + * Method for constructing JSON parser instance to parse + * contents of resource reference by given URL. + *

+ * Encoding is auto-detected from contents according to JSON + * specification recommended mechanism. Json specification + * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + * so auto-detection implemented only for this charsets. + * For other charsets use {@link #createParser(java.io.Reader)}. + *

+ * Underlying input stream (needed for reading contents) + * will be owned (and managed, i.e. closed as need be) by + * the parser, since caller has no access to it. + * + * @param url URL pointing to resource that contains JSON content to parse + * + * @return Parser constructed + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * @throws JsonParseException if parser initialization fails due to content decoding problem + * + * @deprecated Since 2.2, use {@link #createParser(URL)} instead. + */ + @Deprecated + public JsonParser createJsonParser(URL url) throws IOException, JsonParseException { + return createParser(url); + } + + /** + * Method for constructing JSON parser instance to parse + * the contents accessed via specified input stream. + *

+ * The input stream will not be owned by + * the parser, it will still be managed (i.e. closed if + * end-of-stream is reacher, or parser close method called) + * if (and only if) {@link com.fasterxml.jackson.core.JsonParser.Feature#AUTO_CLOSE_SOURCE} + * is enabled. + *

+ * + * Note: no encoding argument is taken since it can always be + * auto-detected as suggested by JSON RFC. Json specification + * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + * so auto-detection implemented only for this charsets. + * For other charsets use {@link #createParser(java.io.Reader)}. + * + * @param in InputStream to use for reading JSON content to parse + * + * @return Parser constructed + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * @throws JsonParseException if parser initialization fails due to content decoding problem + * + * @deprecated Since 2.2, use {@link #createParser(InputStream)} instead. + */ + @Deprecated + public JsonParser createJsonParser(InputStream in) throws IOException, JsonParseException { + return createParser(in); + } + + /** + * Method for constructing parser for parsing + * the contents accessed via specified Reader. +

+ * The read stream will not be owned by + * the parser, it will still be managed (i.e. closed if + * end-of-stream is reacher, or parser close method called) + * if (and only if) {@link com.fasterxml.jackson.core.JsonParser.Feature#AUTO_CLOSE_SOURCE} + * is enabled. + * + * @param r Reader to use for reading JSON content to parse + * + * @return Parser constructed + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * @throws JsonParseException if parser initialization fails due to content decoding problem + * + * @deprecated Since 2.2, use {@link #createParser(Reader)} instead. + */ + @Deprecated + public JsonParser createJsonParser(Reader r) throws IOException, JsonParseException { + return createParser(r); + } + + /** + * Method for constructing parser for parsing the contents of given byte array. + * + * @param data Input content to parse + * + * @return Parser constructed + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * @throws JsonParseException if parser initialization fails due to content decoding problem + * + * @deprecated Since 2.2, use {@link #createParser(byte[])} instead. + */ + @Deprecated + public JsonParser createJsonParser(byte[] data) throws IOException, JsonParseException { + return createParser(data); + } + + /** + * Method for constructing parser for parsing + * the contents of given byte array. + * + * @param data Buffer that contains data to parse + * @param offset Offset of the first data byte within buffer + * @param len Length of contents to parse within buffer + * + * @return Parser constructed + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * @throws JsonParseException if parser initialization fails due to content decoding problem + * + * @deprecated Since 2.2, use {@link #createParser(byte[],int,int)} instead. + */ + @Deprecated + public JsonParser createJsonParser(byte[] data, int offset, int len) throws IOException, JsonParseException { + return createParser(data, offset, len); + } + + /** + * Method for constructing parser for parsing + * contents of given String. + * + * @param content Input content to parse + * + * @return Parser constructed + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * @throws JsonParseException if parser initialization fails due to content decoding problem + * + * @deprecated Since 2.2, use {@link #createParser(String)} instead. + */ + @Deprecated + public JsonParser createJsonParser(String content) throws IOException, JsonParseException { + return createParser(content); + } + + /* + /********************************************************** + /* Deprecated generator factory methods: to be removed from 3.x + /********************************************************** + */ + + /** + * Method for constructing JSON generator for writing JSON content + * using specified output stream. + * Encoding to use must be specified, and needs to be one of available + * types (as per JSON specification). + *

+ * Underlying stream is NOT owned by the generator constructed, + * so that generator will NOT close the output stream when + * {@link JsonGenerator#close} is called (unless auto-closing + * feature, + * {@link com.fasterxml.jackson.core.JsonGenerator.Feature#AUTO_CLOSE_TARGET} + * is enabled). + * Using application needs to close it explicitly if this is the case. + *

+ * Note: there are formats that use fixed encoding (like most binary data formats) + * and that ignore passed in encoding. + * + * @param out OutputStream to use for writing JSON content + * @param enc Character encoding to use + * + * @return Generator constructed + * + * @throws IOException if parser initialization fails due to I/O (write) problem + * + * @deprecated Since 2.2, use {@link #createGenerator(OutputStream, JsonEncoding)} instead. + */ + @Deprecated + public JsonGenerator createJsonGenerator(OutputStream out, JsonEncoding enc) throws IOException { + return createGenerator(out, enc); + } + + /** + * Method for constructing JSON generator for writing JSON content + * using specified Writer. + *

+ * Underlying stream is NOT owned by the generator constructed, + * so that generator will NOT close the Reader when + * {@link JsonGenerator#close} is called (unless auto-closing + * feature, + * {@link com.fasterxml.jackson.core.JsonGenerator.Feature#AUTO_CLOSE_TARGET} is enabled). + * Using application needs to close it explicitly. + * + * @param out Writer to use for writing JSON content + * + * @return Generator constructed + * + * @throws IOException if parser initialization fails due to I/O (write) problem + * + * @deprecated Since 2.2, use {@link #createGenerator(Writer)} instead. + */ + @Deprecated + public JsonGenerator createJsonGenerator(Writer out) throws IOException { + return createGenerator(out); + } + + /** + * Convenience method for constructing generator that uses default + * encoding of the format (UTF-8 for JSON and most other data formats). + *

+ * Note: there are formats that use fixed encoding (like most binary data formats). + * + * @param out OutputStream to use for writing JSON content + * + * @return Generator constructed + * + * @throws IOException if parser initialization fails due to I/O (write) problem + * + * @deprecated Since 2.2, use {@link #createGenerator(OutputStream)} instead. + */ + @Deprecated + public JsonGenerator createJsonGenerator(OutputStream out) throws IOException { + return createGenerator(out, JsonEncoding.UTF8); + } + + /* + /********************************************************** + /* Factory methods used by factory for creating parser instances, + /* overridable by sub-classes + /********************************************************** + */ + + /** + * Overridable factory method that actually instantiates desired parser + * given {@link InputStream} and context object. + *

+ * This method is specifically designed to remain + * compatible between minor versions so that sub-classes can count + * on it being called as expected. That is, it is part of official + * interface from sub-class perspective, although not a public + * method available to users of factory implementations. + * + * @param in InputStream to use for reading content to parse + * @param ctxt I/O context to use for parsing + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * + * @return Parser constructed + * + * @since 2.1 + */ + protected JsonParser _createParser(InputStream in, IOContext ctxt) throws IOException { + // As per [JACKSON-259], may want to fully disable canonicalization: + return new ByteSourceJsonBootstrapper(ctxt, in).constructParser(_parserFeatures, + _objectCodec, _byteSymbolCanonicalizer, _rootCharSymbols, _factoryFeatures); + } + + /** + * Overridable factory method that actually instantiates parser + * using given {@link Reader} object for reading content. + *

+ * This method is specifically designed to remain + * compatible between minor versions so that sub-classes can count + * on it being called as expected. That is, it is part of official + * interface from sub-class perspective, although not a public + * method available to users of factory implementations. + * + * @param r Reader to use for reading content to parse + * @param ctxt I/O context to use for parsing + * + * @return Actual parser to use + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * + * @since 2.1 + */ + protected JsonParser _createParser(Reader r, IOContext ctxt) throws IOException { + return new ReaderBasedJsonParser(ctxt, _parserFeatures, r, _objectCodec, + _rootCharSymbols.makeChild(_factoryFeatures)); + } + + /** + * Overridable factory method that actually instantiates parser + * using given char[] object for accessing content. + * + * @param data Buffer that contains content to parse + * @param offset Offset to the first character of data to parse + * @param len Number of characters within buffer to parse + * @param ctxt I/O context to use for parsing + * @param recyclable Whether input buffer is recycled by the factory + * + * @return Actual parser to use + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * + * @since 2.4 + */ + protected JsonParser _createParser(char[] data, int offset, int len, IOContext ctxt, + boolean recyclable) throws IOException { + return new ReaderBasedJsonParser(ctxt, _parserFeatures, null, _objectCodec, + _rootCharSymbols.makeChild(_factoryFeatures), + data, offset, offset+len, recyclable); + } + + /** + * Overridable factory method that actually instantiates parser + * using given {@link Reader} object for reading content + * passed as raw byte array. + *

+ * This method is specifically designed to remain + * compatible between minor versions so that sub-classes can count + * on it being called as expected. That is, it is part of official + * interface from sub-class perspective, although not a public + * method available to users of factory implementations. + * + * @param data Buffer that contains content to parse + * @param offset Offset to the first character of data to parse + * @param len Number of characters within buffer to parse + * @param ctxt I/O context to use for parsing + * + * @return Actual parser to use + * + * @throws IOException if parser initialization fails due to I/O (read) problem + */ + protected JsonParser _createParser(byte[] data, int offset, int len, IOContext ctxt) throws IOException + { + return new ByteSourceJsonBootstrapper(ctxt, data, offset, len).constructParser(_parserFeatures, + _objectCodec, _byteSymbolCanonicalizer, _rootCharSymbols, _factoryFeatures); + } + + /** + * Optional factory method, expected to be overridden + * + * @param input DataInput to use for reading content to parse + * @param ctxt I/O context to use for parsing + * + * @return Actual parser to use + * + * @throws IOException if parser initialization fails due to I/O (read) problem + * + * @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?) supported 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); + } + + /* + /********************************************************** + /* Factory methods used by factory for creating generator instances, + /* overridable by sub-classes + /********************************************************** + */ + + /** + * Overridable factory method that actually instantiates generator for + * given {@link Writer} and context object. + *

+ * This method is specifically designed to remain + * compatible between minor versions so that sub-classes can count + * on it being called as expected. That is, it is part of official + * interface from sub-class perspective, although not a public + * method available to users of factory implementations. + * + * @param out Writer underlying writer to write generated content to + * @param ctxt I/O context to use + * + * @return This factory instance (to allow call chaining) + * + * @throws IOException if parser initialization fails due to I/O (write) problem + */ + protected JsonGenerator _createGenerator(Writer out, IOContext ctxt) throws IOException + { + WriterBasedJsonGenerator gen = new WriterBasedJsonGenerator(ctxt, + _generatorFeatures, _objectCodec, out, _quoteChar); + if (_maximumNonEscapedChar > 0) { + gen.setHighestNonEscapedChar(_maximumNonEscapedChar); + } + if (_characterEscapes != null) { + gen.setCharacterEscapes(_characterEscapes); + } + SerializableString rootSep = _rootValueSeparator; + if (rootSep != DEFAULT_ROOT_VALUE_SEPARATOR) { + gen.setRootValueSeparator(rootSep); + } + return gen; + } + + /** + * Overridable factory method that actually instantiates generator for + * given {@link OutputStream} and context object, using UTF-8 encoding. + *

+ * This method is specifically designed to remain + * compatible between minor versions so that sub-classes can count + * on it being called as expected. That is, it is part of official + * interface from sub-class perspective, although not a public + * method available to users of factory implementations. + * + * @param out OutputStream underlying writer to write generated content to + * @param ctxt I/O context to use + * + * @return This factory instance (to allow call chaining) + * + * @throws IOException if parser initialization fails due to I/O (write) problem + */ + protected JsonGenerator _createUTF8Generator(OutputStream out, IOContext ctxt) throws IOException { + UTF8JsonGenerator gen = new UTF8JsonGenerator(ctxt, + _generatorFeatures, _objectCodec, out, _quoteChar); + if (_maximumNonEscapedChar > 0) { + gen.setHighestNonEscapedChar(_maximumNonEscapedChar); + } + if (_characterEscapes != null) { + gen.setCharacterEscapes(_characterEscapes); + } + SerializableString rootSep = _rootValueSeparator; + if (rootSep != DEFAULT_ROOT_VALUE_SEPARATOR) { + gen.setRootValueSeparator(rootSep); + } + return gen; + } + + protected Writer _createWriter(OutputStream out, JsonEncoding enc, IOContext ctxt) throws IOException + { + // note: this should not get called any more (caller checks, dispatches) + if (enc == JsonEncoding.UTF8) { // We have optimized writer for UTF-8 + return new UTF8Writer(ctxt, out); + } + // not optimal, but should do unless we really care about UTF-16/32 encoding speed + return new OutputStreamWriter(out, enc.getJavaName()); + } + + /* + /********************************************************** + /* Internal factory methods, decorator handling + /********************************************************** + */ + + protected final InputStream _decorate(InputStream in, IOContext ctxt) throws IOException { + if (_inputDecorator != null) { + InputStream in2 = _inputDecorator.decorate(ctxt, in); + if (in2 != null) { + return in2; + } + } + return in; + } + + protected final Reader _decorate(Reader in, IOContext ctxt) throws IOException { + if (_inputDecorator != null) { + Reader in2 = _inputDecorator.decorate(ctxt, in); + if (in2 != null) { + return in2; + } + } + return in; + } + + // @since 2.8 + protected final DataInput _decorate(DataInput in, IOContext ctxt) throws IOException { + if (_inputDecorator != null) { + DataInput in2 = _inputDecorator.decorate(ctxt, in); + if (in2 != null) { + return in2; + } + } + return in; + } + + protected final OutputStream _decorate(OutputStream out, IOContext ctxt) throws IOException { + if (_outputDecorator != null) { + OutputStream out2 = _outputDecorator.decorate(ctxt, out); + if (out2 != null) { + return out2; + } + } + return out; + } + + protected final Writer _decorate(Writer out, IOContext ctxt) throws IOException { + if (_outputDecorator != null) { + Writer out2 = _outputDecorator.decorate(ctxt, out); + if (out2 != null) { + return out2; + } + } + return out; + } + + /* + /********************************************************** + /* Internal factory methods, other + /********************************************************** + */ + + /** + * Method used by factory to create buffer recycler instances + * for parsers and generators. + *

+ * Note: only public to give access for {@code ObjectMapper} + * + * @return Buffer recycler instance to use + */ + public BufferRecycler _getBufferRecycler() + { + // 23-Apr-2015, tatu: Let's allow disabling of buffer recycling + // scheme, for cases where it is considered harmful (possibly + // on Android, for example) + if (Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING.enabledIn(_factoryFeatures)) { + return BufferRecyclers.getBufferRecycler(); + } + return new BufferRecycler(); + } + + /** + * Overridable factory method that actually instantiates desired + * context object. + * + * @param contentRef Source/target reference to use for diagnostics, exception messages + * @param resourceManaged Whether input/output buffer is managed by this factory or not + * + * @return I/O context created + */ + protected IOContext _createContext(ContentReference contentRef, boolean resourceManaged) { + // 21-Mar-2021, tatu: Bit of defensive coding for backwards compatibility + if (contentRef == null) { + contentRef = ContentReference.unknown(); + } + return new IOContext(_getBufferRecycler(), contentRef, resourceManaged); + } + + /** + * Deprecated variant of {@link #_createContext(Object, boolean)} + * + * @param rawContentRef "Raw" source/target reference + * @param resourceManaged Whether input/output buffer is managed by this factory or not + * + * @return I/O context created + * + * @deprecated Since 2.13 + */ + @Deprecated // @since 2.13 + protected IOContext _createContext(Object rawContentRef, boolean resourceManaged) { + return new IOContext(_getBufferRecycler(), + _createContentReference(rawContentRef), + resourceManaged); + } + + /** + * Overridable factory method that actually instantiates desired + * context object for async (non-blocking) parsing + * + * @param srcRef Source reference to use for diagnostics, exception messages + * + * @return I/O context created + * + * @since 2.9.7 + */ + protected IOContext _createNonBlockingContext(Object srcRef) { + // [jackson-core#479]: allow recycling for non-blocking parser again + // now that access is thread-safe + return new IOContext(_getBufferRecycler(), + _createContentReference(srcRef), + false); + } + + /** + * Overridable factory method for constructing {@link ContentReference} + * to pass to parser or generator being created; used in cases where no offset + * or length is applicable (either irrelevant, or full contents assumed). + * + * @param contentAccessor Access to underlying content; depends on source/target, + * as well as content representation + * + * @return Reference instance to use + * + * @since 2.13 + */ + protected ContentReference _createContentReference(Object contentAccessor) { + // 21-Mar-2021, tatu: For now assume "canHandleBinaryNatively()" is reliable + // indicator of textual vs binary format: + return ContentReference.construct(!canHandleBinaryNatively(), contentAccessor); + } + + /** + * Overridable factory method for constructing {@link ContentReference} + * to pass to parser or generator being created; used in cases where content + * is available in a static buffer with relevant offset and length (mostly + * when reading from {@code byte[]}, {@code char[]} or {@code String}). + * + * @param contentAccessor Access to underlying content; depends on source/target, + * as well as content representation + * @param offset Offset of content + * @param length Length of content + * + * @return Reference instance to use + * + * @since 2.13 + */ + protected ContentReference _createContentReference(Object contentAccessor, + int offset, int length) + { + // 21-Mar-2021, tatu: For now assume "canHandleBinaryNatively()" is reliable + // indicator of textual vs binary format: + return ContentReference.construct(!canHandleBinaryNatively(), + contentAccessor, offset, length); + } + + /* + /********************************************************** + /* Internal helper methods + /********************************************************** + */ + + /** + * Helper method called to work around the problem of this class both defining + * general API for constructing parsers+generators AND implementing the API + * for JSON handling. Problem here is that when adding new functionality + * via factory methods, it is not possible to leave these methods abstract + * (because we are implementing them for JSON); but there is risk that + * sub-classes do not override them all (plus older version can not implement). + * So a work-around is to add a check to ensure that factory is still one + * used for JSON; and if not, make base implementation of a factory method fail. + * + * @param msg Message template to use for reporting problem (if necessary) + * + * @since 2.9 + */ + private final void _requireJSONFactory(String msg) { + if (!_isJSONFactory()) { + throw new UnsupportedOperationException(String.format(msg, getFormatName())); + } + } + + private final boolean _isJSONFactory() { + // NOTE: since we only really care about whether this is standard JSON-backed factory, + // or its sub-class / delegated to one, no need to check for equality, identity is enough + return getFormatName() == FORMAT_NAME_JSON; + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/json/JsonFactoryBuilder.java b/src/main/java/com/fasterxml/jackson/core/JsonFactoryBuilder.java similarity index 76% rename from src/main/java/com/fasterxml/jackson/core/json/JsonFactoryBuilder.java rename to src/main/java/com/fasterxml/jackson/core/JsonFactoryBuilder.java index 2bfaa32d79..2825437788 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/JsonFactoryBuilder.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonFactoryBuilder.java @@ -1,16 +1,22 @@ -package com.fasterxml.jackson.core.json; +package com.fasterxml.jackson.core; -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder; import com.fasterxml.jackson.core.io.CharacterEscapes; import com.fasterxml.jackson.core.io.SerializedString; +import com.fasterxml.jackson.core.json.JsonReadFeature; +import com.fasterxml.jackson.core.json.JsonWriteFeature; /** - * {@link com.fasterxml.jackson.core.TokenStreamFactory.TSFBuilder} - * implementation for constructing {@link JsonFactory} + * {@link com.fasterxml.jackson.core.TSFBuilder} + * implementation for constructing vanilla {@link JsonFactory} * instances for reading/writing JSON encoded content. + *

+ * NOTE: as of Jackson 2.x, use of JSON-specific builder is bit cumbersome + * since {@link JsonFactory} serves dual duty of base class AND actual + * implementation for JSON backend. This will be fixed in Jackson 3.0. + * + * @since 2.10 */ -public class JsonFactoryBuilder extends DecorableTSFBuilder +public class JsonFactoryBuilder extends TSFBuilder { protected CharacterEscapes _characterEscapes; @@ -19,26 +25,23 @@ public class JsonFactoryBuilder extends DecorableTSFBuilder * Default value is double-quote ({@code "}); typical alternative is * single-quote/apostrophe ({@code '}). * - * @param ch Character to use for quoting Object Property names and JSON String values. + * @param ch Character to use for quoting field names and JSON String values. * * @return This builder instance (to allow call chaining) */ diff --git a/src/main/java/com/fasterxml/jackson/core/JsonGenerationException.java b/src/main/java/com/fasterxml/jackson/core/JsonGenerationException.java new file mode 100644 index 0000000000..0d24e5124b --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/JsonGenerationException.java @@ -0,0 +1,71 @@ +/* Jackson JSON-processor. + * + * Copyright (c) 2007- Tatu Saloranta, tatu.saloranta@iki.fi + */ + +package com.fasterxml.jackson.core; + +import com.fasterxml.jackson.core.exc.StreamWriteException; + +/** + * Exception type for exceptions during JSON writing, such as trying + * to output content in wrong context (non-matching end-array or end-object, + * for example). + */ +public class JsonGenerationException + extends StreamWriteException +{ + private final static long serialVersionUID = 123; // eclipse complains otherwise + + @Deprecated // since 2.7 + public JsonGenerationException(Throwable rootCause) { + super(rootCause, null); + } + + @Deprecated // since 2.7 + public JsonGenerationException(String msg) { + super(msg, null); + } + + @Deprecated // since 2.7 + public JsonGenerationException(String msg, Throwable rootCause) { + super(msg, rootCause, null); + } + + // @since 2.7 + public JsonGenerationException(Throwable rootCause, JsonGenerator g) { + super(rootCause, g); + } + + // @since 2.7 + public JsonGenerationException(String msg, JsonGenerator g) { + super(msg, g); + _processor = g; + } + + // @since 2.7 + public JsonGenerationException(String msg, Throwable rootCause, JsonGenerator g) { + super(msg, rootCause, g); + _processor = g; + } + + /** + * Fluent method that may be used to assign originating {@link JsonGenerator}, + * to be accessed using {@link #getProcessor()}. + * + * @param g Generator to assign + * + * @return This exception instance (to allow call chaining) + * + * @since 2.7 + */ + @Override + public JsonGenerationException withGenerator(JsonGenerator g) { + _processor = g; + return this; + } + + // NOTE: overloaded in 2.13 just to retain binary compatibility with 2.12 (remove from 3.0) + @Override + public JsonGenerator getProcessor() { return _processor; } +} diff --git a/src/main/java/com/fasterxml/jackson/core/JsonGenerator.java b/src/main/java/com/fasterxml/jackson/core/JsonGenerator.java index 29b0dfe43c..13ee1ad2f8 100644 --- a/src/main/java/com/fasterxml/jackson/core/JsonGenerator.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonGenerator.java @@ -4,88 +4,345 @@ */ package com.fasterxml.jackson.core; -import java.io.Closeable; -import java.io.Flushable; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; +import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; -import java.util.Objects; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; import com.fasterxml.jackson.core.JsonParser.NumberType; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.exc.StreamWriteException; -import com.fasterxml.jackson.core.exc.WrappedIOException; import com.fasterxml.jackson.core.io.CharacterEscapes; import com.fasterxml.jackson.core.type.WritableTypeId; import com.fasterxml.jackson.core.type.WritableTypeId.Inclusion; import com.fasterxml.jackson.core.util.JacksonFeatureSet; +import com.fasterxml.jackson.core.util.VersionUtil; import static com.fasterxml.jackson.core.JsonTokenId.*; /** * Base class that defines public API for writing JSON content. * Instances are created using factory methods of - * a {@link TokenStreamFactory} instance. + * a {@link JsonFactory} instance. * * @author Tatu Saloranta */ public abstract class JsonGenerator implements Closeable, Flushable, Versioned { + /** + * Default set of {@link StreamWriteCapability}ies that may be used as + * basis for format-specific readers (or as bogus instance if non-null + * set needs to be passed). + * + * @since 2.12 + */ + protected final static JacksonFeatureSet DEFAULT_WRITE_CAPABILITIES + = JacksonFeatureSet.fromDefaults(StreamWriteCapability.values()); + + /** + * Default set of {@link StreamWriteCapability}ies for typical textual formats, + * to use either as-is, or as a base with possible differences. + * + * @since 2.12 + */ + protected final static JacksonFeatureSet DEFAULT_TEXTUAL_WRITE_CAPABILITIES + = DEFAULT_WRITE_CAPABILITIES.with(StreamWriteCapability.CAN_WRITE_FORMATTED_NUMBERS); + + /** + * Default set of {@link StreamWriteCapability}ies for typical binary formats, + * to use either as-is, or as a base with possible differences. + * + * @since 2.12 + */ + protected final static JacksonFeatureSet DEFAULT_BINARY_WRITE_CAPABILITIES + = DEFAULT_WRITE_CAPABILITIES.with(StreamWriteCapability.CAN_WRITE_BINARY_NATIVELY); + + /** + * Enumeration that defines all togglable features for generators. + */ + public enum Feature { + // // Low-level I/O / content features + + /** + * Feature that determines whether generator will automatically + * close underlying output target that is NOT owned by the + * generator. + * If disabled, calling application has to separately + * close the underlying {@link OutputStream} and {@link Writer} + * instances used to create the generator. If enabled, generator + * will handle closing, as long as generator itself gets closed: + * this happens when end-of-input is encountered, or generator + * is closed by a call to {@link JsonGenerator#close}. + *

+ * Feature is enabled by default. + */ + AUTO_CLOSE_TARGET(true), + + /** + * Feature that determines what happens when the generator is + * closed while there are still unmatched + * {@link JsonToken#START_ARRAY} or {@link JsonToken#START_OBJECT} + * entries in output content. If enabled, such Array(s) and/or + * Object(s) are automatically closed; if disabled, nothing + * specific is done. + *

+ * Feature is enabled by default. + */ + AUTO_CLOSE_JSON_CONTENT(true), + + /** + * Feature that specifies that calls to {@link #flush} will cause + * matching flush() to underlying {@link OutputStream} + * or {@link Writer}; if disabled this will not be done. + * Main reason to disable this feature is to prevent flushing at + * generator level, if it is not possible to prevent method being + * called by other code (like ObjectMapper or third + * party libraries). + *

+ * Feature is enabled by default. + */ + FLUSH_PASSED_TO_STREAM(true), + + // // Quoting-related features + + /** + * Feature that determines whether JSON Object field names are + * quoted using double-quotes, as specified by JSON specification + * or not. Ability to disable quoting was added to support use + * cases where they are not usually expected, which most commonly + * occurs when used straight from Javascript. + *

+ * Feature is enabled by default (since it is required by JSON specification). + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonWriteFeature#QUOTE_FIELD_NAMES} instead + */ + @Deprecated + QUOTE_FIELD_NAMES(true), + + /** + * Feature that determines whether "exceptional" (not real number) + * float/double values are output as quoted strings. + * The values checked are Double.Nan, + * Double.POSITIVE_INFINITY and Double.NEGATIVE_INIFINTY (and + * associated Float values). + * If feature is disabled, these numbers are still output using + * associated literal values, resulting in non-conformant + * output. + *

+ * Feature is enabled by default. + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonWriteFeature#WRITE_NAN_AS_STRINGS} instead + */ + @Deprecated + QUOTE_NON_NUMERIC_NUMBERS(true), + + // // Character escaping features + + /** + * Feature that specifies that all characters beyond 7-bit ASCII + * range (i.e. code points of 128 and above) need to be output + * using format-specific escapes (for JSON, backslash escapes), + * if format uses escaping mechanisms (which is generally true + * for textual formats but not for binary formats). + *

+ * Note that this setting may not necessarily make sense for all + * data formats (for example, binary formats typically do not use + * any escaping mechanisms; and some textual formats do not have + * general-purpose escaping); if so, settings is simply ignored. + * Put another way, effects of this feature are data-format specific. + *

+ * Feature is disabled by default. + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonWriteFeature#ESCAPE_NON_ASCII} instead + */ + @Deprecated + ESCAPE_NON_ASCII(false), + + // // Datatype coercion features + + /** + * Feature that forces all Java numbers to be written as Strings, + * even if the underlying data format has non-textual representation + * (which is the case for JSON as well as all binary formats). + * Default state is 'false', meaning that Java numbers are to + * be serialized using basic numeric serialization (as JSON + * numbers, integral or floating point, for example). + * If enabled, all such numeric values are instead written out as + * textual values (which for JSON means quoted in double-quotes). + *

+ * One use case is to avoid problems with Javascript limitations: + * since Javascript standard specifies that all number handling + * should be done using 64-bit IEEE 754 floating point values, + * result being that some 64-bit integer values can not be + * accurately represent (as mantissa is only 51 bit wide). + *

+ * Feature is disabled by default. + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonWriteFeature#WRITE_NUMBERS_AS_STRINGS} instead + */ + @Deprecated + WRITE_NUMBERS_AS_STRINGS(false), + + /** + * Feature that determines whether {@link java.math.BigDecimal} entries are + * serialized using {@link java.math.BigDecimal#toPlainString()} to prevent + * values to be written using scientific notation. + *

+ * NOTE: only affects generators that serialize {@link java.math.BigDecimal}s + * using textual representation (textual formats but potentially some binary + * formats). + *

+ * Feature is disabled by default, so default output mode is used; this generally + * depends on how {@link BigDecimal} has been created. + * + * @since 2.3 + */ + WRITE_BIGDECIMAL_AS_PLAIN(false), + + // // Schema/Validity support features + + /** + * Feature that determines whether {@link JsonGenerator} will explicitly + * check that no duplicate JSON Object field names are written. + * If enabled, generator will check all names within context and report + * duplicates by throwing a {@link JsonGenerationException}; if disabled, + * no such checking will be done. Assumption in latter case is + * that caller takes care of not trying to write duplicate names. + *

+ * Note that enabling this feature will incur performance overhead + * due to having to store and check additional information. + *

+ * Feature is disabled by default. + * + * @since 2.3 + */ + STRICT_DUPLICATE_DETECTION(false), + + /** + * Feature that determines what to do if the underlying data format requires knowledge + * of all properties to output, and if no definition is found for a property that + * caller tries to write. If enabled, such properties will be quietly ignored; + * if disabled, a {@link JsonProcessingException} will be thrown to indicate the + * problem. + * Typically most textual data formats do NOT require schema information (although + * some do, such as CSV), whereas many binary data formats do require definitions + * (such as Avro, protobuf), although not all (Smile, CBOR, BSON and MessagePack do not). + *

+ * Note that support for this feature is implemented by individual data format + * module, if (and only if) it makes sense for the format in question. For JSON, + * for example, this feature has no effect as properties need not be pre-defined. + *

+ * Feature is disabled by default, meaning that if the underlying data format + * requires knowledge of all properties to output, attempts to write an unknown + * property will result in a {@link JsonProcessingException} + * + * @since 2.5 + */ + IGNORE_UNKNOWN(false), + ; + + private final boolean _defaultState; + private final int _mask; + + /** + * Method that calculates bit set (flags) of all features that + * are enabled by default. + * + * @return Bit field of the features that are enabled by default + */ + public static int collectDefaults() + { + int flags = 0; + for (Feature f : values()) { + if (f.enabledByDefault()) { + flags |= f.getMask(); + } + } + return flags; + } + + private Feature(boolean defaultState) { + _defaultState = defaultState; + _mask = (1 << ordinal()); + } + + public boolean enabledByDefault() { return _defaultState; } + + // @since 2.3 + public boolean enabledIn(int flags) { return (flags & _mask) != 0; } + + public int getMask() { return _mask; } + } + /* /********************************************************************** - /* Construction, initialization + /* Configuration /********************************************************************** */ - protected JsonGenerator() { } + /** + * Object that handles pretty-printing (usually additional + * white space to make results more human-readable) during + * output. If null, no pretty-printing is done. + */ + protected PrettyPrinter _cfgPrettyPrinter; /* /********************************************************************** - /* Versioned + /* Construction, initialization /********************************************************************** */ + + protected JsonGenerator() { } + + /** + * Method that can be called to set or reset the object to + * use for writing Java objects as JsonContent + * (using method {@link #writeObject}). + * + * @param oc Codec to assign, if any; {@code null} if none + * + * @return This generator, to allow call chaining + */ + public abstract JsonGenerator setCodec(ObjectCodec oc); + + /** + * Method for accessing the object used for writing Java + * object as JSON content + * (using method {@link #writeObject}). + * + * @return Codec assigned to this generator, if any; {@code null} if none + */ + public abstract ObjectCodec getCodec(); /** * Accessor for finding out version of the bundle that provided this generator instance. + * + * @return Version of this generator (derived from version declared for + * {@code jackson-core} jar that contains the class */ @Override public abstract Version version(); /* /********************************************************************** - /* Public API, output configuration, state access + /* Public API, state, output configuration access /********************************************************************** */ /** * Accessor for context object that provides information about low-level * logical position withing output token stream. - *

- * NOTE: method was called {@code getOutputContext()} in Jackson 2.x * - * @return Stream output context ({@link TokenStreamContext}) associated with this generator + * @return Stream output context ({@link JsonStreamContext}) associated with this generator */ - public abstract TokenStreamContext streamWriteContext(); - - /** - * Accessor for context object provided by higher-level databinding - * functionality (or, in some cases, simple placeholder of the same) - * that allows some level of interaction including ability to trigger - * serialization of Object values through generator instance. - * - * @return Object write context ({@link ObjectWriteContext}) associated with this generator - * - * @since 3.0 - */ - public abstract ObjectWriteContext objectWriteContext(); + public abstract JsonStreamContext getOutputContext(); /** * Method that can be used to get access to object that is used * as target for generated output; this is usually either - * {@link java.io.OutputStream} or {@link java.io.Writer}, depending on what + * {@link OutputStream} or {@link Writer}, depending on what * generator was constructed with. * Note that returned value may be null in some cases; including * case where implementation does not want to exposed raw @@ -96,58 +353,73 @@ protected JsonGenerator() { } *

* In general use of this accessor should be considered as * "last effort", i.e. only used if no other mechanism is applicable. - *

- * NOTE: was named {@code getOutputTarget()} in Jackson 2.x. * * @return Output target this generator was configured with */ - public abstract Object streamWriteOutputTarget(); - - /** - * Method for verifying amount of content that is buffered by generator - * but not yet flushed to the underlying target (stream, writer), - * in units (byte, char) that the generator implementation uses for buffering; - * or -1 if this information is not available. - * Unit used is often the same as the unit of underlying target (that is, - * {@code byte} for {@link java.io.OutputStream}, - * {@code char} for {@link java.io.Writer}), - * but may differ if buffering is done before encoding. - * Default JSON-backed implementations do use matching units. - *

- * NOTE: was named {@code getOutputBuffered()} in Jackson 2.x. - * - * @return Amount of content buffered in internal units, if amount known and - * accessible; -1 if not accessible. - */ - public abstract int streamWriteOutputBuffered(); + public Object getOutputTarget() { + return null; + } /** * Helper method, usually equivalent to: * - * getOutputContext().currentValue(); + * getOutputContext().getCurrentValue(); * *

- * Note that "current value" is NOT populated (or used) by Streaming generator; + * Note that "current value" is NOT populated (or used) by Streaming parser or generators; * it is only used by higher-level data-binding functionality. * The reason it is included here is that it can be stored and accessed hierarchically, * and gets passed through data-binding. * - * @return "Current value" for the current context this generator has + * @return "Current value" associated with the current context (state) of this generator + * + * @since 2.13 (added as replacement for older {@link #getCurrentValue()} */ - public abstract Object currentValue(); + public Object currentValue() { + // TODO: implement directly in 2.14 or later, make getCurrentValue() call this + return getCurrentValue(); + } /** * Helper method, usually equivalent to: * - * getOutputContext().assignCurrentValue(v); + * getOutputContext().setCurrentValue(v); * - * used to assign "current value" for the current context of this generator. - * It is usually assigned and used by higher level data-binding functionality - * (instead of streaming parsers/generators) but is stored at streaming level. * - * @param v "Current value" to assign to the current output context of this generator + * @param v Current value to assign for the current context of this generator + * + * @since 2.13 (added as replacement for older {@link #setCurrentValue} + */ + public void assignCurrentValue(Object v) { + // TODO: implement directly in 2.14 or later, make setCurrentValue() call this + setCurrentValue(v); + } + + // TODO: deprecate in 2.14 or later + /** + * Alias for {@link #currentValue()}, to be deprecated in later + * Jackson 2.x versions (and removed from Jackson 3.0). + * + * @return Location of the last processed input unit (byte or character) + */ + public Object getCurrentValue() { + JsonStreamContext ctxt = getOutputContext(); + return (ctxt == null) ? null : ctxt.getCurrentValue(); + } + + // TODO: deprecate in 2.14 or later + /** + * Alias for {@link #assignCurrentValue}, to be deprecated in later + * Jackson 2.x versions (and removed from Jackson 3.0). + * + * @param v Current value to assign for the current context of this generator */ - public abstract void assignCurrentValue(Object v); + public void setCurrentValue(Object v) { + JsonStreamContext ctxt = getOutputContext(); + if (ctxt != null) { + ctxt.setCurrentValue(v); + } + } /* /********************************************************************** @@ -155,58 +427,249 @@ protected JsonGenerator() { } /********************************************************************** */ - // 25-Jan-2021, tatu: Still called by `ClassUtil` of jackson-databind, to - // prevent secondary issues when closing generator. Should probably figure - // out alternate means of safe closing... + /** + * Method for enabling specified generator feature: + * check {@link Feature} for list of available features. + * + * @param f Feature to enable + * + * @return This generator, to allow call chaining + */ + public abstract JsonGenerator enable(Feature f); + + /** + * Method for disabling specified feature + * (check {@link Feature} for list of features) + * + * @param f Feature to disable + * + * @return This generator, to allow call chaining + */ + public abstract JsonGenerator disable(Feature f); /** * Method for enabling or disabling specified feature: - * check {@link StreamWriteFeature} for list of available features. - *

- * NOTE: mostly left in 3.0 just to support disabling of - * {@link StreamWriteFeature#AUTO_CLOSE_CONTENT} by {@code jackson-databind} + * check {@link Feature} for list of available features. * * @param f Feature to enable or disable - * @param state Whether to enable the feature ({@code true}) or disable ({@code false}) + * @param state Whether to enable ({@code true}) or disable ({@code false}) feature * * @return This generator, to allow call chaining */ - public abstract JsonGenerator configure(StreamWriteFeature f, boolean state); + public final JsonGenerator configure(Feature f, boolean state) { + if (state) enable(f); else disable(f); + return this; + } /** * Method for checking whether given feature is enabled. - * Check {@link StreamWriteFeature} for list of available features. + * Check {@link Feature} for list of available features. * * @param f Feature to check * - * @return {@code True} if feature is enabled; {@code false} if not + * @return True if specified feature is enabled; false if not */ - public abstract boolean isEnabled(StreamWriteFeature f); + public abstract boolean isEnabled(Feature f); /** - * Bulk access method for getting state of all standard (format-agnostic) - * {@link StreamWriteFeature}s. + * Method for checking whether given feature is enabled. + * Check {@link Feature} for list of available features. + * + * @param f Feature to check + * + * @return True if specified feature is enabled; false if not + * + * @since 2.10 + */ + public boolean isEnabled(StreamWriteFeature f) { + return isEnabled(f.mappedFeature()); + } + + /** + * Bulk access method for getting state of all standard (non-dataformat-specific) + * {@link JsonGenerator.Feature}s. + * + * @return Bit mask that defines current states of all standard {@link JsonGenerator.Feature}s. + * + * @since 2.3 + */ + public abstract int getFeatureMask(); + + /** + * Bulk set method for (re)setting states of all standard {@link Feature}s + * + * @since 2.3 + * + * @param values Bitmask that defines which {@link Feature}s are enabled + * and which disabled + * + * @return This generator, to allow call chaining + * + * @deprecated Since 2.7, use {@link #overrideStdFeatures(int, int)} instead -- remove from 2.9 + */ + @Deprecated + public abstract JsonGenerator setFeatureMask(int values); + + /** + * Bulk set method for (re)setting states of features specified by mask. + * Functionally equivalent to + * + * int oldState = getFeatureMask(); + * int newState = (oldState & ~mask) | (values & mask); + * setFeatureMask(newState); + * + * but preferred as this lets caller more efficiently specify actual changes made. + * + * @param values Bit mask of set/clear state for features to change + * @param mask Bit mask of features to change + * + * @return This generator, to allow call chaining * - * @return Bit mask that defines current states of all standard {@link StreamWriteFeature}s. + * @since 2.6 + */ + public JsonGenerator overrideStdFeatures(int values, int mask) { + int oldState = getFeatureMask(); + int newState = (oldState & ~mask) | (values & mask); + return setFeatureMask(newState); + } + + /** + * Bulk access method for getting state of all {@link FormatFeature}s, format-specific + * on/off configuration settings. + * + * @return Bit mask that defines current states of all standard {@link FormatFeature}s. + * + * @since 2.6 + */ + public int getFormatFeatures() { + return 0; + } + + /** + * Bulk set method for (re)setting states of {@link FormatFeature}s, + * by specifying values (set / clear) along with a mask, to determine + * which features to change, if any. + *

+ * Default implementation will simply throw an exception to indicate that + * the generator implementation does not support any {@link FormatFeature}s. + * + * @param values Bit mask of set/clear state for features to change + * @param mask Bit mask of features to change * - * @since 3.0 + * @return This generator, to allow call chaining + * + * @since 2.6 */ - public abstract int streamWriteFeatures(); + public JsonGenerator overrideFormatFeatures(int values, int mask) { + // 08-Oct-2018, tatu: For 2.10 we actually do get `JsonWriteFeature`s, although they + // are (for 2.x only, not for 3.x) mapper to legacy settings. So do not freak out: +// throw new IllegalArgumentException("No FormatFeatures defined for generator of type "+getClass().getName()); + return this; + } /* /********************************************************************** - /* Public API, other configuration + /* Public API, Schema configuration /********************************************************************** - */ + */ + + /** + * Method to call to make this generator use specified schema. + * Method must be called before generating any content, right after instance + * has been created. + * Note that not all generators support schemas; and those that do usually only + * accept specific types of schemas: ones defined for data format this generator + * produces. + *

+ * If generator does not support specified schema, {@link UnsupportedOperationException} + * is thrown. + * + * @param schema Schema to use + * + * @throws UnsupportedOperationException if generator does not support schema + */ + public void setSchema(FormatSchema schema) { + throw new UnsupportedOperationException(String.format( + "Generator of type %s does not support schema of type '%s'", + getClass().getName(), schema.getSchemaType())); + } /** - * Method for accessing Schema that this generator uses, if any. + * Method for accessing Schema that this generator uses, if any; {@code null} if none. * Default implementation returns null. * - * @return {@link FormatSchema} this generator is configured to use, if any; {@code null} if none + * @return Schema in use by this generator, if any; {@code null} if none */ public FormatSchema getSchema() { return null; } + /* + /********************************************************************** + /* Public API, other configuration + /********************************************************************** + */ + + /** + * Method for setting a custom pretty printer, which is usually + * used to add indentation for improved human readability. + * By default, generator does not do pretty printing. + *

+ * To use the default pretty printer that comes with core + * Jackson distribution, call {@link #useDefaultPrettyPrinter} + * instead. + * + * @param pp {@code PrettyPrinter} to assign, if any; {@code null} if none + * + * @return This generator, to allow call chaining + */ + public JsonGenerator setPrettyPrinter(PrettyPrinter pp) { + _cfgPrettyPrinter = pp; + return this; + } + + /** + * Accessor for checking whether this generator has a configured + * {@link PrettyPrinter}; returns it if so, null if none configured. + * + * @return {@link PrettyPrinter} configured for this generator, if any; {@code null} if none + */ + public PrettyPrinter getPrettyPrinter() { + return _cfgPrettyPrinter; + } + + /** + * Convenience method for enabling pretty-printing using + * the default pretty printer + * ({@link com.fasterxml.jackson.core.util.DefaultPrettyPrinter}). + * + * @return This generator, to allow call chaining + */ + public abstract JsonGenerator useDefaultPrettyPrinter(); + + /** + * Method that can be called to request that generator escapes + * all character codes above specified code point (if positive value); + * or, to not escape any characters except for ones that must be + * escaped for the data format (if -1). + * To force escaping of all non-ASCII characters, for example, + * this method would be called with value of 127. + *

+ * Note that generators are NOT required to support setting of value + * higher than 127, because there are other ways to affect quoting + * (or lack thereof) of character codes between 0 and 127. + * Not all generators support concept of escaping, either; if so, + * calling this method will have no effect. + *

+ * Default implementation does nothing; sub-classes need to redefine + * it according to rules of supported data format. + * + * @param charCode Either -1 to indicate that no additional escaping + * is to be done; or highest code point not to escape (meaning higher + * ones will be), if positive value. + * + * @return This generator, to allow call chaining + */ + public JsonGenerator setHighestNonEscapedChar(int charCode) { return this; } + /** * Accessor method for testing what is the highest unescaped character * configured for this generator. This may be either positive value @@ -219,18 +682,16 @@ protected JsonGenerator() { } * @return Currently active limitation for highest non-escaped character, * if defined; or 0 to indicate no additional escaping is performed. */ - public int getHighestNonEscapedChar() { return 0; } + public int getHighestEscapedChar() { return 0; } /** - * Method for accessing custom escapes generator uses for {@link JsonGenerator}s + * Method for accessing custom escapes factory uses for {@link JsonGenerator}s * it creates. * - * @return {@link CharacterEscapes} this generator is configured to use, if any; {@code null} if none + * @return {@link CharacterEscapes} configured for this generator, if any; {@code null} if none */ public CharacterEscapes getCharacterEscapes() { return null; } - // 04-Oct-2017, tatu: Would like to remove this method, but alas JSONP-support - // does require it... /** * Method for defining custom escapes factory uses for {@link JsonGenerator}s * it creates. @@ -243,12 +704,65 @@ protected JsonGenerator() { } */ public JsonGenerator setCharacterEscapes(CharacterEscapes esc) { return this; } + /** + * Method that allows overriding String used for separating root-level + * JSON values (default is single space character) + *

+ * Default implementation throws {@link UnsupportedOperationException}. + * + * @param sep Separator to use, if any; null means that no separator is + * automatically added + * + * @return This generator, to allow call chaining + */ + public JsonGenerator setRootValueSeparator(SerializableString sep) { + throw new UnsupportedOperationException(); + } + + /* + /********************************************************************** + /* Public API, output state access + /********************************************************************** + */ + + /** + * Method for verifying amount of content that is buffered by generator + * but not yet flushed to the underlying target (stream, writer), + * in units (byte, char) that the generator implementation uses for buffering; + * or -1 if this information is not available. + * Unit used is often the same as the unit of underlying target (that is, + * `byte` for {@link java.io.OutputStream}, `char` for {@link java.io.Writer}), + * but may differ if buffering is done before encoding. + * Default JSON-backed implementations do use matching units. + *

+ * Note: non-JSON implementations will be retrofitted for 2.6 and beyond; + * please report if you see -1 (missing override) + * + * @return Amount of content buffered in internal units, if amount known and + * accessible; -1 if not accessible. + * + * @since 2.6 + */ + public int getOutputBuffered() { + return -1; + } + /* /********************************************************************** /* Public API, capability introspection methods /********************************************************************** */ + /** + * Method that can be used to verify that given schema can be used with + * this generator (using {@link #setSchema}). + * + * @param schema Schema to check + * + * @return True if this generator can use given schema; false if not + */ + public boolean canUseSchema(FormatSchema schema) { return false; } + /** * Introspection method that may be called to see if the underlying * data format supports some kind of Object Ids natively (many do not; @@ -264,6 +778,8 @@ protected JsonGenerator() { } * @return {@code True} if this generator is capable of writing "native" Object Ids * (which is typically determined by capabilities of the underlying format), * {@code false} if not + * + * @since 2.3 */ public boolean canWriteObjectId() { return false; } @@ -278,33 +794,75 @@ protected JsonGenerator() { } * that do support native Type Ids. Caller is expected to either * use a non-native notation (explicit property or such), or fail, * in case it can not use native type ids. - * + * * @return {@code True} if this generator is capable of writing "native" Type Ids * (which is typically determined by capabilities of the underlying format), * {@code false} if not + * + * @since 2.3 */ public boolean canWriteTypeId() { return false; } + /** + * Introspection method that may be called to see if the underlying + * data format supports "native" binary data; that is, an efficient + * output of binary content without encoding. + *

+ * Default implementation returns false; overridden by data formats + * that do support native binary content. + * + * @return {@code True} if this generator is capable of writing "raw" Binary + * Content + * (this is typically determined by capabilities of the underlying format); + * {@code false} if not + * + * @since 2.3 + */ + public boolean canWriteBinaryNatively() { return false; } + /** * Introspection method to call to check whether it is ok to omit - * writing of Object properties or not. Most formats do allow omission, + * writing of Object fields or not. Most formats do allow omission, * but certain positional formats (such as CSV) require output of - * place holders, even if no real values are to be emitted. - *

- * NOTE: in Jackson 2.x method was {@code canOmitFields()}. + * placeholders, even if no real values are to be emitted. * * @return {@code True} if this generator is allowed to only write values - * of some Object properties and omit the rest; {@code false} if not + * of some Object fields and omit the rest; {@code false} if not + * + * @since 2.3 */ - public boolean canOmitProperties() { return true; } + public boolean canOmitFields() { return true; } + + /** + * Introspection method to call to check whether it is possible + * to write numbers using {@link #writeNumber(java.lang.String)} + * using possible custom format, or not. Typically textual formats + * allow this (and JSON specifically does), whereas binary formats + * do not allow this (except by writing them as Strings). + * Usual reason for calling this method is to check whether custom + * formatting of numbers may be applied by higher-level code (databinding) + * or not. + * + * @return {@code True} if this generator is capable of writing "formatted" + * numbers (and if so, need to be passed using + * {@link #writeNumber(String)}, that is, passed as {@code String}); + * {@code false} if not + * + * @since 2.8 + */ + public boolean canWriteFormattedNumbers() { return false; } /** * Accessor for getting metadata on capabilities of this generator, based on * underlying data format being read (directly or indirectly). * - * @return Set of read capabilities for content to generate via this generator + * @return Set of write capabilities for content written using this generator + * + * @since 2.12 */ - public abstract JacksonFeatureSet streamWriteCapabilities(); + public JacksonFeatureSet getWriteCapabilities() { + return DEFAULT_WRITE_CAPABILITIES; + } /* /********************************************************************** @@ -319,58 +877,92 @@ protected JsonGenerator() { } *

* Array values can be written in any context where values * are allowed: meaning everywhere except for when - * a property name is expected. + * a field name is expected. * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeStartArray() throws JacksonException; + public abstract void writeStartArray() throws IOException; + + /** + * Method for writing start marker of an Array value, similar + * to {@link #writeStartArray()}, + * but also specifying how many + * elements will be written for the array before calling + * {@link #writeEndArray()}. + *

+ * Default implementation simply calls {@link #writeStartArray()}. + * + * @param size Number of elements this array will have: actual + * number of values written (before matching call to + * {@link #writeEndArray()} MUST match; generator MAY verify + * this is the case (and SHOULD if format itself encodes length) + * + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.4 + * + * @deprecated Since 2.12 Use {@link #writeStartArray(Object, int)} instead + */ + @Deprecated + public void writeStartArray(int size) throws IOException { + writeStartArray(); + } /** * Method for writing start marker of an Array value, similar - * to {@link #writeStartArray()}, but also specifying what is the - * Java object that the Array Object being written represents (if any); - * {@code null} may be passed if not known or not applicable. - * This value is accessible from context as "current value" + * to {@link #writeStartArray()}, + * but also specifying the "current value" + * to assign to the new Array context being created. + * + * @param forValue "Current value" to assign for the Array context being created * - * @param currentValue Java Object that Array being written represents, if any - * (or {@code null} if not known or not applicable) + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @since 2.10 */ - public abstract void writeStartArray(Object currentValue) throws JacksonException; + public void writeStartArray(Object forValue) throws IOException { + writeStartArray(); + setCurrentValue(forValue); + } /** * Method for writing start marker of an Array value, similar - * to {@link #writeStartArray()}, but also specifying what is the - * Java object that the Array Object being written represents (if any) - * and how many elements will be written for the array before calling + * to {@link #writeStartArray()}, but also specifying the "current value" + * to assign to the new Array context being created + * as well as how many elements will be written for the array before calling * {@link #writeEndArray()}. - * - * @param currentValue Java Object that Array being written represents, if any - * (or {@code null} if not known or not applicable) + * + * @param forValue "Current value" to assign for the Array context being created * @param size Number of elements this Array will have: actual * number of values written (before matching call to * {@link #writeEndArray()} MUST match; generator MAY verify * this is the case (and SHOULD if format itself encodes length) * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.10 */ - public abstract void writeStartArray(Object currentValue, int size) throws JacksonException; + public void writeStartArray(Object forValue, int size) throws IOException { + writeStartArray(size); + setCurrentValue(forValue); + } /** * Method for writing closing marker of a JSON Array value * (character ']'; plus possible white space decoration * if pretty-printing is enabled). *

- * Marker can be written if the innermost structured type is Array. + * Marker can be written if the innermost structured type + * is Array. * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeEndArray() throws JacksonException; + public abstract void writeEndArray() throws IOException; /** * Method for writing starting marker of an Object value @@ -379,12 +971,12 @@ protected JsonGenerator() { } *

* Object values can be written in any context where values * are allowed: meaning everywhere except for when - * a property name is expected. + * a field name is expected. * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeStartObject() throws JacksonException; + public abstract void writeStartObject() throws IOException; /** * Method for writing starting marker of an Object value @@ -395,15 +987,20 @@ protected JsonGenerator() { } *

* Object values can be written in any context where values * are allowed: meaning everywhere except for when - * a property name is expected. + * a field name is expected. * - * @param currentValue Java Object that Object being written represents, if any - * (or {@code null} if not known or not applicable) + * @param forValue "Current value" to assign for the Object context being created * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.8 */ - public abstract void writeStartObject(Object currentValue) throws JacksonException; + public void writeStartObject(Object forValue) throws IOException + { + writeStartObject(); + setCurrentValue(forValue); + } /** * Method for writing starting marker of an Object value @@ -417,19 +1014,24 @@ protected JsonGenerator() { } *

* Object values can be written in any context where values * are allowed: meaning everywhere except for when - * a property name is expected. + * a field name is expected. * - * @param forValue Object value to be written (assigned as "current value" for - * the Object context that gets created) + * @param forValue "Current value" to assign for the Object context being created * @param size Number of key/value pairs this Object will have: actual * number of entries written (before matching call to * {@link #writeEndObject()} MUST match; generator MAY verify * this is the case (and SHOULD if format itself encodes length) * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.10 */ - public abstract void writeStartObject(Object forValue, int size) throws JacksonException; + public void writeStartObject(Object forValue, int size) throws IOException + { + writeStartObject(); + setCurrentValue(forValue); + } /** * Method for writing closing marker of an Object value @@ -441,29 +1043,29 @@ protected JsonGenerator() { } * complete value, or START-OBJECT marker (see JSON specification * for more details). * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeEndObject() throws JacksonException; + public abstract void writeEndObject() throws IOException; /** - * Method for writing an Object Property name (JSON String surrounded by + * Method for writing a field name (JSON String surrounded by * double quotes: syntactically identical to a JSON String value), * possibly decorated by white space if pretty-printing is enabled. *

- * Property names can only be written in Object context (check out - * JSON specification for details), when Object Property name is expected - * (property names alternate with values). + * Field names can only be written in Object context (check out + * JSON specification for details), when field name is expected + * (field names alternate with values). * - * @param name Name of the Object Property to write + * @param name Field name to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeName(String name) throws JacksonException; + public abstract void writeFieldName(String name) throws IOException; /** - * Method similar to {@link #writeName(String)}, main difference + * Method similar to {@link #writeFieldName(String)}, main difference * being that it may perform better as some of processing (such as * quoting of certain characters, or encoding into external encoding * if supported by generator) can be done just once and reused for @@ -473,31 +1075,35 @@ protected JsonGenerator() { } * serialized String; implementations are strongly encouraged to make * use of more efficient methods argument object has. * - * @param name Pre-encoded name of the Object Property to write + * @param name Field name to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeName(SerializableString name) throws JacksonException; + public abstract void writeFieldName(SerializableString name) throws IOException; /** - * Alternative to {@link #writeName(String)} that may be used - * in cases where Object Property key is of numeric type; usually where + * Alternative to {@link #writeFieldName(String)} that may be used + * in cases where property key is of numeric type; either where * underlying format supports such notion (some binary formats do, - * unlike JSON). - * Default implementation will simply convert id into {@code String} - * and call {@link #writeName(String)}. + * unlike JSON), or for convenient conversion into String presentation. + * Default implementation will simply convert id into String + * and call {@link #writeFieldName(String)}. + * + * @param id Field id to write * - * @param id Property key id to write + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @since 2.8 */ - public abstract void writePropertyId(long id) throws JacksonException; + public void writeFieldId(long id) throws IOException { + writeFieldName(Long.toString(id)); + } /* /********************************************************************** - /* Public API, write methods, scalar arrays + /* Public API, write methods, scalar arrays (2.8) /********************************************************************** */ @@ -510,12 +1116,16 @@ protected JsonGenerator() { } * @param offset Offset of the first element to write, within array * @param length Number of elements in array to write, from `offset` to `offset + len - 1` * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.8 */ - public void writeArray(int[] array, int offset, int length) throws JacksonException + public void writeArray(int[] array, int offset, int length) throws IOException { - Objects.requireNonNull(array, "null 'array' argument"); + if (array == null) { + throw new IllegalArgumentException("null array"); + } _verifyOffsets(array.length, offset, length); writeStartArray(array, length); for (int i = offset, end = offset+length; i < end; ++i) { @@ -533,12 +1143,16 @@ public void writeArray(int[] array, int offset, int length) throws JacksonExcept * @param offset Offset of the first element to write, within array * @param length Number of elements in array to write, from `offset` to `offset + len - 1` * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.8 */ - public void writeArray(long[] array, int offset, int length) throws JacksonException + public void writeArray(long[] array, int offset, int length) throws IOException { - Objects.requireNonNull(array, "null 'array' argument"); + if (array == null) { + throw new IllegalArgumentException("null array"); + } _verifyOffsets(array.length, offset, length); writeStartArray(array, length); for (int i = offset, end = offset+length; i < end; ++i) { @@ -556,12 +1170,16 @@ public void writeArray(long[] array, int offset, int length) throws JacksonExcep * @param offset Offset of the first element to write, within array * @param length Number of elements in array to write, from `offset` to `offset + len - 1` * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.8 */ - public void writeArray(double[] array, int offset, int length) throws JacksonException + public void writeArray(double[] array, int offset, int length) throws IOException { - Objects.requireNonNull(array, "null 'array' argument"); + if (array == null) { + throw new IllegalArgumentException("null array"); + } _verifyOffsets(array.length, offset, length); writeStartArray(array, length); for (int i = offset, end = offset+length; i < end; ++i) { @@ -579,12 +1197,16 @@ public void writeArray(double[] array, int offset, int length) throws JacksonExc * @param offset Offset of the first element to write, within array * @param length Number of elements in array to write, from `offset` to `offset + len - 1` * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.11 */ - public void writeArray(String[] array, int offset, int length) throws JacksonException + public void writeArray(String[] array, int offset, int length) throws IOException { - Objects.requireNonNull(array, "null 'array' argument"); + if (array == null) { + throw new IllegalArgumentException("null array"); + } _verifyOffsets(array.length, offset, length); writeStartArray(array, length); for (int i = offset, end = offset+length; i < end; ++i) { @@ -601,21 +1223,21 @@ public void writeArray(String[] array, int offset, int length) throws JacksonExc /** * Method for outputting a String value. Depending on context - * this means either array element, (object) property value or - * a stand-alone (root-level value) String; but in all cases, String will be + * this means either array element, (object) field value or + * a stand alone String; but in all cases, String will be * surrounded in double quotes, and contents will be properly * escaped as required by JSON specification. * - * @param value String value to write + * @param text Text value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeString(String value) throws JacksonException; + public abstract void writeString(String text) throws IOException; /** * Method for outputting a String value. Depending on context - * this means either array element, (object) property value or + * this means either array element, (object) field value or * a stand alone String; but in all cases, String will be * surrounded in double quotes, and contents will be properly * escaped as required by JSON specification. @@ -624,21 +1246,26 @@ public void writeArray(String[] array, int offset, int length) throws JacksonExc *

* Note: actual length of content available may exceed {@code len} but * can not be less than it: if not enough content available, a - * {@link StreamWriteException} will be thrown. + * {@link JsonGenerationException} will be thrown. * * @param reader Reader to use for reading Text value to write * @param len Maximum Length of Text value to read (in {@code char}s, non-negative) * if known; {@code -1} to indicate "read and write it all" * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream - * (including the case where {@code reader} does not provide enough content) + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer; or if length ({@code len}) is specified but + * {@code reader} does not provide enough content + * + * @since 2.9 */ - public abstract void writeString(Reader reader, int len) throws JacksonException; + public void writeString(Reader reader, int len) throws IOException { + // Implemented as "unsupported" for backwards compatibility + _reportUnsupportedOperation(); + } /** * Method for outputting a String value. Depending on context - * this means either array element, (object) property value or + * this means either array element, (object) field value or * a stand alone String; but in all cases, String will be * surrounded in double quotes, and contents will be properly * escaped as required by JSON specification. @@ -647,10 +1274,10 @@ public void writeArray(String[] array, int offset, int length) throws JacksonExc * @param offset Offset in {@code buffer} of the first character of String value to write * @param len Length of the String value (in characters) to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeString(char[] buffer, int offset, int len) throws JacksonException; + public abstract void writeString(char[] buffer, int offset, int len) throws IOException; /** * Method similar to {@link #writeString(String)}, but that takes @@ -662,12 +1289,12 @@ public void writeArray(String[] array, int offset, int length) throws JacksonExc * sub-classes should override it with more efficient implementation * if possible. * - * @param value Pre-encoded String value to write + * @param text Pre-encoded String value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeString(SerializableString value) throws JacksonException; + public abstract void writeString(SerializableString text) throws IOException; /** * Method similar to {@link #writeString(String)} but that takes as @@ -687,11 +1314,11 @@ public void writeArray(String[] array, int offset, int length) throws JacksonExc * @param offset Offset in {@code buffer} of the first byte of String value to write * @param len Length of the String value (in characters) to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ public abstract void writeRawUTF8String(byte[] buffer, int offset, int len) - throws JacksonException; + throws IOException; /** * Method similar to {@link #writeString(String)} but that takes as its input @@ -715,15 +1342,15 @@ public abstract void writeRawUTF8String(byte[] buffer, int offset, int len) * @param offset Offset in {@code buffer} of the first byte of String value to write * @param len Length of the String value (in characters) to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ public abstract void writeUTF8String(byte[] buffer, int offset, int len) - throws JacksonException; + throws IOException; /* /********************************************************************** - /* Public API, write methods, raw content + /* Public API, write methods, binary/raw content /********************************************************************** */ @@ -741,10 +1368,10 @@ public abstract void writeUTF8String(byte[] buffer, int offset, int len) * * @param text Textual contents to include as-is in output. * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeRaw(String text) throws JacksonException; + public abstract void writeRaw(String text) throws IOException; /** * Method that will force generator to copy @@ -762,10 +1389,10 @@ public abstract void writeUTF8String(byte[] buffer, int offset, int len) * @param offset Offset within {@code text} of the first character to output * @param len Length of content (from {@code text}, starting at offset {@code offset}) to output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeRaw(String text, int offset, int len) throws JacksonException; + public abstract void writeRaw(String text, int offset, int len) throws IOException; /** * Method that will force generator to copy @@ -779,14 +1406,14 @@ public abstract void writeUTF8String(byte[] buffer, int offset, int len) * such by-pass methods: those that do not will throw * {@link UnsupportedOperationException}. * - * @param buffer Buffer that has contents to include as-is in output + * @param text Buffer that has contents to include as-is in output * @param offset Offset within {@code text} of the first character to output * @param len Length of content (from {@code text}, starting at offset {@code offset}) to output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeRaw(char[] buffer, int offset, int len) throws JacksonException; + public abstract void writeRaw(char[] text, int offset, int len) throws IOException; /** * Method that will force generator to copy @@ -802,10 +1429,10 @@ public abstract void writeUTF8String(byte[] buffer, int offset, int len) * * @param c Character to included in output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeRaw(char c) throws JacksonException; + public abstract void writeRaw(char c) throws IOException; /** * Method that will force generator to copy @@ -826,10 +1453,11 @@ public abstract void writeUTF8String(byte[] buffer, int offset, int len) * * @param raw Pre-encoded textual contents to included in output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public void writeRaw(SerializableString raw) throws JacksonException { +// public abstract void writeRaw(SerializableString raw) throws IOException; + public void writeRaw(SerializableString raw) throws IOException { writeRaw(raw.getValue()); } @@ -843,14 +1471,14 @@ public void writeRaw(SerializableString raw) throws JacksonException { * * @param text Textual contents to included in output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeRawValue(String text) throws JacksonException; + public abstract void writeRawValue(String text) throws IOException; - public abstract void writeRawValue(String text, int offset, int len) throws JacksonException; + public abstract void writeRawValue(String text, int offset, int len) throws IOException; - public abstract void writeRawValue(char[] text, int offset, int len) throws JacksonException; + public abstract void writeRawValue(char[] text, int offset, int len) throws IOException; /** * Method similar to {@link #writeRawValue(String)}, but potentially more @@ -859,19 +1487,15 @@ public void writeRaw(SerializableString raw) throws JacksonException { * * @param raw Pre-encoded textual contents to included in output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.5 */ - public void writeRawValue(SerializableString raw) throws JacksonException { + public void writeRawValue(SerializableString raw) throws IOException { writeRawValue(raw.getValue()); } - /* - /********************************************************************** - /* Public API, write methods, Binary values - /********************************************************************** - */ - /** * Method that will output given chunk of binary data as base64 * encoded, as a complete String value (surrounded by double quotes). @@ -896,11 +1520,11 @@ public void writeRawValue(SerializableString raw) throws JacksonException { * @param offset Offset in {@code data} of the first byte of data to write * @param len Length of data to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ public abstract void writeBinary(Base64Variant bv, - byte[] data, int offset, int len) throws JacksonException; + byte[] data, int offset, int len) throws IOException; /** * Similar to {@link #writeBinary(Base64Variant,byte[],int,int)}, @@ -911,10 +1535,10 @@ public abstract void writeBinary(Base64Variant bv, * @param offset Offset in {@code data} of the first byte of data to write * @param len Length of data to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public void writeBinary(byte[] data, int offset, int len) throws JacksonException { + public void writeBinary(byte[] data, int offset, int len) throws IOException { writeBinary(Base64Variants.getDefaultVariant(), data, offset, len); } @@ -926,10 +1550,10 @@ public void writeBinary(byte[] data, int offset, int len) throws JacksonExceptio * * @param data Buffer that contains binary data to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public void writeBinary(byte[] data) throws JacksonException { + public void writeBinary(byte[] data) throws IOException { writeBinary(Base64Variants.getDefaultVariant(), data, 0, data.length); } @@ -948,10 +1572,11 @@ public void writeBinary(byte[] data) throws JacksonException { * * @return Number of bytes actually written * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public int writeBinary(InputStream data, int dataLength) throws JacksonException { + public int writeBinary(InputStream data, int dataLength) + throws IOException { return writeBinary(Base64Variants.getDefaultVariant(), data, dataLength); } @@ -974,11 +1599,11 @@ public int writeBinary(InputStream data, int dataLength) throws JacksonException * * @return Number of bytes read from data and written as binary payload * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ public abstract int writeBinary(Base64Variant bv, - InputStream data, int dataLength) throws JacksonException; + InputStream data, int dataLength) throws IOException; /* /********************************************************************** @@ -989,100 +1614,102 @@ public abstract int writeBinary(Base64Variant bv, /** * Method for outputting given value as JSON number. * Can be called in any context where a value is expected - * (Array value, Object property value, root-level value). + * (Array value, Object field value, root-level value). * Additional white space may be added around the value * if pretty-printing is enabled. * * @param v Number value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.2 */ - public abstract void writeNumber(short v) throws JacksonException; + public void writeNumber(short v) throws IOException { writeNumber((int) v); } /** * Method for outputting given value as JSON number. * Can be called in any context where a value is expected - * (Array value, Object property value, root-level value). + * (Array value, Object field value, root-level value). * Additional white space may be added around the value * if pretty-printing is enabled. * * @param v Number value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeNumber(int v) throws JacksonException; + public abstract void writeNumber(int v) throws IOException; /** * Method for outputting given value as JSON number. * Can be called in any context where a value is expected - * (Array value, Object property value, root-level value). + * (Array value, Object field value, root-level value). * Additional white space may be added around the value * if pretty-printing is enabled. * * @param v Number value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeNumber(long v) throws JacksonException; + public abstract void writeNumber(long v) throws IOException; /** * Method for outputting given value as JSON number. * Can be called in any context where a value is expected - * (Array value, Object property value, root-level value). + * (Array value, Object field value, root-level value). * Additional white space may be added around the value * if pretty-printing is enabled. * * @param v Number value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeNumber(BigInteger v) throws JacksonException; + public abstract void writeNumber(BigInteger v) throws IOException; /** * Method for outputting indicate JSON numeric value. * Can be called in any context where a value is expected - * (Array value, Object property value, root-level value). + * (Array value, Object field value, root-level value). * Additional white space may be added around the value * if pretty-printing is enabled. * * @param v Number value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeNumber(double v) throws JacksonException; + public abstract void writeNumber(double v) throws IOException; /** * Method for outputting indicate JSON numeric value. * Can be called in any context where a value is expected - * (Array value, Object property value, root-level value). + * (Array value, Object field value, root-level value). * Additional white space may be added around the value * if pretty-printing is enabled. * * @param v Number value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeNumber(float v) throws JacksonException; + public abstract void writeNumber(float v) throws IOException; /** * Method for outputting indicate JSON numeric value. * Can be called in any context where a value is expected - * (Array value, Object property value, root-level value). + * (Array value, Object field value, root-level value). * Additional white space may be added around the value * if pretty-printing is enabled. * * @param v Number value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeNumber(BigDecimal v) throws JacksonException; + public abstract void writeNumber(BigDecimal v) throws IOException; /** * Write method that can be used for custom numeric types that can @@ -1099,17 +1726,17 @@ public abstract int writeBinary(Base64Variant bv, * for generator-wrappers around Java objects or JSON nodes. * If implementation does not implement this method, * it needs to throw {@link UnsupportedOperationException}. - * + * * @param encodedValue Textual (possibly format) number representation to write * + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer * @throws UnsupportedOperationException If underlying data format does not * support numbers serialized textually AND if generator is not allowed * to just output a String instead (Schema-based formats may require actual * number, for example) - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream */ - public abstract void writeNumber(String encodedValue) throws JacksonException; + public abstract void writeNumber(String encodedValue) throws IOException; /** * Overloaded version of {@link #writeNumber(String)} with same semantics @@ -1119,10 +1746,12 @@ public abstract int writeBinary(Base64Variant bv, * @param offset Offset of the first character of value to write * @param len Length of the value (in characters) to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.11 */ - public void writeNumber(char[] encodedValueBuffer, int offset, int len) throws JacksonException { + public void writeNumber(char[] encodedValueBuffer, int offset, int len) throws IOException { writeNumber(new String(encodedValueBuffer, offset, len)); } @@ -1131,33 +1760,33 @@ public void writeNumber(char[] encodedValueBuffer, int offset, int len) throws J /* Public API, write methods, other value types /********************************************************************** */ - + /** * Method for outputting literal JSON boolean value (one of * Strings 'true' and 'false'). * Can be called in any context where a value is expected - * (Array value, Object property value, root-level value). + * (Array value, Object field value, root-level value). * Additional white space may be added around the value * if pretty-printing is enabled. * * @param state Boolean value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeBoolean(boolean state) throws JacksonException; + public abstract void writeBoolean(boolean state) throws IOException; /** * Method for outputting literal JSON null value. * Can be called in any context where a value is expected - * (Array value, Object property value, root-level value). + * (Array value, Object field value, root-level value). * Additional white space may be added around the value * if pretty-printing is enabled. * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeNull() throws JacksonException; + public abstract void writeNull() throws IOException; /** * Method that can be called on backends that support passing opaque native @@ -1165,14 +1794,16 @@ public void writeNumber(char[] encodedValueBuffer, int offset, int len) throws J * more common with binary formats. *

* NOTE: this is NOT the method to call for serializing regular POJOs, - * see {@link #writePOJO} instead. + * see {@link #writeObject} instead. * * @param object Native format-specific value to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.8 */ - public void writeEmbeddedObject(Object object) throws JacksonException { + public void writeEmbeddedObject(Object object) throws IOException { // 01-Sep-2016, tatu: As per [core#318], handle small number of cases if (object == null) { writeNull(); @@ -1182,8 +1813,9 @@ public void writeEmbeddedObject(Object object) throws JacksonException { writeBinary((byte[]) object); return; } - throw _constructWriteException("No native support for writing embedded objects of type %s", - object.getClass().getName()); + throw new JsonGenerationException("No native support for writing embedded objects of type " + +object.getClass().getName(), + this); } /* @@ -1198,16 +1830,20 @@ public void writeEmbeddedObject(Object object) throws JacksonException { * (with {@link #canWriteObjectId()}), as not all data formats * have native type id support; and some may only allow them in * certain positions or locations. + * If output is not allowed by the data format in this position, + * a {@link JsonGenerationException} will be thrown. * * @param id Native Object Id to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream; - * typically if Object ID output is not allowed + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * @throws JsonGenerationException if Object ID output is not allowed * (either at all, or specifically in this position in output) + * + * @since 2.3 */ - public void writeObjectId(Object id) throws JacksonException { - throw _constructWriteException("No native support for writing Object Ids"); + public void writeObjectId(Object id) throws IOException { + throw new JsonGenerationException("No native support for writing Object Ids", this); } /** @@ -1217,17 +1853,17 @@ public void writeObjectId(Object id) throws JacksonException { * have native type id support; and some may only allow them in * certain positions or locations. * If output is not allowed by the data format in this position, - * a {@link StreamWriteException} will be thrown. + * a {@link JsonGenerationException} will be thrown. * * @param referenced Referenced value, for which Object Id is expected to be written * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream; - * typically if Object ID output is not allowed + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * @throws JsonGenerationException if Object ID output is not allowed * (either at all, or specifically in this position in output) */ - public void writeObjectRef(Object referenced) throws JacksonException { - throw _constructWriteException("No native support for writing Object Ids"); + public void writeObjectRef(Object referenced) throws IOException { + throw new JsonGenerationException("No native support for writing Object Ids", this); } /** @@ -1237,15 +1873,19 @@ public void writeObjectRef(Object referenced) throws JacksonException { * have native type id support; and some may only allow them in * certain positions or locations. * If output is not allowed by the data format in this position, - * a {@link StreamWriteException} will be thrown. + * a {@link JsonGenerationException} will be thrown. * * @param id Native Type Id to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * @throws JsonGenerationException if Type ID output is not allowed + * (either at all, or specifically in this position in output) + * + * @since 2.3 */ - public void writeTypeId(Object id) throws JacksonException { - throw _constructWriteException("No native support for writing Type Ids"); + public void writeTypeId(Object id) throws IOException { + throw new JsonGenerationException("No native support for writing Type Ids", this); } /** @@ -1265,11 +1905,14 @@ public void writeTypeId(Object id) throws JacksonException { * @return {@link WritableTypeId} for caller to retain and pass to matching * {@link #writeTypeSuffix} call * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * @throws JsonGenerationException if Type ID output is not allowed + * (either at all, or specifically in this position in output) + * + * @since 2.9 */ - public WritableTypeId writeTypePrefix(WritableTypeId typeIdDef) - throws JacksonException + public WritableTypeId writeTypePrefix(WritableTypeId typeIdDef) throws IOException { Object id = typeIdDef.id; @@ -1300,17 +1943,17 @@ public WritableTypeId writeTypePrefix(WritableTypeId typeIdDef) // other mechanism, so... break; case METADATA_PROPERTY: - // must have Object context by now, so simply write as property name + // must have Object context by now, so simply write as field name // Note, too, that it's bit tricky, since we must print START_OBJECT that is part // of value first -- and then NOT output it later on: hence return "early" writeStartObject(typeIdDef.forValue); - writeStringProperty(typeIdDef.asProperty, idStr); + writeStringField(typeIdDef.asProperty, idStr); return typeIdDef; case WRAPPER_OBJECT: // NOTE: this is wrapper, not directly related to value to output, so don't pass writeStartObject(); - writeName(idStr); + writeFieldName(idStr); break; case WRAPPER_ARRAY: default: // should never occur but translate as "as-array" @@ -1328,7 +1971,24 @@ public WritableTypeId writeTypePrefix(WritableTypeId typeIdDef) return typeIdDef; } - public WritableTypeId writeTypeSuffix(WritableTypeId typeIdDef) throws JacksonException + /** + * Method to call along with {@link #writeTypePrefix}, but after actual value + * that has type id has been completely written. This allows post-processing + * for some cases (for example if the actual Type Id is written at the END of + * the value, not before or at the beginning). + * + * @param typeIdDef Value returned by the earlier matching call to {@link #writeTypePrefix(WritableTypeId)} + * + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * @throws JsonGenerationException if Type ID output is not allowed + * (either at all, or specifically in this position in output) + * + * @return Argument {@code typeIdDef}, possibly modified + * + * @since 2.9 + */ + public WritableTypeId writeTypeSuffix(WritableTypeId typeIdDef) throws IOException { final JsonToken valueShape = typeIdDef.valueShape; // First: does value need closing? @@ -1348,7 +2008,7 @@ public WritableTypeId writeTypeSuffix(WritableTypeId typeIdDef) throws JacksonEx { Object id = typeIdDef.id; String idStr = (id instanceof String) ? (String) id : String.valueOf(id); - writeStringProperty(typeIdDef.asProperty, idStr); + writeStringField(typeIdDef.asProperty, idStr); } break; case METADATA_PROPERTY: @@ -1371,258 +2031,283 @@ public WritableTypeId writeTypeSuffix(WritableTypeId typeIdDef) throws JacksonEx */ /** - * Method for writing given Java object (POJO) as tokens into - * stream this generator manages; serialization must be a valid JSON Value - * (Object, Array, null, Number, String or Boolean). - * This is done by delegating call to - * {@link ObjectWriteContext#writeValue(JsonGenerator, Object)}. + * Method for writing given Java object (POJO) as JSON. + * Exactly how the object gets written depends on object + * in question (and on codec, its configuration); for + * typical POJOs it will result in JSON Object, but for others JSON + * Array, or String or numeric value (and for nulls, JSON + * null literal). + * NOTE: generator must have its {@code ObjectCodec} + * set to non-null value; for generators created by a mapping + * factory this is the case, for others not. + * + * @param pojo Java value (usually POJO) to write + * + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.13 (to eventually replace {@link #writeObject(Object)} + */ + public void writePOJO(Object pojo) throws IOException { + writeObject(pojo); + } + + // TODO: deprecate in 2.14 or later + /** + * Older alias for {@link #writePOJO(Object)} * - * @param pojo Java Object (POJO) value to write + * @param pojo Java value (usually POJO) to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writePOJO(Object pojo) throws JacksonException; + public abstract void writeObject(Object pojo) throws IOException; /** * Method for writing given JSON tree (expressed as a tree - * where given {@code TreeNode} is the root) using this generator. - * This is done by delegating call to - * {@link ObjectWriteContext#writeTree}. + * where given JsonNode is the root) using this generator. + * This will generally just call + * {@link #writeObject} with given node, but is added + * for convenience and to make code more explicit in cases + * where it deals specifically with trees. * * @param rootNode {@link TreeNode} to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public abstract void writeTree(TreeNode rootNode) throws JacksonException; + public abstract void writeTree(TreeNode rootNode) throws IOException; /* /********************************************************************** - /* Public API, convenience property write methods + /* Public API, convenience field write methods /********************************************************************** */ - // 25-May-2020, tatu: NOTE! Made `final` on purpose in 3.x to prevent issues - // rising from complexity of overriding only some of methods (writeName() - // and matching writeXxx() for value) + // 04-Oct-2019, tatu: Reminder: these could be defined final to + // remember NOT to override in delegating sub-classes -- but + // not final in 2.x to reduce compatibility issues /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that contains specified data in base64-encoded form. * Equivalent to: *

-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeBinary(value);
      *
* - * @param propertyName Name of Object Property to write - * @param data Binary value of the property to write + * @param fieldName Name of the field to write + * @param data Binary data for the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeBinaryProperty(String propertyName, byte[] data) throws JacksonException { - writeName(propertyName); + public void writeBinaryField(String fieldName, byte[] data) throws IOException { + writeFieldName(fieldName); writeBinary(data); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has a boolean value. Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeBoolean(value);
      *
* - * @param propertyName Name of Object Property to write - * @param value Boolean value of the property to write + * @param fieldName Name of the field to write + * @param value Boolean value of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeBooleanProperty(String propertyName, boolean value) throws JacksonException { - writeName(propertyName); + public void writeBooleanField(String fieldName, boolean value) throws IOException { + writeFieldName(fieldName); writeBoolean(value); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has JSON literal value null. Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeNull();
      *
* - * @param propertyName Name of the null-valued property to write + * @param fieldName Name of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeNullProperty(String propertyName) throws JacksonException { - writeName(propertyName); + public void writeNullField(String fieldName) throws IOException { + writeFieldName(fieldName); writeNull(); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has a String value. Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeString(value);
      *
* - * @param propertyName Name of the property to write - * @param value String value of the property to write + * @param fieldName Name of the field to write + * @param value String value of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeStringProperty(String propertyName, String value) throws JacksonException { - writeName(propertyName); + public void writeStringField(String fieldName, String value) throws IOException { + writeFieldName(fieldName); writeString(value); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has the specified numeric value. Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeNumber(value);
      *
* - * @param propertyName Name of the property to write - * @param value Numeric value of the property to write + * @param fieldName Name of the field to write + * @param value Numeric value of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.11 */ - public final void writeNumberProperty(String propertyName, short value) throws JacksonException { - writeName(propertyName); + public void writeNumberField(String fieldName, short value) throws IOException { + writeFieldName(fieldName); writeNumber(value); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has the specified numeric value. Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeNumber(value);
      *
* - * @param propertyName Name of the property to write - * @param value Numeric value of the property to write + * @param fieldName Name of the field to write + * @param value Numeric value of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeNumberProperty(String propertyName, int value) throws JacksonException { - writeName(propertyName); + public void writeNumberField(String fieldName, int value) throws IOException { + writeFieldName(fieldName); writeNumber(value); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has the specified numeric value. Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeNumber(value);
      *
* - * @param propertyName Name of the property to write - * @param value Numeric value of the property to write + * @param fieldName Name of the field to write + * @param value Numeric value of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeNumberProperty(String propertyName, long value) throws JacksonException { - writeName(propertyName); + public void writeNumberField(String fieldName, long value) throws IOException { + writeFieldName(fieldName); writeNumber(value); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has the specified numeric value. Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeNumber(value);
      *
* - * @param propertyName Name of the property to write - * @param value Numeric value of the property to write + * @param fieldName Name of the field to write + * @param value Numeric value of the field to write + * + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @since 2.11 */ - public final void writeNumberProperty(String propertyName, BigInteger value) throws JacksonException { - writeName(propertyName); + public void writeNumberField(String fieldName, BigInteger value) throws IOException { + writeFieldName(fieldName); writeNumber(value); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has the specified numeric value. Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeNumber(value);
      *
* - * @param propertyName Name of the property to write - * @param value Numeric value of the property to write + * @param fieldName Name of the field to write + * @param value Numeric value of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeNumberProperty(String propertyName, float value) throws JacksonException { - writeName(propertyName); + public void writeNumberField(String fieldName, float value) throws IOException { + writeFieldName(fieldName); writeNumber(value); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has the specified numeric value. Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeNumber(value);
      *
* - * @param propertyName Name of the property to write - * @param value Numeric value of the property to write + * @param fieldName Name of the field to write + * @param value Numeric value of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeNumberProperty(String propertyName, double value) throws JacksonException { - writeName(propertyName); + public void writeNumberField(String fieldName, double value) throws IOException { + writeFieldName(fieldName); writeNumber(value); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * that has the specified numeric value. * Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeNumber(value);
      *
* - * @param propertyName Name of the property to write - * @param value Numeric value of the property to write + * @param fieldName Name of the field to write + * @param value Numeric value of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeNumberProperty(String propertyName, BigDecimal value) throws JacksonException { - writeName(propertyName); + public void writeNumberField(String fieldName, BigDecimal value) throws IOException { + writeFieldName(fieldName); writeNumber(value); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * (that will contain a JSON Array value), and the START_ARRAY marker. * Equivalent to: *
-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeStartArray();
      *
*

@@ -1630,22 +2315,22 @@ public final void writeNumberProperty(String propertyName, BigDecimal value) thr * (by calling {#link #writeEndArray}) after writing all values * of the value Array. * - * @param propertyName Name of the Array property to write + * @param fieldName Name of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeArrayPropertyStart(String propertyName) throws JacksonException { - writeName(propertyName); + public void writeArrayFieldStart(String fieldName) throws IOException { + writeFieldName(fieldName); writeStartArray(); } /** - * Convenience method for outputting an Object property + * Convenience method for outputting a field entry ("member") * (that will contain an Object value), and the START_OBJECT marker. * Equivalent to: *

-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeStartObject();
      *
*

@@ -1653,37 +2338,51 @@ public final void writeArrayPropertyStart(String propertyName) throws JacksonExc * (by calling {#link #writeEndObject}) after writing all * entries of the value Object. * - * @param propertyName Name of the Object property to write + * @param fieldName Name of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writeObjectPropertyStart(String propertyName) throws JacksonException { - writeName(propertyName); + public void writeObjectFieldStart(String fieldName) throws IOException { + writeFieldName(fieldName); writeStartObject(); } /** - * Convenience method for outputting am Object property - * that has contents of specific Java object (POJO) as its value. + * Convenience method for outputting a field entry ("member") + * that has contents of specific Java object as its value. * Equivalent to: *

-     *  writeName(propertyName);
+     *  writeFieldName(fieldName);
      *  writeObject(pojo);
      *
*

- * NOTE: see {@link #writePOJO(Object)} for details on how POJO value actually - * gets written (uses delegation). + * NOTE: actual serialization of POJO value requires assigned {@code ObjectCodec} + * and will delegate to that (usually {@code ObjectMapper} of databind layer) * - * @param propertyName Name of the property to write - * @param pojo POJO value of the property to write + * @param fieldName Name of the field to write + * @param pojo POJO value of the field to write * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public final void writePOJOProperty(String propertyName, Object pojo) throws JacksonException { - writeName(propertyName); - writePOJO(pojo); + public void writePOJOField(String fieldName, Object pojo) throws IOException { + writeObjectField(fieldName, pojo); + } + + // TODO: deprecate in 2.14 or later + /** + * Older alias for {@link #writePOJOField} + * + * @param fieldName Name of the field to write + * @param pojo POJO value of the field to write + * + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + */ + public void writeObjectField(String fieldName, Object pojo) throws IOException { + writeFieldName(fieldName); + writeObject(pojo); } // // // But this method does need to be delegate so... @@ -1691,24 +2390,22 @@ public final void writePOJOProperty(String propertyName, Object pojo) throws Jac /** * Method called to indicate that a property in this position was * skipped. It is usually only called for generators that return - * false from {@link #canOmitProperties()}. + * false from {@link #canOmitFields()}. *

- * Default implementation does nothing; method is overriden by some format - * backends. + * Default implementation does nothing. * - * @param propertyName Name of the property that is being omitted + * @param fieldName Name of the field omitted * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + * + * @since 2.3 */ - public void writeOmittedProperty(String propertyName) throws JacksonException { } + public void writeOmittedField(String fieldName) throws IOException { } /* /********************************************************************** /* Public API, copy-through methods - /* - /* NOTE: need to remain here for `JsonGeneratorDelegate` to call - /* (or refactor to have "JsonGeneratorMinimalBase" or such) /********************************************************************** */ @@ -1722,13 +2419,12 @@ public void writeOmittedProperty(String propertyName) throws JacksonException { * parser, although it may cause parser to internally process * more data (if it lazy loads contents of value events, for example) * - * @param p Parser that points to the event to copy + * @param p Parser that points to event (token) to copy * - * @throws WrappedIOException if there is an underlying I/O problem (reading or writing) - * @throws StreamReadException for problems with decoding of token stream - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public void copyCurrentEvent(JsonParser p) throws JacksonException + public void copyCurrentEvent(JsonParser p) throws IOException { JsonToken t = p.currentToken(); final int token = (t == null) ? ID_NOT_AVAILABLE : t.id(); @@ -1748,8 +2444,8 @@ public void copyCurrentEvent(JsonParser p) throws JacksonException case ID_END_ARRAY: writeEndArray(); break; - case ID_PROPERTY_NAME: - writeName(p.currentName()); + case ID_FIELD_NAME: + writeFieldName(p.getCurrentName()); break; case ID_STRING: if (p.hasTextCharacters()) { @@ -1792,7 +2488,7 @@ public void copyCurrentEvent(JsonParser p) throws JacksonException writeNull(); break; case ID_EMBEDDED_OBJECT: - writePOJO(p.getEmbeddedObject()); + writeObject(p.getEmbeddedObject()); break; default: throw new IllegalStateException("Internal error: unknown current token, "+t); @@ -1816,11 +2512,11 @@ public void copyCurrentEvent(JsonParser p) throws JacksonException * all events up to and including matching (closing) * {@link JsonToken#END_ARRAY} will be copied * - *

  • {@link JsonToken#PROPERTY_NAME} the logical value (which + *
  • {@link JsonToken#FIELD_NAME} the logical value (which * can consist of a single scalar value; or a sequence of related * events for structured types (JSON Arrays, Objects)) will * be copied along with the name itself. So essentially the - * whole Object property (name and value) will be copied. + * whole field entry (name and value) will be copied. *
  • * *

    @@ -1831,17 +2527,16 @@ public void copyCurrentEvent(JsonParser p) throws JacksonException * * @param p Parser that points to the value to copy * - * @throws WrappedIOException if there is an underlying I/O problem (reading or writing) - * @throws StreamReadException for problems with decoding of token stream - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - public void copyCurrentStructure(JsonParser p) throws JacksonException + public void copyCurrentStructure(JsonParser p) throws IOException { JsonToken t = p.currentToken(); - // Let's handle property-name separately first + // Let's handle field-name separately first int id = (t == null) ? ID_NOT_AVAILABLE : t.id(); - if (id == ID_PROPERTY_NAME) { - writeName(p.currentName()); + if (id == ID_FIELD_NAME) { + writeFieldName(p.getCurrentName()); t = p.nextToken(); id = (t == null) ? ID_NOT_AVAILABLE : t.id(); // fall-through to copy the associated value @@ -1861,7 +2556,8 @@ public void copyCurrentStructure(JsonParser p) throws JacksonException } } - protected void _copyCurrentContents(JsonParser p) throws JacksonException + // @since 2.10 + protected void _copyCurrentContents(JsonParser p) throws IOException { int depth = 1; JsonToken t; @@ -1869,8 +2565,8 @@ protected void _copyCurrentContents(JsonParser p) throws JacksonException // Mostly copied from `copyCurrentEvent()`, but with added nesting counts while ((t = p.nextToken()) != null) { switch (t.id()) { - case ID_PROPERTY_NAME: - writeName(p.currentName()); + case ID_FIELD_NAME: + writeFieldName(p.getCurrentName()); break; case ID_START_ARRAY: @@ -1937,7 +2633,7 @@ protected void _copyCurrentContents(JsonParser p) throws JacksonException writeNull(); break; case ID_EMBEDDED_OBJECT: - writePOJO(p.getEmbeddedObject()); + writeObject(p.getEmbeddedObject()); break; default: throw new IllegalStateException("Internal error: unknown current token, "+t); @@ -1955,15 +2651,18 @@ protected void _copyCurrentContents(JsonParser p) throws JacksonException * Method called to flush any buffered content to the underlying * target (output stream, writer), and to flush the target itself * as well. + * + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ @Override - public abstract void flush(); + public abstract void flush() throws IOException; /** * Method that can be called to determine whether this generator * is closed or not. If it is closed, no more output can be done. * - * @return {@code True} if this generator has been closed; {@code false} if not + * @return {@code True} if this generator instance has been closed */ public abstract boolean isClosed(); @@ -1981,67 +2680,43 @@ protected void _copyCurrentContents(JsonParser p) throws JacksonException * on whether this generator either manages the target (i.e. is the * only one with access to the target -- case if caller passes a * reference to the resource such as File, but not stream); or - * has feature {@link StreamWriteFeature#AUTO_CLOSE_TARGET} enabled. + * has feature {@link Feature#AUTO_CLOSE_TARGET} enabled. * If either of above is true, the target is also closed. Otherwise * (not managing, feature not enabled), target is not closed. + * + * @throws IOException if there is either an underlying I/O problem */ @Override - public abstract void close(); + public abstract void close() throws IOException; /* /********************************************************************** /* Helper methods for sub-classes - /* - /* NOTE: some could be moved out in 3.0 if there was "JsonGeneratorMinimalBase" /********************************************************************** */ /** * Helper method used for constructing and throwing - * {@link StreamWriteException} with given base message. + * {@link JsonGenerationException} with given base message. *

    * Note that sub-classes may override this method to add more detail - * or use a {@link StreamWriteException} sub-class. - * - * @param Bogus type parameter to "return anything" so that compiler - * won't complain when chaining calls + * or use a {@link JsonGenerationException} sub-class. * - * @param msg Message to construct exception with + * @param msg Exception message to use * - * @return Does not return at all as exception is always thrown, but nominally returns "anything" - * - * @throws StreamWriteException that was constructed with given message + * @throws JsonGenerationException constructed */ - protected T _reportError(String msg) throws StreamWriteException { - throw _constructWriteException(msg); - } - - protected T _reportUnsupportedOperation() { - throw new UnsupportedOperationException("Operation not supported by generator of type "+getClass().getName()); - } - - // @since 3.0 - protected StreamWriteException _constructWriteException(String msg) { - return new StreamWriteException(this, msg); - } - - protected StreamWriteException _constructWriteException(String msg, Object arg) { - return _constructWriteException(String.format(msg, arg)); - } - - protected StreamWriteException _constructWriteException(String msg, Object arg1, Object arg2) { - return _constructWriteException(String.format(msg, arg1, arg2)); + protected void _reportError(String msg) throws JsonGenerationException { + throw new JsonGenerationException(msg, this); } - protected StreamWriteException _constructWriteException(String msg, Throwable t) { - return new StreamWriteException(this, msg, t); - } + protected final void _throwInternal() { VersionUtil.throwInternal(); } - // @since 3.0 - protected JacksonException _wrapIOFailure(IOException e) { - return WrappedIOException.construct(e, this); + protected void _reportUnsupportedOperation() { + throw new UnsupportedOperationException("Operation not supported by generator of type "+getClass().getName()); } + // @since 2.8 protected final void _verifyOffsets(int arrayLength, int offset, int length) { if ((offset < 0) || (offset + length) > arrayLength) { @@ -2050,4 +2725,76 @@ protected final void _verifyOffsets(int arrayLength, int offset, int length) offset, length, arrayLength)); } } + + /** + * Helper method to try to call appropriate write method for given + * untyped Object. At this point, no structural conversions should be done, + * only simple basic types are to be coerced as necessary. + * + * @param value Value to write + * + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer + */ + protected void _writeSimpleObject(Object value) throws IOException + { + // 31-Dec-2009, tatu: Actually, we could just handle some basic + // types even without codec. This can improve interoperability, + // and specifically help with TokenBuffer. + if (value == null) { + writeNull(); + return; + } + if (value instanceof String) { + writeString((String) value); + return; + } + if (value instanceof Number) { + Number n = (Number) value; + if (n instanceof Integer) { + writeNumber(n.intValue()); + return; + } else if (n instanceof Long) { + writeNumber(n.longValue()); + return; + } else if (n instanceof Double) { + writeNumber(n.doubleValue()); + return; + } else if (n instanceof Float) { + writeNumber(n.floatValue()); + return; + } else if (n instanceof Short) { + writeNumber(n.shortValue()); + return; + } else if (n instanceof Byte) { + writeNumber(n.byteValue()); + return; + } else if (n instanceof BigInteger) { + writeNumber((BigInteger) n); + return; + } else if (n instanceof BigDecimal) { + writeNumber((BigDecimal) n); + return; + + // then Atomic types + } else if (n instanceof AtomicInteger) { + writeNumber(((AtomicInteger) n).get()); + return; + } else if (n instanceof AtomicLong) { + writeNumber(((AtomicLong) n).get()); + return; + } + } else if (value instanceof byte[]) { + writeBinary((byte[]) value); + return; + } else if (value instanceof Boolean) { + writeBoolean((Boolean) value); + return; + } else if (value instanceof AtomicBoolean) { + writeBoolean(((AtomicBoolean) value).get()); + return; + } + throw new IllegalStateException("No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed " + +value.getClass().getName()+")"); + } } diff --git a/src/main/java/com/fasterxml/jackson/core/JsonLocation.java b/src/main/java/com/fasterxml/jackson/core/JsonLocation.java index edc7c6c893..abd94e2681 100644 --- a/src/main/java/com/fasterxml/jackson/core/JsonLocation.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonLocation.java @@ -17,15 +17,22 @@ public class JsonLocation { private static final long serialVersionUID = 2L; // in 2.13 + /** + * @deprecated Since 2.13 use {@link ContentReference#DEFAULT_MAX_CONTENT_SNIPPET} instead + */ + @Deprecated + public static final int MAX_CONTENT_SNIPPET = 500; + /** * Shared immutable "N/A location" that can be returned to indicate * that no location information is available. + *

    + * NOTE: before 2.9, Location was given as String "N/A"; with 2.9 it was + * removed so that source should be indicated as "UNKNOWN". */ public final static JsonLocation NA = new JsonLocation(ContentReference.unknown(), -1L, -1L, -1, -1); - private final static String NO_LOCATION_DESC = "[No location information]"; - protected final long _totalBytes; protected final long _totalChars; @@ -35,6 +42,8 @@ public class JsonLocation /** * Reference to input source; never null (but may be that of * {@link ContentReference#unknown()}). + * + * @since 2.13 (before we have {@code _sourceRef} (Object-valued) */ protected final ContentReference _contentReference; @@ -72,6 +81,24 @@ public JsonLocation(ContentReference contentRef, long totalBytes, long totalChar _columnNr = columnNr; } + @Deprecated // since 2.13 + public JsonLocation(Object srcRef, long totalChars, int lineNr, int columnNr) { + this(_wrap(srcRef), totalChars, lineNr, columnNr); + } + + @Deprecated // since 2.13 + public JsonLocation(Object srcRef, long totalBytes, long totalChars, + int lineNr, int columnNr) { + this(_wrap(srcRef), totalBytes, totalChars, lineNr, columnNr); + } + + protected static ContentReference _wrap(Object srcRef) { + if (srcRef instanceof ContentReference) { + return (ContentReference) srcRef; + } + return ContentReference.construct(false, srcRef); + } + /* /********************************************************************** /* Simple accessors @@ -83,15 +110,34 @@ public JsonLocation(ContentReference contentRef, long totalBytes, long totalChar * read from. Returned reference is never {@code null} but may not contain * useful information. *

    - * NOTE: not getter, on purpose, to avoid inclusion if serialized using + * NOTE: not getter, on purpose, to avoid inlusion if serialized using * default Jackson serializer. * * @return Object with information about input source. + * + * @since 2.13 (to replace {@code getSourceRef}) */ public ContentReference contentReference() { return _contentReference; } + /** + * Reference to the original resource being read, if one available. + * For example, when a parser has been constructed by passing + * a {@link java.io.File} instance, this method would return + * that File. Will return null if no such reference is available, + * for example when {@link java.io.InputStream} was used to + * construct the parser instance. + * + * @return Source reference this location was constructed with, if any; {@code null} if none + * + * @deprecated Since 2.13 Use {@link #contentReference} instead + */ + @Deprecated + public Object getSourceRef() { + return _contentReference.getRawContent(); + } + /** * Access for getting line number of this location, if available. * Note that line number is typically not available for binary formats. @@ -122,7 +168,7 @@ public ContentReference contentReference() { /** * Accessor for getting a textual description of source reference - * (Object returned by {@link #contentReference()}), as included in + * (Object returned by {@link #getSourceRef()}), as included in * description returned by {@link #toString()}. *

    * Note: implementation will simply call @@ -130,7 +176,9 @@ public ContentReference contentReference() { *

    * NOTE: not added as a "getter" to prevent it from getting serialized. * - * @return Description of the source reference (see {@link #contentReference()} + * @return Description of the source reference (see {@link #getSourceRef()} + * + * @since 2.9 */ public String sourceDescription() { // 04-Apr-2021, tatu: Construct lazily but retain @@ -146,6 +194,8 @@ public String sourceDescription() { * * @return Description of available relevant location offsets; combination of * line number and column position or byte offset + * + * @since 2.13 */ public String offsetDescription() { return appendOffsetDescription(new StringBuilder(40)).toString(); @@ -173,15 +223,24 @@ public StringBuilder appendOffsetDescription(StringBuilder sb) sb.append("UNKNOWN"); } } else { - // 04-Apr-2021, tatu: Jackson 2.x had compatibility checks here; 3.x - // assumes binary content always implies byte offsets - sb.append("byte offset: #"); - // For binary formats, total bytes should be the canonical offset - // for token/current location - if (_totalBytes >= 0) { - sb.append(_totalBytes); + // 04-Apr-2021, tatu: Ideally byte formats would not need line/column + // info, but for backwards-compatibility purposes (Jackson 2.x), + // will leave logic here + if (_lineNr > 0) { // yes, require 1-based in case of allegedly binary content + sb.append("line: ").append(_lineNr); + if (_columnNr > 0) { + sb.append(", column: "); + sb.append(_columnNr); + } } else { - sb.append("UNKNOWN"); + sb.append("byte offset: #"); + // For binary formats, total bytes should be the canonical offset + // for token/current location + if (_totalBytes >= 0) { + sb.append(_totalBytes); + } else { + sb.append("UNKNOWN"); + } } } return sb; @@ -228,9 +287,6 @@ public boolean equals(Object other) @Override public String toString() { - if (this == NA) { - return NO_LOCATION_DESC; - } final String srcDesc = sourceDescription(); StringBuilder sb = new StringBuilder(40 + srcDesc.length()) .append("[Source: ") @@ -240,16 +296,4 @@ public String toString() .append(']') .toString(); } - - public StringBuilder toString(StringBuilder sb) - { - if (this == NA) { - return sb.append(NO_LOCATION_DESC); - } - sb.append("[Source: ") - .append(sourceDescription()) - .append("; "); - return appendOffsetDescription(sb) - .append(']'); - } } diff --git a/src/main/java/com/fasterxml/jackson/core/JsonParseException.java b/src/main/java/com/fasterxml/jackson/core/JsonParseException.java new file mode 100644 index 0000000000..b3b7b5610c --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/JsonParseException.java @@ -0,0 +1,119 @@ +/* Jackson JSON-processor. + * + * Copyright (c) 2007- Tatu Saloranta, tatu.saloranta@iki.fi + */ + +package com.fasterxml.jackson.core; + +import com.fasterxml.jackson.core.exc.StreamReadException; +import com.fasterxml.jackson.core.util.RequestPayload; + +/** + * Exception type for parsing problems, used when non-well-formed content + * (content that does not conform to JSON syntax as per specification) + * is encountered. + */ +public class JsonParseException + extends StreamReadException +{ + private static final long serialVersionUID = 2L; // 2.7 + + @Deprecated // since 2.7 + public JsonParseException(String msg, JsonLocation loc) { + super(msg, loc, null); + } + + @Deprecated // since 2.7 + public JsonParseException(String msg, JsonLocation loc, Throwable root) { + super(msg, loc, root); + } + + /** + * Constructor that uses current parsing location as location, and + * sets processor (accessible via {@link #getProcessor()}) to + * specified parser. + * + * @param p Parser in use when encountering issue reported + * @param msg Base exception message to use + * + * @since 2.7 + */ + public JsonParseException(JsonParser p, String msg) { + super(p, msg); + } + + // @since 2.7 + public JsonParseException(JsonParser p, String msg, Throwable root) { + super(p, msg, root); + } + + // @since 2.7 + public JsonParseException(JsonParser p, String msg, JsonLocation loc) { + super(p, msg, loc); + } + + // @since 2.7 + public JsonParseException(JsonParser p, String msg, JsonLocation loc, Throwable root) { + super(msg, loc, root); + } + + /** + * Fluent method that may be used to assign originating {@link JsonParser}, + * to be accessed using {@link #getProcessor()}. + *

    + * NOTE: `this` instance is modified and no new instance is constructed. + * + * @param p Parser instance to assign to this exception + * + * @return This exception instance to allow call chaining + * + * @since 2.7 + */ + @Override + public JsonParseException withParser(JsonParser p) { + _processor = p; + return this; + } + + /** + * Fluent method that may be used to assign payload to this exception, + * to let recipient access it for diagnostics purposes. + *

    + * NOTE: `this` instance is modified and no new instance is constructed. + * + * @param payload Payload to assign to this exception + * + * @return This exception instance to allow call chaining + * + * @since 2.8 + */ + @Override + public JsonParseException withRequestPayload(RequestPayload payload) { + _requestPayload = payload; + return this; + } + + // NOTE: overloaded in 2.10 just to retain binary compatibility with 2.9 (remove from 3.0) + @Override + public JsonParser getProcessor() { + return super.getProcessor(); + } + + // NOTE: overloaded in 2.10 just to retain binary compatibility with 2.9 (remove from 3.0) + @Override + public RequestPayload getRequestPayload() { + return super.getRequestPayload(); + } + + // NOTE: overloaded in 2.10 just to retain binary compatibility with 2.9 (remove from 3.0) + @Override + public String getRequestPayloadAsString() { + return super.getRequestPayloadAsString(); + } + + // NOTE: overloaded in 2.10 just to retain binary compatibility with 2.9 (remove from 3.0) + @Override + public String getMessage() { + return super.getMessage(); + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/JsonParser.java b/src/main/java/com/fasterxml/jackson/core/JsonParser.java index 9dc91beccb..335fd434e7 100644 --- a/src/main/java/com/fasterxml/jackson/core/JsonParser.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonParser.java @@ -8,16 +8,13 @@ import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; +import java.util.Iterator; import com.fasterxml.jackson.core.async.NonBlockingInputFeeder; import com.fasterxml.jackson.core.exc.InputCoercionException; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.exc.WrappedIOException; -import com.fasterxml.jackson.core.json.JsonFactory; -import com.fasterxml.jackson.core.sym.PropertyNameMatcher; -import com.fasterxml.jackson.core.type.ResolvedType; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.util.JacksonFeatureSet; +import com.fasterxml.jackson.core.util.RequestPayload; /** * Base class that defines public API for reading JSON content. @@ -29,114 +26,389 @@ public abstract class JsonParser implements Closeable, Versioned { + private final static int MIN_BYTE_I = (int) Byte.MIN_VALUE; + // as per [JACKSON-804], allow range up to and including 255 + private final static int MAX_BYTE_I = (int) 255; + + private final static int MIN_SHORT_I = (int) Short.MIN_VALUE; + private final static int MAX_SHORT_I = (int) Short.MAX_VALUE; + /** * Enumeration of possible "native" (optimal) types that can be * used for numbers. */ public enum NumberType { INT, LONG, BIG_INTEGER, FLOAT, DOUBLE, BIG_DECIMAL - } + }; /** - * Set of default {@link StreamReadCapability}ies enabled: usable as basis - * for format-specific instances or placeholder if non-null instance needed. + * Default set of {@link StreamReadCapability}ies that may be used as + * basis for format-specific readers (or as bogus instance if non-null + * set needs to be passed). + * + * @since 2.12 */ protected final static JacksonFeatureSet DEFAULT_READ_CAPABILITIES = JacksonFeatureSet.fromDefaults(StreamReadCapability.values()); - /* - /********************************************************************** - /* Life-cycle - /********************************************************************** - */ - - protected JsonParser() { } - - /* - /********************************************************************** - /* Versioned - /********************************************************************** - */ - /** - * Accessor for getting version of the core package, given a parser instance. - * Left for sub-classes to implement. - */ - @Override - public abstract Version version(); + * Enumeration that defines all on/off features for parsers. + */ + public enum Feature { + // // // Low-level I/O handling features: + + /** + * Feature that determines whether parser will automatically + * close underlying input source that is NOT owned by the + * parser. If disabled, calling application has to separately + * close the underlying {@link InputStream} and {@link Reader} + * instances used to create the parser. If enabled, parser + * will handle closing, as long as parser itself gets closed: + * this happens when end-of-input is encountered, or parser + * is closed by a call to {@link JsonParser#close}. + *

    + * Feature is enabled by default. + */ + AUTO_CLOSE_SOURCE(true), + + // // // Support for non-standard data format constructs + + /** + * Feature that determines whether parser will allow use + * of Java/C++ style comments (both '/'+'*' and + * '//' varieties) within parsed content or not. + *

    + * Since JSON specification does not mention comments as legal + * construct, + * this is a non-standard feature; however, in the wild + * this is extensively used. As such, feature is + * disabled by default for parsers and must be + * explicitly enabled. + *

    + * NOTE: while not technically deprecated, since 2.10 recommended to use + * {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_JAVA_COMMENTS} instead. + */ + ALLOW_COMMENTS(false), + + /** + * Feature that determines whether parser will allow use + * of YAML comments, ones starting with '#' and continuing + * until the end of the line. This commenting style is common + * with scripting languages as well. + *

    + * Since JSON specification does not mention comments as legal + * construct, + * this is a non-standard feature. As such, feature is + * disabled by default for parsers and must be + * explicitly enabled. + *

    + * NOTE: while not technically deprecated, since 2.10 recommended to use + * {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_YAML_COMMENTS} instead. + */ + ALLOW_YAML_COMMENTS(false), + + /** + * Feature that determines whether parser will allow use + * of unquoted field names (which is allowed by Javascript, + * but not by JSON specification). + *

    + * Since JSON specification requires use of double quotes for + * field names, + * this is a non-standard feature, and as such disabled by default. + *

    + * NOTE: while not technically deprecated, since 2.10 recommended to use + * {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_UNQUOTED_FIELD_NAMES} instead. + */ + ALLOW_UNQUOTED_FIELD_NAMES(false), + + /** + * Feature that determines whether parser will allow use + * of single quotes (apostrophe, character '\'') for + * quoting Strings (names and String values). If so, + * this is in addition to other acceptable markers. + * but not by JSON specification). + *

    + * Since JSON specification requires use of double quotes for + * field names, + * this is a non-standard feature, and as such disabled by default. + *

    + * NOTE: while not technically deprecated, since 2.10 recommended to use + * {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_SINGLE_QUOTES} instead. + */ + ALLOW_SINGLE_QUOTES(false), + + /** + * Feature that determines whether parser will allow + * JSON Strings to contain unquoted control characters + * (ASCII characters with value less than 32, including + * tab and line feed characters) or not. + * If feature is set false, an exception is thrown if such a + * character is encountered. + *

    + * Since JSON specification requires quoting for all control characters, + * this is a non-standard feature, and as such disabled by default. + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_UNESCAPED_CONTROL_CHARS} instead + */ + @Deprecated + ALLOW_UNQUOTED_CONTROL_CHARS(false), + + /** + * Feature that can be enabled to accept quoting of all character + * using backslash quoting mechanism: if not enabled, only characters + * that are explicitly listed by JSON specification can be thus + * escaped (see JSON spec for small list of these characters) + *

    + * Since JSON specification requires quoting for all control characters, + * this is a non-standard feature, and as such disabled by default. + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER} instead + */ + @Deprecated + ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER(false), + + /** + * Feature that determines whether parser will allow + * JSON integral numbers to start with additional (ignorable) + * zeroes (like: 000001). If enabled, no exception is thrown, and extra + * nulls are silently ignored (and not included in textual representation + * exposed via {@link JsonParser#getText}). + *

    + * Since JSON specification does not allow leading zeroes, + * this is a non-standard feature, and as such disabled by default. + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_LEADING_ZEROS_FOR_NUMBERS} instead + */ + @Deprecated + ALLOW_NUMERIC_LEADING_ZEROS(false), + + /** + * @deprecated Use {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS} instead + */ + @Deprecated + ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS(false), + + /** + * Feature that allows parser to recognize set of + * "Not-a-Number" (NaN) tokens as legal floating number + * values (similar to how many other data formats and + * programming language source code allows it). + * Specific subset contains values that + * XML Schema + * (see section 3.2.4.1, Lexical Representation) + * allows (tokens are quoted contents, not including quotes): + *

      + *
    • "INF" (for positive infinity), as well as alias of "Infinity" + *
    • "-INF" (for negative infinity), alias "-Infinity" + *
    • "NaN" (for other not-a-numbers, like result of division by zero) + *
    + *

    + * Since JSON specification does not allow use of such values, + * this is a non-standard feature, and as such disabled by default. + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_NON_NUMERIC_NUMBERS} instead + */ + @Deprecated + ALLOW_NON_NUMERIC_NUMBERS(false), + + /** + * Feature allows the support for "missing" values in a JSON array: missing + * value meaning sequence of two commas, without value in-between but only + * optional white space. + * Enabling this feature will expose "missing" values as {@link JsonToken#VALUE_NULL} + * tokens, which typically become Java nulls in arrays and {@link java.util.Collection} + * in data-binding. + *

    + * For example, enabling this feature will represent a JSON array ["value1",,"value3",] + * as ["value1", null, "value3", null] + *

    + * Since the JSON specification does not allow missing values this is a non-compliant JSON + * feature and is disabled by default. + * + * @since 2.8 + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_MISSING_VALUES} instead + */ + @Deprecated + ALLOW_MISSING_VALUES(false), + + /** + * Feature that determines whether {@link JsonParser} will allow for a single trailing + * comma following the final value (in an Array) or member (in an Object). These commas + * will simply be ignored. + *

    + * For example, when this feature is enabled, [true,true,] is equivalent to + * [true, true] and {"a": true,} is equivalent to + * {"a": true}. + *

    + * When combined with ALLOW_MISSING_VALUES, this feature takes priority, and + * the final trailing comma in an array declaration does not imply a missing + * (null) value. For example, when both ALLOW_MISSING_VALUES + * and ALLOW_TRAILING_COMMA are enabled, [true,true,] is + * equivalent to [true, true], and [true,true,,] is equivalent to + * [true, true, null]. + *

    + * Since the JSON specification does not permit trailing commas, this is a non-standard + * feature, and as such disabled by default. + * + * @since 2.9 + * + * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_TRAILING_COMMA} instead + */ + @Deprecated + ALLOW_TRAILING_COMMA(false), + + // // // Validity checks + + /** + * Feature that determines whether {@link JsonParser} will explicitly + * check that no duplicate JSON Object field names are encountered. + * If enabled, parser will check all names within context and report + * duplicates by throwing a {@link JsonParseException}; if disabled, + * parser will not do such checking. Assumption in latter case is + * that caller takes care of handling duplicates at a higher level: + * data-binding, for example, has features to specify detection to + * be done there. + *

    + * Note that enabling this feature will incur performance overhead + * due to having to store and check additional information: this typically + * adds 20-30% to execution time for basic parsing. + * + * @since 2.3 + */ + STRICT_DUPLICATE_DETECTION(false), + + /** + * Feature that determines what to do if the underlying data format requires knowledge + * of all properties to decode (usually via a Schema), and if no definition is + * found for a property that input content contains. + * Typically most textual data formats do NOT require schema information (although + * some do, such as CSV), whereas many binary data formats do require definitions + * (such as Avro, protobuf), although not all (Smile, CBOR, BSON and MessagePack do not). + * Further note that some formats that do require schema information will not be able + * to ignore undefined properties: for example, Avro is fully positional and there is + * no possibility of undefined data. This leaves formats like Protobuf that have identifiers + * that may or may not map; and as such Protobuf format does make use of this feature. + *

    + * Note that support for this feature is implemented by individual data format + * module, if (and only if) it makes sense for the format in question. For JSON, + * for example, this feature has no effect as properties need not be pre-defined. + *

    + * Feature is disabled by default, meaning that if the underlying data format + * requires knowledge of all properties to output, attempts to read an unknown + * property will result in a {@link JsonProcessingException} + * + * @since 2.6 + */ + IGNORE_UNDEFINED(false), + + // // // Other + + /** + * Feature that determines whether {@link JsonLocation} instances should be constructed + * with reference to source or not. If source reference is included, its type and contents + * are included when `toString()` method is called (most notably when printing out parse + * exception with that location information). If feature is disabled, no source reference + * is passed and source is only indicated as "UNKNOWN". + *

    + * Most common reason for disabling this feature is to avoid leaking information about + * internal information; this may be done for security reasons. + * Note that even if source reference is included, only parts of contents are usually + * printed, and not the whole contents. Further, many source reference types can not + * necessarily access contents (like streams), so only type is indicated, not contents. + *

    + * Feature is enabled by default, meaning that "source reference" information is passed + * and some or all of the source content may be included in {@link JsonLocation} information + * constructed either when requested explicitly, or when needed for an exception. + * + * @since 2.9 + */ + INCLUDE_SOURCE_IN_LOCATION(true), + + ; + + /** + * Whether feature is enabled or disabled by default. + */ + private final boolean _defaultState; + + private final int _mask; + + /** + * Method that calculates bit set (flags) of all features that + * are enabled by default. + * + * @return Bit mask of all features that are enabled by default + */ + public static int collectDefaults() + { + int flags = 0; + for (Feature f : values()) { + if (f.enabledByDefault()) { + flags |= f.getMask(); + } + } + return flags; + } + + private Feature(boolean defaultState) { + _mask = (1 << ordinal()); + _defaultState = defaultState; + } + + public boolean enabledByDefault() { return _defaultState; } + + public boolean enabledIn(int flags) { return (flags & _mask) != 0; } + + public int getMask() { return _mask; } + } /* - /********************************************************************** - /* Public API: basic context access - /********************************************************************** + /********************************************************** + /* Minimal configuration state + /********************************************************** */ /** - * Method that can be used to access current parsing context reader - * is in. There are 3 different types: root, array and object contexts, - * with slightly different available information. Contexts are - * hierarchically nested, and can be used for example for figuring - * out part of the input document that correspond to specific - * array or object (for highlighting purposes, or error reporting). - * Contexts can also be used for simple xpath-like matching of - * input, if so desired. - *

    - * NOTE: method was called {@code getParsingContext()} in Jackson 2.x - * - * @return Stream output context ({@link TokenStreamContext}) associated with this parser + * Bit flag composed of bits that indicate which + * {@link com.fasterxml.jackson.core.JsonParser.Feature}s + * are enabled. */ - public abstract TokenStreamContext streamReadContext(); - + protected int _features; + /** - * Accessor for context object provided by higher level data-binding - * functionality (or, in some cases, simple placeholder of the same) - * that allows some level of interaction including ability to trigger - * deserialization of Object values through generator instance. - *

    - * Context object is used by parser to implement some methods, - * like {@code readValueAs(...)} + * Optional container that holds the request payload which will be displayed on JSON parsing error. * - * @return Object write context ({@link ObjectReadContext}) associated with this parser - * - * @since 3.0 + * @since 2.8 */ - public abstract ObjectReadContext objectReadContext(); + protected transient RequestPayload _requestPayload; /* - /********************************************************************** - /* Public API, input source, location access - /********************************************************************** + /********************************************************** + /* Construction, configuration, initialization + /********************************************************** */ + protected JsonParser() { } + protected JsonParser(int features) { _features = features; } + /** - * Method that return the starting location of the current - * token; that is, position of the first character from input - * that starts the current token. - *

    - * Note that the location is not guaranteed to be accurate (although most - * implementation will try their best): some implementations may only - * return {@link JsonLocation#NA} due to not having access - * to input location information (when delegating actual decoding work - * to other library). + * Accessor for {@link ObjectCodec} associated with this + * parser, if any. Codec is used by {@link #readValueAs(Class)} + * method (and its variants). * - * @return Starting location of the token parser currently points to + * @return Codec assigned to this parser, if any; {@code null} if none */ - public abstract JsonLocation currentTokenLocation(); + public abstract ObjectCodec getCodec(); /** - * Method that returns location of the last processed character; - * usually for error reporting purposes. - *

    - * Note that the location is not guaranteed to be accurate (although most - * implementation will try their best): some implementations may only - * report specific boundary locations (start or end locations of tokens) - * and others only return {@link JsonLocation#NA} due to not having access - * to input location information (when delegating actual decoding work - * to other library). + * Setter that allows defining {@link ObjectCodec} associated with this + * parser, if any. Codec is used by {@link #readValueAs(Class)} + * method (and its variants). * - * @return Location of the last processed input unit (byte or character) + * @param oc Codec to assign, if any; {@code null} if none */ - public abstract JsonLocation currentLocation(); + public abstract void setCodec(ObjectCodec oc); /** * Method that can be used to get access to object that is used @@ -152,49 +424,109 @@ protected JsonParser() { } *

    * In general use of this accessor should be considered as * "last effort", i.e. only used if no other mechanism is applicable. - *

    - * NOTE: was named {@code getInputSource()} in Jackson 2.x. * * @return Input source this parser was configured with */ - public abstract Object streamReadInputSource(); + public Object getInputSource() { return null; } + + /** + * Sets the payload to be passed if {@link JsonParseException} is thrown. + * + * @param payload Payload to pass + * + * @since 2.8 + */ + public void setRequestPayloadOnError(RequestPayload payload) { + _requestPayload = payload; + } + + /** + * Sets the byte[] request payload and the charset + * + * @param payload Payload to pass + * @param charset Character encoding for (lazily) decoding payload + * + * @since 2.8 + */ + public void setRequestPayloadOnError(byte[] payload, String charset) { + _requestPayload = (payload == null) ? null : new RequestPayload(payload, charset); + } + + /** + * Sets the String request payload + * + * @param payload Payload to pass + * + * @since 2.8 + */ + public void setRequestPayloadOnError(String payload) { + _requestPayload = (payload == null) ? null : new RequestPayload(payload); + } /* - /********************************************************************** - /* Attaching additional metadata: current value - /********************************************************************** + /********************************************************** + /* Format support + /********************************************************** */ /** - * Helper method, usually equivalent to: - * - * getParsingContext().currentValue(); - * + * Method to call to make this parser use specified schema. Method must + * be called before trying to parse any content, right after parser instance + * has been created. + * Note that not all parsers support schemas; and those that do usually only + * accept specific types of schemas: ones defined for data format parser can read. *

    - * Note that "current value" is NOT populated (or used) by Streaming parser; - * it is only used by higher-level data-binding functionality. - * The reason it is included here is that it can be stored and accessed hierarchically, - * and gets passed through data-binding. - * - * @return "Current value" for the current input context this parser has + * If parser does not support specified schema, {@link UnsupportedOperationException} + * is thrown. + * + * @param schema Schema to use + * + * @throws UnsupportedOperationException if parser does not support schema */ - public abstract Object currentValue(); + public void setSchema(FormatSchema schema) { + throw new UnsupportedOperationException("Parser of type "+getClass().getName()+" does not support schema of type '" + +schema.getSchemaType()+"'"); + } /** - * Helper method, usually equivalent to: - * - * getParsingContext().assignCurrentValue(v); - * + * Method for accessing Schema that this parser uses, if any. + * Default implementation returns null. * - * @param v "Current value" to assign to the current input context of this parser + * @return Schema in use by this parser, if any; {@code null} if none + * + * @since 2.1 */ - public abstract void assignCurrentValue(Object v); + public FormatSchema getSchema() { return null; } + + /** + * Method that can be used to verify that given schema can be used with + * this parser (using {@link #setSchema}). + * + * @param schema Schema to check + * + * @return True if this parser can use given schema; false if not + */ + public boolean canUseSchema(FormatSchema schema) { return false; } /* - /********************************************************************** - /* Optional support for non-blocking parsing - /********************************************************************** + /********************************************************** + /* Capability introspection + /********************************************************** + */ + + /** + * Method that can be called to determine if a custom + * {@link ObjectCodec} is needed for binding data parsed + * using {@link JsonParser} constructed by this factory + * (which typically also implies the same for serialization + * with {@link JsonGenerator}). + * + * @return True if format-specific codec is needed with this parser; false if a general + * {@link ObjectCodec} is enough + * + * @since 2.1 */ + public boolean requiresCustomCodec() { return false;} /** * Method that can be called to determine if this parser instance @@ -202,12 +534,14 @@ protected JsonParser() { } * Access mode is determined by earlier calls via {@link JsonFactory}; * it may not be changed after construction. *

    - * If non-blocking decoding is {@code true}, it is possible to call - * {@link #nonBlockingInputFeeder()} to obtain object to use + * If non-blocking decoding is (@code true}, it is possible to call + * {@link #getNonBlockingInputFeeder()} to obtain object to use * for feeding input; otherwise (false returned) - * input is read by blocking. + * input is read by blocking * * @return True if this is a non-blocking ("asynchronous") parser + * + * @since 2.9 */ public boolean canParseAsync() { return false; } @@ -217,8 +551,10 @@ protected JsonParser() { } * parsers that use blocking I/O. * * @return Input feeder to use with non-blocking (async) parsing + * + * @since 2.9 */ - public NonBlockingInputFeeder nonBlockingInputFeeder() { + public NonBlockingInputFeeder getNonBlockingInputFeeder() { return null; } @@ -227,34 +563,54 @@ public NonBlockingInputFeeder nonBlockingInputFeeder() { * underlying data format being read (directly or indirectly). * * @return Set of read capabilities for content to read via this parser + * + * @since 2.12 */ - public JacksonFeatureSet streamReadCapabilities() { + public JacksonFeatureSet getReadCapabilities() { return DEFAULT_READ_CAPABILITIES; } /* - /********************************************************************** + /********************************************************** + /* Versioned + /********************************************************** + */ + + /** + * Accessor for getting version of the core package, given a parser instance. + * Left for sub-classes to implement. + * + * @return Version of this generator (derived from version declared for + * {@code jackson-core} jar that contains the class + */ + @Override + public abstract Version version(); + + /* + /********************************************************** /* Closeable implementation - /********************************************************************** + /********************************************************** */ /** * Closes the parser so that no further iteration or data access * can be made; will also close the underlying input source * if parser either owns the input source, or feature - * {@link StreamReadFeature#AUTO_CLOSE_SOURCE} is enabled. + * {@link Feature#AUTO_CLOSE_SOURCE} is enabled. * Whether parser owns the input source depends on factory * method that was used to construct instance (so check - * {@link com.fasterxml.jackson.core.json.JsonFactory} for details, + * {@link com.fasterxml.jackson.core.JsonFactory} for details, * but the general * idea is that if caller passes in closable resource (such * as {@link InputStream} or {@link Reader}) parser does NOT * own the source; but if it passes a reference (such as * {@link java.io.File} or {@link java.net.URL} and creates * stream or reader it does own them. + * + * @throws IOException if there is either an underlying I/O problem */ @Override - public abstract void close(); + public abstract void close() throws IOException; /** * Method that can be called to determine whether this parser @@ -269,9 +625,148 @@ public JacksonFeatureSet streamReadCapabilities() { public abstract boolean isClosed(); /* - /********************************************************************** + /********************************************************** + /* Public API, simple location, context accessors + /********************************************************** + */ + + /** + * Method that can be used to access current parsing context reader + * is in. There are 3 different types: root, array and object contexts, + * with slightly different available information. Contexts are + * hierarchically nested, and can be used for example for figuring + * out part of the input document that correspond to specific + * array or object (for highlighting purposes, or error reporting). + * Contexts can also be used for simple xpath-like matching of + * input, if so desired. + * + * @return Stream input context ({@link JsonStreamContext}) associated with this parser + */ + public abstract JsonStreamContext getParsingContext(); + + /** + * Method that returns location of the last processed input unit (character + * or byte) from the input; + * usually for error reporting purposes. + *

    + * Note that the location is not guaranteed to be accurate (although most + * implementation will try their best): some implementations may only + * report specific boundary locations (start or end locations of tokens) + * and others only return {@link JsonLocation#NA} due to not having access + * to input location information (when delegating actual decoding work + * to other library) + * + * @return Location of the last processed input unit (byte or character) + * + * @since 2.13 + */ + public JsonLocation currentLocation() { + return getCurrentLocation(); + } + + /** + * Method that return the starting location of the current + * (most recently returned) + * token; that is, the position of the first input unit (character or byte) from input + * that starts the current token. + *

    + * Note that the location is not guaranteed to be accurate (although most + * implementation will try their best): some implementations may only + * return {@link JsonLocation#NA} due to not having access + * to input location information (when delegating actual decoding work + * to other library) + * + * @return Starting location of the token parser currently points to + * + * @since 2.13 (will eventually replace {@link #getTokenLocation}) + */ + public JsonLocation currentTokenLocation() { + return getTokenLocation(); + } + + // TODO: deprecate in 2.14 or later + /** + * Alias for {@link #currentLocation()}, to be deprecated in later + * Jackson 2.x versions (and removed from Jackson 3.0). + * + * @return Location of the last processed input unit (byte or character) + */ + public abstract JsonLocation getCurrentLocation(); + + // TODO: deprecate in 2.14 or later + /** + * Alias for {@link #currentTokenLocation()}, to be deprecated in later + * Jackson 2.x versions (and removed from Jackson 3.0). + * + * @return Starting location of the token parser currently points to + */ + public abstract JsonLocation getTokenLocation(); + + /** + * Helper method, usually equivalent to: + * + * getParsingContext().getCurrentValue(); + * + *

    + * Note that "current value" is NOT populated (or used) by Streaming parser; + * it is only used by higher-level data-binding functionality. + * The reason it is included here is that it can be stored and accessed hierarchically, + * and gets passed through data-binding. + * + * @return "Current value" associated with the current input context (state) of this parser + * + * @since 2.13 (added as replacement for older {@link #getCurrentValue()} + */ + public Object currentValue() { + // TODO: implement directly in 2.14 or later, make getCurrentValue() call this + return getCurrentValue(); + } + + /** + * Helper method, usually equivalent to: + * + * getParsingContext().setCurrentValue(v); + * + * + * @param v Current value to assign for the current input context of this parser + * + * @since 2.13 (added as replacement for older {@link #setCurrentValue} + */ + public void assignCurrentValue(Object v) { + // TODO: implement directly in 2.14 or later, make setCurrentValue() call this + setCurrentValue(v); + } + + // TODO: deprecate in 2.14 or later + /** + * Alias for {@link #currentValue()}, to be deprecated in later + * Jackson 2.x versions (and removed from Jackson 3.0). + * + * @return Location of the last processed input unit (byte or character) + */ + public Object getCurrentValue() { + JsonStreamContext ctxt = getParsingContext(); + return (ctxt == null) ? null : ctxt.getCurrentValue(); + } + + // TODO: deprecate in 2.14 or later + /** + * Alias for {@link #assignCurrentValue}, to be deprecated in later + * Jackson 2.x versions (and removed from Jackson 3.0). + * + * @param v Current value to assign for the current input context of this parser + */ + public void setCurrentValue(Object v) { + JsonStreamContext ctxt = getParsingContext(); + if (ctxt != null) { + ctxt.setCurrentValue(v); + } + } + + /* + /********************************************************** /* Buffer handling - /********************************************************************** + /********************************************************** */ /** @@ -283,14 +778,14 @@ public JacksonFeatureSet streamReadCapabilities() { * it can not. * * @param out OutputStream to which buffered, undecoded content is written to - * + * * @return -1 if the underlying content source is not byte based * (that is, input can not be sent to {@link OutputStream}; * otherwise number of bytes released (0 if there was nothing to release) - * - * @throws JacksonException if write to stream threw exception + * + * @throws IOException if write to stream threw exception */ - public int releaseBuffered(OutputStream out) throws JacksonException { + public int releaseBuffered(OutputStream out) throws IOException { return -1; } @@ -304,218 +799,244 @@ public int releaseBuffered(OutputStream out) throws JacksonException { * it can not. * * @param w Writer to which buffered but unprocessed content is written to - * + * * @return -1 if the underlying content source is not char-based * (that is, input can not be sent to {@link Writer}; * otherwise number of chars released (0 if there was nothing to release) - * - * @throws JacksonException if write using Writer threw exception - */ - public int releaseBuffered(Writer w) throws JacksonException { return -1; } + * + * @throws IOException if write using Writer threw exception + */ + public int releaseBuffered(Writer w) throws IOException { return -1; } /* - /********************************************************************** + /*************************************************** /* Public API, configuration - /********************************************************************** + /*************************************************** */ - // 25-Jan-2021, tatu: Was needed by jax-rs providers until recently, - // but should no longer be needed at all. Leaving here for a bit longer. - -// public abstract JsonParser enable(StreamReadFeature f); -// public abstract JsonParser disable(StreamReadFeature f); - /** - * Method for checking whether specified {@link StreamReadFeature} is enabled. + * Method for enabling specified parser feature + * (check {@link Feature} for list of features) * - * @param f Feature to check + * @param f Feature to enable * - * @return {@code True} if feature is enabled; {@code false} otherwise + * @return This parser, to allow call chaining */ - public abstract boolean isEnabled(StreamReadFeature f); + public JsonParser enable(Feature f) { + _features |= f.getMask(); + return this; + } /** - * Bulk access method for getting state of all standard {@link StreamReadFeature}s. - * - * @return Bit mask that defines current states of all standard {@link StreamReadFeature}s. + * Method for disabling specified feature + * (check {@link Feature} for list of features) * - * @since 3.0 + * @param f Feature to disable + * + * @return This parser, to allow call chaining */ - public abstract int streamReadFeatures(); + public JsonParser disable(Feature f) { + _features &= ~f.getMask(); + return this; + } /** - * Method for accessing Schema that this parser uses, if any. - * Default implementation returns null. + * Method for enabling or disabling specified feature + * (check {@link Feature} for list of features) + * + * @param f Feature to enable or disable + * @param state Whether to enable feature ({@code true}) or disable ({@code false}) * - * @return {@link FormatSchema} assigned to this parser, if any; {@code null} if none + * @return This parser, to allow call chaining */ - public FormatSchema getSchema() { return null; } - - /* - /********************************************************************** - /* Public API, iterating accessors: general - /********************************************************************** + public JsonParser configure(Feature f, boolean state) { + if (state) enable(f); else disable(f); + return this; + } + + /** + * Method for checking whether specified {@link Feature} is enabled. + * + * @param f Feature to check + * + * @return {@code True} if feature is enabled; {@code false} otherwise */ + public boolean isEnabled(Feature f) { return f.enabledIn(_features); } /** - * Main iteration method, which will advance stream enough - * to determine type of the next token, if any. If none - * remaining (stream has no content other than possible - * white space before ending), null will be returned. + * Method for checking whether specified {@link Feature} is enabled. * - * @return Next token from the stream, if any found, or null - * to indicate end-of-input + * @param f Feature to check * - * @throws JacksonException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @return {@code True} if feature is enabled; {@code false} otherwise + * + * @since 2.10 */ - public abstract JsonToken nextToken() throws JacksonException; + public boolean isEnabled(StreamReadFeature f) { return f.mappedFeature().enabledIn(_features); } + + /** + * Bulk access method for getting state of all standard {@link Feature}s. + * + * @return Bit mask that defines current states of all standard {@link Feature}s. + * + * @since 2.3 + */ + public int getFeatureMask() { return _features; } /** - * Iteration method that will advance stream enough - * to determine type of the next token that is a value type - * (including JSON Array and Object start/end markers). - * Or put another way, nextToken() will be called once, - * and if {@link JsonToken#PROPERTY_NAME} is returned, another - * time to get the value of the property. - * Method is most useful for iterating over value entries - * of JSON objects; Object property name will still be available - * by calling {@link #currentName} when parser points to - * the value. + * Bulk set method for (re)setting states of all standard {@link Feature}s * - * @return Next non-field-name token from the stream, if any found, - * or null to indicate end-of-input (or, for non-blocking - * parsers, {@link JsonToken#NOT_AVAILABLE} if no tokens were - * available yet) + * @param mask Bit mask that defines set of features to enable * + * @return This parser, to allow call chaining * - * @throws JacksonException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @since 2.3 + * @deprecated Since 2.7, use {@link #overrideStdFeatures(int, int)} instead */ - public abstract JsonToken nextValue() throws JacksonException; + @Deprecated + public JsonParser setFeatureMask(int mask) { + _features = mask; + return this; + } /** - * Method that will skip all child tokens of an array or - * object token that the parser currently points to, - * iff stream points to - * {@link JsonToken#START_OBJECT} or {@link JsonToken#START_ARRAY}. - * If not, it will do nothing. - * After skipping, stream will point to matching - * {@link JsonToken#END_OBJECT} or {@link JsonToken#END_ARRAY} - * (possibly skipping nested pairs of START/END OBJECT/ARRAY tokens - * as well as value tokens). - * The idea is that after calling this method, application - * will call {@link #nextToken} to point to the next - * available token, if any. + * Bulk set method for (re)setting states of features specified by mask. + * Functionally equivalent to + * + * int oldState = getFeatureMask(); + * int newState = (oldState & ~mask) | (values & mask); + * setFeatureMask(newState); + * + * but preferred as this lets caller more efficiently specify actual changes made. + * + * @param values Bit mask of set/clear state for features to change + * @param mask Bit mask of features to change * * @return This parser, to allow call chaining * - * @throws JacksonException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @since 2.6 */ - public abstract JsonParser skipChildren() throws JacksonException; + public JsonParser overrideStdFeatures(int values, int mask) { + int newState = (_features & ~mask) | (values & mask); + return setFeatureMask(newState); + } /** - * Method that may be used to force full handling of the current token - * so that even if lazy processing is enabled, the whole contents are - * read for possible retrieval. This is usually used to ensure that - * the token end location is available, as well as token contents - * (similar to what calling, say {@link #getTextCharacters()}, would - * achieve). + * Bulk access method for getting state of all {@link FormatFeature}s, format-specific + * on/off configuration settings. + * + * @return Bit mask that defines current states of all standard {@link FormatFeature}s. + * + * @since 2.6 + */ + public int getFormatFeatures() { + return 0; + } + + /** + * Bulk set method for (re)setting states of {@link FormatFeature}s, + * by specifying values (set / clear) along with a mask, to determine + * which features to change, if any. *

    - * Note that for many dataformat implementations this method - * will not do anything; this is the default implementation unless - * overridden by sub-classes. + * Default implementation will simply throw an exception to indicate that + * the parser implementation does not support any {@link FormatFeature}s. * - * @throws JacksonException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @param values Bit mask of set/clear state for features to change + * @param mask Bit mask of features to change + * + * @return This parser, to allow call chaining + * + * @since 2.6 */ - public abstract void finishToken() throws JacksonException; + public JsonParser overrideFormatFeatures(int values, int mask) { + // 08-Oct-2018, tatu: For 2.10 we actually do get `JsonReadFeature`s, although they + // are (for 2.x only, not for 3.x) mapper to legacy settings. So do not freak out: +// throw new IllegalArgumentException("No FormatFeatures defined for parser of type "+getClass().getName()); + return this; + } /* - /********************************************************************** - /* Public API, iterating accessors: property names - /********************************************************************** + /********************************************************** + /* Public API, traversal + /********************************************************** */ /** - * Method that fetches next token (as if calling {@link #nextToken}) and - * verifies whether it is {@link JsonToken#PROPERTY_NAME}; if it is, - * returns same as {@link #currentName()}, otherwise null. - *

    - * NOTE: in Jackson 2.x method was called {@code nextFieldName()} + * Main iteration method, which will advance stream enough + * to determine type of the next token, if any. If none + * remaining (stream has no content other than possible + * white space before ending), null will be returned. * - * @return Name of the the {@code JsonToken.PROPERTY_NAME} parser advanced to, if any; - * {@code null} if next token is of some other type + * @return Next token from the stream, if any found, or null + * to indicate end-of-input + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public abstract JsonToken nextToken() throws IOException; + + /** + * Iteration method that will advance stream enough + * to determine type of the next token that is a value type + * (including JSON Array and Object start/end markers). + * Or put another way, nextToken() will be called once, + * and if {@link JsonToken#FIELD_NAME} is returned, another + * time to get the value for the field. + * Method is most useful for iterating over value entries + * of JSON objects; field name will still be available + * by calling {@link #getCurrentName} when parser points to + * the value. + * + * @return Next non-field-name token from the stream, if any found, + * or null to indicate end-of-input (or, for non-blocking + * parsers, {@link JsonToken#NOT_AVAILABLE} if no tokens were + * available yet) * - * @throws JacksonException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract String nextName() throws JacksonException; + public abstract JsonToken nextValue() throws IOException; /** * Method that fetches next token (as if calling {@link #nextToken}) and - * verifies whether it is {@link JsonToken#PROPERTY_NAME} with specified name + * verifies whether it is {@link JsonToken#FIELD_NAME} with specified name * and returns result of that comparison. * It is functionally equivalent to: *

    -     *  return (nextToken() == JsonToken.PROPERTY_NAME) && str.getValue().equals(currentName());
    +     *  return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName());
          *
    * but may be faster for parser to verify, and can therefore be used if caller * expects to get such a property name from input next. - *

    - * NOTE: in Jackson 2.x method was called {@code nextFieldName()} - * + * * @param str Property name to compare next token to (if next token is - * JsonToken.PROPERTY_NAME) + * JsonToken.FIELD_NAME) * - * @return {@code True} if parser advanced to {@code JsonToken.PROPERTY_NAME} with + * @return {@code True} if parser advanced to {@code JsonToken.FIELD_NAME} with * specified name; {@code false} otherwise (different token or non-matching name) * - * @throws JacksonException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems - */ - public abstract boolean nextName(SerializableString str) throws JacksonException; - - /** - * Method that tries to match next token from stream as {@link JsonToken#PROPERTY_NAME}, - * and if so, further match it to one of pre-specified (field) names. - * If match succeeds, property index (non-negative `int`) is returned; otherwise one of - * marker constants from {@link PropertyNameMatcher}. - * - * @param matcher Matcher that will handle actual matching - * - * @return Index of the matched property name, if non-negative, or a negative error - * code otherwise (see {@link PropertyNameMatcher} for details) - * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems - * - * @since 3.0 + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException; + public boolean nextFieldName(SerializableString str) throws IOException { + return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName()); + } /** - * Method that verifies that the current token (see {@link #currentToken}) is - * {@link JsonToken#PROPERTY_NAME} and if so, further match that associated name - * (see {@link #currentName}) to one of pre-specified (property) names. - * If there is a match succeeds, the property index (non-negative {@code int}) is returned; - * otherwise one of marker constants from {@link PropertyNameMatcher} is returned. + * Method that fetches next token (as if calling {@link #nextToken}) and + * verifies whether it is {@link JsonToken#FIELD_NAME}; if it is, + * returns same as {@link #getCurrentName()}, otherwise null. * - * @param matcher Matcher that will handle actual matching + * @return Name of the the {@code JsonToken.FIELD_NAME} parser advanced to, if any; + * {@code null} if next token is of some other type * - * @return Index of the matched property name, if non-negative, or a negative error - * code otherwise (see {@link PropertyNameMatcher} for details) + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems * - * @since 3.0 - */ - public abstract int currentNameMatch(PropertyNameMatcher matcher); - - /* - /********************************************************************** - /* Public API, iterating accessors: typed values - /********************************************************************** + * @since 2.5 */ + public String nextFieldName() throws IOException { + return (nextToken() == JsonToken.FIELD_NAME) ? getCurrentName() : null; + } /** * Method that fetches next token (as if calling {@link #nextToken}) and @@ -531,10 +1052,10 @@ public int releaseBuffered(OutputStream out) throws JacksonException { * @return Text value of the {@code JsonToken.VALUE_STRING} token parser advanced * to; or {@code null} if next token is of some other type * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public String nextTextValue() throws JacksonException { + public String nextTextValue() throws IOException { return (nextToken() == JsonToken.VALUE_STRING) ? getText() : null; } @@ -556,11 +1077,11 @@ public String nextTextValue() throws JacksonException { * @return Integer ({@code int}) value of the {@code JsonToken.VALUE_NUMBER_INT} token parser advanced * to; or {@code defaultValue} if next token is of some other type * - * @throws JacksonException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems - * @throws com.fasterxml.jackson.core.exc.InputCoercionException if integer number does not fit in Java {@code int} + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * @throws InputCoercionException if integer number does not fit in Java {@code int} */ - public int nextIntValue(int defaultValue) throws JacksonException { + public int nextIntValue(int defaultValue) throws IOException { return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue; } @@ -582,11 +1103,11 @@ public int nextIntValue(int defaultValue) throws JacksonException { * @return {@code long} value of the {@code JsonToken.VALUE_NUMBER_INT} token parser advanced * to; or {@code defaultValue} if next token is of some other type * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems - * @throws com.fasterxml.jackson.core.exc.InputCoercionException if integer number does not fit in Java {@code long} + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * @throws InputCoercionException if integer number does not fit in Java {@code long} */ - public long nextLongValue(long defaultValue) throws JacksonException { + public long nextLongValue(long defaultValue) throws IOException { return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue; } @@ -607,20 +1128,62 @@ public long nextLongValue(long defaultValue) throws JacksonException { * @return {@code Boolean} value of the {@code JsonToken.VALUE_TRUE} or {@code JsonToken.VALUE_FALSE} * token parser advanced to; or {@code null} if next token is of some other type * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public Boolean nextBooleanValue() throws JacksonException { + public Boolean nextBooleanValue() throws IOException { JsonToken t = nextToken(); if (t == JsonToken.VALUE_TRUE) { return Boolean.TRUE; } if (t == JsonToken.VALUE_FALSE) { return Boolean.FALSE; } return null; } + /** + * Method that will skip all child tokens of an array or + * object token that the parser currently points to, + * iff stream points to + * {@link JsonToken#START_OBJECT} or {@link JsonToken#START_ARRAY}. + * If not, it will do nothing. + * After skipping, stream will point to matching + * {@link JsonToken#END_OBJECT} or {@link JsonToken#END_ARRAY} + * (possibly skipping nested pairs of START/END OBJECT/ARRAY tokens + * as well as value tokens). + * The idea is that after calling this method, application + * will call {@link #nextToken} to point to the next + * available token, if any. + * + * @return This parser, to allow call chaining + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public abstract JsonParser skipChildren() throws IOException; + + /** + * Method that may be used to force full handling of the current token + * so that even if lazy processing is enabled, the whole contents are + * read for possible retrieval. This is usually used to ensure that + * the token end location is available, as well as token contents + * (similar to what calling, say {@link #getTextCharacters()}, would + * achieve). + *

    + * Note that for many dataformat implementations this method + * will not do anything; this is the default implementation unless + * overridden by sub-classes. + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * + * @since 2.8 + */ + public void finishToken() throws IOException { + ; // nothing + } + /* - /********************************************************************** + /********************************************************** /* Public API, simple token id/type access - /********************************************************************** + /********************************************************** */ /** @@ -633,21 +1196,49 @@ public Boolean nextBooleanValue() throws JacksonException { * if any: null before any tokens have been read, and * after end-of-input has been encountered, as well as * if the current token has been explicitly cleared. + * + * @since 2.8 */ - public abstract JsonToken currentToken(); + public JsonToken currentToken() { + return getCurrentToken(); + } /** - * Method similar to {@link #currentToken()} but that returns an + * Method similar to {@link #getCurrentToken()} but that returns an * int instead of {@link JsonToken} (enum value). *

    * Use of int directly is typically more efficient on switch statements, * so this method may be useful when building low-overhead codecs. * Note, however, that effect may not be big enough to matter: make sure * to profile performance before deciding to use this method. + * + * @since 2.8 * * @return {@code int} matching one of constants from {@link JsonTokenId}. */ - public abstract int currentTokenId(); + public int currentTokenId() { + return getCurrentTokenId(); + } + + // TODO: deprecate in 2.14 or later + /** + * Alias for {@link #currentToken()}, may be deprecated sometime after + * Jackson 2.13 (will be removed from 3.0). + * + * @return Type of the token this parser currently points to, + * if any: null before any tokens have been read, and + */ + public abstract JsonToken getCurrentToken(); + + /** + * Deprecated alias for {@link #currentTokenId()}. + * + * @return {@code int} matching one of constants from {@link JsonTokenId}. + * + * @deprecated Since 2.12 use {@link #currentTokenId} instead + */ + @Deprecated + public abstract int getCurrentTokenId(); /** * Method for checking whether parser currently points to @@ -676,6 +1267,8 @@ public Boolean nextBooleanValue() throws JacksonException { * @param id Token id to match (from (@link JsonTokenId}) * * @return {@code True} if the parser current points to specified token + * + * @since 2.5 */ public abstract boolean hasTokenId(int id); @@ -693,6 +1286,8 @@ public Boolean nextBooleanValue() throws JacksonException { * @param t Token to match * * @return {@code True} if the parser current points to specified token + * + * @since 2.6 */ public abstract boolean hasToken(JsonToken t); @@ -715,7 +1310,7 @@ public Boolean nextBooleanValue() throws JacksonException { * start-array marker (such {@link JsonToken#START_ARRAY}); * {@code false} if not */ - public abstract boolean isExpectedStartArrayToken(); + public boolean isExpectedStartArrayToken() { return currentToken() == JsonToken.START_ARRAY; } /** * Similar to {@link #isExpectedStartArrayToken()}, but checks whether stream @@ -724,8 +1319,10 @@ public Boolean nextBooleanValue() throws JacksonException { * @return True if the current token can be considered as a * start-array marker (such {@link JsonToken#START_OBJECT}); * {@code false} if not + * + * @since 2.5 */ - public abstract boolean isExpectedStartObjectToken(); + public boolean isExpectedStartObjectToken() { return currentToken() == JsonToken.START_OBJECT; } /** * Similar to {@link #isExpectedStartArrayToken()}, but checks whether stream @@ -737,9 +1334,11 @@ public Boolean nextBooleanValue() throws JacksonException { * @return True if the current token can be considered as a * start-array marker (such {@link JsonToken#VALUE_NUMBER_INT}); * {@code false} if not + * + * @since 2.12 */ - public abstract boolean isExpectedNumberIntToken(); - + public boolean isExpectedNumberIntToken() { return currentToken() == JsonToken.VALUE_NUMBER_INT; } + /** * Access for checking whether current token is a numeric value token, but * one that is of "not-a-number" (NaN) variety (including both "NaN" AND @@ -751,19 +1350,26 @@ public Boolean nextBooleanValue() throws JacksonException { * @return {@code True} if the current token is of type {@link JsonToken#VALUE_NUMBER_FLOAT} * but represents a "Not a Number"; {@code false} for other tokens and regular * floating-point numbers + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * + * @since 2.9 */ - public abstract boolean isNaN(); + public boolean isNaN() throws IOException { + return false; + } /* - /********************************************************************** + /********************************************************** /* Public API, token state overrides - /********************************************************************** + /********************************************************** */ /** * Method called to "consume" the current token by effectively * removing it so that {@link #hasCurrentToken} returns false, and - * {@link #currentToken} null). + * {@link #getCurrentToken} null). * Cleared token value can still be accessed by calling * {@link #getLastClearedToken} (if absolutely needed), but * usually isn't. @@ -784,23 +1390,54 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Last cleared token, if any; {@code null} otherwise */ public abstract JsonToken getLastClearedToken(); + + /** + * Method that can be used to change what is considered to be + * the current (field) name. + * May be needed to support non-JSON data formats or unusual binding + * conventions; not needed for typical processing. + *

    + * Note that use of this method should only be done as sort of last + * resort, as it is a work-around for regular operation. + * + * @param name Name to use as the current name; may be null. + */ + public abstract void overrideCurrentName(String name); /* - /********************************************************************** + /********************************************************** /* Public API, access to token information, text - /********************************************************************** + /********************************************************** + */ + + // TODO: deprecate in 2.14 or later + /** + * Alias of {@link #currentName()}. + * + * @return Name of the current field in the parsing context + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ + public abstract String getCurrentName() throws IOException; /** * Method that can be called to get the name associated with - * the current token: for {@link JsonToken#PROPERTY_NAME}s it will + * the current token: for {@link JsonToken#FIELD_NAME}s it will * be the same as what {@link #getText} returns; - * for Object property values it will be the preceding property name; - * and for others (array element, root-level values) null. + * for field values it will be preceding field name; + * and for others (array values, root-level values) null. + * + * @return Name of the current field in the parsing context * - * @return Name of the current property name, if any, in the parsing context ({@code null} if none) + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * + * @since 2.10 */ - public abstract String currentName(); + public String currentName() throws IOException { + return getCurrentName(); + } /** * Method for accessing textual representation of the current token; @@ -811,10 +1448,10 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Textual value associated with the current token (one returned * by {@link #nextToken()} or other iteration methods) * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract String getText() throws JacksonException; + public abstract String getText() throws IOException; /** * Method to read the textual representation of the current token in chunks and @@ -831,10 +1468,21 @@ public Boolean nextBooleanValue() throws JacksonException { * * @return The number of characters written to the Writer * - * @throws WrappedIOException for low-level read issues, or failed write using {@link Writer} - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues or writes using passed + * {@code writer}, or + * {@link JsonParseException} for decoding problems + * + * @since 2.8 */ - public abstract int getText(Writer writer) throws JacksonException; + public int getText(Writer writer) throws IOException, UnsupportedOperationException + { + String str = getText(); + if (str == null) { + return 0; + } + writer.write(str); + return str.length(); + } /** * Method similar to {@link #getText}, but that will return @@ -864,10 +1512,10 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Buffer that contains the current textual value (but not necessarily * at offset 0, and not necessarily until the end of buffer) * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract char[] getTextCharacters() throws JacksonException; + public abstract char[] getTextCharacters() throws IOException; /** * Accessor used with {@link #getTextCharacters}, to know length @@ -877,10 +1525,10 @@ public Boolean nextBooleanValue() throws JacksonException { * by {@link #getTextCharacters} that are part of * textual content of the current token. * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract int getTextLength() throws JacksonException; + public abstract int getTextLength() throws IOException; /** * Accessor used with {@link #getTextCharacters}, to know offset @@ -890,10 +1538,10 @@ public Boolean nextBooleanValue() throws JacksonException { * by {@link #getTextCharacters} that is part of * textual content of the current token. * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract int getTextOffset() throws JacksonException; + public abstract int getTextOffset() throws IOException; /** * Method that can be used to determine whether calling of @@ -915,9 +1563,9 @@ public Boolean nextBooleanValue() throws JacksonException { public abstract boolean hasTextCharacters(); /* - /********************************************************************** + /********************************************************** /* Public API, access to token information, numeric - /********************************************************************** + /********************************************************** */ /** @@ -929,9 +1577,12 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Numeric value of the current token in its most optimal * representation * - * @throws InputCoercionException If the current token is not of numeric type + * @throws IOException Problem with access: {@link JsonParseException} if + * the current token is not numeric, or if decoding of the value fails + * (invalid format for numbers); plain {@link IOException} if underlying + * content read fails (possible if values are extracted lazily) */ - public abstract Number getNumberValue() throws InputCoercionException; + public abstract Number getNumberValue() throws IOException; /** * Method similar to {@link #getNumberValue} with the difference that @@ -945,9 +1596,16 @@ public Boolean nextBooleanValue() throws JacksonException { * * @return Numeric value of the current token using most accurate representation * - * @throws InputCoercionException If the current token is not of numeric type + * @throws IOException Problem with access: {@link JsonParseException} if + * the current token is not numeric, or if decoding of the value fails + * (invalid format for numbers); plain {@link IOException} if underlying + * content read fails (possible if values are extracted lazily) + * + * @since 2.12 */ - public abstract Number getNumberValueExact() throws InputCoercionException; + public Number getNumberValueExact() throws IOException { + return getNumberValue(); + } /** * If current token is of type @@ -956,8 +1614,11 @@ public Boolean nextBooleanValue() throws JacksonException { * one of {@link NumberType} constants; otherwise returns null. * * @return Type of current number, if parser points to numeric token; {@code null} otherwise + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract NumberType getNumberType(); + public abstract NumberType getNumberType() throws IOException; /** * Numeric accessor that can be called when the current @@ -981,10 +1642,21 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Current number value as {@code byte} (if numeric token within * range of {@code [-128, 255]}); otherwise exception thrown * - * @throws InputCoercionException If either token type is not a number OR numeric - * value exceeds allowed range - */ - public abstract byte getByteValue() throws InputCoercionException; + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public byte getByteValue() throws IOException { + int value = getIntValue(); + // So far so good: but does it fit? + // [JACKSON-804]: Let's actually allow range of [-128, 255], as those are uniquely mapped + // (instead of just signed range of [-128, 127]) + if (value < MIN_BYTE_I || value > MAX_BYTE_I) { + throw new InputCoercionException(this, + String.format("Numeric value (%s) out of range of Java byte", getText()), + JsonToken.VALUE_NUMBER_INT, Byte.TYPE); + } + return (byte) value; + } /** * Numeric accessor that can be called when the current @@ -1002,10 +1674,19 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Current number value as {@code short} (if numeric token within * Java 16-bit signed {@code short} range); otherwise exception thrown * - * @throws InputCoercionException If either token type is not a number OR numeric - * value exceeds allowed range - */ - public abstract short getShortValue() throws InputCoercionException; + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public short getShortValue() throws IOException + { + int value = getIntValue(); + if (value < MIN_SHORT_I || value > MAX_SHORT_I) { + throw new InputCoercionException(this, + String.format("Numeric value (%s) out of range of Java short", getText()), + JsonToken.VALUE_NUMBER_INT, Short.TYPE); + } + return (short) value; + } /** * Numeric accessor that can be called when the current @@ -1023,10 +1704,10 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Current number value as {@code int} (if numeric token within * Java 32-bit signed {@code int} range); otherwise exception thrown * - * @throws InputCoercionException If either token type is not a number OR numeric - * value exceeds allowed range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract int getIntValue() throws InputCoercionException; + public abstract int getIntValue() throws IOException; /** * Numeric accessor that can be called when the current @@ -1034,7 +1715,7 @@ public Boolean nextBooleanValue() throws JacksonException { * it can be expressed as a Java long primitive type. * It can also be called for {@link JsonToken#VALUE_NUMBER_FLOAT}; * if so, it is equivalent to calling {@link #getDoubleValue} - * and then casting to {@code int}; except for possible overflow/underflow + * and then casting to int; except for possible overflow/underflow * exception. *

    * Note: if the token is an integer, but its value falls @@ -1044,10 +1725,10 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Current number value as {@code long} (if numeric token within * Java 32-bit signed {@code long} range); otherwise exception thrown * - * @throws InputCoercionException If either token type is not a number OR numeric - * value exceeds allowed range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract long getLongValue() throws InputCoercionException; + public abstract long getLongValue() throws IOException; /** * Numeric accessor that can be called when the current @@ -1061,9 +1742,10 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Current number value as {@link BigInteger} (if numeric token); * otherwise exception thrown * - * @throws InputCoercionException If either token type is not a number + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract BigInteger getBigIntegerValue() throws InputCoercionException; + public abstract BigInteger getBigIntegerValue() throws IOException; /** * Numeric accessor that can be called when the current @@ -1081,10 +1763,10 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Current number value as {@code float} (if numeric token within * Java {@code float} range); otherwise exception thrown * - * @throws InputCoercionException If either token type is not a number OR numeric - * value exceeds allowed range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract float getFloatValue() throws InputCoercionException; + public abstract float getFloatValue() throws IOException; /** * Numeric accessor that can be called when the current @@ -1102,10 +1784,10 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Current number value as {@code double} (if numeric token within * Java {@code double} range); otherwise exception thrown * - * @throws InputCoercionException If either token type is not a number OR numeric - * value exceeds allowed range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract double getDoubleValue() throws InputCoercionException; + public abstract double getDoubleValue() throws IOException; /** * Numeric accessor that can be called when the current @@ -1116,14 +1798,15 @@ public Boolean nextBooleanValue() throws JacksonException { * @return Current number value as {@link BigDecimal} (if numeric token); * otherwise exception thrown * - * @throws InputCoercionException If either token type is not a number + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract BigDecimal getDecimalValue() throws InputCoercionException; + public abstract BigDecimal getDecimalValue() throws IOException; /* - /********************************************************************** + /********************************************************** /* Public API, access to token information, other - /********************************************************************** + /********************************************************** */ /** @@ -1131,16 +1814,24 @@ public Boolean nextBooleanValue() throws JacksonException { * token is {@link JsonToken#VALUE_TRUE} or * {@link JsonToken#VALUE_FALSE}, to return matching {@code boolean} * value. - * If the current token is of some other type, {@link InputCoercionException} + * If the current token is of some other type, {@link JsonParseException} * will be thrown * * @return {@code True} if current token is {@code JsonToken.VALUE_TRUE}, * {@code false} if current token is {@code JsonToken.VALUE_FALSE}; - * otherwise throws {@link InputCoercionException} - * - * @throws InputCoercionException if the current token is not of boolean type - */ - public abstract boolean getBooleanValue() throws InputCoercionException; + * otherwise throws {@link JsonParseException} + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public boolean getBooleanValue() throws IOException { + JsonToken t = currentToken(); + if (t == JsonToken.VALUE_TRUE) return true; + if (t == JsonToken.VALUE_FALSE) return false; + throw new JsonParseException(this, + String.format("Current token (%s) not of boolean type", t)) + .withRequestPayload(_requestPayload); + } /** * Accessor that can be called if (and only if) the current token @@ -1156,13 +1847,16 @@ public Boolean nextBooleanValue() throws JacksonException { * * @return Embedded value (usually of "native" type supported by format) * for the current token, if any; {@code null otherwise} + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract Object getEmbeddedObject(); + public Object getEmbeddedObject() throws IOException { return null; } /* - /********************************************************************** + /********************************************************** /* Public API, access to token information, binary - /********************************************************************** + /********************************************************** */ /** @@ -1187,10 +1881,10 @@ public Boolean nextBooleanValue() throws JacksonException { * * @return Decoded binary data * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public abstract byte[] getBinaryValue(Base64Variant bv) throws JacksonException; + public abstract byte[] getBinaryValue(Base64Variant bv) throws IOException; /** * Convenience alternative to {@link #getBinaryValue(Base64Variant)} @@ -1199,15 +1893,15 @@ public Boolean nextBooleanValue() throws JacksonException { * * @return Decoded binary data * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public byte[] getBinaryValue() throws JacksonException { + public byte[] getBinaryValue() throws IOException { return getBinaryValue(Base64Variants.getDefaultVariant()); } /** - * Method that can be used as an alternative to {@link #getBinaryValue()}, + * Method that can be used as an alternative to {@link #getBigIntegerValue()}, * especially when value can be large. The main difference (beyond method * of returning content using {@link OutputStream} instead of as byte array) * is that content will NOT remain accessible after method returns: any content @@ -1218,10 +1912,12 @@ public byte[] getBinaryValue() throws JacksonException { * * @return Number of bytes that were decoded and written via {@link OutputStream} * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * + * @since 2.1 */ - public int readBinaryValue(OutputStream out) throws JacksonException { + public int readBinaryValue(OutputStream out) throws IOException { return readBinaryValue(Base64Variants.getDefaultVariant(), out); } @@ -1234,54 +1930,22 @@ public int readBinaryValue(OutputStream out) throws JacksonException { * * @return Number of bytes that were decoded and written via {@link OutputStream} * - * @throws WrappedIOException for low-level read issues - * @throws com.fasterxml.jackson.core.exc.StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * + * @since 2.1 */ - public int readBinaryValue(Base64Variant bv, OutputStream out) throws JacksonException { + public int readBinaryValue(Base64Variant bv, OutputStream out) throws IOException { _reportUnsupportedOperation(); return 0; // never gets here } - + /* - /********************************************************************** + /********************************************************** /* Public API, access to token information, coercion/conversion - /********************************************************************** - */ - - /** - * Method that will try to convert value of current token to a - * boolean. - * JSON booleans map naturally; integer numbers other than 0 map to true, and - * 0 maps to false - * and Strings 'true' and 'false' map to corresponding values. - *

    - * If representation can not be converted to a boolean value (including structured types - * like Objects and Arrays), - * default value of {@code false} will be returned; no exceptions are thrown. - * - * @return {@code boolean} value current token is converted to, if possible; or {@code false} if not - */ - public boolean getValueAsBoolean() { - return getValueAsBoolean(false); - } - - /** - * Method that will try to convert value of current token to a - * boolean. - * JSON booleans map naturally; integer numbers other than 0 map to true, and - * 0 maps to false - * and Strings 'true' and 'false' map to corresponding values. - *

    - * If representation can not be converted to a boolean value (including structured types - * like Objects and Arrays), - * specified def will be returned; no exceptions are thrown. - * - * @param def Default value to return if conversion to {@code boolean} is not possible - * - * @return {@code boolean} value current token is converted to, if possible; {@code def} otherwise + /********************************************************** */ - public abstract boolean getValueAsBoolean(boolean def); - + /** * Method that will try to convert value of current token to a * Java {@code int} value. @@ -1293,23 +1957,24 @@ public boolean getValueAsBoolean() { * markers like start/end Object/Array) * default value of 0 will be returned; no exceptions are thrown. * - * @return {@code int} value current token is converted to, if possible; default value otherwise + * @return {@code int} value current token is converted to, if possible; exception thrown * otherwise * - * @throws InputCoercionException If numeric value exceeds {@code int} range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public int getValueAsInt() throws InputCoercionException { + public int getValueAsInt() throws IOException { return getValueAsInt(0); } - + /** * Method that will try to convert value of current token to a - * {@code int}. + * int. * Numbers are coerced using default Java rules; booleans convert to 0 (false) * and 1 (true), and Strings are parsed using default Java language integer * parsing rules. *

    - * If representation can not be converted to an {@code int} (including structured type + * If representation can not be converted to an int (including structured type * markers like start/end Object/Array) * specified def will be returned; no exceptions are thrown. * @@ -1317,13 +1982,14 @@ public int getValueAsInt() throws InputCoercionException { * * @return {@code int} value current token is converted to, if possible; {@code def} otherwise * - * @throws InputCoercionException If numeric value exceeds {@code int} range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public int getValueAsInt(int def) throws InputCoercionException { return def; } + public int getValueAsInt(int def) throws IOException { return def; } /** * Method that will try to convert value of current token to a - * {@code long}. + * long. * Numbers are coerced using default Java rules; booleans convert to 0 (false) * and 1 (true), and Strings are parsed using default Java language integer * parsing rules. @@ -1332,17 +1998,19 @@ public int getValueAsInt() throws InputCoercionException { * markers like start/end Object/Array) * default value of 0L will be returned; no exceptions are thrown. * - * @return {@code long} value current token is converted to, if possible; default value otherwise + * @return {@code long} value current token is converted to, if possible; exception thrown + * otherwise * - * @throws InputCoercionException If numeric value exceeds {@code long} range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public long getValueAsLong() throws InputCoercionException { + public long getValueAsLong() throws IOException { return getValueAsLong(0); } /** * Method that will try to convert value of current token to a - * {@code long}. + * long. * Numbers are coerced using default Java rules; booleans convert to 0 (false) * and 1 (true), and Strings are parsed using default Java language integer * parsing rules. @@ -1355,9 +2023,10 @@ public long getValueAsLong() throws InputCoercionException { * * @return {@code long} value current token is converted to, if possible; {@code def} otherwise * - * @throws InputCoercionException If numeric value exceeds {@code long} range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public long getValueAsLong(long def) throws InputCoercionException { + public long getValueAsLong(long def) throws IOException { return def; } @@ -1372,15 +2041,16 @@ public long getValueAsLong(long def) throws InputCoercionException { * like Objects and Arrays), * default value of 0.0 will be returned; no exceptions are thrown. * - * @return {@code double} value current token is converted to, if possible; - * default value otherwise + * @return {@code double} value current token is converted to, if possible; exception thrown + * otherwise * - * @throws InputCoercionException If numeric value exceeds {@code double} range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public double getValueAsDouble() throws InputCoercionException { + public double getValueAsDouble() throws IOException { return getValueAsDouble(0.0); } - + /** * Method that will try to convert value of current token to a * Java double. @@ -1396,9 +2066,53 @@ public double getValueAsDouble() throws InputCoercionException { * * @return {@code double} value current token is converted to, if possible; {@code def} otherwise * - * @throws InputCoercionException If numeric value exceeds {@code double} range + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public double getValueAsDouble(double def) throws IOException { + return def; + } + + /** + * Method that will try to convert value of current token to a + * boolean. + * JSON booleans map naturally; integer numbers other than 0 map to true, and + * 0 maps to false + * and Strings 'true' and 'false' map to corresponding values. + *

    + * If representation can not be converted to a boolean value (including structured types + * like Objects and Arrays), + * default value of false will be returned; no exceptions are thrown. + * + * @return {@code boolean} value current token is converted to, if possible; exception thrown + * otherwise + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public boolean getValueAsBoolean() throws IOException { + return getValueAsBoolean(false); + } + + /** + * Method that will try to convert value of current token to a + * boolean. + * JSON booleans map naturally; integer numbers other than 0 map to true, and + * 0 maps to false + * and Strings 'true' and 'false' map to corresponding values. + *

    + * If representation can not be converted to a boolean value (including structured types + * like Objects and Arrays), + * specified def will be returned; no exceptions are thrown. + * + * @param def Default value to return if conversion to {@code boolean} is not possible + * + * @return {@code boolean} value current token is converted to, if possible; {@code def} otherwise + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - public double getValueAsDouble(double def) throws InputCoercionException { + public boolean getValueAsBoolean(boolean def) throws IOException { return def; } @@ -1412,8 +2126,13 @@ public double getValueAsDouble(double def) throws InputCoercionException { * null will be returned; no exceptions are thrown. * * @return {@link String} value current token is converted to, if possible; {@code null} otherwise + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * + * @since 2.1 */ - public String getValueAsString() { + public String getValueAsString() throws IOException { return getValueAsString(null); } @@ -1429,13 +2148,18 @@ public String getValueAsString() { * @param def Default value to return if conversion to {@code String} is not possible * * @return {@link String} value current token is converted to, if possible; {@code def} otherwise + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * + * @since 2.1 */ - public abstract String getValueAsString(String def); + public abstract String getValueAsString(String def) throws IOException; /* - /********************************************************************** + /********************************************************** /* Public API, Native Ids (type, object) - /********************************************************************** + /********************************************************** */ /** @@ -1450,6 +2174,8 @@ public String getValueAsString() { * * @return {@code True} if the format being read supports native Object Ids; * {@code false} if not + * + * @since 2.3 */ public boolean canReadObjectId() { return false; } @@ -1465,6 +2191,8 @@ public String getValueAsString() { * * @return {@code True} if the format being read supports native Type Ids; * {@code false} if not + * + * @since 2.3 */ public boolean canReadTypeId() { return false; } @@ -1480,8 +2208,13 @@ public String getValueAsString() { * Default implementation will simply return null. * * @return Native Object id associated with the current token, if any; {@code null} if none + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * + * @since 2.3 */ - public Object getObjectId() { return null; } + public Object getObjectId() throws IOException { return null; } /** * Method that can be called to check whether current token @@ -1495,29 +2228,33 @@ public String getValueAsString() { * Default implementation will simply return null. * * @return Native Type Id associated with the current token, if any; {@code null} if none + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + * + * @since 2.3 */ - public Object getTypeId() { return null; } + public Object getTypeId() throws IOException { return null; } /* - /********************************************************************** + /********************************************************** /* Public API, optional data binding functionality - /********************************************************************** + /********************************************************** */ /** - * Method to deserialize stream content into a non-container + * Method to deserialize JSON content into a non-container * type (it can be an array type, however): typically a bean, array * or a wrapper type (like {@link java.lang.Boolean}). - *
    * Note: method can only be called if the parser has - * been constructed with a linkage to - * {@link ObjectReadContext}; this is true if constructed by - * databinding layer above, or by factory method that takes in - * context object. + * an object codec assigned; this is true for parsers constructed + * by MappingJsonFactory (from "jackson-databind" jar) + * but not for {@link JsonFactory} (unless its setCodec + * method has been explicitly called). *

    - * This method may advance the event stream, for structured values + * This method may advance the event stream, for structured types * the current token will be the closing end marker (END_ARRAY, - * END_OBJECT) of the bound structure. For non-structured values + * END_OBJECT) of the bound structure. For non-structured Json types * (and for {@link JsonToken#VALUE_EMBEDDED_OBJECT}) * stream is not advanced. *

    @@ -1526,111 +2263,190 @@ public String getValueAsString() { * The reason is that due to type erasure, key and value types * can not be introspected when using this method. * - * @param Nominal type parameter to specify expected node type to - * reduce need to cast result value - * @param valueType Type to bind content to + * @param Nominal type parameter for value type * - * @return Java value read from content + * @param valueType Java type to read content as (passed to ObjectCodec that + * deserializes content) * - * @throws JacksonException if there is either an underlying I/O problem or decoding + * @return Java value read from content + * + * @throws IOException if there is either an underlying I/O problem or decoding * issue at format layer */ - public abstract T readValueAs(Class valueType) throws JacksonException; + public T readValueAs(Class valueType) throws IOException { + return _codec().readValue(this, valueType); + } /** - * Method to deserialize stream content into a Java type, reference + * Method to deserialize JSON content into a Java type, reference * to which is passed as argument. Type is passed using so-called * "super type token" * and specifically needs to be used if the root type is a * parameterized (generic) container type. - *
    * Note: method can only be called if the parser has - * been constructed with a linkage to - * {@link ObjectReadContext}; this is true if constructed by - * databinding layer above, or by factory method that takes in - * context object. + * an object codec assigned; this is true for parsers constructed + * by MappingJsonFactory (defined in 'jackson-databind' bundle) + * but not for {@link JsonFactory} (unless its setCodec + * method has been explicitly called). *

    * This method may advance the event stream, for structured types * the current token will be the closing end marker (END_ARRAY, - * END_OBJECT) of the bound structure. For non-structured types + * END_OBJECT) of the bound structure. For non-structured Json types * (and for {@link JsonToken#VALUE_EMBEDDED_OBJECT}) * stream is not advanced. * - * @param Nominal type parameter to specify expected node type to - * reduce need to cast result value - * @param valueTypeRef Type to bind content to + * @param Nominal type parameter for value type + * + * @param valueTypeRef Java type to read content as (passed to ObjectCodec that + * deserializes content) * * @return Java value read from content * - * @throws JacksonException if there is either an underlying I/O problem or decoding + * @throws IOException if there is either an underlying I/O problem or decoding * issue at format layer */ - public abstract T readValueAs(TypeReference valueTypeRef) throws JacksonException; + @SuppressWarnings("unchecked") + public T readValueAs(TypeReference valueTypeRef) throws IOException { + return (T) _codec().readValue(this, valueTypeRef); + } - public abstract T readValueAs(ResolvedType type) throws JacksonException; + /** + * Method for reading sequence of Objects from parser stream, + * all with same specified value type. + * + * @param Nominal type parameter for value type + * + * @param valueType Java type to read content as (passed to ObjectCodec that + * deserializes content) + * + * @return Iterator for reading multiple Java values from content + * + * @throws IOException if there is either an underlying I/O problem or decoding + * issue at format layer + */ + public Iterator readValuesAs(Class valueType) throws IOException { + return _codec().readValues(this, valueType); + } /** - * Method to deserialize stream content into equivalent "tree model", + * Method for reading sequence of Objects from parser stream, + * all with same specified value type. + * + * @param Nominal type parameter for value type + * + * @param valueTypeRef Java type to read content as (passed to ObjectCodec that + * deserializes content) + * + * @return Iterator for reading multiple Java values from content + * + * @throws IOException if there is either an underlying I/O problem or decoding + * issue at format layer + */ + public Iterator readValuesAs(TypeReference valueTypeRef) throws IOException { + return _codec().readValues(this, valueTypeRef); + } + + /** + * Method to deserialize JSON content into equivalent "tree model", * represented by root {@link TreeNode} of resulting model. - * For Array values it will an array node (with child nodes), - * for Object values object node (with child nodes), and for other types + * For JSON Arrays it will an array node (with child nodes), + * for objects object node (with child nodes), and for other types * matching leaf node type. Empty or whitespace documents are null. - *
    - * Note: method can only be called if the parser has - * been constructed with a linkage to - * {@link ObjectReadContext}; this is true if constructed by - * databinding layer above, or by factory method that takes in - * context object. * * @param Nominal type parameter for result node type (to reduce need for casting) * * @return root of the document, or null if empty or whitespace. * - * @throws JacksonException if there is either an underlying I/O problem or decoding + * @throws IOException if there is either an underlying I/O problem or decoding * issue at format layer */ - public abstract T readValueAsTree() throws JacksonException; + @SuppressWarnings("unchecked") + public T readValueAsTree() throws IOException { + return (T) _codec().readTree(this); + } + protected ObjectCodec _codec() { + ObjectCodec c = getCodec(); + if (c == null) { + throw new IllegalStateException("No ObjectCodec defined for parser, needed for deserialization"); + } + return c; + } + /* - /********************************************************************** + /********************************************************** /* Internal methods - /********************************************************************** + /********************************************************** + */ + + /** + * Helper method for constructing {@link JsonParseException}s + * based on current state of the parser + * + * @param msg Base exception message to construct exception with + * + * @return {@link JsonParseException} constructed */ + protected JsonParseException _constructError(String msg) { + return new JsonParseException(this, msg) + .withRequestPayload(_requestPayload); + } /** * Helper method to call for operations that are not supported by * parser implementation. + * + * @since 2.1 */ protected void _reportUnsupportedOperation() { throw new UnsupportedOperationException("Operation not supported by parser of type "+getClass().getName()); } /** - * Helper method for constructing {@link StreamReadException} - * based on current state of the parser + * Helper method for constructing {@link JsonParseException} + * based on current state of the parser. * * @param msg Base exception message to construct exception with * - * @return {@link StreamReadException} constructed + * @return Read exception (of type {@link JsonParseException}) constructed + * + * @since 2.13 */ - protected StreamReadException _constructReadException(String msg) { - return new StreamReadException(this, msg); + protected JsonParseException _constructReadException(String msg) { + // In 3.0 will be actual `StreamReadException`... + return _constructError(msg); } - protected StreamReadException _constructReadException(String msg, Object arg) { + protected JsonParseException _constructReadException(String msg, Object arg) { return _constructReadException(String.format(msg, arg)); } - protected StreamReadException _constructReadException(String msg, Object arg1, Object arg2) { + protected JsonParseException _constructReadException(String msg, Object arg1, Object arg2) { return _constructReadException(String.format(msg, arg1, arg2)); } - protected StreamReadException _constructReadException(String msg, + protected JsonParseException _constructReadException(String msg, Object arg1, Object arg2, Object arg3) { return _constructReadException(String.format(msg, arg1, arg2, arg3)); } - protected final StreamReadException _constructReadException(String msg, Throwable t) { - return new StreamReadException(this, msg, t); + /** + * Helper method for constructing {@link JsonParseException} + * based on current state of the parser and indicating that the given + * {@link Throwable} is the root cause. + * + * @param msg Base exception message to construct exception with + * @param t Root cause to assign + * + * @return Read exception (of type {@link JsonParseException}) constructed + * + * @since 2.13 + */ + protected JsonParseException _constructReadException(String msg, Throwable t) { + JsonParseException e = new JsonParseException(this, msg, t); + if (_requestPayload != null) { + e = e.withRequestPayload(_requestPayload); + } + return e; } } diff --git a/src/main/java/com/fasterxml/jackson/core/JsonPointer.java b/src/main/java/com/fasterxml/jackson/core/JsonPointer.java index 31c70712a8..0b6950f403 100644 --- a/src/main/java/com/fasterxml/jackson/core/JsonPointer.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonPointer.java @@ -8,15 +8,21 @@ * specification. * Pointer instances can be used to locate logical JSON nodes for things like * tree traversal (see {@link TreeNode#at}). + * It may be used in future for filtering of streaming JSON content + * as well (not implemented yet for 2.3). *

    * Instances are fully immutable and can be cached, shared between threads. * * @author Tatu Saloranta + * + * @since 2.3 */ public class JsonPointer { /** * Character used to separate segments. + * + * @since 2.9 */ public final static char SEPARATOR = '/'; @@ -59,9 +65,9 @@ public class JsonPointer protected final int _matchingElementIndex; /* - /********************************************************************** + /********************************************************** /* Construction - /********************************************************************** + /********************************************************** */ /** @@ -85,19 +91,20 @@ protected JsonPointer(String fullString, String segment, JsonPointer next) { _matchingElementIndex = _parseIndex(segment); } + // @since 2.5 protected JsonPointer(String fullString, String segment, int matchIndex, JsonPointer next) { _asString = fullString; _nextSegment = next; _matchingPropertyName = segment; _matchingElementIndex = matchIndex; } - + /* - /********************************************************************** + /********************************************************** /* Factory methods - /********************************************************************** + /********************************************************** */ - + /** * Factory method that parses given input and construct matching pointer * instance, if it represents a valid JSON Pointer: if not, a @@ -149,14 +156,17 @@ public static JsonPointer compile(String expr) throws IllegalArgumentException /** * Factory method that will construct a pointer instance that describes - * path to location given {@link TokenStreamContext} points to. + * path to location given {@link JsonStreamContext} points to. * - * @param context Context to build pointer expression fot - * @param includeRoot Whether to include number offset for virtual "root context" or not. + * @param context Context to build pointer expression for + * @param includeRoot Whether to include number offset for virtual "root context" + * or not. * * @return {@link JsonPointer} path to location of given context + * + * @since 2.9 */ - public static JsonPointer forPath(TokenStreamContext context, + public static JsonPointer forPath(JsonStreamContext context, boolean includeRoot) { // First things first: last segment may be for START_ARRAY/START_OBJECT, @@ -174,7 +184,7 @@ public static JsonPointer forPath(TokenStreamContext context, for (; context != null; context = context.getParent()) { if (context.inObject()) { - String seg = context.currentName(); + String seg = context.getCurrentName(); if (seg == null) { // is this legal? seg = ""; } @@ -249,9 +259,9 @@ public static JsonPointer fromSegment(String... segments) */ /* - /********************************************************************** + /********************************************************** /* Public API - /********************************************************************** + /********************************************************** */ public boolean matches() { return _nextSegment == null; } @@ -260,19 +270,21 @@ public static JsonPointer fromSegment(String... segments) /** * @return True if the root selector matches property name (that is, could - * match Property value of Object node) + * match field value of JSON Object node) */ public boolean mayMatchProperty() { return _matchingPropertyName != null; } /** * @return True if the root selector matches element index (that is, could - * match an element of Array node) + * match an element of JSON Array node) */ public boolean mayMatchElement() { return _matchingElementIndex >= 0; } /** * @return the leaf of current JSON Pointer expression: leaf is the last * non-null segment of current JSON Pointer. + * + * @since 2.5 */ public JsonPointer last() { JsonPointer current = this; @@ -320,64 +332,6 @@ public JsonPointer append(JsonPointer tail) { return compile(currentJsonPointer + tail._asString); } - /** - * ATTENTION! {@link JsonPointer} is head centric, tail appending is much costlier than head appending. - * It is not recommended to overuse the method. - * - * Mutant factory method that will return - *

      - *
    • `this` instance if `property` is null or empty String, OR - *
    • - *
    • Newly constructed {@link JsonPointer} instance that starts with all segments - * of `this`, followed by new segment of 'property' name. - *
    • - *
    - * - * 'property' format is starting separator (optional, added automatically if not provided) and new segment name. - * - * @param property new segment property name - * - * @return Either `this` instance, or a newly created combination, as per description above. - */ - public JsonPointer appendProperty(String property) { - if (property == null || property.isEmpty()) { - return this; - } - if (property.charAt(0) != SEPARATOR) { - property = SEPARATOR + property; - } - String currentJsonPointer = _asString; - if (currentJsonPointer.endsWith("/")) { - //removes final slash - currentJsonPointer = currentJsonPointer.substring(0, currentJsonPointer.length()-1); - } - return compile(currentJsonPointer + property); - } - - /** - * ATTENTION! {@link JsonPointer} is head centric, tail appending is much costlier than head appending. - * It is not recommended to overuse the method. - * - * Mutant factory method that will return newly constructed {@link JsonPointer} instance that starts with all - * segments of `this`, followed by new segment of element 'index'. Element 'index' should be non-negative. - * - * @param index new segment element index - * - * @return Newly created combination, as per description above. - * @throws IllegalArgumentException if element index is negative - */ - public JsonPointer appendIndex(int index) { - if (index < 0) { - throw new IllegalArgumentException("Negative index cannot be appended"); - } - String currentJsonPointer = _asString; - if (currentJsonPointer.endsWith("/")) { - //removes final slash - currentJsonPointer = currentJsonPointer.substring(0, currentJsonPointer.length()-1); - } - return compile(currentJsonPointer + SEPARATOR + index); - } - /** * Method that may be called to see if the pointer head (first segment) * would match property (of a JSON Object) with given name. @@ -489,9 +443,9 @@ public JsonPointer head() { } /* - /********************************************************************** + /********************************************************** /* Standard method overrides - /********************************************************************** + /********************************************************** */ @Override public String toString() { return _asString; } @@ -505,9 +459,9 @@ public JsonPointer head() { } /* - /********************************************************************** + /********************************************************** /* Internal methods - /********************************************************************** + /********************************************************** */ private final static int _parseIndex(String str) { diff --git a/src/main/java/com/fasterxml/jackson/core/JsonProcessingException.java b/src/main/java/com/fasterxml/jackson/core/JsonProcessingException.java new file mode 100644 index 0000000000..54c7989aff --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/JsonProcessingException.java @@ -0,0 +1,144 @@ +/* Jackson JSON-processor. + * + * Copyright (c) 2007- Tatu Saloranta, tatu.saloranta@iki.fi + */ + +package com.fasterxml.jackson.core; + +/** + * Intermediate base class for all problems encountered when + * processing (parsing, generating) JSON content + * that are not pure I/O problems. + * Regular {@link java.io.IOException}s will be passed through as is. + * Sub-class of {@link java.io.IOException} for convenience. + *

    + * Since Jackson 2.12 extends intermediate {@link JacksonException} type + * instead of directly extending {@link java.io.IOException}. + */ +public class JsonProcessingException extends JacksonException +{ + private final static long serialVersionUID = 123; // eclipse complains otherwise + + protected JsonLocation _location; + + protected JsonProcessingException(String msg, JsonLocation loc, Throwable rootCause) { + super(msg, rootCause); + _location = loc; + } + + protected JsonProcessingException(String msg) { + super(msg); + } + + protected JsonProcessingException(String msg, JsonLocation loc) { + this(msg, loc, null); + } + + protected JsonProcessingException(String msg, Throwable rootCause) { + this(msg, null, rootCause); + } + + protected JsonProcessingException(Throwable rootCause) { + this(null, null, rootCause); + } + + /* + /********************************************************************** + /* Extended API + /********************************************************************** + */ + + @Override + public JsonLocation getLocation() { return _location; } + + /** + * Method that allows to remove context information from this exception's message. + * Useful when you are parsing security-sensitive data and don't want original data excerpts + * to be present in Jackson parser error messages. + * + * @since 2.9 + */ + public void clearLocation() { _location = null; } + + /** + * Method that allows accessing the original "message" argument, + * without additional decorations (like location information) + * that overridden {@link #getMessage} adds. + * + * @return Original message passed in constructor + * + * @since 2.1 + */ + @Override + public String getOriginalMessage() { return super.getMessage(); } + + /** + * Method that allows accessing underlying processor that triggered + * this exception; typically either {@link JsonParser} or {@link JsonGenerator} + * for exceptions that originate from streaming API. + * Note that it is possible that `null` may be returned if code throwing + * exception either has no access to processor; or has not been retrofitted + * to set it; this means that caller needs to take care to check for nulls. + * Subtypes override this method with co-variant return type, for more + * type-safe access. + * + * @return Originating processor, if available; null if not. + * + * @since 2.7 + */ + @Override + public Object getProcessor() { return null; } + + /* + /********************************************************************** + /* Methods for sub-classes to use, override + /********************************************************************** + */ + + /** + * Accessor that sub-classes can override to append additional + * information right after the main message, but before + * source location information. + * + * @return Message suffix assigned, if any; {@code null} if none + */ + protected String getMessageSuffix() { return null; } + + /* + /********************************************************************** + /* Overrides of standard methods + /********************************************************************** + */ + + /** + * Default implementation overridden so that we can add location information + * + * @return Original {@code message} preceded by optional prefix and followed by + * location information, message and location information separated by a linefeed + */ + @Override public String getMessage() { + String msg = super.getMessage(); + if (msg == null) { + msg = "N/A"; + } + JsonLocation loc = getLocation(); + String suffix = getMessageSuffix(); + // mild optimization, if nothing extra is needed: + if (loc != null || suffix != null) { + StringBuilder sb = new StringBuilder(100); + sb.append(msg); + if (suffix != null) { + sb.append(suffix); + } + if (loc != null) { + sb.append('\n'); + sb.append(" at "); + sb.append(loc.toString()); + } + msg = sb.toString(); + } + return msg; + } + + @Override public String toString() { return getClass().getName()+": "+getMessage(); } +} diff --git a/src/main/java/com/fasterxml/jackson/core/TokenStreamContext.java b/src/main/java/com/fasterxml/jackson/core/JsonStreamContext.java similarity index 75% rename from src/main/java/com/fasterxml/jackson/core/TokenStreamContext.java rename to src/main/java/com/fasterxml/jackson/core/JsonStreamContext.java index eff4fdde41..2de6d0cf18 100644 --- a/src/main/java/com/fasterxml/jackson/core/TokenStreamContext.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonStreamContext.java @@ -10,20 +10,15 @@ /** * Shared base class for streaming processing contexts used during - * reading and writing of token streams using Streaming API. + * reading and writing of Json content using Streaming API. * This context is also exposed to applications: * context object can be used by applications to get an idea of - * relative position of the parser/generator within content + * relative position of the parser/generator within json content * being processed. This allows for some contextual processing: for * example, output within Array context can differ from that of - * Object context. Perhaps more importantly context is hierarchic so - * that enclosing contexts can be inspected as well. All levels - * also include information about current property name (for Objects) - * and element index (for Arrays). - *

    - * NOTE: In jackson 2.x this class was named JsonStreamContext + * Object context. */ -public abstract class TokenStreamContext +public abstract class JsonStreamContext { // // // Type constants used internally // // // (but exposed publicly as of 2.12 as possibly needed) @@ -58,32 +53,36 @@ public abstract class TokenStreamContext protected int _index; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ - protected TokenStreamContext() { } + protected JsonStreamContext() { } /** - * Copy constructor used by sub-classes for creating copies for buffering. + * Copy constructor used by sub-classes for creating copies for + * buffering. * * @param base Context instance to copy type and index from + * + * @since 2.9 */ - protected TokenStreamContext(TokenStreamContext base) { + protected JsonStreamContext(JsonStreamContext base) { _type = base._type; _index = base._index; } - protected TokenStreamContext(int type, int index) { + // @since 2.9 + protected JsonStreamContext(int type, int index) { _type = type; _index = index; } /* - /********************************************************************** + /********************************************************** /* Public API, accessors - /********************************************************************** + /********************************************************** */ /** @@ -92,7 +91,7 @@ protected TokenStreamContext(int type, int index) { * * @return Parent context of this context, if any; {@code null} for Root contexts */ - public abstract TokenStreamContext getParent(); + public abstract JsonStreamContext getParent(); /** * Method that returns true if this context is an Array context; @@ -119,12 +118,29 @@ protected TokenStreamContext(int type, int index) { */ public final boolean inObject() { return _type == TYPE_OBJECT; } + /** + * @return Type description String + * + * @deprecated Since 2.8 use {@link #typeDesc} instead + */ + @Deprecated // since 2.8 + public final String getTypeDesc() { + switch (_type) { + case TYPE_ROOT: return "ROOT"; + case TYPE_ARRAY: return "ARRAY"; + case TYPE_OBJECT: return "OBJECT"; + } + return "?"; + } + /** * Method for accessing simple type description of current context; - * either ROOT (for root-level values), OBJECT (for Object property names and - * values) or ARRAY (for elements of JSON Arrays) + * either ROOT (for root-level values), OBJECT (for field names and + * values of JSON Objects) or ARRAY (for values of JSON Arrays) * * @return Type description String + * + * @since 2.8 */ public String typeDesc() { switch (_type) { @@ -151,6 +167,8 @@ public String typeDesc() { * first element of Array context; otherwise returns `true`. * * @return {@code True} if this context has value index to access, {@code false} otherwise + * + * @since 2.9 */ public boolean hasCurrentIndex() { return _index >= 0; } @@ -170,6 +188,8 @@ public String typeDesc() { * constructing {@link JsonPointer} * * @return {@code True} if this context has value path segment to access, {@code false} otherwise + * + * @since 2.9 */ public boolean hasPathSegment() { if (_type == TYPE_OBJECT) { @@ -182,14 +202,20 @@ public boolean hasPathSegment() { /** * Method for accessing name associated with the current location. - * Non-null for PROPERTY_NAME and value events that directly - * follow Property names; null for root level and array values. + * Non-null for FIELD_NAME and value events that directly + * follow field names; null for root level and array values. * - * @return Current property name within context, if any; {@code null} if none + * @return Current field name within context, if any; {@code null} if none */ - public abstract String currentName(); + public abstract String getCurrentName(); - public boolean hasCurrentName() { return currentName() != null; } + /** + * @return {@code True} if a call to {@link #getCurrentName()} would return non-{@code null} + * name; {@code false} otherwise + * + * @since 2.9 + */ + public boolean hasCurrentName() { return getCurrentName() != null; } /** * Method for accessing currently active value being used by data-binding @@ -202,19 +228,23 @@ public boolean hasPathSegment() { * and gets passed through data-binding. * * @return Currently active value, if one has been assigned. + * + * @since 2.5 */ - public Object currentValue() { + public Object getCurrentValue() { return null; } /** - * Method to call to pass value to be returned via {@link #currentValue}; typically - * called indirectly through {@link JsonParser#assignCurrentValue} - * or {@link JsonGenerator#assignCurrentValue}). + * Method to call to pass value to be returned via {@link #getCurrentValue}; typically + * called indirectly through {@link JsonParser#setCurrentValue} + * or {@link JsonGenerator#setCurrentValue}). * * @param v Current value to assign to this context + * + * @since 2.5 */ - public void assignCurrentValue(Object v) { } + public void setCurrentValue(Object v) { } /** * Factory method for constructing a {@link JsonPointer} that points to the current @@ -222,6 +252,8 @@ public void assignCurrentValue(Object v) { } * "root context" (only relevant for multi-root-value cases) * * @return Pointer instance constructed + * + * @since 2.9 */ public JsonPointer pathAsPointer() { return JsonPointer.forPath(this, false); @@ -232,9 +264,11 @@ public JsonPointer pathAsPointer() { * location within the stream that this context is for, optionally including * "root value index" * - * @param includeRoot Whether root-value offset is included as the first segment or not + * @param includeRoot Whether root-value offset is included as the first segment or not; * * @return Pointer instance constructed + * + * @since 2.9 */ public JsonPointer pathAsPointer(boolean includeRoot) { return JsonPointer.forPath(this, includeRoot); @@ -251,17 +285,33 @@ public JsonPointer pathAsPointer(boolean includeRoot) { * * @return Location pointing to the point where the context * start marker was found (or written); never {@code null}. + * + * @since 2.13 */ public JsonLocation startLocation(ContentReference srcRef) { return JsonLocation.NA; } + /** + * @param srcRef Source reference needed to construct location instance + * @return Location pointing to the point where the context + * start marker was found (or written); never {@code null}. + * @since 2.9 + * @deprecated Since 2.13 use {@link #startLocation} instead + */ + @Deprecated + public JsonLocation getStartLocation(Object srcRef) { + return JsonLocation.NA; + } + /** * Overridden to provide developer readable "JsonPath" representation * of the context. * * @return Simple developer-readable description this context layer * (note: NOT constructed with parents, unlike {@link #pathAsPointer}) + * + * @since 2.9 */ @Override public String toString() { @@ -278,7 +328,7 @@ public String toString() { case TYPE_OBJECT: default: sb.append('{'); - String currentName = currentName(); + String currentName = getCurrentName(); if (currentName != null) { sb.append('"'); CharTypes.appendQuoted(sb, currentName); diff --git a/src/main/java/com/fasterxml/jackson/core/JsonToken.java b/src/main/java/com/fasterxml/jackson/core/JsonToken.java index 9f19f195a6..4078f1a3a2 100644 --- a/src/main/java/com/fasterxml/jackson/core/JsonToken.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonToken.java @@ -14,7 +14,7 @@ public enum JsonToken /* Some notes on implementation: * * - Entries are to be ordered such that start/end array/object - * markers come first, then Property name marker (if any), and + * markers come first, then field name marker (if any), and * finally scalar value tokens. This is assumed by some * typing checks. */ @@ -53,13 +53,13 @@ public enum JsonToken * which signals ending of an Array value */ END_ARRAY("]", JsonTokenId.ID_END_ARRAY), - + /** - * PROPERTY_NAME is returned when a String token is encountered - * as a property name (same lexical value, different function) + * FIELD_NAME is returned when a String token is encountered + * as a field name (same lexical value, different function) */ - PROPERTY_NAME(null, JsonTokenId.ID_PROPERTY_NAME), - + FIELD_NAME(null, JsonTokenId.ID_FIELD_NAME), + /** * Placeholder token returned when the input source has a concept * of embedded Object that are not accessible as usual structure @@ -74,7 +74,7 @@ public enum JsonToken /** * VALUE_STRING is returned when a String token is encountered - * in value context (array element, object property value, or root-level + * in value context (array element, field value, or root-level * stand-alone value) */ VALUE_STRING(null, JsonTokenId.ID_STRING), @@ -163,7 +163,7 @@ public enum JsonToken _isStructEnd = (id == JsonTokenId.ID_END_OBJECT || id == JsonTokenId.ID_END_ARRAY); _isScalar = !_isStructStart && !_isStructEnd - && (id != JsonTokenId.ID_PROPERTY_NAME) + && (id != JsonTokenId.ID_FIELD_NAME) && (id != JsonTokenId.ID_NOT_AVAILABLE); } @@ -200,6 +200,8 @@ public enum JsonToken * * @return {@code True} if this token is {@code END_OBJECT} or {@code END_ARRAY}, * {@code false} otherwise + * + * @since 2.3 */ public final boolean isStructEnd() { return _isStructEnd; } @@ -207,7 +209,7 @@ public enum JsonToken * Method that can be used to check whether this token represents * a valid non-structured value. This means all {@code VALUE_xxx} tokens; * excluding {@code START_xxx} and {@code END_xxx} tokens as well - * {@code PROPERTY_NAME}. + * {@code FIELD_NAME}. * * @return {@code True} if this token is a scalar value token (one of * {@code VALUE_xxx} tokens), {@code false} otherwise diff --git a/src/main/java/com/fasterxml/jackson/core/JsonTokenId.java b/src/main/java/com/fasterxml/jackson/core/JsonTokenId.java index 3aa92cc165..f7244882d9 100644 --- a/src/main/java/com/fasterxml/jackson/core/JsonTokenId.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonTokenId.java @@ -5,6 +5,8 @@ * Needed because it is impossible to define these constants in * {@link JsonToken} itself, as static constants (oddity of how Enums * are implemented by JVM). + * + * @since 2.3 */ public interface JsonTokenId { @@ -44,9 +46,9 @@ public interface JsonTokenId public final static int ID_END_ARRAY = 4; /** - * Id used to represent {@link JsonToken#PROPERTY_NAME} + * Id used to represent {@link JsonToken#FIELD_NAME} */ - public final static int ID_PROPERTY_NAME = 5; + public final static int ID_FIELD_NAME = 5; /** * Id used to represent {@link JsonToken#VALUE_STRING} diff --git a/src/main/java/com/fasterxml/jackson/core/util/JsonpCharacterEscapes.java b/src/main/java/com/fasterxml/jackson/core/JsonpCharacterEscapes.java similarity index 93% rename from src/main/java/com/fasterxml/jackson/core/util/JsonpCharacterEscapes.java rename to src/main/java/com/fasterxml/jackson/core/JsonpCharacterEscapes.java index a552b5b56c..282bb4286f 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/JsonpCharacterEscapes.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonpCharacterEscapes.java @@ -1,6 +1,5 @@ -package com.fasterxml.jackson.core.util; +package com.fasterxml.jackson.core; -import com.fasterxml.jackson.core.SerializableString; import com.fasterxml.jackson.core.io.CharacterEscapes; import com.fasterxml.jackson.core.io.SerializedString; @@ -10,6 +9,8 @@ * escaped otherwise), which are apparently considered linefeeds as * per newer Javascript specifications, and consequently problematic * when using JSONP (see https://en.wikipedia.org/wiki/JSONP). + * + * @since 2.8 */ public class JsonpCharacterEscapes extends CharacterEscapes { diff --git a/src/main/java/com/fasterxml/jackson/core/ObjectCodec.java b/src/main/java/com/fasterxml/jackson/core/ObjectCodec.java new file mode 100644 index 0000000000..70762aabc1 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/ObjectCodec.java @@ -0,0 +1,279 @@ +/* Jackson JSON-processor. + * + * Copyright (c) 2007- Tatu Saloranta, tatu.saloranta@iki.fi + */ + +package com.fasterxml.jackson.core; + +import java.io.IOException; +import java.util.Iterator; + +import com.fasterxml.jackson.core.type.ResolvedType; +import com.fasterxml.jackson.core.type.TypeReference; + +/** + * Abstract class that defines the interface that {@link JsonParser} and + * {@link JsonGenerator} use to serialize and deserialize regular + * Java objects (POJOs aka Beans). + *

    + * The standard implementation of this class is + * com.fasterxml.jackson.databind.ObjectMapper, + * defined in the "jackson-databind". + */ +public abstract class ObjectCodec + extends TreeCodec // since 2.3 + implements Versioned // since 2.3 +{ + protected ObjectCodec() { } + + // Since 2.3 + @Override + public abstract Version version(); + + /* + /********************************************************** + /* API for de-serialization (JSON-to-Object) + /********************************************************** + */ + + /** + * Method to deserialize JSON content into a non-container + * type (it can be an array type, however): typically a bean, array + * or a wrapper type (like {@link java.lang.Boolean}). + *

    + * Note: this method should NOT be used if the result type is a + * container ({@link java.util.Collection} or {@link java.util.Map}. + * The reason is that due to type erasure, key and value types + * can not be introspected when using this method. + * + * @param Nominal parameter for target type + * + * @param p Parser to use for decoding content to bind + * @param valueType Java value type to bind content to + * + * @return Value deserialized + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public abstract T readValue(JsonParser p, Class valueType) + throws IOException; + + /** + * Method to deserialize JSON content into a Java type, reference + * to which is passed as argument. Type is passed using so-called + * "super type token" + * and specifically needs to be used if the root type is a + * parameterized (generic) container type. + * + * @param Nominal parameter for target type + * + * @param p Parser to use for decoding content to bind + * @param valueTypeRef Java value type to bind content to + * + * @return Value deserialized + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public abstract T readValue(JsonParser p, TypeReference valueTypeRef) + throws IOException; + + /** + * Method to deserialize JSON content into a POJO, type specified + * with fully resolved type object (so it can be a generic type, + * including containers like {@link java.util.Collection} and + * {@link java.util.Map}). + * + * @param Nominal parameter for target type + * + * @param p Parser to use for decoding content to bind + * @param valueType Java value type to bind content to + * + * @return Value deserialized + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public abstract T readValue(JsonParser p, ResolvedType valueType) + throws IOException; + + /** + * Method for reading sequence of Objects from parser stream, + * all with same specified value type. + * + * @param Nominal parameter for target type + * + * @param p Parser to use for decoding content to bind + * @param valueType Java value type to bind content to + * + * @return Iterator for incrementally deserializing values + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public abstract Iterator readValues(JsonParser p, Class valueType) + throws IOException; + + /** + * Method for reading sequence of Objects from parser stream, + * all with same specified value type. + * + * @param Nominal parameter for target type + * + * @param p Parser to use for decoding content to bind + * @param valueTypeRef Java value type to bind content to + * + * @return Iterator for incrementally deserializing values + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public abstract Iterator readValues(JsonParser p, TypeReference valueTypeRef) + throws IOException; + + /** + * Method for reading sequence of Objects from parser stream, + * all with same specified value type. + * + * @param Nominal parameter for target type + * + * @param p Parser to use for decoding content to bind + * @param valueType Java value type to bind content to + * + * @return Iterator for incrementally deserializing values + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + public abstract Iterator readValues(JsonParser p, ResolvedType valueType) + throws IOException; + + /* + /********************************************************** + /* API for serialization (Object-to-JSON) + /********************************************************** + */ + + /** + * Method to serialize given Java Object, using generator + * provided. + * + * @param gen Generator to use for serializing value + * @param value Value to serialize + * + * @throws IOException for low-level write issues, or + * {@link JsonGenerationException} for decoding problems + */ + public abstract void writeValue(JsonGenerator gen, Object value) throws IOException; + + /* + /********************************************************** + /* TreeCodec pass-through methods + /********************************************************** + */ + + /** + * Method for deserializing JSON content as tree expressed + * using set of {@link TreeNode} instances. Returns + * root of the resulting tree (where root can consist + * of just a single node if the current event is a + * value event, not container). Empty or whitespace + * documents return null. + * + * @return next tree from {@code p}, or {@code null} if empty. + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems + */ + @Override + public abstract T readTree(JsonParser p) throws IOException; + + /** + * Method for serializing JSON content from given Tree instance, using + * specified generator. + * + * @param gen Generator to use for serializing value + * @param tree Tree to serialize + * + * @throws IOException for low-level write issues, or + * {@link JsonGenerationException} for decoding problems + */ + @Override + public abstract void writeTree(JsonGenerator gen, TreeNode tree) throws IOException; + + /** + * Method for construct root level Object nodes + * for Tree Model instances. + * + * @return Object node created + */ + @Override + public abstract TreeNode createObjectNode(); + + /** + * Method for construct root level Array nodes + * for Tree Model instances. + * + * @return Array node created + */ + @Override + public abstract TreeNode createArrayNode(); + + /** + * Method for constructing a {@link JsonParser} for reading + * contents of a JSON tree, as if it was external serialized + * JSON content. + * + * @param n Content to traverse over + * + * @return Parser constructed for traversing over contents of specified node + */ + @Override + public abstract JsonParser treeAsTokens(TreeNode n); + + /* + /********************************************************** + /* Extended tree conversions beyond TreeCodec + /********************************************************** + */ + + /** + * Convenience method for converting given JSON tree into instance of specified + * value type. This is equivalent to first constructing a {@link JsonParser} to + * iterate over contents of the tree, and using that parser for data binding. + * + * @param Nominal parameter for target type + * + * @param n Tree to convert + * @param valueType Java target value type to convert content to + * + * @return Converted value instance + * + * @throws JsonProcessingException if structural conversion fails + */ + public abstract T treeToValue(TreeNode n, Class valueType) + throws JsonProcessingException; + + /* + /********************************************************** + /* Basic accessors + /********************************************************** + */ + + /** + * @deprecated Use {@link #getFactory} instead. + * + * @return Underlying {@link JsonFactory} instance + */ + @Deprecated + public JsonFactory getJsonFactory() { return getFactory(); } + + /** + * Accessor for finding underlying data format factory + * ({@link JsonFactory}) codec will use for data binding. + * + * @return Underlying {@link JsonFactory} instance + */ + public JsonFactory getFactory() { return getJsonFactory(); } +} diff --git a/src/main/java/com/fasterxml/jackson/core/ObjectReadContext.java b/src/main/java/com/fasterxml/jackson/core/ObjectReadContext.java deleted file mode 100644 index b0ecfdcaa5..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/ObjectReadContext.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.fasterxml.jackson.core; - -import java.io.InputStream; -import java.io.Reader; - -import com.fasterxml.jackson.core.tree.ArrayTreeNode; -import com.fasterxml.jackson.core.tree.ObjectTreeNode; -import com.fasterxml.jackson.core.type.ResolvedType; -import com.fasterxml.jackson.core.type.TypeReference; - -/** - * Defines API for accessing configuration and state exposed by - * higher level databind - * functionality during read (token stream to Object deserialization) process. - * Access is mostly needed during construction of - * {@link JsonParser} instances by {@link TokenStreamFactory}. - * - * @since 3.0 - */ -public interface ObjectReadContext -{ - public static ObjectReadContext empty() { - return Base.EMPTY_CONTEXT; - } - - // // // Configuration access - - public FormatSchema getSchema(); - - public int getStreamReadFeatures(int defaults); - public int getFormatReadFeatures(int defaults); - - public TokenStreamFactory getParserFactory(); - - // // // Parser construction - - default JsonParser createParser(InputStream in) throws JacksonException { - return getParserFactory().createParser(this, in); - } - - default JsonParser createParser(Reader r) throws JacksonException { - return getParserFactory().createParser(this, r); - } - - default JsonParser createParser(String content) throws JacksonException { - return getParserFactory().createParser(this, content); - } - - default JsonParser createParser(byte[] content) throws JacksonException { - return getParserFactory().createParser(this, content); - } - - default JsonParser createParser(byte[] content, int offset, int length) throws JacksonException { - return getParserFactory().createParser(this, content, offset, length); - } - - // // // Databinding callbacks, tree node creation - - /** - * Method for construct Array nodes for Tree Model instances. - * - * @return Array node created - */ - public ArrayTreeNode createArrayNode(); - - /** - * Method for construct Object nodes for Tree Model instances. - * - * @return Object node created - */ - public ObjectTreeNode createObjectNode(); - - // // // Databinding callbacks, tree deserialization - - public T readTree(JsonParser p) throws JacksonException; - - /** - * Convenience method for traversing over given {@link TreeNode} by exposing - * contents as a {@link JsonParser}. - *

    - * NOTE! Returned parser has not been advanced to the first token; caller has to - * do this. - * - * @param n Node to traverse over - * - * @return Parser that iterates over contents of given node - */ - default JsonParser treeAsTokens(TreeNode n) { - return n.traverse(this); - } - - // // // Databinding callbacks, non-tree value deserialization - - public T readValue(JsonParser p, Class valueType) throws JacksonException; - - public T readValue(JsonParser p, TypeReference valueTypeRef) throws JacksonException; - - public T readValue(JsonParser p, ResolvedType type) throws JacksonException; - - /** - * Default no-op implementation. - */ - public static class Base implements ObjectReadContext { - protected static Base EMPTY_CONTEXT = new Base(); - - // // // Config access methods - - @Override - public FormatSchema getSchema() { return null; } - - @Override - public int getStreamReadFeatures(int defaults) { - return defaults; - } - - @Override - public int getFormatReadFeatures(int defaults) { - return defaults; - } - - @Override - public TokenStreamFactory getParserFactory() { - return _reportUnsupportedOperation(); - } - - // // // Databind, trees - - @Override - public ObjectTreeNode createObjectNode() { - return _reportUnsupportedOperation(); - } - - @Override - public ArrayTreeNode createArrayNode() { - return _reportUnsupportedOperation(); - } - - // // // Databind integration, trees - - @Override - public T readTree(JsonParser p) { - return _reportUnsupportedOperation(); - } - - // // // Databind integration, other values - - @Override - public T readValue(JsonParser p, Class valueType) { - return _reportUnsupportedOperation(); - } - - @Override - public T readValue(JsonParser p, TypeReference valueTypeRef) { - return _reportUnsupportedOperation(); - } - - @Override - public T readValue(JsonParser p, ResolvedType type) { - return _reportUnsupportedOperation(); - } - - // // // Helper methods - - protected T _reportUnsupportedOperation() { - throw new UnsupportedOperationException("Operation not supported by `ObjectReadContext` of type "+getClass().getName()); - } - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/ObjectWriteContext.java b/src/main/java/com/fasterxml/jackson/core/ObjectWriteContext.java deleted file mode 100644 index e1b44a7236..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/ObjectWriteContext.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.fasterxml.jackson.core; - -import java.io.OutputStream; -import java.io.Writer; - -import com.fasterxml.jackson.core.exc.StreamWriteException; -import com.fasterxml.jackson.core.exc.WrappedIOException; -import com.fasterxml.jackson.core.io.CharacterEscapes; -import com.fasterxml.jackson.core.tree.ArrayTreeNode; -import com.fasterxml.jackson.core.tree.ObjectTreeNode; - -/** - * Defines API for accessing configuration and state exposed by - * higher level databind - * functionality during write (Object to token stream serialization) process. - * Access is mostly needed during construction of - * {@link JsonGenerator} instances by {@link TokenStreamFactory}. - * - * @since 3.0 - */ -public interface ObjectWriteContext -{ - public static ObjectWriteContext empty() { - return Base.EMPTY_CONTEXT; - } - - // // // Configuration access - - public FormatSchema getSchema(); - - public CharacterEscapes getCharacterEscapes(); - - /** - * Accessor for getting {@link PrettyPrinter} instance to use for a new generator. - * Note that this MUST BE a thread-safe instance: that is, if the pretty printer - * implementation is stateful, - * a new unshared instance needs to be returned -- caller will NOT try to make - * a copy of {@link com.fasterxml.jackson.core.util.Instantiatable} printers, context - * must do that. - * - * @return {@link PrettyPrinter} instance to use for a single serialization operation - */ - public PrettyPrinter getPrettyPrinter(); - - /** - * Accessor similar to {@link #getPrettyPrinter()} but which only indicates whether - * a non-{@code null} instance would be constructed if requested, or not. - * This is useful for backends that have custom pretty-printing instead of relying on - * Jackson standard mechanism. - * - * @return True if {@link #getPrettyPrinter()} would return non-{@code null}; false otherwise. - */ - public boolean hasPrettyPrinter(); - - public SerializableString getRootValueSeparator(SerializableString defaultSeparator); - - public int getStreamWriteFeatures(int defaults); - public int getFormatWriteFeatures(int defaults); - - public TokenStreamFactory getGeneratorFactory(); - - // // // Generator construction: limited to targets that make sense for embedding - // // // purposes (like "JSON in JSON" etc) - - default JsonGenerator createGenerator(OutputStream out) throws JacksonException { - return getGeneratorFactory().createGenerator(this, out); - } - - default JsonGenerator createGenerator(OutputStream out, JsonEncoding enc) throws JacksonException { - return getGeneratorFactory().createGenerator(this, out, enc); - } - - default JsonGenerator createGenerator(Writer w) throws JacksonException { - return getGeneratorFactory().createGenerator(this, w); - } - - // // // Databinding callbacks, tree node creation - - /** - * Method for construct Array nodes for Tree Model instances. - * - * @return Array node created - */ - public ArrayTreeNode createArrayNode(); - - /** - * Method for construct Object nodes for Tree Model instances. - * - * @return Object node created - */ - public ObjectTreeNode createObjectNode(); - - // // // Databinding callbacks, value serialization - - /** - * Method that may be called to serialize given value, using specified - * token stream generator. - * - * @param g Generator to use for serialization - * @param value Java value to be serialized - * - * @throws WrappedIOException for low-level write problems, - * @throws StreamWriteException for encoding problems - * @throws JacksonException (various subtypes) for databinding problems - */ - public void writeValue(JsonGenerator g, Object value) throws JacksonException; - - public void writeTree(JsonGenerator g, TreeNode value) throws JacksonException; - - /** - * Default no-op implementation. - */ - public static class Base implements ObjectWriteContext { - protected static Base EMPTY_CONTEXT = new Base(); - - // // // Config access methods - - @Override - public FormatSchema getSchema() { return null; } - - @Override - public CharacterEscapes getCharacterEscapes() { return null; } - - @Override - public PrettyPrinter getPrettyPrinter() { return null; } - - @Override - public boolean hasPrettyPrinter() { - return getPrettyPrinter() != null; - } - - @Override - public SerializableString getRootValueSeparator(SerializableString defaultSeparator) { - return defaultSeparator; - } - - @Override - public int getStreamWriteFeatures(int defaults) { - return defaults; - } - - @Override - public TokenStreamFactory getGeneratorFactory() { - return _reportUnsupportedOperation(); - } - - @Override - public int getFormatWriteFeatures(int defaults) { - return defaults; - } - - // // // Databind integration - - @Override - public ObjectTreeNode createObjectNode() { - return _reportUnsupportedOperation(); - } - - @Override - public ArrayTreeNode createArrayNode() { - return _reportUnsupportedOperation(); - } - - @Override - public void writeValue(JsonGenerator g, Object value) { - _reportUnsupportedOperation(); - } - - @Override - public void writeTree(JsonGenerator g, TreeNode value) { - _reportUnsupportedOperation(); - } - - protected T _reportUnsupportedOperation() { - throw new UnsupportedOperationException("Operation not supported by `ObjectWriteContext` of type "+getClass().getName()); - } - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/PrettyPrinter.java b/src/main/java/com/fasterxml/jackson/core/PrettyPrinter.java index aa6d97bc2d..ecd0bc0b8b 100644 --- a/src/main/java/com/fasterxml/jackson/core/PrettyPrinter.java +++ b/src/main/java/com/fasterxml/jackson/core/PrettyPrinter.java @@ -5,8 +5,8 @@ package com.fasterxml.jackson.core; -import com.fasterxml.jackson.core.exc.StreamWriteException; -import com.fasterxml.jackson.core.exc.WrappedIOException; +import java.io.IOException; + import com.fasterxml.jackson.core.io.SerializedString; import com.fasterxml.jackson.core.util.Separators; @@ -17,7 +17,7 @@ * to make results more human readable. Usually this means things like adding * linefeeds and indentation. *

    - * Note: stateful implementations MUST implement + * Note: since Jackson 2.1, stateful implementations MUST implement * {@link com.fasterxml.jackson.core.util.Instantiatable} interface, * to allow for constructing per-generation instances and avoid * state corruption. @@ -25,19 +25,24 @@ */ public interface PrettyPrinter { + /** + * @since 2.9 + */ public final static Separators DEFAULT_SEPARATORS = Separators.createDefaultInstance(); /** * Default String used for separating root values is single space. + * + * @since 2.9 */ public final static SerializedString DEFAULT_ROOT_VALUE_SEPARATOR = new SerializedString(" "); /* - /********************************************************************** + /********************************************************** /* First methods that act both as events, and expect /* output for correct functioning (i.e something gets /* output even when not pretty-printing) - /********************************************************************** + /********************************************************** */ // // // Root-level handling: @@ -51,12 +56,12 @@ public interface PrettyPrinter * to output some other suitable and nice-looking separator * (tab(s), space(s), linefeed(s) or any combination thereof). * - * @param g Generator used for output + * @param gen Generator used for output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void writeRootValueSeparator(JsonGenerator g) throws JacksonException; + void writeRootValueSeparator(JsonGenerator gen) throws IOException; // // Object handling @@ -70,12 +75,12 @@ public interface PrettyPrinter * to output a curly bracket as well, but can surround that * with other (white-space) decoration. * - * @param g Generator used for output + * @param gen Generator used for output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void writeStartObject(JsonGenerator g) throws JacksonException; + void writeStartObject(JsonGenerator gen) throws IOException; /** * Method called after an Object value has been completely output @@ -87,14 +92,14 @@ public interface PrettyPrinter * to output a curly bracket as well, but can surround that * with other (white-space) decoration. * - * @param g Generator used for output + * @param gen Generator used for output * @param nrOfEntries Number of direct members of the Object that * have been output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void writeEndObject(JsonGenerator g, int nrOfEntries) throws JacksonException; + void writeEndObject(JsonGenerator gen, int nrOfEntries) throws IOException; /** * Method called after an Object entry (field:value) has been completely @@ -105,15 +110,15 @@ public interface PrettyPrinter * to output a comma as well, but can surround that with other * (white-space) decoration. * - * @param g Generator used for output + * @param gen Generator used for output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void writeObjectEntrySeparator(JsonGenerator g) throws JacksonException; + void writeObjectEntrySeparator(JsonGenerator gen) throws IOException; /** - * Method called after an Object property name has been output, but + * Method called after an object field has been output, but * before the value is output. *

    * Default handling (without pretty-printing) will output a single @@ -121,12 +126,12 @@ public interface PrettyPrinter * to output a colon as well, but can surround that with other * (white-space) decoration. * - * @param g Generator used for output + * @param gen Generator used for output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void writeObjectFieldValueSeparator(JsonGenerator g) throws JacksonException; + void writeObjectFieldValueSeparator(JsonGenerator gen) throws IOException; // // // Array handling @@ -140,12 +145,12 @@ public interface PrettyPrinter * to output a bracket as well, but can surround that * with other (white-space) decoration. * - * @param g Generator used for output + * @param gen Generator used for output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void writeStartArray(JsonGenerator g) throws JacksonException; + void writeStartArray(JsonGenerator gen) throws IOException; /** * Method called after an Array value has been completely output @@ -157,14 +162,14 @@ public interface PrettyPrinter * to output a bracket as well, but can surround that * with other (white-space) decoration. * - * @param g Generator used for output + * @param gen Generator used for output * @param nrOfValues Number of direct members of the array that * have been output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void writeEndArray(JsonGenerator g, int nrOfValues) throws JacksonException; + void writeEndArray(JsonGenerator gen, int nrOfValues) throws IOException; /** * Method called after an array value has been completely @@ -175,18 +180,18 @@ public interface PrettyPrinter * to output a comma as well, but can surround that with other * (white-space) decoration. * - * @param g Generator used for output + * @param gen Generator used for output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void writeArrayValueSeparator(JsonGenerator g) throws JacksonException; + void writeArrayValueSeparator(JsonGenerator gen) throws IOException; /* - /********************************************************************** + /********************************************************** /* Then events that by default do not produce any output but that are /* often overridden to add white space in pretty-printing mode - /********************************************************************** + /********************************************************** */ /** @@ -197,26 +202,27 @@ public interface PrettyPrinter * Default handling does not output anything, but pretty-printer * is free to add any white space decoration. * - * @param g Generator used for output + * @param gen Generator used for output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void beforeArrayValues(JsonGenerator g) throws JacksonException; + void beforeArrayValues(JsonGenerator gen) throws IOException; /** * Method called after object start marker has been output, - * and right before the Name of the first property is + * and right before the field name of the first entry is * to be output. - * It is not called for objects without properties. + * It is not called for objects without entries. *

    * Default handling does not output anything, but pretty-printer * is free to add any white space decoration. * - * @param g Generator used for output + * @param gen Generator used for output * - * @throws WrappedIOException if there is an underlying I/O problem - * @throws StreamWriteException for problems in encoding token stream + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - void beforeObjectEntries(JsonGenerator g) throws JacksonException; + void beforeObjectEntries(JsonGenerator gen) throws IOException; } + diff --git a/src/main/java/com/fasterxml/jackson/core/SerializableString.java b/src/main/java/com/fasterxml/jackson/core/SerializableString.java index 14026a8b23..d726a3bf9e 100644 --- a/src/main/java/com/fasterxml/jackson/core/SerializableString.java +++ b/src/main/java/com/fasterxml/jackson/core/SerializableString.java @@ -43,9 +43,10 @@ public interface SerializableString int charLength(); /* - /********************************************************************** + /********************************************************** /* Accessors for byte sequences - /********************************************************************** + /********************************************************** + */ /** * Returns JSON quoted form of the String, as character array. @@ -78,9 +79,9 @@ public interface SerializableString byte[] asQuotedUTF8(); /* - /********************************************************************** + /********************************************************** /* Helper methods for appending byte/char sequences - /********************************************************************** + /********************************************************** */ /** @@ -149,9 +150,9 @@ public interface SerializableString int appendUnquoted(char[] buffer, int offset); /* - /********************************************************************** + /********************************************************** /* Helper methods for writing out byte sequences - /********************************************************************** + /********************************************************** */ /** diff --git a/src/main/java/com/fasterxml/jackson/core/StreamReadFeature.java b/src/main/java/com/fasterxml/jackson/core/StreamReadFeature.java index 6f03d9b204..4169755be5 100644 --- a/src/main/java/com/fasterxml/jackson/core/StreamReadFeature.java +++ b/src/main/java/com/fasterxml/jackson/core/StreamReadFeature.java @@ -3,16 +3,16 @@ import java.io.InputStream; import java.io.Reader; -import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.core.util.JacksonFeature; /** * Token reader (parser) features not-specific to any particular format backend. - *

    - * NOTE: Jackson 2.x contained these along with JSON-specific features in JsonParser.Feature. + * Eventual replacement for non-JSON-specific {@link com.fasterxml.jackson.core.JsonParser.Feature}s. + * + * @since 2.10 */ public enum StreamReadFeature - implements JacksonFeature + implements JacksonFeature // since 2.12 { // // // Low-level I/O handling features: @@ -28,15 +28,15 @@ public enum StreamReadFeature *

    * Feature is enabled by default. */ - AUTO_CLOSE_SOURCE(true), + AUTO_CLOSE_SOURCE(JsonParser.Feature.AUTO_CLOSE_SOURCE), // // // Validity checks /** * Feature that determines whether {@link JsonParser} will explicitly - * check that no duplicate JSON Object Property names are encountered. + * check that no duplicate JSON Object field names are encountered. * If enabled, parser will check all names within context and report - * duplicates by throwing a {@link StreamReadException}; if disabled, + * duplicates by throwing a {@link JsonParseException}; if disabled, * parser will not do such checking. Assumption in latter case is * that caller takes care of handling duplicates at a higher level: * data-binding, for example, has features to specify detection to @@ -46,7 +46,7 @@ public enum StreamReadFeature * due to having to store and check additional information: this typically * adds 20-30% to execution time for basic parsing. */ - STRICT_DUPLICATE_DETECTION(false), + STRICT_DUPLICATE_DETECTION(JsonParser.Feature.STRICT_DUPLICATE_DETECTION), /** * Feature that determines what to do if the underlying data format requires knowledge @@ -66,10 +66,9 @@ public enum StreamReadFeature *

    * Feature is disabled by default, meaning that if the underlying data format * requires knowledge of all properties to output, attempts to read an unknown - * property will result in an exception (typically of type - * {@link com.fasterxml.jackson.core.exc.StreamReadException}). + * property will result in a {@link JsonProcessingException} */ - IGNORE_UNDEFINED(false), + IGNORE_UNDEFINED(JsonParser.Feature.IGNORE_UNDEFINED), // // // Other @@ -90,7 +89,7 @@ public enum StreamReadFeature * and some or all of the source content may be included in {@link JsonLocation} information * constructed either when requested explicitly, or when needed for an exception. */ - INCLUDE_SOURCE_IN_LOCATION(true), + INCLUDE_SOURCE_IN_LOCATION(JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION), ; @@ -101,9 +100,17 @@ public enum StreamReadFeature private final int _mask; - private StreamReadFeature(boolean defaultState) { - _mask = (1 << ordinal()); - _defaultState = defaultState; + /** + * For backwards compatibility we may need to map to one of existing {@link JsonParser.Feature}s; + * if so, this is the feature to enable/disable. + */ + final private JsonParser.Feature _mappedFeature; + + private StreamReadFeature(JsonParser.Feature mapTo) { + // only for 2.x, let's map everything to legacy feature: + _mappedFeature = mapTo; + _mask = mapTo.getMask(); + _defaultState = mapTo.enabledByDefault(); } /** @@ -129,4 +136,6 @@ public static int collectDefaults() public boolean enabledIn(int flags) { return (flags & _mask) != 0; } @Override public int getMask() { return _mask; } + + public JsonParser.Feature mappedFeature() { return _mappedFeature; } } diff --git a/src/main/java/com/fasterxml/jackson/core/StreamWriteFeature.java b/src/main/java/com/fasterxml/jackson/core/StreamWriteFeature.java index 0b31dac1e4..4f1998484e 100644 --- a/src/main/java/com/fasterxml/jackson/core/StreamWriteFeature.java +++ b/src/main/java/com/fasterxml/jackson/core/StreamWriteFeature.java @@ -4,16 +4,16 @@ import java.io.Writer; import java.math.BigDecimal; -import com.fasterxml.jackson.core.exc.StreamWriteException; import com.fasterxml.jackson.core.util.JacksonFeature; /** * Token writer (generator) features not-specific to any particular format backend. - *

    - * NOTE: Jackson 2.x contained these along with JSON-specific features in JsonGenerator.Feature. + * Eventual replacement for non-JSON-specific {@link com.fasterxml.jackson.core.JsonGenerator.Feature}s. + * + * @since 2.10 */ public enum StreamWriteFeature - implements JacksonFeature + implements JacksonFeature // since 2.12 { // // Low-level I/O / content features @@ -30,19 +30,20 @@ public enum StreamWriteFeature *

    * Feature is enabled by default. */ - AUTO_CLOSE_TARGET(true), + AUTO_CLOSE_TARGET(JsonGenerator.Feature.AUTO_CLOSE_TARGET), /** * Feature that determines what happens when the generator is * closed while there are still unmatched * {@link JsonToken#START_ARRAY} or {@link JsonToken#START_OBJECT} * entries in output content. If enabled, such Array(s) and/or - * Object(s) are automatically closed; if disabled, nothing - * specific is done. + * Object(s) are automatically closed (that is, matching END_ token write + * call is made for all open scopes); if disabled, no additional + * write calls are made. *

    * Feature is enabled by default. */ - AUTO_CLOSE_CONTENT(true), + AUTO_CLOSE_CONTENT(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT), /** * Feature that specifies that calls to {@link JsonGenerator#flush} will cause @@ -55,7 +56,7 @@ public enum StreamWriteFeature *

    * Feature is enabled by default. */ - FLUSH_PASSED_TO_STREAM(true), + FLUSH_PASSED_TO_STREAM(JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM), // // Datatype coercion features @@ -71,15 +72,15 @@ public enum StreamWriteFeature * Feature is disabled by default, so default output mode is used; this generally * depends on how {@link BigDecimal} has been created. */ - WRITE_BIGDECIMAL_AS_PLAIN(false), + WRITE_BIGDECIMAL_AS_PLAIN(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN), // // Schema/Validity support features /** * Feature that determines whether {@link JsonGenerator} will explicitly - * check that no duplicate JSON Object Property names are written. + * check that no duplicate JSON Object field names are written. * If enabled, generator will check all names within context and report - * duplicates by throwing a {@link StreamWriteException}; if disabled, + * duplicates by throwing a {@link JsonGenerationException}; if disabled, * no such checking will be done. Assumption in latter case is * that caller takes care of not trying to write duplicate names. *

    @@ -88,13 +89,13 @@ public enum StreamWriteFeature *

    * Feature is disabled by default. */ - STRICT_DUPLICATE_DETECTION(false), + STRICT_DUPLICATE_DETECTION(JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION), /** * Feature that determines what to do if the underlying data format requires knowledge * of all properties to output, and if no definition is found for a property that * caller tries to write. If enabled, such properties will be quietly ignored; - * if disabled, a {@link StreamWriteException} will be thrown to indicate the + * if disabled, a {@link JsonProcessingException} will be thrown to indicate the * problem. * Typically most textual data formats do NOT require schema information (although * some do, such as CSV), whereas many binary data formats do require definitions @@ -106,9 +107,9 @@ public enum StreamWriteFeature *

    * Feature is disabled by default, meaning that if the underlying data format * requires knowledge of all properties to output, attempts to write an unknown - * property will result in a {@link StreamWriteException} + * property will result in a {@link JsonProcessingException} */ - IGNORE_UNKNOWN(false), + IGNORE_UNKNOWN(JsonGenerator.Feature.IGNORE_UNKNOWN), ; /** @@ -118,9 +119,17 @@ public enum StreamWriteFeature private final int _mask; - private StreamWriteFeature(boolean defaultState) { - _mask = (1 << ordinal()); - _defaultState = defaultState; + /** + * For backwards compatibility we may need to map to one of existing {@link JsonParser.Feature}s; + * if so, this is the feature to enable/disable. + */ + final private JsonGenerator.Feature _mappedFeature; + + private StreamWriteFeature(JsonGenerator.Feature mappedTo) { + // only for 2.x, let's map everything to legacy feature: + _mappedFeature = mappedTo; + _mask = mappedTo.getMask(); + _defaultState = mappedTo.enabledByDefault(); } /** @@ -146,4 +155,6 @@ public static int collectDefaults() public boolean enabledIn(int flags) { return (flags & _mask) != 0; } @Override public int getMask() { return _mask; } + + public JsonGenerator.Feature mappedFeature() { return _mappedFeature; } } diff --git a/src/main/java/com/fasterxml/jackson/core/TSFBuilder.java b/src/main/java/com/fasterxml/jackson/core/TSFBuilder.java new file mode 100644 index 0000000000..d9055eb26c --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/TSFBuilder.java @@ -0,0 +1,303 @@ +package com.fasterxml.jackson.core; + +import com.fasterxml.jackson.core.io.InputDecorator; +import com.fasterxml.jackson.core.io.OutputDecorator; +import com.fasterxml.jackson.core.json.JsonReadFeature; +import com.fasterxml.jackson.core.json.JsonWriteFeature; + +/** + * Since 2.10, Builder class is offered for creating token stream factories + * with difference configurations: with 3.x they will be fully immutable. + * + * @since 2.10 + */ +public abstract class TSFBuilder> +{ + /* + /********************************************************************** + /* Constants + /********************************************************************** + */ + + /** + * Bitfield (set of flags) of all factory features that are enabled by default. + */ + protected final static int DEFAULT_FACTORY_FEATURE_FLAGS = JsonFactory.Feature.collectDefaults(); + + /** + * Bitfield (set of flags) of all parser features that are enabled + * by default. + */ + protected final static int DEFAULT_PARSER_FEATURE_FLAGS = JsonParser.Feature.collectDefaults(); + + /** + * Bitfield (set of flags) of all generator features that are enabled + * by default. + */ + protected final static int DEFAULT_GENERATOR_FEATURE_FLAGS = JsonGenerator.Feature.collectDefaults(); + + /* + /********************************************************************** + /* Configured features + /********************************************************************** + */ + + /** + * Set of {@link com.fasterxml.jackson.core.JsonFactory.Feature}s enabled, + * as bitmask. + */ + protected int _factoryFeatures; + + /** + * Set of {@link JsonParser.Feature}s enabled, as bitmask. + */ + protected int _streamReadFeatures; + + /** + * Set of {@link JsonGenerator.Feature}s enabled, as bitmask. + */ + protected int _streamWriteFeatures; + + /* + /********************************************************************** + /* Other configuration + /********************************************************************** + */ + + /** + * Optional helper object that may decorate input sources, to do + * additional processing on input during parsing. + */ + protected InputDecorator _inputDecorator; + + /** + * Optional helper object that may decorate output object, to do + * additional processing on output during content generation. + */ + protected OutputDecorator _outputDecorator; + + /* + /********************************************************************** + /* Construction + /********************************************************************** + */ + + protected TSFBuilder() { + _factoryFeatures = DEFAULT_FACTORY_FEATURE_FLAGS; + _streamReadFeatures = DEFAULT_PARSER_FEATURE_FLAGS; + _streamWriteFeatures = DEFAULT_GENERATOR_FEATURE_FLAGS; + _inputDecorator = null; + _outputDecorator = null; + } + + protected TSFBuilder(JsonFactory base) + { + this(base._factoryFeatures, + base._parserFeatures, base._generatorFeatures); + } + + protected TSFBuilder(int factoryFeatures, + int parserFeatures, int generatorFeatures) + { + _factoryFeatures = factoryFeatures; + _streamReadFeatures = parserFeatures; + _streamWriteFeatures = generatorFeatures; + } + + // // // Accessors + + public int factoryFeaturesMask() { return _factoryFeatures; } + public int streamReadFeatures() { return _streamReadFeatures; } + public int streamWriteFeatures() { return _streamWriteFeatures; } + + public InputDecorator inputDecorator() { return _inputDecorator; } + public OutputDecorator outputDecorator() { return _outputDecorator; } + + // // // Factory features + + public B enable(JsonFactory.Feature f) { + _factoryFeatures |= f.getMask(); + return _this(); + } + + public B disable(JsonFactory.Feature f) { + _factoryFeatures &= ~f.getMask(); + return _this(); + } + + public B configure(JsonFactory.Feature f, boolean state) { + return state ? enable(f) : disable(f); + } + + // // // StreamReadFeatures (replacement of non-json-specific parser features) + + public B enable(StreamReadFeature f) { + _streamReadFeatures |= f.mappedFeature().getMask(); + return _this(); + } + + public B enable(StreamReadFeature first, StreamReadFeature... other) { + _streamReadFeatures |= first.mappedFeature().getMask(); + for (StreamReadFeature f : other) { + _streamReadFeatures |= f.mappedFeature().getMask(); + } + return _this(); + } + + public B disable(StreamReadFeature f) { + _streamReadFeatures &= ~f.mappedFeature().getMask(); + return _this(); + } + + public B disable(StreamReadFeature first, StreamReadFeature... other) { + _streamReadFeatures &= ~first.mappedFeature().getMask(); + for (StreamReadFeature f : other) { + _streamReadFeatures &= ~f.mappedFeature().getMask(); + } + return _this(); + } + + public B configure(StreamReadFeature f, boolean state) { + return state ? enable(f) : disable(f); + } + + // // // StreamWriteFeatures (replacement of non-json-specific generator features) + + public B enable(StreamWriteFeature f) { + _streamWriteFeatures |= f.mappedFeature().getMask(); + return _this(); + } + + public B enable(StreamWriteFeature first, StreamWriteFeature... other) { + _streamWriteFeatures |= first.mappedFeature().getMask(); + for (StreamWriteFeature f : other) { + _streamWriteFeatures |= f.mappedFeature().getMask(); + } + return _this(); + } + + public B disable(StreamWriteFeature f) { + _streamWriteFeatures &= ~f.mappedFeature().getMask(); + return _this(); + } + + public B disable(StreamWriteFeature first, StreamWriteFeature... other) { + _streamWriteFeatures &= ~first.mappedFeature().getMask(); + for (StreamWriteFeature f : other) { + _streamWriteFeatures &= ~f.mappedFeature().getMask(); + } + return _this(); + } + + public B configure(StreamWriteFeature f, boolean state) { + return state ? enable(f) : disable(f); + } + + /* 26-Jun-2018, tatu: This should not be needed here, but due to 2.x limitations, + * we do need to include it or require casting. + * Specifically: since `JsonFactory` (and not `TokenStreamFactory`) is base class + * for all backends, it can not expose JSON-specific builder, but this. + * So let's select lesser evil(s). + */ + + // // // JSON-specific, reads + + public B enable(JsonReadFeature f) { + return _failNonJSON(f); + } + + public B enable(JsonReadFeature first, JsonReadFeature... other) { + return _failNonJSON(first); + } + + public B disable(JsonReadFeature f) { + return _failNonJSON(f); + } + + public B disable(JsonReadFeature first, JsonReadFeature... other) { + return _failNonJSON(first); + } + + public B configure(JsonReadFeature f, boolean state) { + return _failNonJSON(f); + } + + private B _failNonJSON(Object feature) { + throw new IllegalArgumentException("Feature "+feature.getClass().getName() + +"#"+feature.toString()+" not supported for non-JSON backend"); + } + + // // // JSON-specific, writes + + public B enable(JsonWriteFeature f) { + return _failNonJSON(f); + } + + public B enable(JsonWriteFeature first, JsonWriteFeature... other) { + return _failNonJSON(first); + } + + public B disable(JsonWriteFeature f) { + return _failNonJSON(f); + } + + public B disable(JsonWriteFeature first, JsonWriteFeature... other) { + return _failNonJSON(first); + } + + public B configure(JsonWriteFeature f, boolean state) { + return _failNonJSON(f); + } + + // // // Other configuration + + public B inputDecorator(InputDecorator dec) { + _inputDecorator = dec; + return _this(); + } + + public B outputDecorator(OutputDecorator dec) { + _outputDecorator = dec; + return _this(); + } + + // // // Other methods + + /** + * Method for constructing actual {@link TokenStreamFactory} instance, given + * configuration. + * + * @return {@link TokenStreamFactory} build based on current configuration + */ + public abstract F build(); + + // silly convenience cast method we need + @SuppressWarnings("unchecked") + protected final B _this() { return (B) this; } + + // // // Support for subtypes + + protected void _legacyEnable(JsonParser.Feature f) { + if (f != null) { + _streamReadFeatures |= f.getMask(); + } + } + + protected void _legacyDisable(JsonParser.Feature f) { + if (f != null) { + _streamReadFeatures &= ~f.getMask(); + } + } + + protected void _legacyEnable(JsonGenerator.Feature f) { + if (f != null) { + _streamWriteFeatures |= f.getMask(); + } + } + protected void _legacyDisable(JsonGenerator.Feature f) { + if (f != null) { + _streamWriteFeatures &= ~f.getMask(); + } + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/TokenStreamFactory.java b/src/main/java/com/fasterxml/jackson/core/TokenStreamFactory.java index ac43808dae..c8a661b3c7 100644 --- a/src/main/java/com/fasterxml/jackson/core/TokenStreamFactory.java +++ b/src/main/java/com/fasterxml/jackson/core/TokenStreamFactory.java @@ -1,492 +1,30 @@ -/* Jackson JSON-processor. - * - * Copyright (c) 2007- Tatu Saloranta, tatu.saloranta@iki.fi - */ package com.fasterxml.jackson.core; import java.io.*; -import java.lang.ref.SoftReference; import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.Locale; -import com.fasterxml.jackson.core.async.ByteArrayFeeder; -import com.fasterxml.jackson.core.exc.WrappedIOException; -import com.fasterxml.jackson.core.io.*; -import com.fasterxml.jackson.core.json.JsonFactory; -import com.fasterxml.jackson.core.sym.PropertyNameMatcher; -import com.fasterxml.jackson.core.sym.SimpleNameMatcher; -import com.fasterxml.jackson.core.util.BufferRecycler; -import com.fasterxml.jackson.core.util.BufferRecyclers; -import com.fasterxml.jackson.core.util.JacksonFeature; -import com.fasterxml.jackson.core.util.Named; -import com.fasterxml.jackson.core.util.Snapshottable; +import com.fasterxml.jackson.core.io.DataOutputAsStream; /** - * The main factory class of Jackson streaming package, used to configure and - * construct token reader (aka parser, {@link JsonParser}) - * and token writer (aka generator, {@link JsonGenerator}) - * instances. - *

    - * Factory instances are thread-safe and reusable after configuration - * (if any). Typically applications and services use only a single - * globally shared factory instance, unless they need differently - * configured factories. Factory reuse is important if efficiency matters; - * most recycling of expensive construct is done on per-factory basis. - *

    - * Creation of a factory instance is a light-weight operation. + * Intermediate base class for actual format-specific factories for constructing + * parsers (reading) and generators (writing). Although full power will only be + * available with Jackson 3, skeletal implementation added in 2.10 to help conversion + * of code for 2.x to 3.x migration of projects depending on Jackson * - * @since 3.0 (refactored out of {@link JsonFactory}) + * @since 2.10 */ public abstract class TokenStreamFactory implements Versioned, - java.io.Serializable, - Snapshottable // 3.0 + java.io.Serializable { - private static final long serialVersionUID = 3L; - - /** - * Shareable stateles "empty" {@link ObjectWriteContext} Object, passed in - * cases where caller had not passed actual context -- "null object" of sort. - */ - public final static ObjectWriteContext EMPTY_WRITE_CONTEXT = new ObjectWriteContext.Base(); - - /* - /********************************************************************** - /* Helper types - /********************************************************************** - */ - - /** - * Enumeration that defines all on/off features that can only be - * changed for {@link TokenStreamFactory}. - */ - public enum Feature - implements JacksonFeature - { - - // // // Symbol handling (interning etc) - - /** - * Feature that determines whether JSON object property names are - * to be canonicalized using {@link String#intern} or not: - * if enabled, all property names will be intern()ed (and caller - * can count on this being true for all such names); if disabled, - * no intern()ing is done. There may still be basic - * canonicalization (that is, same String will be used to represent - * all identical object property names for a single document). - *

    - * Note: this setting only has effect if - * {@link #CANONICALIZE_PROPERTY_NAMES} is true -- otherwise no - * canonicalization of any sort is done. - *

    - * This setting is disabled by default since 3.0 (was enabled in 1.x and 2.x) - */ - INTERN_PROPERTY_NAMES(false), - - /** - * Feature that determines whether JSON object property names are - * to be canonicalized (details of how canonicalization is done - * then further specified by - * {@link #INTERN_PROPERTY_NAMES}). - *

    - * This setting is enabled by default. - */ - CANONICALIZE_PROPERTY_NAMES(true), - - /** - * Feature that determines what happens if we encounter a case in symbol - * handling where number of hash collisions exceeds a safety threshold - * -- which almost certainly means a denial-of-service attack via generated - * duplicate hash codes. - * If feature is enabled, an {@link IllegalStateException} is - * thrown to indicate the suspected denial-of-service attack; if disabled, processing continues but - * canonicalization (and thereby intern()ing) is disabled) as protective - * measure. - *

    - * This setting is enabled by default. - */ - FAIL_ON_SYMBOL_HASH_OVERFLOW(true), - - /** - * Feature that determines whether we will use {@link BufferRecycler} with - * {@link ThreadLocal} and {@link SoftReference}, for efficient reuse of - * underlying input/output buffers. - * This usually makes sense on normal J2SE/J2EE server-side processing; - * but may not make sense on platforms where {@link SoftReference} handling - * is broken (like Android), or if there are retention issues due to - * {@link ThreadLocal} (see - * Issue #189 - * for a possible case) - *

    - * This setting is enabled by default. - */ - USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING(true) - - ; - - /** - * Whether feature is enabled or disabled by default. - */ - private final boolean _defaultState; - - /** - * Method that calculates bit set (flags) of all features that - * are enabled by default. - * - * @return Bit mask of all features that are enabled by default - */ - public static int collectDefaults() { - int flags = 0; - for (Feature f : values()) { - if (f.enabledByDefault()) { flags |= f.getMask(); } - } - return flags; - } - - private Feature(boolean defaultState) { _defaultState = defaultState; } - - @Override - public boolean enabledByDefault() { return _defaultState; } - @Override - public boolean enabledIn(int flags) { return (flags & getMask()) != 0; } - @Override - public int getMask() { return (1 << ordinal()); } - } - - /** - * Since factory instances are immutable, a Builder class is needed for creating - * configurations for differently configured factory instances. - * - * @since 3.0 - */ - public abstract static class TSFBuilder> - { - /** - * Set of {@link TokenStreamFactory.Feature}s enabled, as bitmask. - */ - protected int _factoryFeatures; - - /** - * Set of {@link StreamReadFeature}s enabled, as bitmask. - */ - protected int _streamReadFeatures; - - /** - * Set of {@link StreamWriteFeature}s enabled, as bitmask. - */ - protected int _streamWriteFeatures; - - /** - * Set of format-specific read {@link FormatFeature}s enabled, as bitmask. - */ - protected int _formatReadFeatures; - - /** - * Set of format-specific write {@link FormatFeature}s enabled, as bitmask. - */ - protected int _formatWriteFeatures; - - // // // Construction - - protected TSFBuilder(int formatReadF, int formatWriteF) { - _factoryFeatures = DEFAULT_FACTORY_FEATURE_FLAGS; - _streamReadFeatures = DEFAULT_STREAM_READ_FEATURE_FLAGS; - _streamWriteFeatures = DEFAULT_STREAM_WRITE_FEATURE_FLAGS; - _formatReadFeatures = formatReadF; - _formatWriteFeatures = formatWriteF; - } - - protected TSFBuilder(TokenStreamFactory base) - { - this(base._factoryFeatures, - base._streamReadFeatures, base._streamWriteFeatures, - base._formatReadFeatures, base._formatWriteFeatures); - } - - protected TSFBuilder(int factoryFeatures, - int streamReadFeatures, int streamWriteFeatures, - int formatReadFeatures, int formatWriteFeatures) - { - _factoryFeatures = factoryFeatures; - _streamReadFeatures = streamReadFeatures; - _streamWriteFeatures = streamWriteFeatures; - _formatReadFeatures = formatReadFeatures; - _formatWriteFeatures = formatWriteFeatures; - } - - // // // Accessors - - public int factoryFeaturesMask() { return _factoryFeatures; } - public int streamReadFeaturesMask() { return _streamReadFeatures; } - public int streamWriteFeaturesMask() { return _streamWriteFeatures; } - - public int formatReadFeaturesMask() { return _formatReadFeatures; } - public int formatWriteFeaturesMask() { return _formatWriteFeatures; } - - // // // Factory features - - public B enable(TokenStreamFactory.Feature f) { - _factoryFeatures |= f.getMask(); - return _this(); - } - - public B disable(TokenStreamFactory.Feature f) { - _factoryFeatures &= ~f.getMask(); - return _this(); - } - - public B configure(TokenStreamFactory.Feature f, boolean state) { - return state ? enable(f) : disable(f); - } - - // // // Parser features - - public B enable(StreamReadFeature f) { - _streamReadFeatures |= f.getMask(); - return _this(); - } - - public B enable(StreamReadFeature first, StreamReadFeature... other) { - _streamReadFeatures |= first.getMask(); - for (StreamReadFeature f : other) { - _streamReadFeatures |= f.getMask(); - } - return _this(); - } - - public B disable(StreamReadFeature f) { - _streamReadFeatures &= ~f.getMask(); - return _this(); - } - - public B disable(StreamReadFeature first, StreamReadFeature... other) { - _streamReadFeatures &= ~first.getMask(); - for (StreamReadFeature f : other) { - _streamReadFeatures &= ~f.getMask(); - } - return _this(); - } - - public B configure(StreamReadFeature f, boolean state) { - return state ? enable(f) : disable(f); - } - - // // // Generator features - - public B enable(StreamWriteFeature f) { - _streamWriteFeatures |= f.getMask(); - return _this(); - } - - public B enable(StreamWriteFeature first, StreamWriteFeature... other) { - _streamWriteFeatures |= first.getMask(); - for (StreamWriteFeature f : other) { - _streamWriteFeatures |= f.getMask(); - } - return _this(); - } - - public B disable(StreamWriteFeature f) { - _streamWriteFeatures &= ~f.getMask(); - return _this(); - } - - public B disable(StreamWriteFeature first, StreamWriteFeature... other) { - _streamWriteFeatures &= ~first.getMask(); - for (StreamWriteFeature f : other) { - _streamWriteFeatures &= ~f.getMask(); - } - return _this(); - } - - public B configure(StreamWriteFeature f, boolean state) { - return state ? enable(f) : disable(f); - } - - // // // Other methods - - /** - * Method for constructing actual {@link TokenStreamFactory} instance, given - * configuration. - * - * @return {@link TokenStreamFactory} build using builder configuration settings - */ - public abstract F build(); - - // silly convenience cast method we need - @SuppressWarnings("unchecked") - protected final B _this() { return (B) this; } - } - - /* - /********************************************************************** - /* Constants - /********************************************************************** - */ - - /** - * Bitfield (set of flags) of all factory features that are enabled by default. - */ - protected final static int DEFAULT_FACTORY_FEATURE_FLAGS = TokenStreamFactory.Feature.collectDefaults(); - - /** - * Bitfield (set of flags) of all parser features that are enabled - * by default. - */ - protected final static int DEFAULT_STREAM_READ_FEATURE_FLAGS = StreamReadFeature.collectDefaults(); - - /** - * Bitfield (set of flags) of all generator features that are enabled - * by default. - */ - protected final static int DEFAULT_STREAM_WRITE_FEATURE_FLAGS = StreamWriteFeature.collectDefaults(); - - /* - /********************************************************************** - /* Configuration - /********************************************************************** - */ - - /** - * Currently enabled {@link TokenStreamFactory.Feature}s features as a bitmask. - */ - protected final int _factoryFeatures; - - /** - * Currently enabled {@link StreamReadFeature}s as a bitmask. - */ - protected final int _streamReadFeatures; - - /** - * Currently enabled {@link StreamWriteFeature}s as a bitmask. - */ - protected final int _streamWriteFeatures; - - /** - * Set of format-specific read features enabled, as bitmask. - */ - protected final int _formatReadFeatures; - - /** - * Set of format-specific write features enabled, as bitmask. - */ - protected final int _formatWriteFeatures; - - /* - /********************************************************************** - /* Construction - /********************************************************************** - */ - - /** - * Default constructor used to create factory instances. - * Creation of a factory instance is a light-weight operation, - * but it is still a good idea to reuse limited number of - * factory instances (and quite often just a single instance): - * factories are used as context for storing some reused - * processing objects (such as symbol tables parsers use) - * and this reuse only works within context of a single - * factory instance. - * - * @param formatReadFeatures Bitmask of format-specific read features enabled - * @param formatWriteFeatures Bitmask of format-specific write features enabled - */ - protected TokenStreamFactory(int formatReadFeatures, int formatWriteFeatures) { - _factoryFeatures = DEFAULT_FACTORY_FEATURE_FLAGS; - _streamReadFeatures = DEFAULT_STREAM_READ_FEATURE_FLAGS; - _streamWriteFeatures = DEFAULT_STREAM_WRITE_FEATURE_FLAGS; - _formatReadFeatures = formatReadFeatures; - _formatWriteFeatures = formatWriteFeatures; - } - - /** - * Constructors used by {@link TSFBuilder} for instantiation. Base builder is - * passed as-is to try to make interface between base types and implementations - * less likely to change (given that sub-classing is a fragile way to do it): - * if and when new general-purpose properties are added, implementation classes - * do not have to use different constructors. - * - * @param baseBuilder Builder with configuration to use - * - * @since 3.0 - */ - protected TokenStreamFactory(TSFBuilder baseBuilder) - { - _factoryFeatures = baseBuilder.factoryFeaturesMask(); - _streamReadFeatures = baseBuilder.streamReadFeaturesMask(); - _streamWriteFeatures = baseBuilder.streamWriteFeaturesMask(); - _formatReadFeatures = baseBuilder.formatReadFeaturesMask(); - _formatWriteFeatures = baseBuilder.formatWriteFeaturesMask(); - } - - /** - * Constructor used if a snapshot is created, or possibly for sub-classing or - * wrapping (delegating) - * - * @param src Source factory with configuration to copy - */ - protected TokenStreamFactory(TokenStreamFactory src) - { - _factoryFeatures = src._factoryFeatures; - _streamReadFeatures = src._streamReadFeatures; - _streamWriteFeatures = src._streamWriteFeatures; - _formatReadFeatures = src._formatReadFeatures; - _formatWriteFeatures = src._formatWriteFeatures; - } - - /** - * Method similar to {@link #snapshot()}, but one that forces creation of actual - * new copy that does NOT share any state, even non-visible to calling code, - * such as symbol table reuse. - *

    - * Implementation should be functionally equivalent to: - *

    -     *    factoryInstance.rebuild().build();
    -     *
    - * - * @return Newly constructed stream factory instance of same type as this one, - * with identical configuration settings - */ - public abstract TokenStreamFactory copy(); - - /** - * Method for constructing a new {@link TokenStreamFactory} that has - * the same settings as this instance, but is otherwise - * independent (i.e. nothing is actually shared, symbol tables - * are separate). - *

    - * Although assumption is that all factories are immutable -- and that we could - * usually simply return `this` -- method is left unimplemented at this level - * to make implementors aware of requirement to consider immutability. - * - * @return This factory instance to allow call chaining - * - * @since 3.0 - */ - @Override - public abstract TokenStreamFactory snapshot(); - - /** - * Method that can be used to create differently configured stream factories: it will - * create and return a Builder instance with exact settings of this stream factory. - * - * @return Builder instance initialized with configuration this stream factory has - * - * @since 3.0 - */ - public abstract TSFBuilder rebuild(); -// public abstract > TSFBuilder rebuild(); + private static final long serialVersionUID = 2; /* /********************************************************************** /* Capability introspection /********************************************************************** */ - + /** * Introspection method that higher-level functionality may call * to see whether underlying data format requires a stable ordering @@ -494,17 +32,26 @@ protected TokenStreamFactory(TokenStreamFactory src) * This is usually used for determining * whether to force a stable ordering (like alphabetic ordering by name) * if no ordering if explicitly specified. + *

    + * Default implementation returns false as JSON does NOT + * require stable ordering. Formats that require ordering include positional + * textual formats like CSV, and schema-based binary formats + * like Avro. * * @return Whether format supported by this factory * requires Object properties to be ordered. */ - public boolean requiresPropertyOrdering() { return false; } + public abstract boolean requiresPropertyOrdering(); /** * Introspection method that higher-level functionality may call * to see whether underlying data format can read and write binary - * data natively; that is, embedded it as-is without using encodings + * data natively; that is, embeded it as-is without using encodings * such as Base64. + *

    + * Default implementation returns false as JSON does not + * support native access: all binary content must use Base64 encoding. + * Most binary formats (like Smile and Avro) support native binary content. * * @return Whether format supported by this factory * supports native binary content @@ -528,10 +75,10 @@ protected TokenStreamFactory(TokenStreamFactory src) * null returned if none. * * @return Type of format-specific stream read features, if any; {@code null} if none + * + * @since 2.6 */ - public Class getFormatReadFeatureType() { - return null; - } + public abstract Class getFormatReadFeatureType(); /** * Method for accessing kind of {@link FormatFeature} that a parser @@ -539,10 +86,10 @@ public Class getFormatReadFeatureType() { * null returned if none. * * @return Type of format-specific stream read features, if any; {@code null} if none + * + * @since 2.6 */ - public Class getFormatWriteFeatureType() { - return null; - } + public abstract Class getFormatWriteFeatureType(); /* /********************************************************************** @@ -562,6 +109,8 @@ public Class getFormatWriteFeatureType() { * * @return Whether parsers and generators constructed by this factory * can use specified format schema instance + * + * @since 2.1 */ public abstract boolean canUseSchema(FormatSchema schema); @@ -575,706 +124,50 @@ public Class getFormatWriteFeatureType() { /* /********************************************************************** - /* Versioned - /********************************************************************** - */ - - @Override - public abstract Version version(); - - /* - /********************************************************************** - /* Configuration, access to features - /********************************************************************** - */ - - /** - * Checked whether specified parser feature is enabled. - * - * @param f Feature to check - * - * @return {@code True} if feature is enabled; {@code false} otherwise - */ - public final boolean isEnabled(TokenStreamFactory.Feature f) { - return (_factoryFeatures & f.getMask()) != 0; - } - - /** - * Checked whether specified parser feature is enabled. - * - * @param f Feature to check - * - * @return {@code True} if feature is enabled; {@code false} otherwise - */ - public final boolean isEnabled(StreamReadFeature f) { - return (_streamReadFeatures & f.getMask()) != 0; - } - - /** - * Checked whether specified parser feature is enabled. - * - * @param f Feature to check - * - * @return {@code True} if feature is enabled; {@code false} otherwise - */ - public final boolean isEnabled(StreamWriteFeature f) { - return (_streamWriteFeatures & f.getMask()) != 0; - } - - // @since 3.0 - public final int getStreamReadFeatures() { - return _streamReadFeatures; - } - - // @since 3.0 - public final int getStreamWriteFeatures() { - return _streamWriteFeatures; - } - - // @since 3.0 - public int getFormatReadFeatures() { return _formatReadFeatures; } - - // @since 3.0 - public int getFormatWriteFeatures() { return _formatWriteFeatures; } - - /* - /********************************************************************** - /* Factory methods for helper objects - /********************************************************************** - */ - - /** - * Factory method for constructing case-sensitive {@link PropertyNameMatcher} - * for given names. It will call {@link String#intern} on names unless specified - * that this has already been done by caller. - * - * @param matches Names to match, including both primary names and possible aliases - * @param alreadyInterned Whether name Strings are already {@code String.intern()ed} or not - * - * @return Case-sensitive {@link PropertyNameMatcher} instance to use - */ - public PropertyNameMatcher constructNameMatcher(List matches, boolean alreadyInterned) { - // 15-Nov-2017, tatu: Base implementation that is likely to work fine for - // most if not all implementations as it is more difficult to optimize - return SimpleNameMatcher.constructFrom(null, matches, alreadyInterned); - } - - /** - * Factory method for constructing case-insensitive {@link PropertyNameMatcher} - * for given names. It will call {@link String#intern} on names unless specified - * that this has already been done by caller. - * - * @param matches Names to match, including both primary names and possible aliases - * @param alreadyInterned Whether name Strings are already {@code String.intern()ed} or not - * @param locale Locale to use for case-handling - * - * @return Case-insensitive {@link PropertyNameMatcher} instance to use - */ - public PropertyNameMatcher constructCINameMatcher(List matches, boolean alreadyInterned, - Locale locale) { - return SimpleNameMatcher.constructCaseInsensitive(locale, matches, alreadyInterned); - } - - /* - /********************************************************************** - /* Parser factories, traditional (blocking) I/O sources - /********************************************************************** - */ - - /** - * Method for constructing parser instance to decode - * contents of specified file. - *

    - * Encoding is auto-detected from contents according to JSON - * specification recommended mechanism. Json specification - * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - * so auto-detection implemented only for this charsets. - * For other charsets use {@link #createParser(java.io.Reader)}. - *

    - * Underlying input stream (needed for reading contents) - * will be owned (and managed, i.e. closed as need be) by - * the parser, since caller has no access to it. - * - * @param readCtxt Object read context to use - * @param f File that contains content to parse - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public abstract JsonParser createParser(ObjectReadContext readCtxt, - File f) throws JacksonException; - - /** - * Method for constructing parser instance to decode - * contents of specified path. - *

    - * Encoding is auto-detected from contents according to JSON - * specification recommended mechanism. Json specification - * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - * so auto-detection implemented only for this charsets. - * For other charsets use {@link #createParser(java.io.Reader)}. - *

    - * Underlying input stream (needed for reading contents) - * will be owned (and managed, i.e. closed as need be) by - * the parser, since caller has no access to it. - * - * @param readCtxt Object read context to use - * @param p Path that contains content to parse - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - * - * @since 3.0 - */ - public abstract JsonParser createParser(ObjectReadContext readCtxt, - Path p) throws JacksonException; - - /** - * Method for constructing JSON parser instance to decode - * contents of resource reference by given URL. - * - *

    - * Encoding is auto-detected from contents according to JSON - * specification recommended mechanism. Json specification - * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - * so auto-detection implemented only for this charsets. - * For other charsets use {@link #createParser(java.io.Reader)}. - *

    - * Underlying input stream (needed for reading contents) - * will be owned (and managed, i.e. closed as need be) by - * the parser, since caller has no access to it. - * - * @param readCtxt Object read context to use - * @param url URL pointing to resource that contains content to parse - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public abstract JsonParser createParser(ObjectReadContext readCtxt, - URL url) throws JacksonException; - - /** - * Method for constructing JSON parser instance to parse - * the contents accessed via specified input stream. - *

    - * The input stream will not be owned by - * the parser, it will still be managed (i.e. closed if - * end-of-stream is reacher, or parser close method called) - * if (and only if) {@link com.fasterxml.jackson.core.StreamReadFeature#AUTO_CLOSE_SOURCE} - * is enabled. - *

    - * Note: no encoding argument is taken since it can always be - * auto-detected as suggested by JSON RFC. Json specification - * supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - * so auto-detection implemented only for this charsets. - * For other charsets use {@link #createParser(java.io.Reader)}. - * - * @param readCtxt Object read context to use - * @param in InputStream to use for reading content to parse - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public abstract JsonParser createParser(ObjectReadContext readCtxt, - InputStream in) throws JacksonException; - - /** - * Method for constructing parser for parsing - * the contents accessed via specified Reader. -

    - * The read stream will not be owned by - * the parser, it will still be managed (i.e. closed if - * end-of-stream is reacher, or parser close method called) - * if (and only if) {@link com.fasterxml.jackson.core.StreamReadFeature#AUTO_CLOSE_SOURCE} - * is enabled. - * - * @param readCtxt Object read context to use - * @param r Reader to use for reading content to parse - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public abstract JsonParser createParser(ObjectReadContext readCtxt, - Reader r) throws JacksonException; - - /** - * Method for constructing parser for parsing - * the contents of given byte array. - * - * @param readCtxt Object read context to use - * @param data Content to read - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public JsonParser createParser(ObjectReadContext readCtxt, byte[] data) throws JacksonException { - return createParser(readCtxt, data, 0, data.length); - } - - /** - * Method for constructing parser for parsing - * the contents of given byte array. - * - * @param readCtxt Object read context to use - * @param content Buffer that contains data to parse - * @param offset Offset of the first data byte within buffer - * @param len Length of contents to parse within buffer - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public abstract JsonParser createParser(ObjectReadContext readCtxt, - byte[] content, int offset, int len) throws JacksonException; - - /** - * Method for constructing parser for parsing contents of given String. - * - * @param readCtxt Object read context to use - * @param content Content to read - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public abstract JsonParser createParser(ObjectReadContext readCtxt, - String content) throws JacksonException; - - /** - * Method for constructing parser for parsing contents of given char array. - * - * @param readCtxt Object read context to use - * @param content Content to read - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public JsonParser createParser(ObjectReadContext readCtxt, - char[] content) throws JacksonException { - return createParser(readCtxt, content, 0, content.length); - } - - /** - * Method for constructing parser for parsing contents of given char array. - * - * @param readCtxt Object read context to use - * @param content Buffer that contains data to parse - * @param offset Offset of the first data byte within buffer - * @param len Length of contents to parse within buffer - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public abstract JsonParser createParser(ObjectReadContext readCtxt, - char[] content, int offset, int len) throws JacksonException; - - /* - /********************************************************************** - /* Parser factories, convenience methods that do not specify - /* `ObjectReadContext` + /* Configuration access /********************************************************************** */ - /** - * @param f File that contains content to parse - * @return Parser constructed - * @throws JacksonException If parser construction or initialization fails - * - * @deprecated Since 3.0 use {@link #createParser(ObjectReadContext,java.io.File)} - */ - @Deprecated - public JsonParser createParser(File f) throws JacksonException { - return createParser(ObjectReadContext.empty(), f); - } - - /** - * @param src Resource that contains content to parse - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - * - * @deprecated Since 3.0 use {@link #createParser(ObjectReadContext,java.net.URL)} - */ - @Deprecated - public JsonParser createParser(URL src) throws JacksonException { - return createParser(ObjectReadContext.empty(), src); - } - - /** - * @param in InputStream to use for reading content to parse - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - * - * @deprecated Since 3.0 use {@link #createParser(ObjectReadContext,java.io.InputStream)} - */ - @Deprecated - public JsonParser createParser(InputStream in) throws JacksonException { - return createParser(ObjectReadContext.empty(), in); - } - - /** - * @param r Reader to use for reading content to parse - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - * - * @deprecated Since 3.0 use {@link #createParser(ObjectReadContext,java.io.Reader)} - */ - @Deprecated - public JsonParser createParser(Reader r) throws JacksonException { - return createParser(ObjectReadContext.empty(), r); - } - - /** - * @param content Buffer that contains content to parse - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - * - * @deprecated Since 3.0 use {@link #createParser(ObjectReadContext,byte[])} - */ - @Deprecated - public JsonParser createParser(byte[] content) throws JacksonException { - return createParser(ObjectReadContext.empty(), content, 0, content.length); - } + public abstract boolean isEnabled(JsonParser.Feature f); + public abstract boolean isEnabled(JsonGenerator.Feature f); - /** - * @param content Buffer that contains content to parse - * @param offset Offset of the first data byte within buffer - * @param len Length of contents to parse within buffer - * - * @return Parser constructed - * @throws JacksonException If parser construction or initialization fails - * - * @deprecated Since 3.0 use {@link #createParser(ObjectReadContext,byte[],int,int)} - */ - @Deprecated - public JsonParser createParser(byte[] content, int offset, int len) throws JacksonException { - return createParser(ObjectReadContext.empty(), content, offset, len); - } + public abstract int getParserFeatures(); + public abstract int getGeneratorFeatures(); - /** - * @param content Content to parse - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - * - * @deprecated Since 3.0 use {@link #createParser(ObjectReadContext,String)} - */ - @Deprecated - public JsonParser createParser(String content) throws JacksonException { - return createParser(ObjectReadContext.empty(), content); - } - - /** - * @param content Buffer that contains data to parse - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - * - * @deprecated Since 3.0 use {@link #createParser(ObjectReadContext,char[])} - */ - @Deprecated - public JsonParser createParser(char[] content) throws JacksonException { - return createParser(ObjectReadContext.empty(), content, 0, content.length); - } - - /** - * @param content Buffer that contains data to parse - * @param offset Offset of the first data byte within buffer - * @param len Length of contents to parse within buffer - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - * - * @deprecated Since 3.0 use {@link #createParser(ObjectReadContext,char[],int,int)} - */ - @Deprecated - public JsonParser createParser(char[] content, int offset, int len) throws JacksonException { - return createParser(ObjectReadContext.empty(), content, offset, len); - } + public abstract int getFormatParserFeatures(); + public abstract int getFormatGeneratorFeatures(); /* /********************************************************************** - /* Parser factories, non-stream sources + /* Factory methods, parsers /********************************************************************** */ - /** - * Optional method for constructing parser for reading contents from specified {@link DataInput} - * instance. - *

    - * If this factory does not support {@link DataInput} as source, - * will throw {@link UnsupportedOperationException} - * - * @param readCtxt Object read context to use - * @param in InputStream to use for reading content to parse - * - * @return Parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public abstract JsonParser createParser(ObjectReadContext readCtxt, - DataInput in) throws JacksonException; + public abstract JsonParser createParser(byte[] data) throws IOException; + public abstract JsonParser createParser(byte[] data, int offset, int len) throws IOException; + public abstract JsonParser createParser(char[] content) throws IOException; + public abstract JsonParser createParser(char[] content, int offset, int len) throws IOException; + public abstract JsonParser createParser(DataInput in) throws IOException; + public abstract JsonParser createParser(File f) throws IOException; + public abstract JsonParser createParser(InputStream in) throws IOException; + public abstract JsonParser createParser(Reader r) throws IOException; + public abstract JsonParser createParser(String content) throws IOException; + public abstract JsonParser createParser(URL url) throws IOException; - /** - * Optional method for constructing parser for non-blocking parsing - * via {@link com.fasterxml.jackson.core.async.ByteArrayFeeder} - * interface (accessed using {@link JsonParser#nonBlockingInputFeeder()} - * from constructed instance). - *

    - * If this factory does not support non-blocking parsing (either at all, - * or from byte array), - * will throw {@link UnsupportedOperationException} - * - * @param

    Nominal type of parser constructed and returned - * @param readCtxt Object read context to use - * - * @return Non-blocking parser constructed - * - * @throws JacksonException If parser construction or initialization fails - */ - public

    P createNonBlockingByteArrayParser(ObjectReadContext readCtxt) throws JacksonException { - return _unsupported("Non-blocking source not (yet?) support for this format ("+getFormatName()+")"); - } + public abstract JsonParser createNonBlockingByteArrayParser() throws IOException; /* /********************************************************************** - /* Generator factories with databind context (3.0) + /* Factory methods, generators /********************************************************************** */ - /** - * Method for constructing generator that writes contents - * using specified {@link OutputStream}. - * Textual encoding used will be UTF-8, where applicable. - *

    - * Underlying stream is NOT owned by the generator constructed, - * so that generator will NOT close the output stream when - * {@link JsonGenerator#close} is called (unless auto-closing - * feature, - * {@link com.fasterxml.jackson.core.StreamWriteFeature#AUTO_CLOSE_TARGET} - * is enabled). - * Using application needs to close it explicitly if this is the case. - * - * @param writeCtxt Object-binding context where applicable; used for providing contextual - * configuration - * @param out OutputStream to use for writing content - * - * @return Generator constructed - * - * @throws JacksonException If generator construction or initialization fails - * - * @since 3.0 - */ - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, OutputStream out) - throws JacksonException { - return createGenerator(writeCtxt, out, JsonEncoding.UTF8); - } - - /** - * Method for constructing generator that writes contents - * using specified {@link OutputStream} with specified textual encoding - * (if applicable). - *

    - * Underlying stream is NOT owned by the generator constructed, - * so that generator will NOT close the output stream when - * {@link JsonGenerator#close} is called (unless auto-closing - * feature, - * {@link com.fasterxml.jackson.core.StreamWriteFeature#AUTO_CLOSE_TARGET} - * is enabled). - * Using application needs to close it explicitly if this is the case. - * - * @param writeCtxt Object-binding context where applicable; used for providing contextual - * configuration - * @param out OutputStream to use for writing content - * @param enc Character set encoding to use (usually {@link JsonEncoding#UTF8}) - * - * @return Generator constructed - * - * @throws JacksonException If generator construction or initialization fails - * - * @since 3.0 - */ - public abstract JsonGenerator createGenerator(ObjectWriteContext writeCtxt, - OutputStream out, JsonEncoding enc) - throws JacksonException; - - /** - * Method for constructing generator that writes contents - * using specified {@link Writer}. - * Textual encoding used will be UTF-8, where applicable. - *

    - * Underlying stream is NOT owned by the generator constructed, - * so that generator will NOT close the Reader when - * {@link JsonGenerator#close} is called (unless auto-closing - * feature, - * {@link com.fasterxml.jackson.core.StreamWriteFeature#AUTO_CLOSE_TARGET} is enabled). - * Using application needs to close it explicitly. - * - * @param writeCtxt Object-binding context where applicable; used for providing contextual - * configuration - * @param w Writer to use for writing content - * - * @return Generator constructed - * - * @throws JacksonException If generator construction or initialization fails - * - * @since 3.0 - */ - public abstract JsonGenerator createGenerator(ObjectWriteContext writeCtxt, Writer w) - throws JacksonException; - - /** - * Method for constructing generator that writes contents - * to specified file, overwriting contents it might have (or creating - * it if such file does not yet exist). - *

    - * Underlying stream is owned by the generator constructed, - * i.e. generator will handle closing of file when - * {@link JsonGenerator#close} is called. - * - * @param writeCtxt Object-binding context where applicable; used for providing contextual - * configuration - * @param f File to write contents to - * @param enc Character set encoding to use (usually {@link JsonEncoding#UTF8}) - * - * @return Generator constructed - * - * @throws JacksonException If generator construction or initialization fails - * - * @since 3.0 - */ - public abstract JsonGenerator createGenerator(ObjectWriteContext writeCtxt, File f, - JsonEncoding enc) - throws JacksonException; - - /** - * Method for constructing generator that writes contents - * to specified path, overwriting contents it might have (or creating - * it if such path does not yet exist). - *

    - * Underlying stream is owned by the generator constructed, - * i.e. generator will handle closing of path when - * {@link JsonGenerator#close} is called. - * - * @param writeCtxt Object-binding context where applicable; used for providing contextual - * configuration - * @param p Path to write contents to - * @param enc Character set encoding to use (usually {@link JsonEncoding#UTF8}) - * - * @return Generator constructed - * - * @throws JacksonException If generator construction or initialization fails - * - * @since 3.0 - */ - public abstract JsonGenerator createGenerator(ObjectWriteContext writeCtxt, Path p, - JsonEncoding enc) - throws JacksonException; - - /** - * Method for constructing generator that writes content into specified {@link DataOutput}, - * using UTF-8 encoding (with formats where encoding is user-configurable). - * - * @param writeCtxt Object-binding context where applicable; used for providing contextual - * configuration - * @param out {@link DataOutput} used as target of generation - * - * @return Generator constructed - * - * @throws JacksonException If generator construction or initialization fails - * - * @since 3.0 - */ - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, DataOutput out) - throws JacksonException { - return createGenerator(writeCtxt, _createDataOutputWrapper(out)); - } - - /* - /********************************************************************** - /* Generator factories, convenience methods that do not specify - /* `ObjectWriteContext` - /********************************************************************** - */ - - /** - * Method for constructing JSON generator for writing content - * using specified output stream. - * Encoding to use must be specified, and needs to be one of available - * types (as per JSON specification). - *

    - * Underlying stream is NOT owned by the generator constructed, - * so that generator will NOT close the output stream when - * {@link JsonGenerator#close} is called (unless auto-closing - * feature, - * {@link com.fasterxml.jackson.core.StreamWriteFeature#AUTO_CLOSE_TARGET} - * is enabled). - * Using application needs to close it explicitly if this is the case. - *

    - * Note: there are formats that use fixed encoding (like most binary data formats) - * and that ignore passed in encoding. - * - * @param out OutputStream to use for writing content - * @param enc Character encoding to use - * - * @return Generator constructed - * - * @throws JacksonException If generator construction or initialization fails - */ - @Deprecated // since 3.0 - public JsonGenerator createGenerator(OutputStream out, JsonEncoding enc) - throws JacksonException { - return createGenerator(ObjectWriteContext.empty(), out, enc); - } - - /** - * Convenience method for constructing generator that uses default - * encoding of the format (UTF-8 for JSON and most other data formats), - * - * @param out OutputStream to use for writing content - * - * @return Generator constructed - * - * @throws JacksonException If generator construction or initialization fails - */ - @Deprecated // since 3.0 - public JsonGenerator createGenerator(OutputStream out) throws JacksonException { - return createGenerator(ObjectWriteContext.empty(), out, JsonEncoding.UTF8); - } - - /** - * Method for constructing JSON generator for writing content - * using specified Writer. - *

    - * Underlying stream is NOT owned by the generator constructed, - * so that generator will NOT close the Reader when - * {@link JsonGenerator#close} is called (unless auto-closing - * feature, - * {@link com.fasterxml.jackson.core.StreamWriteFeature#AUTO_CLOSE_TARGET} is enabled). - * Using application needs to close it explicitly. - * - * @param w Writer to use for writing content - * - * @return Generator constructed - * - * @throws JacksonException If generator construction or initialization fails - */ - @Deprecated // since 3.0 - public JsonGenerator createGenerator(Writer w) throws JacksonException { - return createGenerator(ObjectWriteContext.empty(), w); - } + public abstract JsonGenerator createGenerator(DataOutput out, JsonEncoding enc) throws IOException; + public abstract JsonGenerator createGenerator(DataOutput out) throws IOException; + public abstract JsonGenerator createGenerator(File f, JsonEncoding enc) throws IOException; + public abstract JsonGenerator createGenerator(OutputStream out) throws IOException; + public abstract JsonGenerator createGenerator(OutputStream out, JsonEncoding enc) throws IOException; + public abstract JsonGenerator createGenerator(Writer w) throws IOException; /* /********************************************************************** @@ -1282,82 +175,9 @@ public JsonGenerator createGenerator(Writer w) throws JacksonException { /********************************************************************** */ - /** - * Method used by factory to create buffer recycler instances - * for parsers and generators. - *

    - * Note: only public to give access for {@code ObjectMapper} - * - * @return BufferRecycler instance to use - */ - public BufferRecycler _getBufferRecycler() - { - // 23-Apr-2015, tatu: Let's allow disabling of buffer recycling - // scheme, for cases where it is considered harmful (possibly - // on Android, for example) - if (Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING.enabledIn(_factoryFeatures)) { - return BufferRecyclers.getBufferRecycler(); - } - return new BufferRecycler(); - } - - /** - * Overridable factory method that actually instantiates desired - * context object. - * - * @param contentRef Source reference to use (relevant to {@code JsonLocation} construction) - * @param resourceManaged Whether input/output buffers used are managed by this factory - * - * @return Context constructed - */ - protected IOContext _createContext(ContentReference contentRef, boolean resourceManaged) { - return new IOContext(_getBufferRecycler(), contentRef, resourceManaged, null); - } - - /** - * Overridable factory method that actually instantiates desired - * context object. - * - * @param contentRef Source reference to use (relevant to {@code JsonLocation} construction) - * @param resourceManaged Whether input/output buffers used are managed by this factory - * @param enc Character encoding defined to be used/expected - * - * @return Context constructed - */ - protected IOContext _createContext(ContentReference contentRef, boolean resourceManaged, - JsonEncoding enc) { - return new IOContext(_getBufferRecycler(), contentRef, resourceManaged, enc); - } - - /** - * Overridable factory method for constructing {@link ContentReference} - * to pass to parser or generator being created; used in cases where no offset - * or length is applicable (either irrelevant, or full contents assumed). - * - * @param contentRef Underlying input source (parser) or target (generator) - * - * @return InputSourceReference instance to use - */ - protected abstract ContentReference _createContentReference(Object contentRef); - - /** - * Overridable factory method for constructing {@link ContentReference} - * to pass to parser or generator being created; used in cases where input - * comes in a static buffer with relevant offset and length. - * - * @param contentRef Underlying input source (parser) or target (generator) - * @param offset Offset of content in buffer ({@code rawSource}) - * @param length Length of content in buffer ({@code rawSource}) - * - * @return InputSourceReference instance to use - */ - protected abstract ContentReference _createContentReference(Object contentRef, - int offset, int length); - protected OutputStream _createDataOutputWrapper(DataOutput out) { return new DataOutputAsStream(out); } - /** * Helper methods used for constructing an optimal stream for * parsers to use, when input is to be read from an URL. @@ -1367,9 +187,9 @@ protected OutputStream _createDataOutputWrapper(DataOutput out) { * * @return InputStream constructed for given {@link URL} * - * @throws JacksonException If there is a problem accessing content from specified {@link URL} + * @throws IOException If there is a problem accessing content from specified {@link URL} */ - protected InputStream _optimizedStreamFromURL(URL url) throws JacksonException { + protected InputStream _optimizedStreamFromURL(URL url) throws IOException { if ("file".equals(url.getProtocol())) { /* Can not do this if the path refers * to a network drive on windows. This fixes the problem; @@ -1382,67 +202,12 @@ protected InputStream _optimizedStreamFromURL(URL url) throws JacksonException { // [core#48]: Let's try to avoid probs with URL encoded stuff String path = url.getPath(); if (path.indexOf('%') < 0) { - try { - return new FileInputStream(url.getPath()); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + return new FileInputStream(url.getPath()); + } // otherwise, let's fall through and let URL decoder do its magic } } - try { - return url.openStream(); - } catch (IOException e) { - throw _wrapIOFailure(e); - } - } - - protected InputStream _fileInputStream(File f) throws JacksonException - { - try { - return new FileInputStream(f); - } catch (IOException e) { - throw _wrapIOFailure(e); - } - } - - protected InputStream _pathInputStream(Path p) throws JacksonException - { - try { - return Files.newInputStream(p); - } catch (IOException e) { - throw _wrapIOFailure(e); - } - } - - protected OutputStream _fileOutputStream(File f) throws JacksonException - { - try { - return new FileOutputStream(f); - } catch (IOException e) { - throw _wrapIOFailure(e); - } - } - - protected OutputStream _pathOutputStream(Path p) throws JacksonException - { - try { - return Files.newOutputStream(p); - } catch (IOException e) { - throw _wrapIOFailure(e); - } - } - - protected JacksonException _wrapIOFailure(IOException e) { - return WrappedIOException.construct(e, this); - } - - protected T _unsupported() { - return _unsupported("Operation not supported for this format (%s)", getFormatName()); - } - - protected T _unsupported(String str, Object... args) { - throw new UnsupportedOperationException(String.format(str, args)); + return url.openStream(); } } diff --git a/src/main/java/com/fasterxml/jackson/core/TreeCodec.java b/src/main/java/com/fasterxml/jackson/core/TreeCodec.java index b61f3fc8ae..7b4e625723 100644 --- a/src/main/java/com/fasterxml/jackson/core/TreeCodec.java +++ b/src/main/java/com/fasterxml/jackson/core/TreeCodec.java @@ -1,32 +1,38 @@ package com.fasterxml.jackson.core; -import com.fasterxml.jackson.core.tree.ArrayTreeNode; -import com.fasterxml.jackson.core.tree.ObjectTreeNode; +import java.io.IOException; /** * Interface that defines objects that can read and write * {@link TreeNode} instances using Streaming API. + * + * @since 2.3 */ -public interface TreeCodec +public abstract class TreeCodec { - // // // Factory methods - - public abstract ArrayTreeNode createArrayNode(); - public abstract ObjectTreeNode createObjectNode(); - - public abstract TreeNode booleanNode(boolean b); - public abstract TreeNode stringNode(String text); - - public abstract TreeNode missingNode(); - public abstract TreeNode nullNode(); - - // // // Read methods - + public abstract T readTree(JsonParser p) throws IOException, JsonProcessingException; + public abstract void writeTree(JsonGenerator g, TreeNode tree) throws IOException, JsonProcessingException; + + /** + * @return Node that represents "missing" node during traversal: something + * referenced but that does not exist in content model + * + * @since 2.10 + */ + public TreeNode missingNode() { + return null; + } + + /** + * @return Node that represents explict {@code null} value in content + * + * @since 2.10 + */ + public TreeNode nullNode() { + return null; + } + + public abstract TreeNode createArrayNode(); + public abstract TreeNode createObjectNode(); public abstract JsonParser treeAsTokens(TreeNode node); - - public abstract T readTree(JsonParser p) throws JacksonException; - - // // // Write methods - - public abstract void writeTree(JsonGenerator g, TreeNode tree) throws JacksonException; } diff --git a/src/main/java/com/fasterxml/jackson/core/TreeNode.java b/src/main/java/com/fasterxml/jackson/core/TreeNode.java index aa293430e8..647a4be51d 100644 --- a/src/main/java/com/fasterxml/jackson/core/TreeNode.java +++ b/src/main/java/com/fasterxml/jackson/core/TreeNode.java @@ -10,17 +10,31 @@ /** * Marker interface used to denote JSON Tree nodes, as far as * the core package knows them (which is very little): mostly - * needed to allow {@link ObjectReadContext} and {@link ObjectWriteContext} - * to have some level of interoperability. - * Most functionality is within {@code JsonNode} - * base class in {@code databind} package. + * needed to allow {@link ObjectCodec} to have some level + * of interoperability. + * Most functionality is within JsonNode + * base class in mapper package. + *

    + * Note that in Jackson 1.x JsonNode itself + * was part of core package: Jackson 2.x refactored this + * since conceptually Tree Model is part of mapper package, + * and so part visible to core package should + * be minimized. + *

    + * NOTE: starting with Jackson 2.2, there is more functionality + * available via this class, and the intent was that this should + * form actual base for multiple alternative tree representations; + * for example, immutable trees could use different implementation + * than mutable trees. + * + * @since 2.2 */ public interface TreeNode { /* - /********************************************************************** + /********************************************************** /* Minimal introspection methods - /********************************************************************** + /********************************************************** */ /** @@ -47,10 +61,12 @@ public interface TreeNode /** * Method that returns number of child nodes this node contains: * for Array nodes, number of child elements, for Object nodes, - * number of properties, and for all other nodes 0. + * number of fields, and for all other nodes 0. * * @return For non-container nodes returns 0; for arrays number of - * contained elements, and for objects number of properties. + * contained elements, and for objects number of fields. + * + * @since 2.2 */ int size(); @@ -66,6 +82,8 @@ public interface TreeNode * * @return True if this node is considered a value node; something that * represents either a scalar value or explicit {@code null} + * + * @since 2.2 */ boolean isValueNode(); @@ -77,6 +95,8 @@ public interface TreeNode * returns true for any given node. * * @return {@code True} for Array and Object nodes, {@code false} otherwise + * + * @since 2.2 */ boolean isContainerNode(); @@ -90,6 +110,8 @@ public interface TreeNode * returns true for any given node. * * @return {@code True} if this node represents a "missing" node + * + * @since 2.2 */ boolean isMissingNode(); @@ -100,6 +122,8 @@ public interface TreeNode * must also return true. * * @return {@code True} for Array nodes, {@code false} for everything else + * + * @since 2.2 */ boolean isArray(); @@ -110,56 +134,36 @@ public interface TreeNode * must also return true. * * @return {@code True} for Object nodes, {@code false} for everything else + * + * @since 2.2 */ boolean isObject(); - /** - * Method that returns true if this node is a node that represents - * logical {@code null} value. - * - * @return {@code True} for nodes representing explicit input {@code null}, - * {@code false} for everything else - * - * @since 3.0 - */ - boolean isNull(); - - /** - * Method that returns true if this node represents an embedded - * "foreign" (or perhaps native?) object (like POJO), not represented - * as regular content. Such nodes are used to pass information that - * either native format can not express as-is, metadata not included within - * at all, or something else that requires special handling. - * - * @return {@code True} for nodes representing "embedded" (or format-specific, native) - * value -- ones that streaming api exposes as {@link JsonToken#VALUE_EMBEDDED_OBJECT} - * -- {@code false} for other nodes - * - * @since 3.0 - */ - boolean isEmbeddedValue(); - /* - /********************************************************************** + /********************************************************** /* Basic traversal through structured entries (Arrays, Objects) - /********************************************************************** + /********************************************************** */ /** - * Method for accessing value of the specified property of - * an Object node. If this node is not an Object (or it - * does not have a value for specified property) {@code null} is returned. + * Method for accessing value of the specified field of + * an object node. If this node is not an object (or it + * does not have a value for specified field name), or + * if there is no field with such name, null is returned. *

    * NOTE: handling of explicit null values may vary between - * implementations; some trees may retain explicit nulls, others not. + * implementations; some trees may retain explicit nulls, others + * not. * - * @param propertyName Name of the property to access + * @param fieldName Name of the field (of Object node) to access * - * @return Node that represent value of the specified property, + * @return Node that represent value of the specified field, * if this node is an Object and has value for the specified - * property; {@code null} otherwise. + * field; {@code null} otherwise. + * + * @since 2.2 */ - TreeNode get(String propertyName); + TreeNode get(String fieldName); /** * Method for accessing value of the specified element of @@ -178,22 +182,26 @@ public interface TreeNode * @return Node that represent value of the specified element, * if this node is an array and has specified element; * {@code null} otherwise. + * + * @since 2.2 */ TreeNode get(int index); /** - * Method for accessing value of the specified property of - * an Object node. + * Method for accessing value of the specified field of + * an object node. * For other nodes, a "missing node" (virtual node * for which {@link #isMissingNode} returns true) is returned. * - * @param propertyName Name of the property to access + * @param fieldName Name of the field (of Object node) to access * - * @return Node that represent value of the specified Object property, - * if this node is an object and has value for the specified property; + * @return Node that represent value of the specified field, + * if this node is an object and has value for the specified field; * otherwise "missing node" is returned. + * + * @since 2.2 */ - TreeNode path(String propertyName); + TreeNode path(String fieldName); /** * Method for accessing value of the specified element of @@ -214,18 +222,22 @@ public interface TreeNode * @return Node that represent value of the specified element, * if this node is an array and has specified element; * otherwise "missing node" is returned. + * + * @since 2.2 */ TreeNode path(int index); /** - * Method for accessing names of all properties for this node, iff - * this node is an Object node. Number of property names accessible + * Method for accessing names of all fields for this node, iff + * this node is an Object node. Number of field names accessible * will be {@link #size}. * - * @return An iterator for traversing names of all properties this Object node + * @return An iterator for traversing names of all fields this Object node * has (if Object node); empty {@link Iterator} otherwise (never {@code null}). + * + * @since 2.2 */ - Iterator propertyNames(); + Iterator fieldNames(); /** * Method for locating node specified by given JSON pointer instances. @@ -237,6 +249,8 @@ public interface TreeNode * @return Node that matches given JSON Pointer, if any: if no match exists, * will return a "missing" node (for which {@link TreeNode#isMissingNode()} * returns {@code true}). + * + * @since 2.3 */ TreeNode at(JsonPointer ptr); @@ -250,35 +264,57 @@ public interface TreeNode * {@link JsonPointer} instance once and reuse it: this method will not perform * any caching of compiled expressions. * - * @param ptrExpr Expression to compile as a {@link JsonPointer} + * @param jsonPointerExpression Expression to compile as a {@link JsonPointer} * instance * * @return Node that matches given JSON Pointer, if any: if no match exists, * will return a "missing" node (for which {@link TreeNode#isMissingNode()} * returns {@code true}). + * + * @since 2.3 */ - TreeNode at(String ptrExpr) throws IllegalArgumentException; - + TreeNode at(String jsonPointerExpression) throws IllegalArgumentException; + /* - /********************************************************************** + /********************************************************** /* Converting to/from Streaming API - /********************************************************************** + /********************************************************** */ /** * Method for constructing a {@link JsonParser} instance for * iterating over contents of the tree that this node is root of. - * Functionally equivalent to first serializing tree and then re-parsing but + * Functionally equivalent to first serializing tree using + * {@link ObjectCodec} and then re-parsing but * more efficient. *

    * NOTE: constructed parser instance will NOT initially point to a token, * so before passing it to deserializers, it is typically necessary to * advance it to the first available token by calling {@link JsonParser#nextToken()}. + *

    + * Also note that calling this method will NOT pass {@link ObjectCodec} + * reference, so data-binding callback methods like {@link JsonParser#readValueAs(Class)} + * will not work with calling {@link JsonParser#setCodec}). + * It is often better to call {@link #traverse(ObjectCodec)} to pass the codec explicitly. + * + * @return {@link JsonParser} that will stream over contents of this node + */ + JsonParser traverse(); + + /** + * Same as {@link #traverse()}, but additionally passes {@link com.fasterxml.jackson.core.ObjectCodec} + * to use if {@link JsonParser#readValueAs(Class)} is used (otherwise caller must call + * {@link JsonParser#setCodec} on response explicitly). + *

    + * NOTE: constructed parser instance will NOT initially point to a token, + * so before passing it to deserializers, it is typically necessary to + * advance it to the first available token by calling {@link JsonParser#nextToken()}. * - * @param readCtxt {@link ObjectReadContext} to associate with parser constructed - * (to allow seamless databinding functionality) + * @param codec {@link ObjectCodec} to associate with parser constructed * * @return {@link JsonParser} that will stream over contents of this node + * + * @since 2.1 */ - JsonParser traverse(ObjectReadContext readCtxt); + JsonParser traverse(ObjectCodec codec); } diff --git a/src/main/java/com/fasterxml/jackson/core/Version.java b/src/main/java/com/fasterxml/jackson/core/Version.java index 321aff1601..f53aad29a7 100644 --- a/src/main/java/com/fasterxml/jackson/core/Version.java +++ b/src/main/java/com/fasterxml/jackson/core/Version.java @@ -41,16 +41,23 @@ public class Version * @param minor Minor version number * @param patchLevel patch level of version * @param snapshotInfo Optional additional string qualifier - * @param groupId Maven group id - * @param artifactId Maven artifact id + * + * @since 2.1 + * @deprecated Use variant that takes group and artifact ids */ + @Deprecated + public Version(int major, int minor, int patchLevel, String snapshotInfo) + { + this(major, minor, patchLevel, snapshotInfo, null, null); + } + public Version(int major, int minor, int patchLevel, String snapshotInfo, String groupId, String artifactId) { _majorVersion = major; _minorVersion = minor; _patchLevel = patchLevel; - _snapshotInfo = (snapshotInfo == null) ? "" : snapshotInfo; + _snapshotInfo = snapshotInfo; _groupId = (groupId == null) ? "" : groupId; _artifactId = (artifactId == null) ? "" : artifactId; } @@ -67,10 +74,21 @@ public Version(int major, int minor, int patchLevel, String snapshotInfo, /** * @return {@code True} if this instance is the one returned by * call to {@link #unknownVersion()} + * + * @since 2.7 to replace misspelled {@link #isUknownVersion()} */ public boolean isUnknownVersion() { return (this == UNKNOWN_VERSION); } - public boolean isSnapshot() { return (_snapshotInfo != null) && (_snapshotInfo.length() > 0); } + public boolean isSnapshot() { return (_snapshotInfo != null && _snapshotInfo.length() > 0); } + + /** + * @return {@code True} if this instance is the one returned by + * call to {@link #unknownVersion()} + * + * @deprecated Since 2.7 use correctly spelled method {@link #isUnknownVersion()} + */ + @Deprecated + public boolean isUknownVersion() { return isUnknownVersion(); } public int getMajorVersion() { return _majorVersion; } public int getMinorVersion() { return _minorVersion; } @@ -95,8 +113,7 @@ public String toFullString() { } @Override public int hashCode() { - return _artifactId.hashCode() ^ _groupId.hashCode() - + _majorVersion - _minorVersion + _patchLevel; + return _artifactId.hashCode() ^ _groupId.hashCode() + _majorVersion - _minorVersion + _patchLevel; } @Override @@ -109,7 +126,6 @@ public boolean equals(Object o) return (other._majorVersion == _majorVersion) && (other._minorVersion == _minorVersion) && (other._patchLevel == _patchLevel) - && other._snapshotInfo.equals(_snapshotInfo) && other._artifactId.equals(_artifactId) && other._groupId.equals(_groupId) ; @@ -129,9 +145,6 @@ public int compareTo(Version other) diff = _minorVersion - other._minorVersion; if (diff == 0) { diff = _patchLevel - other._patchLevel; - if (diff == 0) { - diff = _snapshotInfo.compareTo(other._snapshotInfo); - } } } } diff --git a/src/main/java/com/fasterxml/jackson/core/async/ByteArrayFeeder.java b/src/main/java/com/fasterxml/jackson/core/async/ByteArrayFeeder.java index 57abbe034b..f80b4da2a7 100644 --- a/src/main/java/com/fasterxml/jackson/core/async/ByteArrayFeeder.java +++ b/src/main/java/com/fasterxml/jackson/core/async/ByteArrayFeeder.java @@ -1,10 +1,12 @@ package com.fasterxml.jackson.core.async; -import com.fasterxml.jackson.core.JacksonException; +import java.io.IOException; /** * {@link NonBlockingInputFeeder} implementation used when feeding data * as byte arrays. + * + * @since 2.9 */ public interface ByteArrayFeeder extends NonBlockingInputFeeder { @@ -18,8 +20,8 @@ public interface ByteArrayFeeder extends NonBlockingInputFeeder * @param offset Offset within array where input data to process starts * @param end Offset after last byte contained in the input array * - * @throws JacksonException if the state is such that this method should not be called + * @throws IOException if the state is such that this method should not be called * (has not yet consumed existing input data, or has been marked as closed) */ - public void feedInput(byte[] data, int offset, int end) throws JacksonException; + public void feedInput(byte[] data, int offset, int end) throws IOException; } diff --git a/src/main/java/com/fasterxml/jackson/core/async/ByteBufferFeeder.java b/src/main/java/com/fasterxml/jackson/core/async/ByteBufferFeeder.java index fae0eb8c21..8fc80df643 100644 --- a/src/main/java/com/fasterxml/jackson/core/async/ByteBufferFeeder.java +++ b/src/main/java/com/fasterxml/jackson/core/async/ByteBufferFeeder.java @@ -1,12 +1,13 @@ package com.fasterxml.jackson.core.async; +import java.io.IOException; import java.nio.ByteBuffer; -import com.fasterxml.jackson.core.JacksonException; - /** * {@link NonBlockingInputFeeder} implementation used when feeding data * as {@link ByteBuffer} contents. + * + * @since 2.9 */ public interface ByteBufferFeeder extends NonBlockingInputFeeder { @@ -16,8 +17,8 @@ public interface ByteBufferFeeder extends NonBlockingInputFeeder * * @param buffer Buffer that contains additional input to read * - * @throws JacksonException if the state is such that this method should not be called + * @throws IOException if the state is such that this method should not be called * (has not yet consumed existing input data, or has been marked as closed) */ - public void feedInput(ByteBuffer buffer) throws JacksonException; + public void feedInput(ByteBuffer buffer) throws IOException; } diff --git a/src/main/java/com/fasterxml/jackson/core/async/package-info.java b/src/main/java/com/fasterxml/jackson/core/async/package-info.java index a0d1775d32..c7d2782fa7 100644 --- a/src/main/java/com/fasterxml/jackson/core/async/package-info.java +++ b/src/main/java/com/fasterxml/jackson/core/async/package-info.java @@ -2,7 +2,7 @@ * Package that contains abstractions needed to support optional * non-blocking decoding (parsing) functionality. * Although parsers are constructed normally via - * {@link com.fasterxml.jackson.core.json.JsonFactory} + * {@link com.fasterxml.jackson.core.JsonFactory} * (and are, in fact, sub-types of {@link com.fasterxml.jackson.core.JsonParser}), * the way input is provided differs. * diff --git a/src/main/java/com/fasterxml/jackson/core/base/BinaryTSFactory.java b/src/main/java/com/fasterxml/jackson/core/base/BinaryTSFactory.java deleted file mode 100644 index 89cbf067d8..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/base/BinaryTSFactory.java +++ /dev/null @@ -1,250 +0,0 @@ -package com.fasterxml.jackson.core.base; - -import java.io.*; -import java.net.URL; -import java.nio.file.Path; - -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.io.IOContext; -import com.fasterxml.jackson.core.io.ContentReference; - -/** - * Intermediate {@link TokenStreamFactory} sub-class used as the base for - * binary (non-textual) data formats. - */ -@SuppressWarnings("resource") -public abstract class BinaryTSFactory - extends DecorableTSFactory - implements java.io.Serializable -{ - private static final long serialVersionUID = 3L; - - /* - /********************************************************************** - /* Construction - /********************************************************************** - */ - - protected BinaryTSFactory(int formatPF, int formatGF) { - super(formatPF, formatGF); - } - - /** - * Constructor used by builders for instantiation. - * - * @param baseBuilder Builder with configurations to use - * - * @since 3.0 - */ - protected BinaryTSFactory(DecorableTSFBuilder baseBuilder) - { - super(baseBuilder); - } - - // Copy constructor. - protected BinaryTSFactory(BinaryTSFactory src) { - super(src); - } - - /* - /********************************************************************** - /* Default introspection - /********************************************************************** - */ - - @Override - public boolean canHandleBinaryNatively() { - // binary formats tend to support native inclusion: - return true; - } - - /* - /********************************************************************** - /* Factory methods: parsers - /********************************************************************** - */ - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - File f) throws JacksonException - { - final InputStream in = _fileInputStream(f); - // true, since we create InputStream from File - final IOContext ioCtxt = _createContext(_createContentReference(f), true); - return _createParser(readCtxt, ioCtxt, - _decorate(ioCtxt, in)); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - Path p) throws JacksonException - { - // true, since we create InputStream from Path - IOContext ioCtxt = _createContext(_createContentReference(p), true); - return _createParser(readCtxt, ioCtxt, - _decorate(ioCtxt, _pathInputStream(p))); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - URL url) throws JacksonException - { - // true, since we create InputStream from URL - IOContext ioCtxt = _createContext(_createContentReference(url), true); - InputStream in = _optimizedStreamFromURL(url); - return _createParser(readCtxt, ioCtxt, - _decorate(ioCtxt, in)); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, InputStream in) throws JacksonException { - IOContext ioCtxt = _createContext(_createContentReference(in), false); - return _createParser(readCtxt, ioCtxt, _decorate(ioCtxt, in)); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, Reader r) throws JacksonException { - return _nonByteSource(); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - byte[] data, int offset, int len) throws JacksonException - { - IOContext ioCtxt = _createContext(_createContentReference(data, offset, len), - true, null); - if (_inputDecorator != null) { - InputStream in = _inputDecorator.decorate(ioCtxt, data, offset, len); - if (in != null) { - return _createParser(readCtxt, ioCtxt, in); - } - } - return _createParser(readCtxt, ioCtxt, data, offset, len); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - String content) throws JacksonException { - return _nonByteSource(); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - char[] content, int offset, int len) throws JacksonException { - return _nonByteSource(); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - DataInput in) throws JacksonException { - IOContext ioCtxt = _createContext(_createContentReference(in), false); - return _createParser(readCtxt, ioCtxt, _decorate(ioCtxt, in)); - } - - protected abstract JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ioCtxt, InputStream in) throws JacksonException; - - protected abstract JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ioCtxt, byte[] data, int offset, int len) throws JacksonException; - - protected abstract JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ioCtxt, DataInput input) throws JacksonException; - - /* - /********************************************************************** - /* Factory methods: generators - /********************************************************************** - */ - - @Override - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, - OutputStream out, JsonEncoding enc) - throws JacksonException - { - // false -> we won't manage the stream unless explicitly directed to - IOContext ioCtxt = _createContext(_createContentReference(out), false, enc); - return _createGenerator(writeCtxt, ioCtxt, _decorate(ioCtxt, out)); - } - - @Override - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, - Writer w) throws JacksonException - { - return _nonByteTarget(); - } - - @Override - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, - File f, JsonEncoding enc) throws JacksonException - { - final OutputStream out = _fileOutputStream(f); - // true -> yes, we have to manage the stream since we created it - final IOContext ioCtxt = _createContext(_createContentReference(out), true, enc); - return _createGenerator(writeCtxt, ioCtxt, _decorate(ioCtxt, out)); - } - - @Override - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, - Path p, JsonEncoding enc) - throws JacksonException - { - final OutputStream out = _pathOutputStream(p); - final IOContext ioCtxt = _createContext(_createContentReference(p), true, enc); - return _createGenerator(writeCtxt, ioCtxt, _decorate(ioCtxt, out)); - } - - /* - /********************************************************************** - /* Factory methods: context objects - /********************************************************************** - */ - - @Override - protected ContentReference _createContentReference(Object contentRef) { - // false -> not textual - return ContentReference.construct(false, contentRef); - } - - @Override - protected ContentReference _createContentReference(Object contentRef, - int offset, int length) - { - // false -> not textual - return ContentReference.construct(false, contentRef, offset, length); - } - - /* - /********************************************************************** - /* Factory methods: abstract, for sub-classes to implement - /********************************************************************** - */ - - /** - * Overridable factory method that actually instantiates generator for - * given {@link OutputStream} and context object, using UTF-8 encoding. - *

    - * This method is specifically designed to remain - * compatible between minor versions so that sub-classes can count - * on it being called as expected. That is, it is part of official - * interface from sub-class perspective, although not a public - * method available to users of factory implementations. - * - * @param writeCtxt Object write context for generator to use - * @param ioCtxt IOContext for generator to use - * @param out Writer for generator to use - * - * @return Generator constructed - * - * @throws JacksonException If there is a problem constructing generator - */ - protected abstract JsonGenerator _createGenerator(ObjectWriteContext writeCtxt, - IOContext ioCtxt, OutputStream out) throws JacksonException; - - protected T _nonByteSource() throws JacksonException { - throw new UnsupportedOperationException("Cannot create parser for character-based (not byte-based) source"); - } - - protected T _nonByteTarget() throws JacksonException { - throw new UnsupportedOperationException("Cannot create generator for character-based (not byte-based) target"); - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/base/DecorableTSFactory.java b/src/main/java/com/fasterxml/jackson/core/base/DecorableTSFactory.java deleted file mode 100644 index be770deb98..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/base/DecorableTSFactory.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.fasterxml.jackson.core.base; - -import java.io.DataInput; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; - -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.io.*; - -/** - * Intermediate base {@link TokenStreamFactory} implementation that offers support for - * streams that allow decoration of low-level input sources and output targets. - * - * @since 3.0 - */ -public abstract class DecorableTSFactory - extends TokenStreamFactory - implements java.io.Serializable -{ - private static final long serialVersionUID = 3L; - - /** - * Since factory instances are immutable, a Builder class is needed for creating - * configurations for differently configured factory instances. - * - * @since 3.0 - */ - public abstract static class DecorableTSFBuilder> - extends TSFBuilder - { - /** - * Optional helper object that may decorate input sources, to do - * additional processing on input during parsing. - */ - protected InputDecorator _inputDecorator; - - /** - * Optional helper object that may decorate output object, to do - * additional processing on output during content generation. - */ - protected OutputDecorator _outputDecorator; - - // // // Construction - - protected DecorableTSFBuilder(int formatPF, int formatGF) { - super(formatPF, formatGF); - _inputDecorator = null; - _outputDecorator = null; - } - - protected DecorableTSFBuilder(DecorableTSFactory base) - { - super(base); - _inputDecorator = base.getInputDecorator(); - _outputDecorator = base.getOutputDecorator(); - } - - // // // Accessors - public InputDecorator inputDecorator() { return _inputDecorator; } - public OutputDecorator outputDecorator() { return _outputDecorator; } - - // // // Decorators - - public T inputDecorator(InputDecorator dec) { - _inputDecorator = dec; - return _this(); - } - - public T outputDecorator(OutputDecorator dec) { - _outputDecorator = dec; - return _this(); - } - } - - /* - /********************************************************************** - /* Configuration - /********************************************************************** - */ - - /** - * Optional helper object that may decorate input sources, to do - * additional processing on input during parsing. - */ - protected final InputDecorator _inputDecorator; - - /** - * Optional helper object that may decorate output object, to do - * additional processing on output during content generation. - */ - protected final OutputDecorator _outputDecorator; - - /* - /********************************************************************** - /* Construction - /********************************************************************** - */ - - protected DecorableTSFactory(int formatPF, int formatGF) { - super(formatPF, formatGF); - _inputDecorator = null; - _outputDecorator = null; - } - - /** - * Constructor used by builders for instantiation. - * - * @param baseBuilder Builder with configurations to use - * - * @since 3.0 - */ - protected DecorableTSFactory(DecorableTSFBuilder baseBuilder) - { - super(baseBuilder); - _inputDecorator = baseBuilder.inputDecorator(); - _outputDecorator = baseBuilder.outputDecorator(); - } - - // Copy constructor. - protected DecorableTSFactory(DecorableTSFactory src) { - super(src); - _inputDecorator = src.getInputDecorator(); - _outputDecorator = src.getOutputDecorator(); - } - - /* - /********************************************************************** - /* Configuration, decorators - /********************************************************************** - */ - - public OutputDecorator getOutputDecorator() { - return _outputDecorator; - } - - public InputDecorator getInputDecorator() { - return _inputDecorator; - } - - /* - /********************************************************************** - /* Decorators, input - /********************************************************************** - */ - - protected InputStream _decorate(IOContext ioCtxt, InputStream in) throws JacksonException - { - if (_inputDecorator != null) { - InputStream in2 = _inputDecorator.decorate(ioCtxt, in); - if (in2 != null) { - return in2; - } - } - return in; - } - - protected Reader _decorate(IOContext ioCtxt, Reader in) throws JacksonException - { - if (_inputDecorator != null) { - Reader in2 = _inputDecorator.decorate(ioCtxt, in); - if (in2 != null) { - return in2; - } - } - return in; - } - - protected DataInput _decorate(IOContext ioCtxt, DataInput in) throws JacksonException - { - if (_inputDecorator != null) { - DataInput in2 = _inputDecorator.decorate(ioCtxt, in); - if (in2 != null) { - return in2; - } - } - return in; - } - - /* - /********************************************************************** - /* Decorators, output - /********************************************************************** - */ - - protected OutputStream _decorate(IOContext ioCtxt, OutputStream out) throws JacksonException - { - if (_outputDecorator != null) { - OutputStream out2 = _outputDecorator.decorate(ioCtxt, out); - if (out2 != null) { - return out2; - } - } - return out; - } - - protected Writer _decorate(IOContext ioCtxt, Writer out) throws JacksonException - { - if (_outputDecorator != null) { - Writer out2 = _outputDecorator.decorate(ioCtxt, out); - if (out2 != null) { - return out2; - } - } - return out; - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/base/GeneratorBase.java b/src/main/java/com/fasterxml/jackson/core/base/GeneratorBase.java index 1bcdc8455d..bedb761a25 100644 --- a/src/main/java/com/fasterxml/jackson/core/base/GeneratorBase.java +++ b/src/main/java/com/fasterxml/jackson/core/base/GeneratorBase.java @@ -1,13 +1,14 @@ package com.fasterxml.jackson.core.base; -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; - import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.json.DupDetector; +import com.fasterxml.jackson.core.json.JsonWriteContext; +import com.fasterxml.jackson.core.json.PackageVersion; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; -import com.fasterxml.jackson.core.util.JacksonFeatureSet; -import com.fasterxml.jackson.core.util.VersionUtil; + +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; /** * This base class implements part of API that a JSON generator exposes @@ -21,7 +22,20 @@ public abstract class GeneratorBase extends JsonGenerator public final static int SURR2_FIRST = 0xDC00; public final static int SURR2_LAST = 0xDFFF; - // // // Constants for validation messages + /** + * Set of feature masks related to features that need updates of other + * local configuration or state. + * + * @since 2.5 + */ + @SuppressWarnings("deprecation") + protected final static int DERIVED_FEATURES_MASK = + Feature.WRITE_NUMBERS_AS_STRINGS.getMask() + | Feature.ESCAPE_NON_ASCII.getMask() + | Feature.STRICT_DUPLICATE_DETECTION.getMask() + ; + + // // // Constants for validation messages (since 2.6) protected final static String WRITE_BINARY = "write a binary value"; protected final static String WRITE_BOOLEAN = "write a boolean value"; @@ -31,67 +45,48 @@ public abstract class GeneratorBase extends JsonGenerator protected final static String WRITE_STRING = "write a string"; /** - * This value is the limit of scale allowed for serializing {@link java.math.BigDecimal} + * This value is the limit of scale allowed for serializing {@link BigDecimal} * in "plain" (non-engineering) notation; intent is to prevent asymmetric * attack whereupon simple eng-notation with big scale is used to generate * huge "plain" serialization. See [core#315] for details. + * + * @since 2.7.7 */ protected final static int MAX_BIG_DECIMAL_SCALE = 9999; /* - /********************************************************************** - /* Default capabilities - /********************************************************************** + /********************************************************** + /* Configuration + /********************************************************** */ - /** - * Default set of {@link StreamWriteCapability}ies that may be used as - * basis for format-specific readers (or as bogus instance if non-null - * set needs to be passed). - */ - protected final static JacksonFeatureSet DEFAULT_WRITE_CAPABILITIES - = JacksonFeatureSet.fromDefaults(StreamWriteCapability.values()); + protected ObjectCodec _objectCodec; /** - * Default set of {@link StreamWriteCapability}ies for typical textual formats, - * to use either as-is, or as a base with possible differences. + * Bit flag composed of bits that indicate which + * {@link com.fasterxml.jackson.core.JsonGenerator.Feature}s + * are enabled. */ - protected final static JacksonFeatureSet DEFAULT_TEXTUAL_WRITE_CAPABILITIES - = DEFAULT_WRITE_CAPABILITIES.with(StreamWriteCapability.CAN_WRITE_FORMATTED_NUMBERS); + protected int _features; /** - * Default set of {@link StreamWriteCapability}ies for typical binary formats, - * to use either as-is, or as a base with possible differences. + * Flag set to indicate that implicit conversion from number + * to JSON String is needed (as per + * {@link com.fasterxml.jackson.core.json.JsonWriteFeature#WRITE_NUMBERS_AS_STRINGS}). */ - protected final static JacksonFeatureSet DEFAULT_BINARY_WRITE_CAPABILITIES - = DEFAULT_WRITE_CAPABILITIES.with(StreamWriteCapability.CAN_WRITE_BINARY_NATIVELY); + protected boolean _cfgNumbersAsStrings; /* - /********************************************************************** - /* Configuration - /********************************************************************** + /********************************************************** + /* State + /********************************************************** */ /** - * Context object used both to pass some initial settings and to allow - * triggering of Object serialization through generator. - * - * @since 3.0 - */ - protected final ObjectWriteContext _objectWriteContext; - - /** - * Bit flag composed of bits that indicate which - * {@link com.fasterxml.jackson.core.StreamWriteFeature}s - * are enabled. - */ - protected int _streamWriteFeatures; - - /* - /********************************************************************** - /* State - /********************************************************************** + * Object that keeps track of the current contextual state + * of the generator. */ + protected JsonWriteContext _writeContext; /** * Flag that indicates whether generator is closed or not. Gets @@ -101,133 +96,264 @@ public abstract class GeneratorBase extends JsonGenerator protected boolean _closed; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ - protected GeneratorBase(ObjectWriteContext writeCtxt, int streamWriteFeatures) { + @SuppressWarnings("deprecation") + protected GeneratorBase(int features, ObjectCodec codec) { super(); - _objectWriteContext = writeCtxt; - _streamWriteFeatures = streamWriteFeatures; + _features = features; + _objectCodec = codec; + DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) + ? DupDetector.rootDetector(this) : null; + _writeContext = JsonWriteContext.createRootContext(dups); + _cfgNumbersAsStrings = Feature.WRITE_NUMBERS_AS_STRINGS.enabledIn(features); + } + + // @since 2.5 + @SuppressWarnings("deprecation") + protected GeneratorBase(int features, ObjectCodec codec, JsonWriteContext ctxt) { + super(); + _features = features; + _objectCodec = codec; + _writeContext = ctxt; + _cfgNumbersAsStrings = Feature.WRITE_NUMBERS_AS_STRINGS.enabledIn(features); + } + + /** + * Implemented with standard version number detection algorithm, typically using + * a simple generated class, with information extracted from Maven project file + * during build. + * + * @return Version number of the generator (version of the jar that contains + * generator implementation class) + */ + @Override public Version version() { return PackageVersion.VERSION; } + + @Override + public Object getCurrentValue() { + return _writeContext.getCurrentValue(); + } + + @Override + public void setCurrentValue(Object v) { + if (_writeContext != null) { + _writeContext.setCurrentValue(v); + } } /* - /********************************************************************** + /********************************************************** /* Configuration - /********************************************************************** + /********************************************************** */ - @Override public final boolean isEnabled(StreamWriteFeature f) { return (_streamWriteFeatures & f.getMask()) != 0; } - @Override public int streamWriteFeatures() { return _streamWriteFeatures; } - // public int formatWriteFeatures(); + @Override public final boolean isEnabled(Feature f) { return (_features & f.getMask()) != 0; } + @Override public int getFeatureMask() { return _features; } + //public JsonGenerator configure(Feature f, boolean state) { } + + @SuppressWarnings("deprecation") @Override - public final JsonGenerator configure(StreamWriteFeature f, boolean state) { - if (state) { - _streamWriteFeatures |= f.getMask(); - } else { - _streamWriteFeatures &= ~f.getMask(); + public JsonGenerator enable(Feature f) { + final int mask = f.getMask(); + _features |= mask; + if ((mask & DERIVED_FEATURES_MASK) != 0) { + // why not switch? Requires addition of a generated class, alas + if (f == Feature.WRITE_NUMBERS_AS_STRINGS) { + _cfgNumbersAsStrings = true; + } else if (f == Feature.ESCAPE_NON_ASCII) { + setHighestNonEscapedChar(127); + } else if (f == Feature.STRICT_DUPLICATE_DETECTION) { + if (_writeContext.getDupDetector() == null) { // but only if disabled currently + _writeContext = _writeContext.withDupDetector(DupDetector.rootDetector(this)); + } + } } return this; } - /* - /********************************************************************** - /* Public API, accessors - /********************************************************************** + @SuppressWarnings("deprecation") + @Override + public JsonGenerator disable(Feature f) { + final int mask = f.getMask(); + _features &= ~mask; + if ((mask & DERIVED_FEATURES_MASK) != 0) { + if (f == Feature.WRITE_NUMBERS_AS_STRINGS) { + _cfgNumbersAsStrings = false; + } else if (f == Feature.ESCAPE_NON_ASCII) { + setHighestNonEscapedChar(0); + } else if (f == Feature.STRICT_DUPLICATE_DETECTION) { + _writeContext = _writeContext.withDupDetector(null); + } + } + return this; + } + + @Override + @Deprecated + public JsonGenerator setFeatureMask(int newMask) { + int changed = newMask ^ _features; + _features = newMask; + if (changed != 0) { + _checkStdFeatureChanges(newMask, changed); + } + return this; + } + + @Override // since 2.7 + public JsonGenerator overrideStdFeatures(int values, int mask) { + int oldState = _features; + int newState = (oldState & ~mask) | (values & mask); + int changed = oldState ^ newState; + if (changed != 0) { + _features = newState; + _checkStdFeatureChanges(newState, changed); + } + return this; + } + + /** + * Helper method called to verify changes to standard features. + * + * @param newFeatureFlags Bitflag of standard features after they were changed + * @param changedFeatures Bitflag of standard features for which setting + * did change + * + * @since 2.7 */ + @SuppressWarnings("deprecation") + protected void _checkStdFeatureChanges(int newFeatureFlags, int changedFeatures) + { + if ((changedFeatures & DERIVED_FEATURES_MASK) == 0) { + return; + } + _cfgNumbersAsStrings = Feature.WRITE_NUMBERS_AS_STRINGS.enabledIn(newFeatureFlags); + if (Feature.ESCAPE_NON_ASCII.enabledIn(changedFeatures)) { + if (Feature.ESCAPE_NON_ASCII.enabledIn(newFeatureFlags)) { + setHighestNonEscapedChar(127); + } else { + setHighestNonEscapedChar(0); + } + } + if (Feature.STRICT_DUPLICATE_DETECTION.enabledIn(changedFeatures)) { + if (Feature.STRICT_DUPLICATE_DETECTION.enabledIn(newFeatureFlags)) { // enabling + if (_writeContext.getDupDetector() == null) { // but only if disabled currently + _writeContext = _writeContext.withDupDetector(DupDetector.rootDetector(this)); + } + } else { // disabling + _writeContext = _writeContext.withDupDetector(null); + } + } + } - // public Object currentValue(); - // public void assignCurrentValue(Object v); + @Override public JsonGenerator useDefaultPrettyPrinter() { + // Should not override a pretty printer if one already assigned. + if (getPrettyPrinter() != null) { + return this; + } + return setPrettyPrinter(_constructDefaultPrettyPrinter()); + } + + @Override public JsonGenerator setCodec(ObjectCodec oc) { + _objectCodec = oc; + return this; + } - // public TokenStreamContext getOutputContext(); + @Override public ObjectCodec getCodec() { return _objectCodec; } - @Override public ObjectWriteContext objectWriteContext() { return _objectWriteContext; } + /* + /********************************************************** + /* Public API, accessors + /********************************************************** + */ + + /** + * Note: type was co-variant until Jackson 2.7; reverted back to + * base type in 2.8 to allow for overriding by subtypes that use + * custom context type. + */ + @Override public JsonStreamContext getOutputContext() { return _writeContext; } /* - /********************************************************************** + /********************************************************** /* Public API, write methods, structural - /********************************************************************** + /********************************************************** */ - //public void writeStartArray() - //public void writeEndArray() - //public void writeStartObject() - //public void writeEndObject() + //public void writeStartArray() throws IOException + //public void writeEndArray() throws IOException + //public void writeStartObject() throws IOException + //public void writeEndObject() throws IOException - @Override - public void writeStartArray(Object forValue, int size) throws JacksonException { - writeStartArray(forValue); - } - - @Override - public void writeStartObject(Object forValue, int size) throws JacksonException + @Override // since 2.8 + public void writeStartObject(Object forValue) throws IOException { - writeStartObject(forValue); + writeStartObject(); + if (forValue != null) { + setCurrentValue(forValue); + } } /* - /********************************************************************** + /********************************************************** /* Public API, write methods, textual - /********************************************************************** + /********************************************************** */ - @Override public void writeName(SerializableString name) throws JacksonException { - writeName(name.getValue()); + @Override public void writeFieldName(SerializableString name) throws IOException { + writeFieldName(name.getValue()); } - //public abstract void writeString(String text); + //public abstract void writeString(String text) throws IOException; - //public abstract void writeString(char[] text, int offset, int len); + //public abstract void writeString(char[] text, int offset, int len) throws IOException; - @Override - public void writeString(Reader reader, int len) throws JacksonException { - // Let's implement this as "unsupported" to make it easier to add new parser impls - _reportUnsupportedOperation(); - } - - //public abstract void writeRaw(String text); + //public abstract void writeString(Reader reader, int len) throws IOException; - //public abstract void writeRaw(char[] text, int offset, int len); + //public abstract void writeRaw(String text) throws IOException,; + + //public abstract void writeRaw(char[] text, int offset, int len) throws IOException; @Override - public void writeString(SerializableString text) throws JacksonException { + public void writeString(SerializableString text) throws IOException { writeString(text.getValue()); } - @Override public void writeRawValue(String text) throws JacksonException { + @Override public void writeRawValue(String text) throws IOException { _verifyValueWrite("write raw value"); writeRaw(text); } - @Override public void writeRawValue(String text, int offset, int len) throws JacksonException { + @Override public void writeRawValue(String text, int offset, int len) throws IOException { _verifyValueWrite("write raw value"); writeRaw(text, offset, len); } - @Override public void writeRawValue(char[] text, int offset, int len) throws JacksonException { + @Override public void writeRawValue(char[] text, int offset, int len) throws IOException { _verifyValueWrite("write raw value"); writeRaw(text, offset, len); } - @Override public void writeRawValue(SerializableString text) throws JacksonException { + @Override public void writeRawValue(SerializableString text) throws IOException { _verifyValueWrite("write raw value"); writeRaw(text); } @Override - public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) throws JacksonException { + public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) throws IOException { // Let's implement this as "unsupported" to make it easier to add new parser impls _reportUnsupportedOperation(); return 0; } /* - /********************************************************************** + /********************************************************** /* Public API, write methods, primitive - /********************************************************************** + /********************************************************** */ // Not implemented at this level, added as placeholders @@ -243,48 +369,57 @@ public abstract void writeNull() */ /* - /********************************************************************** + /********************************************************** /* Public API, write methods, POJOs, trees - /********************************************************************** + /********************************************************** */ @Override - public void writePOJO(Object value) throws JacksonException { + public void writeObject(Object value) throws IOException { if (value == null) { // important: call method that does check value write: writeNull(); } else { - // We are NOT to call _verifyValueWrite here, because that will be - // done when actual serialization of POJO occurs. If we did call it, - // state would advance causing exception later on - _objectWriteContext.writeValue(this, value); + /* 02-Mar-2009, tatu: we are NOT to call _verifyValueWrite here, + * because that will be done when codec actually serializes + * contained POJO. If we did call it it would advance state + * causing exception later on + */ + if (_objectCodec != null) { + _objectCodec.writeValue(this, value); + return; + } + _writeSimpleObject(value); } } @Override - public void writeTree(TreeNode rootNode) throws JacksonException { - // As with 'writeObject()', we are not to check if write would work + public void writeTree(TreeNode rootNode) throws IOException { + // As with 'writeObject()', we are not check if write would work if (rootNode == null) { writeNull(); } else { - _objectWriteContext.writeTree(this, rootNode); + if (_objectCodec == null) { + throw new IllegalStateException("No ObjectCodec defined"); + } + _objectCodec.writeValue(this, rootNode); } } /* - /********************************************************************** + /********************************************************** /* Public API, low-level output handling - /********************************************************************** + /********************************************************** */ -// @Override public abstract void flush(); - @Override public void close() { _closed = true; } + @Override public abstract void flush() throws IOException; + @Override public void close() throws IOException { _closed = true; } @Override public boolean isClosed() { return _closed; } /* - /********************************************************************** + /********************************************************** /* Package methods for this, sub-classes - /********************************************************************** + /********************************************************** */ /** @@ -301,15 +436,18 @@ public void writeTree(TreeNode rootNode) throws JacksonException { * @param typeMsg Additional message used for generating exception message * if value output is NOT legal in current generator output state. * - * @throws JacksonException if there is a problem in trying to write a value + * @throws IOException if there is either an underlying I/O problem or encoding + * issue at format layer */ - protected abstract void _verifyValueWrite(String typeMsg) throws JacksonException; + protected abstract void _verifyValueWrite(String typeMsg) throws IOException; /** * Overridable factory method called to instantiate an appropriate {@link PrettyPrinter} - * for case of "just use the default one", when default pretty printer handling enabled. + * for case of "just use the default one", when {@link #useDefaultPrettyPrinter()} is called. * * @return Instance of "default" pretty printer to use + * + * @since 2.6 */ protected PrettyPrinter _constructDefaultPrettyPrinter() { return new DefaultPrettyPrinter(); @@ -323,10 +461,12 @@ protected PrettyPrinter _constructDefaultPrettyPrinter() { * * @return String representation of {@code value} * - * @throws JacksonException if there is a problem serializing value as String + * @throws IOException if there is a problem serializing value as String + * + * @since 2.7.7 */ - protected String _asString(BigDecimal value) throws JacksonException { - if (StreamWriteFeature.WRITE_BIGDECIMAL_AS_PLAIN.enabledIn(_streamWriteFeatures)) { + protected String _asString(BigDecimal value) throws IOException { + if (Feature.WRITE_BIGDECIMAL_AS_PLAIN.enabledIn(_features)) { // 24-Aug-2016, tatu: [core#315] prevent possible DoS vector int scale = value.scale(); if ((scale < -MAX_BIG_DECIMAL_SCALE) || (scale > MAX_BIG_DECIMAL_SCALE)) { @@ -340,12 +480,13 @@ protected String _asString(BigDecimal value) throws JacksonException { } /* - /********************************************************************** + /********************************************************** /* UTF-8 related helper method(s) - /********************************************************************** + /********************************************************** */ - protected final int _decodeSurrogate(int surr1, int surr2) throws JacksonException + // @since 2.5 + protected final int _decodeSurrogate(int surr1, int surr2) throws IOException { // First is known to be valid, but how about the other? if (surr2 < SURR2_FIRST || surr2 > SURR2_LAST) { @@ -356,12 +497,4 @@ protected final int _decodeSurrogate(int surr1, int surr2) throws JacksonExcepti int c = 0x10000 + ((surr1 - SURR1_FIRST) << 10) + (surr2 - SURR2_FIRST); return c; } - - /* - /********************************************************************** - /* Helper methods: error reporting - /********************************************************************** - */ - - protected void _throwInternal() { VersionUtil.throwInternal(); } } diff --git a/src/main/java/com/fasterxml/jackson/core/base/ParserBase.java b/src/main/java/com/fasterxml/jackson/core/base/ParserBase.java index fa6ed7a960..252b135f6f 100644 --- a/src/main/java/com/fasterxml/jackson/core/base/ParserBase.java +++ b/src/main/java/com/fasterxml/jackson/core/base/ParserBase.java @@ -1,38 +1,44 @@ package com.fasterxml.jackson.core.base; -import java.io.IOException; -//import java.io.*; +import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; +import java.util.Arrays; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.InputCoercionException; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.exc.WrappedIOException; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.core.io.ContentReference; import com.fasterxml.jackson.core.io.NumberInput; +import com.fasterxml.jackson.core.json.DupDetector; +import com.fasterxml.jackson.core.json.JsonReadContext; +import com.fasterxml.jackson.core.json.PackageVersion; import com.fasterxml.jackson.core.util.ByteArrayBuilder; +import com.fasterxml.jackson.core.util.JacksonFeatureSet; import com.fasterxml.jackson.core.util.TextBuffer; /** - * Intermediate base class used by many (but not all) Jackson {@link JsonParser} + * Intermediate base class used by all Jackson {@link JsonParser} * implementations. Contains most common things that are independent * of actual underlying input source. */ public abstract class ParserBase extends ParserMinimalBase { + // JSON capabilities are the same as defaults + // @since 2.12 + protected final static JacksonFeatureSet JSON_READ_CAPABILITIES + = DEFAULT_READ_CAPABILITIES; + /* - /********************************************************************** + /********************************************************** /* Generic I/O state - /********************************************************************** + /********************************************************** */ /** * I/O context for this reader. It handles buffer allocation * for the reader. */ - protected final IOContext _ioContext; + final protected IOContext _ioContext; /** * Flag that indicates whether parser is closed or not. Gets @@ -42,9 +48,9 @@ public abstract class ParserBase extends ParserMinimalBase protected boolean _closed; /* - /********************************************************************** + /********************************************************** /* Current input data - /********************************************************************** + /********************************************************** */ // Note: type of actual buffer depends on sub-class, can't include @@ -60,9 +66,9 @@ public abstract class ParserBase extends ParserMinimalBase protected int _inputEnd; /* - /********************************************************************** + /********************************************************** /* Current input location information - /********************************************************************** + /********************************************************** */ /** @@ -86,10 +92,10 @@ public abstract class ParserBase extends ParserMinimalBase protected int _currInputRowStart; /* - /********************************************************************** + /********************************************************** /* Information about starting location of event /* Reader is pointing to; updated on-demand - /********************************************************************** + /********************************************************** */ // // // Location info at point when current token was started @@ -113,18 +119,51 @@ public abstract class ParserBase extends ParserMinimalBase protected int _tokenInputCol; /* - /********************************************************************** + /********************************************************** + /* Parsing state + /********************************************************** + */ + + /** + * Information about parser context, context in which + * the next token is to be parsed (root, array, object). + */ + protected JsonReadContext _parsingContext; + + /** + * Secondary token related to the next token after current one; + * used if its type is known. This may be value token that + * follows FIELD_NAME, for example. + */ + protected JsonToken _nextToken; + + /* + /********************************************************** /* Buffer(s) for local name(s) and text content - /********************************************************************** + /********************************************************** */ /** * Buffer that contains contents of String values, including - * property names if necessary (name split across boundary, + * field names if necessary (name split across boundary, * contains escape sequence, or access needed to char array) */ protected final TextBuffer _textBuffer; + /** + * Temporary buffer that is needed if field name is accessed + * using {@link #getTextCharacters} method (instead of String + * returning alternatives) + */ + protected char[] _nameCopyBuffer; + + /** + * Flag set to indicate whether the field name is available + * from the name copy buffer or not (in addition to its String + * representation being available via read context) + */ + protected boolean _nameCopied; + /** * ByteArrayBuilder is needed if 'getBinaryValue' is called. If so, * we better reuse it for remainder of content. @@ -139,11 +178,8 @@ public abstract class ParserBase extends ParserMinimalBase */ protected byte[] _binaryValue; - /* - /********************************************************************** - /* Numeric value state; multiple fields used for efficiency - /********************************************************************** - */ + // Numeric value holders: multiple fields used for + // for efficiency /** * Bitfield that indicates which numeric representations @@ -194,29 +230,42 @@ public abstract class ParserBase extends ParserMinimalBase protected int _expLength; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ - protected ParserBase(ObjectReadContext readCtxt, - IOContext ctxt, int features) { - super(readCtxt, features); + protected ParserBase(IOContext ctxt, int features) { + super(features); _ioContext = ctxt; _textBuffer = ctxt.constructTextBuffer(); + DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) + ? DupDetector.rootDetector(this) : null; + _parsingContext = JsonReadContext.createRootContext(dups); + } + + @Override public Version version() { return PackageVersion.VERSION; } + + @Override + public Object getCurrentValue() { + return _parsingContext.getCurrentValue(); } + @Override + public void setCurrentValue(Object v) { + _parsingContext.setCurrentValue(v); + } + /* - /********************************************************************** + /********************************************************** /* Overrides for Feature handling - /********************************************************************** + /********************************************************** */ - /* @Override - public JsonParser enable(StreamReadFeature f) { - _streamReadFeatures |= f.getMask(); - if (f == StreamReadFeature.STRICT_DUPLICATE_DETECTION) { // enabling dup detection? + public JsonParser enable(Feature f) { + _features |= f.getMask(); + if (f == Feature.STRICT_DUPLICATE_DETECTION) { // enabling dup detection? if (_parsingContext.getDupDetector() == null) { // but only if disabled currently _parsingContext = _parsingContext.withDupDetector(DupDetector.rootDetector(this)); } @@ -225,61 +274,104 @@ public JsonParser enable(StreamReadFeature f) { } @Override - public JsonParser disable(StreamReadFeature f) { - _streamReadFeatures &= ~f.getMask(); - if (f == StreamReadFeature.STRICT_DUPLICATE_DETECTION) { + public JsonParser disable(Feature f) { + _features &= ~f.getMask(); + if (f == Feature.STRICT_DUPLICATE_DETECTION) { _parsingContext = _parsingContext.withDupDetector(null); } return this; } - */ - - /* - /********************************************************************** - /* JsonParser impl - /********************************************************************** - */ @Override - public void assignCurrentValue(Object v) { - TokenStreamContext ctxt = streamReadContext(); - if (ctxt != null) { - ctxt.assignCurrentValue(v); + @Deprecated + public JsonParser setFeatureMask(int newMask) { + int changes = (_features ^ newMask); + if (changes != 0) { + _features = newMask; + _checkStdFeatureChanges(newMask, changes); } + return this; } - @Override - public Object currentValue() { - TokenStreamContext ctxt = streamReadContext(); - return (ctxt == null) ? null : ctxt.currentValue(); + @Override // since 2.7 + public JsonParser overrideStdFeatures(int values, int mask) { + int oldState = _features; + int newState = (oldState & ~mask) | (values & mask); + int changed = oldState ^ newState; + if (changed != 0) { + _features = newState; + _checkStdFeatureChanges(newState, changed); + } + return this; + } + + /** + * Helper method called to verify changes to standard features. + * + * @param newFeatureFlags Bitflag of standard features after they were changed + * @param changedFeatures Bitflag of standard features for which setting + * did change + * + * @since 2.7 + */ + protected void _checkStdFeatureChanges(int newFeatureFlags, int changedFeatures) + { + int f = Feature.STRICT_DUPLICATE_DETECTION.getMask(); + + if ((changedFeatures & f) != 0) { + if ((newFeatureFlags & f) != 0) { + if (_parsingContext.getDupDetector() == null) { + _parsingContext = _parsingContext.withDupDetector(DupDetector.rootDetector(this)); + } else { // disabling + _parsingContext = _parsingContext.withDupDetector(null); + } + } + } } + /* + /********************************************************** + /* JsonParser impl + /********************************************************** + */ + /** * Method that can be called to get the name associated with * the current event. */ - /* - @Override public String currentName() { + @Override public String getCurrentName() throws IOException { // [JACKSON-395]: start markers require information from parent if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) { JsonReadContext parent = _parsingContext.getParent(); if (parent != null) { - return parent.currentName(); + return parent.getCurrentName(); } } - return _parsingContext.currentName(); + return _parsingContext.getCurrentName(); + } + + @Override public void overrideCurrentName(String name) { + // Simple, but need to look for START_OBJECT/ARRAY's "off-by-one" thing: + JsonReadContext ctxt = _parsingContext; + if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) { + ctxt = ctxt.getParent(); + } + // 24-Sep-2013, tatu: Unfortunate, but since we did not expose exceptions, + // need to wrap this here + try { + ctxt.setCurrentName(name); + } catch (IOException e) { + throw new IllegalStateException(e); + } } - */ - @Override public void close() throws JacksonException { + @Override public void close() throws IOException { if (!_closed) { // 19-Jan-2018, tatu: as per [core#440] need to ensure no more data assumed available _inputPtr = Math.max(_inputPtr, _inputEnd); _closed = true; try { _closeInput(); - } catch (IOException e) { - throw _wrapIOFailure(e); } finally { // as per [JACKSON-324], do in finally block // Also, internal buffer(s) can now be released as well @@ -289,28 +381,53 @@ public Object currentValue() { } @Override public boolean isClosed() { return _closed; } + @Override public JsonReadContext getParsingContext() { return _parsingContext; } -// public JsonLocation getTokenLocation() -// public JsonLocation getCurrentLocation() + /** + * Method that return the starting location of the current + * token; that is, position of the first character from input + * that starts the current token. + */ + @Override + public JsonLocation getTokenLocation() { + return new JsonLocation(_contentReference(), + -1L, getTokenCharacterOffset(), // bytes, chars + getTokenLineNr(), + getTokenColumnNr()); + } + + /** + * Method that returns location of the last processed character; + * usually for error reporting purposes + */ + @Override + public JsonLocation getCurrentLocation() { + int col = _inputPtr - _currInputRowStart + 1; // 1-based + return new JsonLocation(_contentReference(), + -1L, _currInputProcessed + _inputPtr, // bytes, chars + _currInputRow, col); + } /* - /********************************************************************** + /********************************************************** /* Public API, access to token information, text and similar - /********************************************************************** + /********************************************************** */ @Override public boolean hasTextCharacters() { + if (_currToken == JsonToken.VALUE_STRING) { return true; } // usually true + if (_currToken == JsonToken.FIELD_NAME) { return _nameCopied; } return false; } @SuppressWarnings("resource") - @Override - public byte[] getBinaryValue(Base64Variant variant) throws JacksonException + @Override // since 2.7 + public byte[] getBinaryValue(Base64Variant variant) throws IOException { if (_binaryValue == null) { if (_currToken != JsonToken.VALUE_STRING) { - _reportError("Current token (%s) not VALUE_EMBEDDED_OBJECT or VALUE_STRING, can not access as binary", _currToken); + _reportError("Current token ("+_currToken+") not VALUE_STRING, can not access as binary"); } ByteArrayBuilder builder = _getByteArrayBuilder(); _decodeBase64(getText(), builder, variant); @@ -320,9 +437,9 @@ public byte[] getBinaryValue(Base64Variant variant) throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Public low-level accessors - /********************************************************************** + /********************************************************** */ public long getTokenCharacterOffset() { return _tokenInputTotal; } @@ -334,17 +451,17 @@ public int getTokenColumnNr() { } /* - /********************************************************************** + /********************************************************** /* Abstract methods for sub-classes to implement - /********************************************************************** + /********************************************************** */ protected abstract void _closeInput() throws IOException; - + /* - /********************************************************************** + /********************************************************** /* Low-level reading, other - /********************************************************************** + /********************************************************** */ /** @@ -352,25 +469,32 @@ public int getTokenColumnNr() { * reader. This may be called along with {@link #_closeInput} (for * example, when explicitly closing this reader instance), or * separately (if need be). + * + * @throws IOException Not thrown by base implementation but could be thrown + * by sub-classes */ - protected void _releaseBuffers() { + protected void _releaseBuffers() throws IOException { _textBuffer.releaseBuffers(); + char[] buf = _nameCopyBuffer; + if (buf != null) { + _nameCopyBuffer = null; + _ioContext.releaseNameCopyBuffer(buf); + } } - + /** * Method called when an EOF is encountered between tokens. * If so, it may be a legitimate EOF, but only iff there * is no open non-root context. */ @Override - protected void _handleEOF() throws JacksonException { - TokenStreamContext parsingContext = streamReadContext(); - if ((parsingContext != null) && !parsingContext.inRoot()) { - String marker = parsingContext.inArray() ? "Array" : "Object"; + protected void _handleEOF() throws JsonParseException { + if (!_parsingContext.inRoot()) { + String marker = _parsingContext.inArray() ? "Array" : "Object"; _reportInvalidEOF(String.format( ": expected close marker for %s (start marker at %s)", marker, - parsingContext.startLocation(_contentReference())), + _parsingContext.startLocation(_contentReference())), null); } } @@ -378,21 +502,23 @@ protected void _handleEOF() throws JacksonException { /** * @return If no exception is thrown, {@code -1} which is used as marked for "end-of-input" * - * @throws StreamReadException If check on {@code _handleEOF()} fails; usually because + * @throws JsonParseException If check on {@code _handleEOF()} fails; usually because * the current context is not root context (missing end markers in content) + * + * @since 2.4 */ - protected final int _eofAsNextChar() throws StreamReadException { + protected final int _eofAsNextChar() throws JsonParseException { _handleEOF(); return -1; } /* - /********************************************************************** + /********************************************************** /* Internal/package methods: shared/reusable builders - /********************************************************************** + /********************************************************** */ - - protected ByteArrayBuilder _getByteArrayBuilder() + + public ByteArrayBuilder _getByteArrayBuilder() { if (_byteArrayBuilder == null) { _byteArrayBuilder = new ByteArrayBuilder(); @@ -403,9 +529,9 @@ protected ByteArrayBuilder _getByteArrayBuilder() } /* - /********************************************************************** - /* Methods related to number handling - /********************************************************************** + /********************************************************** + /* Methods from former JsonNumericParserBase + /********************************************************** */ // // // Life-cycle of number-parsing @@ -459,13 +585,13 @@ public boolean isNaN() { } /* - /********************************************************************** + /********************************************************** /* Numeric accessors of public API - /********************************************************************** + /********************************************************** */ @Override - public Number getNumberValue() + public Number getNumberValue() throws IOException { if (_numTypesValid == NR_UNKNOWN) { _parseNumericValue(NR_UNKNOWN); // will also check event type @@ -489,8 +615,6 @@ public Number getNumberValue() if ((_numTypesValid & NR_BIGDECIMAL) != 0) { return _numberBigDecimal; } - // And then floating point types. But here optimal type - // needs to be big decimal, to avoid losing any data? if ((_numTypesValid & NR_DOUBLE) == 0) { // sanity check _throwInternal(); } @@ -499,7 +623,7 @@ public Number getNumberValue() // NOTE: mostly copied from above @Override - public Number getNumberValueExact() + public Number getNumberValueExact() throws IOException { if (_currToken == JsonToken.VALUE_NUMBER_INT) { if (_numTypesValid == NR_UNKNOWN) { @@ -530,7 +654,7 @@ public Number getNumberValueExact() } @Override - public NumberType getNumberType() + public NumberType getNumberType() throws IOException { if (_numTypesValid == NR_UNKNOWN) { _parseNumericValue(NR_UNKNOWN); // will also check event type @@ -558,7 +682,7 @@ public NumberType getNumberType() } @Override - public int getIntValue() throws JacksonException + public int getIntValue() throws IOException { if ((_numTypesValid & NR_INT) == 0) { if (_numTypesValid == NR_UNKNOWN) { // not parsed at all @@ -572,7 +696,7 @@ public int getIntValue() throws JacksonException } @Override - public long getLongValue() throws JacksonException + public long getLongValue() throws IOException { if ((_numTypesValid & NR_LONG) == 0) { if (_numTypesValid == NR_UNKNOWN) { @@ -586,7 +710,7 @@ public long getLongValue() throws JacksonException } @Override - public BigInteger getBigIntegerValue() + public BigInteger getBigIntegerValue() throws IOException { if ((_numTypesValid & NR_BIGINT) == 0) { if (_numTypesValid == NR_UNKNOWN) { @@ -600,11 +724,12 @@ public BigInteger getBigIntegerValue() } @Override - public float getFloatValue() throws JacksonException + public float getFloatValue() throws IOException { double value = getDoubleValue(); - // 22-Jan-2009, tatu: Bounds/range checks would be tricky - // here, so let's not bother even trying... + /* 22-Jan-2009, tatu: Bounds/range checks would be tricky + * here, so let's not bother even trying... + */ /* if (value < -Float.MAX_VALUE || value > MAX_FLOAT_D) { _reportError("Numeric value ("+getText()+") out of range of Java float"); @@ -614,7 +739,7 @@ public float getFloatValue() throws JacksonException } @Override - public double getDoubleValue() throws JacksonException + public double getDoubleValue() throws IOException { if ((_numTypesValid & NR_DOUBLE) == 0) { if (_numTypesValid == NR_UNKNOWN) { @@ -628,7 +753,7 @@ public double getDoubleValue() throws JacksonException } @Override - public BigDecimal getDecimalValue() + public BigDecimal getDecimalValue() throws IOException { if ((_numTypesValid & NR_BIGDECIMAL) == 0) { if (_numTypesValid == NR_UNKNOWN) { @@ -642,9 +767,9 @@ public BigDecimal getDecimalValue() } /* - /********************************************************************** - /* Abstract methods sub-classes will need to provide - /********************************************************************** + /********************************************************** + /* Conversion from textual to numeric representation + /********************************************************** */ /** @@ -656,47 +781,187 @@ public BigDecimal getDecimalValue() * @param expType Numeric type that we will immediately need, if any; * mostly necessary to optimize handling of floating point numbers * - * @throws WrappedIOException for low-level read issues - * @throws InputCoercionException if the current token not of numeric type - * @throws com.fasterxml.jackson.core.exc.StreamReadException for number decoding problems + * @throws IOException If there are problems reading content + * @throws JsonParseException If there are problems decoding number value */ - protected abstract void _parseNumericValue(int expType) - throws JacksonException, InputCoercionException; + protected void _parseNumericValue(int expType) throws IOException + { + // 12-Jun-2020, tatu: Sanity check to prevent more cryptic error for this case. + // (note: could alternatively see if TextBuffer has aggregated contents, avoid + // exception -- but that might be more confusing) + if (_closed) { + _reportError("Internal error: _parseNumericValue called when parser instance closed"); + } - protected abstract int _parseIntValue() throws JacksonException; + // Int or float? + if (_currToken == JsonToken.VALUE_NUMBER_INT) { + final int len = _intLength; + // First: optimization for simple int + if (len <= 9) { + int i = _textBuffer.contentsAsInt(_numberNegative); + _numberInt = i; + _numTypesValid = NR_INT; + return; + } + if (len <= 18) { // definitely fits AND is easy to parse using 2 int parse calls + long l = _textBuffer.contentsAsLong(_numberNegative); + // Might still fit in int, need to check + if (len == 10) { + if (_numberNegative) { + if (l >= MIN_INT_L) { + _numberInt = (int) l; + _numTypesValid = NR_INT; + return; + } + } else { + if (l <= MAX_INT_L) { + _numberInt = (int) l; + _numTypesValid = NR_INT; + return; + } + } + } + _numberLong = l; + _numTypesValid = NR_LONG; + return; + } + _parseSlowInt(expType); + return; + } + if (_currToken == JsonToken.VALUE_NUMBER_FLOAT) { + _parseSlowFloat(expType); + return; + } + _reportError("Current token (%s) not numeric, can not use numeric value accessors", _currToken); + } + + // @since 2.6 + protected int _parseIntValue() throws IOException + { + // 12-Jun-2020, tatu: Sanity check to prevent more cryptic error for this case. + // (note: could alternatively see if TextBuffer has aggregated contents, avoid + // exception -- but that might be more confusing) + if (_closed) { + _reportError("Internal error: _parseNumericValue called when parser instance closed"); + } + // Inlined variant of: _parseNumericValue(NR_INT) + if (_currToken == JsonToken.VALUE_NUMBER_INT) { + if (_intLength <= 9) { + int i = _textBuffer.contentsAsInt(_numberNegative); + _numberInt = i; + _numTypesValid = NR_INT; + return i; + } + } + // if not optimizable, use more generic + _parseNumericValue(NR_INT); + if ((_numTypesValid & NR_INT) == 0) { + convertNumberToInt(); + } + return _numberInt; + } + + private void _parseSlowFloat(int expType) throws IOException + { + /* Nope: floating point. Here we need to be careful to get + * optimal parsing strategy: choice is between accurate but + * slow (BigDecimal) and lossy but fast (Double). For now + * let's only use BD when explicitly requested -- it can + * still be constructed correctly at any point since we do + * retain textual representation + */ + try { + if (expType == NR_BIGDECIMAL) { + _numberBigDecimal = _textBuffer.contentsAsDecimal(); + _numTypesValid = NR_BIGDECIMAL; + } else { + // Otherwise double has to do + _numberDouble = _textBuffer.contentsAsDouble(); + _numTypesValid = NR_DOUBLE; + } + } catch (NumberFormatException nex) { + // Can this ever occur? Due to overflow, maybe? + _wrapError("Malformed numeric value ("+_longNumberDesc(_textBuffer.contentsAsString())+")", nex); + } + } + + private void _parseSlowInt(int expType) throws IOException + { + String numStr = _textBuffer.contentsAsString(); + try { + int len = _intLength; + char[] buf = _textBuffer.getTextBuffer(); + int offset = _textBuffer.getTextOffset(); + if (_numberNegative) { + ++offset; + } + // Some long cases still... + if (NumberInput.inLongRange(buf, offset, len, _numberNegative)) { + // Probably faster to construct a String, call parse, than to use BigInteger + _numberLong = Long.parseLong(numStr); + _numTypesValid = NR_LONG; + } else { + // 16-Oct-2018, tatu: Need to catch "too big" early due to [jackson-core#488] + if ((expType == NR_INT) || (expType == NR_LONG)) { + _reportTooLongIntegral(expType, numStr); + } + if ((expType == NR_DOUBLE) || (expType == NR_FLOAT)) { + _numberDouble = NumberInput.parseDouble(numStr); + _numTypesValid = NR_DOUBLE; + } else { + // nope, need the heavy guns... (rare case) + _numberBigInt = new BigInteger(numStr); + _numTypesValid = NR_BIGINT; + } + } + } catch (NumberFormatException nex) { + // Can this ever occur? Due to overflow, maybe? + _wrapError("Malformed numeric value ("+_longNumberDesc(numStr)+")", nex); + } + } + + // @since 2.9.8 + protected void _reportTooLongIntegral(int expType, String rawNum) throws IOException + { + if (expType == NR_INT) { + reportOverflowInt(rawNum); + } else { + reportOverflowLong(rawNum); + } + } /* - /********************************************************************** + /********************************************************** /* Numeric conversions - /********************************************************************** - */ - - protected void convertNumberToInt() throws InputCoercionException + /********************************************************** + */ + + protected void convertNumberToInt() throws IOException { // First, converting from long ought to be easy if ((_numTypesValid & NR_LONG) != 0) { // Let's verify it's lossless conversion by simple roundtrip int result = (int) _numberLong; if (((long) result) != _numberLong) { - _reportOverflowInt(getText(), currentToken()); + reportOverflowInt(getText(), currentToken()); } _numberInt = result; } else if ((_numTypesValid & NR_BIGINT) != 0) { if (BI_MIN_INT.compareTo(_numberBigInt) > 0 || BI_MAX_INT.compareTo(_numberBigInt) < 0) { - _reportOverflowInt(); + reportOverflowInt(); } _numberInt = _numberBigInt.intValue(); } else if ((_numTypesValid & NR_DOUBLE) != 0) { // Need to check boundaries if (_numberDouble < MIN_INT_D || _numberDouble > MAX_INT_D) { - _reportOverflowInt(); + reportOverflowInt(); } _numberInt = (int) _numberDouble; } else if ((_numTypesValid & NR_BIGDECIMAL) != 0) { if (BD_MIN_INT.compareTo(_numberBigDecimal) > 0 || BD_MAX_INT.compareTo(_numberBigDecimal) < 0) { - _reportOverflowInt(); + reportOverflowInt(); } _numberInt = _numberBigDecimal.intValue(); } else { @@ -704,27 +969,27 @@ protected void convertNumberToInt() throws InputCoercionException } _numTypesValid |= NR_INT; } - - protected void convertNumberToLong() throws InputCoercionException + + protected void convertNumberToLong() throws IOException { if ((_numTypesValid & NR_INT) != 0) { _numberLong = (long) _numberInt; } else if ((_numTypesValid & NR_BIGINT) != 0) { if (BI_MIN_LONG.compareTo(_numberBigInt) > 0 || BI_MAX_LONG.compareTo(_numberBigInt) < 0) { - _reportOverflowLong(); + reportOverflowLong(); } _numberLong = _numberBigInt.longValue(); } else if ((_numTypesValid & NR_DOUBLE) != 0) { // Need to check boundaries if (_numberDouble < MIN_LONG_D || _numberDouble > MAX_LONG_D) { - _reportOverflowLong(); + reportOverflowLong(); } _numberLong = (long) _numberDouble; } else if ((_numTypesValid & NR_BIGDECIMAL) != 0) { if (BD_MIN_LONG.compareTo(_numberBigDecimal) > 0 || BD_MAX_LONG.compareTo(_numberBigDecimal) < 0) { - _reportOverflowLong(); + reportOverflowLong(); } _numberLong = _numberBigDecimal.longValue(); } else { @@ -733,7 +998,7 @@ protected void convertNumberToLong() throws InputCoercionException _numTypesValid |= NR_LONG; } - protected void convertNumberToBigInteger() + protected void convertNumberToBigInteger() throws IOException { if ((_numTypesValid & NR_BIGDECIMAL) != 0) { // here it'll just get truncated, no exceptions thrown @@ -750,7 +1015,7 @@ protected void convertNumberToBigInteger() _numTypesValid |= NR_BIGINT; } - protected void convertNumberToDouble() throws InputCoercionException + protected void convertNumberToDouble() throws IOException { /* 05-Aug-2008, tatus: Important note: this MUST start with * more accurate representations, since we don't know which @@ -772,15 +1037,18 @@ protected void convertNumberToDouble() throws InputCoercionException _numTypesValid |= NR_DOUBLE; } - protected void convertNumberToBigDecimal() + protected void convertNumberToBigDecimal() throws IOException { - // 05-Aug-2008, tatus: Important note: this MUST start with more - // accurate representations, since we don't know which value is - // the original one (others get generated when requested) - + /* 05-Aug-2008, tatus: Important note: this MUST start with + * more accurate representations, since we don't know which + * value is the original one (others get generated when + * requested) + */ + if ((_numTypesValid & NR_DOUBLE) != 0) { - // Let's actually parse from String representation, to avoid - // rounding errors that non-decimal floating operations could incur + /* Let's actually parse from String representation, to avoid + * rounding errors that non-decimal floating operations could incur + */ _numberBigDecimal = NumberInput.parseBigDecimal(getText()); } else if ((_numTypesValid & NR_BIGINT) != 0) { _numberBigDecimal = new BigDecimal(_numberBigInt); @@ -795,9 +1063,88 @@ protected void convertNumberToBigDecimal() } /* - /********************************************************************** + /********************************************************** + /* Internal/package methods: Error reporting + /********************************************************** + */ + + protected void _reportMismatchedEndMarker(int actCh, char expCh) throws JsonParseException { + JsonReadContext ctxt = getParsingContext(); + _reportError(String.format( + "Unexpected close marker '%s': expected '%c' (for %s starting at %s)", + (char) actCh, expCh, ctxt.typeDesc(), + ctxt.startLocation(_contentReference()))); + } + + @SuppressWarnings("deprecation") + protected char _handleUnrecognizedCharacterEscape(char ch) throws JsonProcessingException { + // as per [JACKSON-300] + if (isEnabled(Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER)) { + return ch; + } + // and [JACKSON-548] + if (ch == '\'' && isEnabled(Feature.ALLOW_SINGLE_QUOTES)) { + return ch; + } + _reportError("Unrecognized character escape "+_getCharDesc(ch)); + return ch; + } + + /** + * Method called to report a problem with unquoted control character. + * Note: it is possible to suppress some instances of + * exception by enabling + * {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_UNESCAPED_CONTROL_CHARS}. + * + * @param i Invalid control character + * @param ctxtDesc Addition description of context to use in exception message + * + * @throws JsonParseException explaining the problem + */ + @SuppressWarnings("deprecation") + protected void _throwUnquotedSpace(int i, String ctxtDesc) throws JsonParseException { + // JACKSON-208; possible to allow unquoted control chars: + if (!isEnabled(Feature.ALLOW_UNQUOTED_CONTROL_CHARS) || i > INT_SPACE) { + char c = (char) i; + String msg = "Illegal unquoted character ("+_getCharDesc(c)+"): has to be escaped using backslash to be included in "+ctxtDesc; + _reportError(msg); + } + } + + /** + * @return Description to use as "valid tokens" in an exception message about + * invalid (unrecognized) JSON token: called when parser finds something that + * looks like unquoted textual token + * + * @throws IOException Not thrown by base implementation but allowed by sub-classes + * + * @since 2.10 + */ + protected String _validJsonTokenList() throws IOException { + return _validJsonValueList(); + } + + /** + * @return Description to use as "valid JSON values" in an exception message about + * invalid (unrecognized) JSON value: called when parser finds something that + * does not look like a value or separator. + * + * @throws IOException Not thrown by base implementation but allowed by sub-classes + * + * @since 2.10 + */ + @SuppressWarnings("deprecation") + protected String _validJsonValueList() throws IOException { + if (isEnabled(Feature.ALLOW_NON_NUMERIC_NUMBERS)) { + return "(JSON String, Number (or 'NaN'/'INF'/'+INF'), Array, Object or token 'null', 'true' or 'false')"; + } + return "(JSON String, Number, Array, Object or token 'null', 'true' or 'false')"; + } + + /* + /********************************************************** /* Base64 handling support - /********************************************************************** + /********************************************************** */ /** @@ -807,18 +1154,17 @@ protected void convertNumberToBigDecimal() * * @return Character decoded, if any * - * @throws JacksonException If escape decoding fails + * @throws IOException If escape decoding fails */ - protected char _decodeEscaped() throws JacksonException { + protected char _decodeEscaped() throws IOException { throw new UnsupportedOperationException(); } - protected final int _decodeBase64Escape(Base64Variant b64variant, int ch, int index) - throws JacksonException + protected final int _decodeBase64Escape(Base64Variant b64variant, int ch, int index) throws IOException { - // Need to handle escaped chars + // 17-May-2011, tatu: As per [JACKSON-xxx], need to handle escaped chars if (ch != '\\') { - _reportInvalidBase64Char(b64variant, ch, index); + throw reportInvalidBase64Char(b64variant, ch, index); } int unescaped = _decodeEscaped(); // if white space, skip if first triplet; otherwise errors @@ -831,18 +1177,16 @@ protected final int _decodeBase64Escape(Base64Variant b64variant, int ch, int in int bits = b64variant.decodeBase64Char(unescaped); if (bits < 0) { if (bits != Base64Variant.BASE64_VALUE_PADDING) { - _reportInvalidBase64Char(b64variant, unescaped, index); + throw reportInvalidBase64Char(b64variant, unescaped, index); } } return bits; } - protected final int _decodeBase64Escape(Base64Variant b64variant, char ch, int index) - throws JacksonException + protected final int _decodeBase64Escape(Base64Variant b64variant, char ch, int index) throws IOException { if (ch != '\\') { - _reportInvalidBase64Char(b64variant, ch, index); - return -1; // never gets here + throw reportInvalidBase64Char(b64variant, ch, index); } char unescaped = _decodeEscaped(); // if white space, skip if first triplet; otherwise errors @@ -856,24 +1200,21 @@ protected final int _decodeBase64Escape(Base64Variant b64variant, char ch, int i if (bits < 0) { // second check since padding can only be 3rd or 4th byte (index #2 or #3) if ((bits != Base64Variant.BASE64_VALUE_PADDING) || (index < 2)) { - _reportInvalidBase64Char(b64variant, unescaped, index); + throw reportInvalidBase64Char(b64variant, unescaped, index); } } return bits; } - protected void _reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex) - throws StreamReadException { - _reportInvalidBase64Char(b64variant, ch, bindex, null); + protected IllegalArgumentException reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex) throws IllegalArgumentException { + return reportInvalidBase64Char(b64variant, ch, bindex, null); } /* * @param bindex Relative index within base64 character unit; between 0 * and 3 (as unit has exactly 4 characters) */ - protected void _reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex, String msg) - throws StreamReadException - { + protected IllegalArgumentException reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex, String msg) throws IllegalArgumentException { String base; if (ch <= INT_SPACE) { base = String.format("Illegal white space character (code 0x%s) as character #%d of 4-char base64 unit: can only used between units", @@ -889,31 +1230,72 @@ protected void _reportInvalidBase64Char(Base64Variant b64variant, int ch, int bi if (msg != null) { base = base + ": " + msg; } - _reportError(base); + return new IllegalArgumentException(base); } - protected void _handleBase64MissingPadding(Base64Variant b64variant) - throws StreamReadException + // since 2.9.8 + protected void _handleBase64MissingPadding(Base64Variant b64variant) throws IOException { _reportError(b64variant.missingPaddingMessage()); } /* - /********************************************************************** + /********************************************************** /* Internal/package methods: other - /********************************************************************** + /********************************************************** */ + /** + * @return Source reference + * @since 2.9 + * @deprecated Since 2.13, use {@link #_contentReference()} instead. + */ + @Deprecated + protected Object _getSourceReference() { + if (JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION.enabledIn(_features)) { + return _ioContext.contentReference().getRawContent(); + } + return null; + } + /** * Helper method used to encapsulate logic of including (or not) of * "content reference" when constructing {@link JsonLocation} instances. * * @return Source reference object, if any; {@code null} if none + * + * @since 2.13 */ protected ContentReference _contentReference() { - if (isEnabled(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)) { + if (JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION.enabledIn(_features)) { return _ioContext.contentReference(); } return ContentReference.unknown(); } + + protected static int[] growArrayBy(int[] arr, int more) + { + if (arr == null) { + return new int[more]; + } + return Arrays.copyOf(arr, arr.length + more); + } + + /* + /********************************************************** + /* Stuff that was abstract and required before 2.8, but that + /* is not mandatory in 2.8 or above. + /********************************************************** + */ + + @Deprecated // since 2.8 + protected void loadMoreGuaranteed() throws IOException { + if (!loadMore()) { _reportInvalidEOF(); } + } + + @Deprecated // since 2.8 + protected boolean loadMore() throws IOException { return false; } + + // Can't declare as deprecated, for now, but shouldn't be needed + protected void _finishString() throws IOException { } } diff --git a/src/main/java/com/fasterxml/jackson/core/base/ParserMinimalBase.java b/src/main/java/com/fasterxml/jackson/core/base/ParserMinimalBase.java index c2bcfa49e1..5446c96d09 100644 --- a/src/main/java/com/fasterxml/jackson/core/base/ParserMinimalBase.java +++ b/src/main/java/com/fasterxml/jackson/core/base/ParserMinimalBase.java @@ -1,21 +1,14 @@ package com.fasterxml.jackson.core.base; import java.io.IOException; -import java.io.Writer; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.exc.InputCoercionException; -import com.fasterxml.jackson.core.exc.UnexpectedEndOfInputException; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.exc.WrappedIOException; +import com.fasterxml.jackson.core.io.JsonEOFException; import com.fasterxml.jackson.core.io.NumberInput; -import com.fasterxml.jackson.core.sym.PropertyNameMatcher; -import com.fasterxml.jackson.core.type.ResolvedType; -import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.util.ByteArrayBuilder; -import com.fasterxml.jackson.core.util.JacksonFeatureSet; import com.fasterxml.jackson.core.util.VersionUtil; import static com.fasterxml.jackson.core.JsonTokenId.*; @@ -63,14 +56,20 @@ public abstract class ParserMinimalBase extends JsonParser protected final static char CHAR_NULL = '\0'; + /** + * @since 2.9 + */ protected final static byte[] NO_BYTES = new byte[0]; + /** + * @since 2.9 + */ protected final static int[] NO_INTS = new int[0]; /* - /********************************************************************** - /* Constants and fields wrt number handling - /********************************************************************** + /********************************************************** + /* Constants and fields of former 'JsonNumericParserBase' + /********************************************************** */ protected final static int NR_UNKNOWN = 0; @@ -88,6 +87,8 @@ public abstract class ParserMinimalBase extends JsonParser /** * NOTE! Not used by JSON implementation but used by many of binary codecs + * + * @since 2.9 */ protected final static int NR_FLOAT = 0x020; @@ -105,13 +106,6 @@ public abstract class ParserMinimalBase extends JsonParser protected final static BigDecimal BD_MIN_INT = new BigDecimal(BI_MIN_INT); protected final static BigDecimal BD_MAX_INT = new BigDecimal(BI_MAX_INT); - protected final static int MIN_BYTE_I = (int) Byte.MIN_VALUE; - // Allow range up to and including 255, to support signed AND unsigned bytes - protected final static int MAX_BYTE_I = (int) 255; - - protected final static int MIN_SHORT_I = (int) Short.MIN_VALUE; - protected final static int MAX_SHORT_I = (int) Short.MAX_VALUE; - protected final static long MIN_INT_L = (long) Integer.MIN_VALUE; protected final static long MAX_INT_L = (long) Integer.MAX_VALUE; @@ -124,45 +118,24 @@ public abstract class ParserMinimalBase extends JsonParser protected final static double MAX_INT_D = (double) Integer.MAX_VALUE; /* - /********************************************************************** + /********************************************************** /* Misc other constants - /********************************************************************** + /********************************************************** */ /** * Maximum number of characters to include in token reported * as part of error messages. + * + * @since 2.9 */ protected final static int MAX_ERROR_TOKEN_LENGTH = 256; /* - /********************************************************************** - /* Minimal configuration state - /********************************************************************** - */ - - /** - * Bit flag composed of bits that indicate which - * {@link com.fasterxml.jackson.core.StreamReadFeature}s - * are enabled. - */ - protected int _streamReadFeatures; - - /* - /********************************************************************** + /********************************************************** /* Minimal generally useful state - /********************************************************************** - */ - - /** - * Context object provided by higher level functionality like - * databinding for two reasons: passing configuration information - * during construction, and to allow calling of some databind - * operations via parser instance. - * - * @since 3.0 + /********************************************************** */ - protected final ObjectReadContext _objectReadContext; /** * Last token retrieved via {@link #nextToken}, if any. @@ -178,113 +151,48 @@ public abstract class ParserMinimalBase extends JsonParser protected JsonToken _lastClearedToken; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ - protected ParserMinimalBase(ObjectReadContext readCtxt) { - _objectReadContext = readCtxt; - } + protected ParserMinimalBase() { } + protected ParserMinimalBase(int features) { super(features); } - protected ParserMinimalBase(ObjectReadContext readCtxt, - int streamReadFeatures) - { - super(); - _objectReadContext = readCtxt; - _streamReadFeatures = streamReadFeatures; - } + // NOTE: had base impl in 2.3 and before; but shouldn't + // public abstract Version version(); /* - /********************************************************************** + /********************************************************** /* Configuration overrides if any - /********************************************************************** + /********************************************************** */ // from base class: - /* - @Override - public JsonParser enable(StreamReadFeature f) { - _streamReadFeatures |= f.getMask(); - return this; - } - - @Override - public JsonParser disable(StreamReadFeature f) { - _streamReadFeatures &= ~f.getMask(); - return this; - } - */ - - @Override - public boolean isEnabled(StreamReadFeature f) { return f.enabledIn(_streamReadFeatures); } - - /* - /********************************************************************** - /* Config access, capability introspection - /********************************************************************** - */ - - @Override - public int streamReadFeatures() { return _streamReadFeatures; } - - @Override - public JacksonFeatureSet streamReadCapabilities() { - return DEFAULT_READ_CAPABILITIES; - } + //public void enableFeature(Feature f) + //public void disableFeature(Feature f) + //public void setFeature(Feature f, boolean state) + //public boolean isFeatureEnabled(Feature f) /* - /********************************************************************** - /* JsonParser impl: open / close - /********************************************************************** + /********************************************************** + /* JsonParser impl + /********************************************************** */ - // public JsonToken getCurrentToken() - // public boolean hasCurrentToken() - - // public abstract void close(); - // public abstract boolean isClosed(); - - /* - /********************************************************************** - /* JsonParser impl: basic state access - /********************************************************************** - */ + @Override public abstract JsonToken nextToken() throws IOException; - // public abstract TokenStreamContext getParsingContext(); - - // public abstract JsonLocation getTokenLocation(); - // public abstract JsonLocation getCurrentLocation(); - - @Override - public ObjectReadContext objectReadContext() { - return _objectReadContext; + @Override public JsonToken currentToken() { return _currToken; } + @Override public int currentTokenId() { + final JsonToken t = _currToken; + return (t == null) ? JsonTokenId.ID_NO_TOKEN : t.id(); } - /** - * Method sub-classes need to implement to check whether end-of-content is allowed - * at the current decoding position: formats often want to verify the all - * start/end token pairs match, for example. - * - * @throws JacksonException if end-of-content not allowed at current position. - */ - protected abstract void _handleEOF() throws JacksonException; - - // public abstract String currentName(); + @Override public JsonToken getCurrentToken() { return _currToken; } - /* - /********************************************************************** - /* JsonParser impl: basic stream iteration - /********************************************************************** - */ - - // public abstract JsonToken nextToken() throws JacksonException; - - @Override public void finishToken() throws JacksonException { ; /* nothing */ } - - @Override public JsonToken currentToken() { return _currToken; } - @Override public int currentTokenId() { + @Deprecated + @Override public int getCurrentTokenId() { final JsonToken t = _currToken; return (t == null) ? JsonTokenId.ID_NO_TOKEN : t.id(); } @@ -307,18 +215,18 @@ public ObjectReadContext objectReadContext() { @Override public boolean isExpectedNumberIntToken() { return _currToken == JsonToken.VALUE_NUMBER_INT; } @Override - public JsonToken nextValue() throws JacksonException { + public JsonToken nextValue() throws IOException { // Implementation should be as trivial as follows; only needs to change if // we are to skip other tokens (for example, if comments were exposed as tokens) JsonToken t = nextToken(); - if (t == JsonToken.PROPERTY_NAME) { + if (t == JsonToken.FIELD_NAME) { t = nextToken(); } return t; } @Override - public JsonParser skipChildren() throws JacksonException + public JsonParser skipChildren() throws IOException { if (_currToken != JsonToken.START_OBJECT && _currToken != JsonToken.START_ARRAY) { @@ -332,8 +240,10 @@ public JsonParser skipChildren() throws JacksonException JsonToken t = nextToken(); if (t == null) { _handleEOF(); - // given constraints, above should never return; however, FindBugs - // doesn't know about it and complains... so let's add dummy break here + /* given constraints, above should never return; + * however, FindBugs doesn't know about it and + * complains... so let's add dummy break here + */ return this; } if (t.isStructStart()) { @@ -352,51 +262,32 @@ public JsonParser skipChildren() throws JacksonException } } - /* - /********************************************************************** - /* JsonParser impl: stream iteration, property names - /********************************************************************** + /** + * Method sub-classes need to implement for verifying that end-of-content + * is acceptable at current input position. + * + * @throws JsonParseException If end-of-content is not acceptable (for example, + * missing end-object or end-array tokens) */ + protected abstract void _handleEOF() throws JsonParseException; - @Override - public String nextName() throws JacksonException { - return (nextToken() == JsonToken.PROPERTY_NAME) ? currentName() : null; - } + //public JsonToken getCurrentToken() + //public boolean hasCurrentToken() - @Override - public boolean nextName(SerializableString str) throws JacksonException { - return (nextToken() == JsonToken.PROPERTY_NAME) && str.getValue().equals(currentName()); - } + @Override public abstract String getCurrentName() throws IOException; + @Override public abstract void close() throws IOException; + @Override public abstract boolean isClosed(); - // Base implementation that should work well for most implementations but that - // is typically overridden for performance optimization purposes - @Override - public int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException { - String str = nextName(); - if (str != null) { - return matcher.matchName(str); - } - if (_currToken == JsonToken.END_OBJECT) { - return PropertyNameMatcher.MATCH_END_OBJECT; - } - return PropertyNameMatcher.MATCH_ODD_TOKEN; - } + @Override public abstract JsonStreamContext getParsingContext(); - @Override - public int currentNameMatch(PropertyNameMatcher matcher) { - if (_currToken == JsonToken.PROPERTY_NAME) { - return matcher.matchName(currentName()); - } - if (_currToken == JsonToken.END_OBJECT) { - return PropertyNameMatcher.MATCH_END_OBJECT; - } - return PropertyNameMatcher.MATCH_ODD_TOKEN; - } +// public abstract JsonLocation getTokenLocation(); + +// public abstract JsonLocation getCurrentLocation(); /* - /********************************************************************** + /********************************************************** /* Public API, token state overrides - /********************************************************************** + /********************************************************** */ @Override public void clearCurrentToken() { @@ -408,109 +299,36 @@ public int currentNameMatch(PropertyNameMatcher matcher) { @Override public JsonToken getLastClearedToken() { return _lastClearedToken; } -// @Override public abstract void overrideCurrentName(String name); - + @Override public abstract void overrideCurrentName(String name); + /* - /********************************************************************** + /********************************************************** /* Public API, access to token information, text - /********************************************************************** + /********************************************************** */ -// @Override public abstract String getText(); -// @Override public abstract char[] getTextCharacters(); -// @Override public abstract boolean hasTextCharacters(); -// @Override public abstract int getTextLength(); -// @Override public abstract int getTextOffset(); - - @Override - public int getText(Writer writer) throws JacksonException - { - String str = getText(); - if (str == null) { - return 0; - } - try { - writer.write(str); - } catch (IOException e) { - throw _wrapIOFailure(e); - } - return str.length(); - } + @Override public abstract String getText() throws IOException; + @Override public abstract char[] getTextCharacters() throws IOException; + @Override public abstract boolean hasTextCharacters(); + @Override public abstract int getTextLength() throws IOException; + @Override public abstract int getTextOffset() throws IOException; /* - /********************************************************************** - /* Public API, access to token information, numeric - /********************************************************************** - */ - -// public abstract Number getNumberValue(); -// public abstract NumberType getNumberType(); - - @Override - public Number getNumberValueExact() throws InputCoercionException { - return getNumberValue(); - } - - @Override - public byte getByteValue() throws InputCoercionException { - int value = getIntValue(); - // So far so good: but does it fit? - // Let's actually allow range of [-128, 255] instead of just signed range of [-128, 127] - // since "unsigned" usage quite common for bytes (but Java may use signed range, too) - if (value < MIN_BYTE_I || value > MAX_BYTE_I) { - _reportOverflowByte(getText(), currentToken()); - } - return (byte) value; - } - - @Override - public short getShortValue() throws InputCoercionException - { - int value = getIntValue(); - if (value < MIN_SHORT_I || value > MAX_SHORT_I) { - _reportOverflowShort(getText(), currentToken()); - } - return (short) value; - } - -// public abstract int getIntValue(); -// public abstract long getLongValue(); - - /* - /********************************************************************** - /* Public API, access to token information, other - /********************************************************************** - */ - - @Override - public boolean getBooleanValue() throws InputCoercionException { - JsonToken t = currentToken(); - if (t == JsonToken.VALUE_TRUE) return true; - if (t == JsonToken.VALUE_FALSE) return false; - - throw _constructInputCoercion(String.format("Current token (%s) not of boolean type", t), - t, Boolean.TYPE); - } - - /* - /********************************************************************** + /********************************************************** /* Public API, access to token information, binary - /********************************************************************** + /********************************************************** */ -// public abstract byte[] getBinaryValue(Base64Variant b64variant); - - @Override - public Object getEmbeddedObject() { return null; } + @Override public abstract byte[] getBinaryValue(Base64Variant b64variant) throws IOException; /* - /********************************************************************** + /********************************************************** /* Public API, access with conversion/coercion - /********************************************************************** + /********************************************************** */ @Override - public boolean getValueAsBoolean(boolean defaultValue) + public boolean getValueAsBoolean(boolean defaultValue) throws IOException { JsonToken t = _currToken; if (t != null) { @@ -546,9 +364,8 @@ public boolean getValueAsBoolean(boolean defaultValue) return defaultValue; } - @Override - public int getValueAsInt() + public int getValueAsInt() throws IOException { JsonToken t = _currToken; if ((t == JsonToken.VALUE_NUMBER_INT) || (t == JsonToken.VALUE_NUMBER_FLOAT)) { @@ -558,7 +375,7 @@ public int getValueAsInt() } @Override - public int getValueAsInt(int defaultValue) + public int getValueAsInt(int defaultValue) throws IOException { JsonToken t = _currToken; if ((t == JsonToken.VALUE_NUMBER_INT) || (t == JsonToken.VALUE_NUMBER_FLOAT)) { @@ -589,7 +406,7 @@ public int getValueAsInt(int defaultValue) } @Override - public long getValueAsLong() + public long getValueAsLong() throws IOException { JsonToken t = _currToken; if ((t == JsonToken.VALUE_NUMBER_INT) || (t == JsonToken.VALUE_NUMBER_FLOAT)) { @@ -599,7 +416,7 @@ public long getValueAsLong() } @Override - public long getValueAsLong(long defaultValue) + public long getValueAsLong(long defaultValue) throws IOException { JsonToken t = _currToken; if ((t == JsonToken.VALUE_NUMBER_INT) || (t == JsonToken.VALUE_NUMBER_FLOAT)) { @@ -629,7 +446,7 @@ public long getValueAsLong(long defaultValue) } @Override - public double getValueAsDouble(double defaultValue) + public double getValueAsDouble(double defaultValue) throws IOException { JsonToken t = _currToken; if (t != null) { @@ -649,7 +466,7 @@ public double getValueAsDouble(double defaultValue) case ID_NULL: return 0.0; case ID_EMBEDDED_OBJECT: - Object value = getEmbeddedObject(); + Object value = this.getEmbeddedObject(); if (value instanceof Number) { return ((Number) value).doubleValue(); } @@ -659,57 +476,29 @@ public double getValueAsDouble(double defaultValue) } @Override - public String getValueAsString() { + public String getValueAsString() throws IOException { // sub-classes tend to override so... return getValueAsString(null); } - + @Override - public String getValueAsString(String defaultValue) { + public String getValueAsString(String defaultValue) throws IOException { if (_currToken == JsonToken.VALUE_STRING) { return getText(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return currentName(); + if (_currToken == JsonToken.FIELD_NAME) { + return getCurrentName(); } if (_currToken == null || _currToken == JsonToken.VALUE_NULL || !_currToken.isScalarValue()) { return defaultValue; } return getText(); } - - /* - /********************************************************************** - /* Databind callbacks - /********************************************************************** - */ - - @Override - public T readValueAs(Class valueType) throws JacksonException { - return _objectReadContext.readValue(this, valueType); - } - - @Override - public T readValueAs(TypeReference valueTypeRef) throws JacksonException { - return _objectReadContext.readValue(this, valueTypeRef); - } - - @SuppressWarnings("unchecked") - @Override - public T readValueAs(ResolvedType type) throws JacksonException { - return (T) _objectReadContext.readValue(this, type); - } - - @SuppressWarnings("unchecked") - @Override - public T readValueAsTree() throws JacksonException { - return (T) _objectReadContext.readTree(this); - } - + /* - /********************************************************************** - /* Helper methods: Base64 decoding - /********************************************************************** + /********************************************************** + /* Base64 decoding + /********************************************************** */ /** @@ -720,11 +509,10 @@ public T readValueAsTree() throws JacksonException { * @param builder Builder used to buffer binary content decoded * @param b64variant Base64 variant expected in content * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - protected void _decodeBase64(String str, ByteArrayBuilder builder, Base64Variant b64variant) - throws JacksonException + protected void _decodeBase64(String str, ByteArrayBuilder builder, Base64Variant b64variant) throws IOException { try { b64variant.decode(str, builder); @@ -734,9 +522,9 @@ protected void _decodeBase64(String str, ByteArrayBuilder builder, Base64Variant } /* - /********************************************************************** + /********************************************************** /* Coercion helper methods (overridable) - /********************************************************************** + /********************************************************** */ /** @@ -750,22 +538,25 @@ protected void _decodeBase64(String str, ByteArrayBuilder builder, Base64Variant * * @return True if given value contains "null equivalent" String value (for * content this parser handles). + * + * @since 2.3 */ protected boolean _hasTextualNull(String value) { return "null".equals(value); } /* - /********************************************************************** - /* Error reporting, numeric conversion/parsing issues - /********************************************************************** + /********************************************************** + /* Error reporting + /********************************************************** */ - protected void _reportUnexpectedNumberChar(int ch, String comment) throws StreamReadException { + protected void reportUnexpectedNumberChar(int ch, String comment) throws JsonParseException { String msg = String.format("Unexpected character (%s) in numeric value", _getCharDesc(ch)); if (comment != null) { msg += ": "+comment; } _reportError(msg); } + /** * Method called to throw an exception for input token that looks like a number * based on first character(s), but is not valid according to rules of format. @@ -774,44 +565,31 @@ protected void _reportUnexpectedNumberChar(int ch, String comment) throws Stream * * @param msg Base exception message to use * - * @throws StreamReadException Exception that describes problem with number validity + * @throws JsonParseException Exception that describes problem with number validity */ - protected void _reportInvalidNumber(String msg) throws StreamReadException { + protected void reportInvalidNumber(String msg) throws JsonParseException { _reportError("Invalid numeric value: "+msg); } - protected void _reportOverflowByte(String numDesc, JsonToken inputType) throws InputCoercionException { - throw _constructInputCoercion(String.format( - "Numeric value (%s) out of range of `byte` (%d - %s)", - _longIntegerDesc(numDesc), MIN_BYTE_I, MAX_BYTE_I), - inputType, Byte.TYPE); - } - - protected void _reportOverflowShort(String numDesc, JsonToken inputType) throws InputCoercionException { - throw _constructInputCoercion(String.format( - "Numeric value (%s) out of range of `short` (%d - %s)", - _longIntegerDesc(numDesc), MIN_SHORT_I, MAX_SHORT_I), - inputType, Short.TYPE); - } - /** * Method called to throw an exception for integral (not floating point) input * token with value outside of Java signed 32-bit range when requested as {@code int}. * Result will be {@link InputCoercionException} being thrown. * - * @throws InputCoercionException Exception that describes problem with number range validity + * @throws JsonParseException Exception that describes problem with number range validity */ - protected void _reportOverflowInt() throws InputCoercionException { - _reportOverflowInt(getText()); + protected void reportOverflowInt() throws IOException { + reportOverflowInt(getText()); } - protected void _reportOverflowInt(String numDesc) throws InputCoercionException { - _reportOverflowInt(numDesc, currentToken()); + // @since 2.10 + protected void reportOverflowInt(String numDesc) throws IOException { + reportOverflowInt(numDesc, currentToken()); } - protected void _reportOverflowInt(String numDesc, JsonToken inputType) throws InputCoercionException { - throw _constructInputCoercion(String.format( - "Numeric value (%s) out of range of `int` (%d - %s)", + // @since 2.10 + protected void reportOverflowInt(String numDesc, JsonToken inputType) throws IOException { + _reportInputCoercion(String.format("Numeric value (%s) out of range of int (%d - %s)", _longIntegerDesc(numDesc), Integer.MIN_VALUE, Integer.MAX_VALUE), inputType, Integer.TYPE); } @@ -821,23 +599,31 @@ protected void _reportOverflowInt(String numDesc, JsonToken inputType) throws In * token with value outside of Java signed 64-bit range when requested as {@code long}. * Result will be {@link InputCoercionException} being thrown. * - * @throws InputCoercionException Exception that describes problem with number range validity + * @throws JsonParseException Exception that describes problem with number range validity */ - protected void _reportOverflowLong() throws InputCoercionException { - _reportOverflowLong(getText()); + protected void reportOverflowLong() throws IOException { + reportOverflowLong(getText()); } - protected void _reportOverflowLong(String numDesc) throws InputCoercionException { - _reportOverflowLong(numDesc, currentToken()); + // @since 2.10 + protected void reportOverflowLong(String numDesc) throws IOException { + reportOverflowLong(numDesc, currentToken()); } - protected void _reportOverflowLong(String numDesc, JsonToken inputType) throws InputCoercionException { - throw _constructInputCoercion(String.format( - "Numeric value (%s) out of range of `long` (%d - %s)", + // @since 2.10 + protected void reportOverflowLong(String numDesc, JsonToken inputType) throws IOException { + _reportInputCoercion(String.format("Numeric value (%s) out of range of long (%d - %s)", _longIntegerDesc(numDesc), Long.MIN_VALUE, Long.MAX_VALUE), inputType, Long.TYPE); } + // @since 2.10 + protected void _reportInputCoercion(String msg, JsonToken inputType, Class targetType) + throws InputCoercionException { + throw new InputCoercionException(this, msg, inputType, targetType); + } + + // @since 2.9.8 protected String _longIntegerDesc(String rawNum) { int rawLen = rawNum.length(); if (rawLen < 1000) { @@ -849,6 +635,7 @@ protected String _longIntegerDesc(String rawNum) { return String.format("[Integer with %d digits]", rawLen); } + // @since 2.9.8 protected String _longNumberDesc(String rawNum) { int rawLen = rawNum.length(); if (rawLen < 1000) { @@ -860,13 +647,7 @@ protected String _longNumberDesc(String rawNum) { return String.format("[number with %d characters]", rawLen); } - /* - /********************************************************************** - /* Error reporting, EOF, unexpected chars/content - /********************************************************************** - */ - - protected void _reportUnexpectedChar(int ch, String comment) throws StreamReadException + protected void _reportUnexpectedChar(int ch, String comment) throws JsonParseException { if (ch < 0) { // sanity check _reportInvalidEOF(); @@ -878,11 +659,12 @@ protected void _reportUnexpectedChar(int ch, String comment) throws StreamReadEx _reportError(msg); } - protected void _reportInvalidEOF() throws StreamReadException { + protected void _reportInvalidEOF() throws JsonParseException { _reportInvalidEOF(" in "+_currToken, _currToken); } - protected void _reportInvalidEOFInValue(JsonToken type) throws StreamReadException { + // @since 2.8 + protected void _reportInvalidEOFInValue(JsonToken type) throws JsonParseException { String msg; if (type == JsonToken.VALUE_STRING) { msg = " in a String value"; @@ -895,38 +677,48 @@ protected void _reportInvalidEOFInValue(JsonToken type) throws StreamReadExcepti _reportInvalidEOF(msg, type); } - protected void _reportInvalidEOF(String msg, JsonToken currToken) throws StreamReadException { - throw new UnexpectedEndOfInputException(this, currToken, "Unexpected end-of-input"+msg); + // @since 2.8 + protected void _reportInvalidEOF(String msg, JsonToken currToken) throws JsonParseException { + throw new JsonEOFException(this, currToken, "Unexpected end-of-input"+msg); } - protected void _reportMissingRootWS(int ch) throws StreamReadException { - _reportUnexpectedChar(ch, "Expected space separating root-level values"); + /** + * @deprecated Since 2.8 use {@link #_reportInvalidEOF(String, JsonToken)} instead + * + * @throws JsonParseException Exception that describes problem with end-of-content within value + */ + @Deprecated // since 2.8 + protected void _reportInvalidEOFInValue() throws JsonParseException { + _reportInvalidEOF(" in a value"); } - - // @since 3.0 - protected void _reportBadInputStream(int readLen) throws StreamReadException - { - // 12-Jan-2021, tatu: May need to think about this bit more but for now - // do double-wrapping - throw _wrapIOFailure(new IOException( -"Bad input source: InputStream.read() returned 0 bytes when trying to read "+readLen+" bytes")); + + /** + * @param msg Addition message snippet to append to base exception message + * @deprecated Since 2.8 use {@link #_reportInvalidEOF(String, JsonToken)} instead + * + * @throws JsonParseException Exception that describes problem with end-of-content within value + */ + @Deprecated // since 2.8 + protected void _reportInvalidEOF(String msg) throws JsonParseException { + throw new JsonEOFException(this, null, "Unexpected end-of-input"+msg); } - - // @since 3.0 - protected void _reportBadReader(int readLen) throws StreamReadException - { - // 12-Jan-2021, tatu: May need to think about this bit more but for now - // do double-wrapping - throw _wrapIOFailure(new IOException( -"Bad input source: Reader.read() returned 0 bytes when trying to read "+readLen+" bytes")); + + protected void _reportMissingRootWS(int ch) throws JsonParseException { + _reportUnexpectedChar(ch, "Expected space separating root-level values"); } - - protected void _throwInvalidSpace(int i) throws StreamReadException { + + protected void _throwInvalidSpace(int i) throws JsonParseException { char c = (char) i; String msg = "Illegal character ("+_getCharDesc(c)+"): only regular white space (\\r, \\n, \\t) is allowed between tokens"; _reportError(msg); } + /* + /********************************************************** + /* Error reporting, generic + /********************************************************** + */ + protected final static String _getCharDesc(int ch) { char c = (char) ch; @@ -939,78 +731,47 @@ protected final static String _getCharDesc(int ch) return "'"+c+"' (code "+ch+")"; } - /* - /********************************************************************** - /* Error reporting, input coercion support - /********************************************************************** - */ - - // @since 3.0 - protected InputCoercionException _constructNotNumericType(JsonToken actualToken, int expNumericType) - { - final String msg = String.format( -"Current token (%s) not numeric, can not use numeric value accessors", actualToken); - - Class targetType; - - switch (expNumericType) { - case NR_INT: - targetType = Integer.TYPE; - break; - case NR_LONG: - targetType = Long.TYPE; - break; - case NR_BIGINT: - targetType = BigInteger.class; - break; - case NR_FLOAT: - targetType = Float.TYPE; - break; - case NR_DOUBLE: - targetType = Double.TYPE; - break; - case NR_BIGDECIMAL: - targetType = BigDecimal.class; - break; - default: - targetType = Number.class; - break; - } - return _constructInputCoercion(msg, actualToken, targetType); + protected final void _reportError(String msg) throws JsonParseException { + throw _constructError(msg); } - protected InputCoercionException _constructInputCoercion(String msg, JsonToken inputType, Class targetType) { - return new InputCoercionException(this, msg, inputType, targetType); + // @since 2.9 + protected final void _reportError(String msg, Object arg) throws JsonParseException { + throw _constructError(String.format(msg, arg)); } - /* - /********************************************************************** - /* Error reporting, generic - /********************************************************************** - */ - - protected void _reportError(String msg) throws StreamReadException { - throw _constructReadException(msg); + // @since 2.9 + protected final void _reportError(String msg, Object arg1, Object arg2) throws JsonParseException { + throw _constructError(String.format(msg, arg1, arg2)); } - protected void _reportError(String msg, Object arg) throws StreamReadException { - throw _constructReadException(String.format(msg, arg)); + protected final void _wrapError(String msg, Throwable t) throws JsonParseException { + throw _constructError(msg, t); } - protected void _reportError(String msg, Object arg1, Object arg2) throws StreamReadException { - throw _constructReadException(String.format(msg, arg1, arg2)); + protected final void _throwInternal() { + VersionUtil.throwInternal(); } - protected void _reportError(String msg, Object arg1, Object arg2, Object arg3) throws StreamReadException { - throw _constructReadException(String.format(msg, arg1, arg2, arg3)); + protected final JsonParseException _constructError(String msg, Throwable t) { + return new JsonParseException(this, msg, t); } - // @since 3.0 - protected JacksonException _wrapIOFailure(IOException e) { - return WrappedIOException.construct(e, this); + @Deprecated // since 2.11 + protected static byte[] _asciiBytes(String str) { + byte[] b = new byte[str.length()]; + for (int i = 0, len = str.length(); i < len; ++i) { + b[i] = (byte) str.charAt(i); + } + return b; } - - protected final void _throwInternal() { - VersionUtil.throwInternal(); + + @Deprecated // since 2.11 + protected static String _ascii(byte[] b) { + try { + return new String(b, "US-ASCII"); + } catch (IOException e) { // never occurs + throw new RuntimeException(e); + } } } diff --git a/src/main/java/com/fasterxml/jackson/core/base/TextualTSFactory.java b/src/main/java/com/fasterxml/jackson/core/base/TextualTSFactory.java deleted file mode 100644 index ea70dbcba1..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/base/TextualTSFactory.java +++ /dev/null @@ -1,347 +0,0 @@ -package com.fasterxml.jackson.core.base; - -import java.io.*; -import java.net.URL; -import java.nio.file.Path; - -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.io.IOContext; -import com.fasterxml.jackson.core.io.ContentReference; -import com.fasterxml.jackson.core.io.UTF8Writer; - -/** - * Intermediate {@link TokenStreamFactory} sub-class used as the base for - * textual data formats. - */ -@SuppressWarnings("resource") -public abstract class TextualTSFactory - extends DecorableTSFactory - implements java.io.Serializable -{ - private static final long serialVersionUID = 3L; - - /* - /********************************************************************** - /* Construction - /********************************************************************** - */ - - protected TextualTSFactory(int formatPF, int formatGF) { - super(formatPF, formatGF); - } - - /** - * Constructors used by builders for instantiation. - * - * @param baseBuilder Builder with configurations to use - * - * @since 3.0 - */ - protected TextualTSFactory(DecorableTSFBuilder baseBuilder) - { - super(baseBuilder); - } - - // Copy constructor. - protected TextualTSFactory(TextualTSFactory src) { - super(src); - } - - /* - /********************************************************************** - /* Default introspection - /********************************************************************** - */ - - @Override - public boolean canHandleBinaryNatively() { - // typically textual formats need escaping like Base64 so: - return false; - } - - /* - /********************************************************************** - /* Extended capabilities for textual formats (only) - /********************************************************************** - */ - - /** - * Introspection method that can be used by base factory to check - * whether access using char[] is something that actual - * parser implementations can take advantage of, over having to - * use {@link java.io.Reader}. Sub-types are expected to override - * definition; default implementation (suitable for JSON) alleges - * that optimization are possible; and thereby is likely to try - * to access {@link java.lang.String} content by first copying it into - * recyclable intermediate buffer. - *

    - * Default implementation simply returns {@code true} - * - * @return Whether efficient access is possible - */ - public boolean canUseCharArrays() { return true; } - - /* - /********************************************************************** - /* Factory methods: parsers, with context - /********************************************************************** - */ - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, File f) - throws JacksonException - { - // true, since we create InputStream from File - IOContext ioCtxt = _createContext(_createContentReference(f), true); - return _createParser(readCtxt, ioCtxt, - _decorate(ioCtxt, _fileInputStream(f))); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, Path p) - throws JacksonException - { - // true, since we create InputStream from Path - IOContext ioCtxt = _createContext(_createContentReference(p), true); - return _createParser(readCtxt, ioCtxt, - _decorate(ioCtxt, _pathInputStream(p))); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, URL url) - throws JacksonException - { - // true, since we create InputStream from URL - IOContext ioCtxt = _createContext(_createContentReference(url), true); - return _createParser(readCtxt, ioCtxt, - _decorate(ioCtxt, _optimizedStreamFromURL(url))); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, InputStream in) - throws JacksonException - { - IOContext ioCtxt = _createContext(_createContentReference(in), false); - return _createParser(readCtxt, ioCtxt, _decorate(ioCtxt, in)); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, Reader r) - throws JacksonException - { - // false -> we do NOT own Reader (did not create it) - IOContext ioCtxt = _createContext(_createContentReference(r), false); - return _createParser(readCtxt, ioCtxt, _decorate(ioCtxt, r)); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - byte[] data, int offset, int len) - throws JacksonException - { - IOContext ioCtxt = _createContext(_createContentReference(data, offset, len), true); - if (_inputDecorator != null) { - InputStream in = _inputDecorator.decorate(ioCtxt, data, offset, len); - if (in != null) { - return _createParser(readCtxt, ioCtxt, in); - } - } - return _createParser(readCtxt, ioCtxt, data, offset, len); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, String content) - throws JacksonException - { - final int strLen = content.length(); - // Actually, let's use this for medium-sized content, up to 64kB chunk (32kb char) - if ((_inputDecorator != null) || (strLen > 0x8000) || !canUseCharArrays()) { - // easier to just wrap in a Reader than extend InputDecorator; or, if content - // is too long for us to copy it over - return createParser(readCtxt, new StringReader(content)); - } - IOContext ioCtxt = _createContext(_createContentReference(content), true); - char[] buf = ioCtxt.allocTokenBuffer(strLen); - content.getChars(0, strLen, buf, 0); - return _createParser(readCtxt, ioCtxt, buf, 0, strLen, true); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - char[] content, int offset, int len) - throws JacksonException - { - if (_inputDecorator != null) { // easier to just wrap in a Reader than extend InputDecorator - return createParser(readCtxt, new CharArrayReader(content, offset, len)); - } - return _createParser(readCtxt, - _createContext(_createContentReference(content, offset, len), true), - content, offset, len, - // important: buffer is NOT recyclable, as it's from caller - false); - } - - @Override - public JsonParser createParser(ObjectReadContext readCtxt, - DataInput in) throws JacksonException - { - IOContext ioCtxt = _createContext(_createContentReference(in), false); - return _createParser(readCtxt, ioCtxt, _decorate(ioCtxt, in)); - } - - protected abstract JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, InputStream in) throws JacksonException; - - protected abstract JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, Reader r) throws JacksonException; - - protected abstract JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, - byte[] data, int offset, int len) throws JacksonException; - - protected abstract JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, char[] data, int offset, int len, boolean recyclable) - throws JacksonException; - - protected abstract JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, DataInput input) throws JacksonException; - - /* - /********************************************************************** - /* Factory methods: generators - /********************************************************************** - */ - - @Override - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, - OutputStream out, JsonEncoding enc) - throws JacksonException - { - // false -> we won't manage the stream unless explicitly directed to - IOContext ioCtxt = _createContext(_createContentReference(out), false, enc); - if (enc == JsonEncoding.UTF8) { - return _createUTF8Generator(writeCtxt, ioCtxt, _decorate(ioCtxt, out)); - } - return _createGenerator(writeCtxt, ioCtxt, - _decorate(ioCtxt, _createWriter(ioCtxt, out, enc))); - } - - @Override - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, Writer w) - throws JacksonException - { - IOContext ioCtxt = _createContext(_createContentReference(w), false); - return _createGenerator(writeCtxt, ioCtxt, _decorate(ioCtxt, w)); - } - - @Override - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, - File f, JsonEncoding enc) - throws JacksonException - { - final OutputStream out = _fileOutputStream(f); - final IOContext ioCtxt = _createContext(_createContentReference(f), true, enc); - if (enc == JsonEncoding.UTF8) { - return _createUTF8Generator(writeCtxt, ioCtxt, _decorate(ioCtxt, out)); - } - return _createGenerator(writeCtxt, ioCtxt, - _decorate(ioCtxt, _createWriter(ioCtxt, out, enc))); - } - - @Override - public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, - Path p, JsonEncoding enc) - throws JacksonException - { - final OutputStream out = _pathOutputStream(p); - final IOContext ioCtxt = _createContext(_createContentReference(p), true, enc); - if (enc == JsonEncoding.UTF8) { - return _createUTF8Generator(writeCtxt, ioCtxt, _decorate(ioCtxt, out)); - } - return _createGenerator(writeCtxt, ioCtxt, - _decorate(ioCtxt, _createWriter(ioCtxt, out, enc))); - } - - /* - /********************************************************************** - /* Factory methods: context objects - /********************************************************************** - */ - - @Override - protected ContentReference _createContentReference(Object contentRef) { - // true -> textual - return ContentReference.construct(true, contentRef); - } - - @Override - protected ContentReference _createContentReference(Object contentRef, - int offset, int length) - { - // true -> textual - return ContentReference.construct(true, contentRef, offset, length); - } - - /* - /********************************************************************** - /* Factory methods: abstract, for sub-classes to implement - /********************************************************************** - */ - - /** - * Overridable factory method that actually instantiates generator for - * given {@link Writer} and context object. - *

    - * This method is specifically designed to remain - * compatible between minor versions so that sub-classes can count - * on it being called as expected. That is, it is part of official - * interface from sub-class perspective, although not a public - * method available to users of factory implementations. - * - * @param writeCtxt Object write context for generator to use - * @param ioCtxt IOContext for generator to use - * @param out Writer for generator to use - * - * @return Generator constructed - * - * @throws JacksonException If there is a problem constructing generator - */ - protected abstract JsonGenerator _createGenerator(ObjectWriteContext writeCtxt, - IOContext ioCtxt, Writer out) throws JacksonException; - - /** - * Overridable factory method that actually instantiates generator for - * given {@link OutputStream} and context object, using UTF-8 encoding. - *

    - * This method is specifically designed to remain - * compatible between minor versions so that sub-classes can count - * on it being called as expected. That is, it is part of official - * interface from sub-class perspective, although not a public - * method available to users of factory implementations. - * - * @param writeCtxt Object write context for generator to use - * @param ioCtxt IOContext for generator to use - * @param out OutputStream for generator to use - * - * @return Generator constructed - * - * @throws JacksonException If there is a problem constructing generator - */ - protected abstract JsonGenerator _createUTF8Generator(ObjectWriteContext writeCtxt, - IOContext ioCtxt, OutputStream out) throws JacksonException; - - protected Writer _createWriter(IOContext ioCtxt, OutputStream out, JsonEncoding enc) - throws JacksonException - { - // note: this should not get called any more (caller checks, dispatches) - if (enc == JsonEncoding.UTF8) { // We have optimized writer for UTF-8 - return new UTF8Writer(ioCtxt, out); - } - // not optimal, but should do unless we really care about UTF-16/32 encoding speed - try { - return new OutputStreamWriter(out, enc.getJavaName()); - } catch (IOException e) { - throw _wrapIOFailure(e); - } - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/exc/InputCoercionException.java b/src/main/java/com/fasterxml/jackson/core/exc/InputCoercionException.java index bedc49af1b..0faa1a2ad3 100644 --- a/src/main/java/com/fasterxml/jackson/core/exc/InputCoercionException.java +++ b/src/main/java/com/fasterxml/jackson/core/exc/InputCoercionException.java @@ -1,18 +1,19 @@ package com.fasterxml.jackson.core.exc; import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.util.RequestPayload; /** * Exception type for read-side problems that are not direct decoding ("parsing") - * problems (those would be reported as basic - * {@link StreamReadException}s), + * problems (those would be reported as {@link com.fasterxml.jackson.core.JsonParseException}s), * but rather result from failed attempts to convert specific Java value out of valid * but incompatible input value. One example is numeric coercions where target number type's * range does not allow mapping of too large/too small input value. + * + * @since 2.10 */ -public class InputCoercionException extends StreamReadException -{ - private static final long serialVersionUID = 3L; +public class InputCoercionException extends StreamReadException { + private static final long serialVersionUID = 1L; /** * Input token that represents input value that failed to coerce. @@ -26,7 +27,7 @@ public class InputCoercionException extends StreamReadException /** * Constructor that uses current parsing location as location, and - * sets processor (accessible via {@link #processor()}) to + * sets processor (accessible via {@link #getProcessor()}) to * specified parser. * * @param p Parser in use at the point where failure occurred @@ -43,7 +44,7 @@ public InputCoercionException(JsonParser p, String msg, /** * Fluent method that may be used to assign originating {@link JsonParser}, - * to be accessed using {@link #processor()}. + * to be accessed using {@link #getProcessor()}. *

    * NOTE: `this` instance is modified and no new instance is constructed. */ @@ -53,6 +54,12 @@ public InputCoercionException withParser(JsonParser p) { return this; } + @Override + public InputCoercionException withRequestPayload(RequestPayload p) { + _requestPayload = p; + return this; + } + /** * Accessor for getting information about input type (in form of token, giving "shape" * of input) for which coercion failed. diff --git a/src/main/java/com/fasterxml/jackson/core/exc/StreamReadException.java b/src/main/java/com/fasterxml/jackson/core/exc/StreamReadException.java index fcd9f17eda..9aaefb5dfb 100644 --- a/src/main/java/com/fasterxml/jackson/core/exc/StreamReadException.java +++ b/src/main/java/com/fasterxml/jackson/core/exc/StreamReadException.java @@ -1,47 +1,60 @@ package com.fasterxml.jackson.core.exc; import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.util.RequestPayload; /** * Intermediate base class for all read-side streaming processing problems, including * parsing and input value coercion problems. + *

    + * Added in 2.10 to eventually replace {@link com.fasterxml.jackson.core.JsonParseException}. + * + * @since 2.10 */ -public class StreamReadException - extends JacksonException +public abstract class StreamReadException + extends JsonProcessingException { - private final static long serialVersionUID = 3L; + final static long serialVersionUID = 2L; protected transient JsonParser _processor; - public StreamReadException(JsonParser p, String msg) { - super(msg, (p == null) ? null : p.currentLocation(), null); + /** + * Optional payload that can be assigned to pass along for error reporting + * or handling purposes. Core streaming parser implementations DO NOT + * initialize this; it is up to using applications and frameworks to + * populate it. + */ + protected RequestPayload _requestPayload; + + protected StreamReadException(JsonParser p, String msg) { + super(msg, (p == null) ? null : p.getCurrentLocation()); _processor = p; } - public StreamReadException(JsonParser p, String msg, Throwable root) { - super(msg, (p == null) ? null : p.currentLocation(), root); + protected StreamReadException(JsonParser p, String msg, Throwable root) { + super(msg, (p == null) ? null : p.getCurrentLocation(), root); _processor = p; } - public StreamReadException(JsonParser p, String msg, JsonLocation loc) { + protected StreamReadException(JsonParser p, String msg, JsonLocation loc) { super(msg, loc, null); _processor = p; } + // @since 2.13 protected StreamReadException(JsonParser p, String msg, JsonLocation loc, Throwable rootCause) { super(msg, loc, rootCause); _processor = p; } - @Deprecated // @since 3.0 -- is this still in use? protected StreamReadException(String msg, JsonLocation loc, Throwable rootCause) { super(msg, loc, rootCause); } /** * Fluent method that may be used to assign originating {@link JsonParser}, - * to be accessed using {@link #processor()}. + * to be accessed using {@link #getProcessor()}. *

    * NOTE: `this` instance is modified and no new instance is constructed. * @@ -49,13 +62,54 @@ protected StreamReadException(String msg, JsonLocation loc, Throwable rootCause) * * @return This exception instance to allow call chaining */ - public StreamReadException withParser(JsonParser p) { - _processor = p; - return this; - } + public abstract StreamReadException withParser(JsonParser p); + /** + * Fluent method that may be used to assign payload to this exception, + * to let recipient access it for diagnostics purposes. + *

    + * NOTE: `this` instance is modified and no new instance is constructed. + * + * @param payload Payload to assign to this exception + * + * @return This exception instance to allow call chaining + */ + public abstract StreamReadException withRequestPayload(RequestPayload payload); + @Override - public JsonParser processor() { + public JsonParser getProcessor() { return _processor; } + + /** + * Method that may be called to find payload that was being parsed, if + * one was specified for parser that threw this Exception. + * + * @return request body, if payload was specified; `null` otherwise + */ + public RequestPayload getRequestPayload() { + return _requestPayload; + } + + /** + * The method returns the String representation of the request payload if + * one was specified for parser that threw this Exception. + * + * @return request body as String, if payload was specified; `null` otherwise + */ + public String getRequestPayloadAsString() { + return (_requestPayload != null) ? _requestPayload.toString() : null; + } + + /** + * Overriding the getMessage() to include the request body + */ + @Override + public String getMessage() { + String msg = super.getMessage(); + if (_requestPayload != null) { + msg += "\nRequest payload : " + _requestPayload.toString(); + } + return msg; + } } diff --git a/src/main/java/com/fasterxml/jackson/core/exc/StreamWriteException.java b/src/main/java/com/fasterxml/jackson/core/exc/StreamWriteException.java index 57d86cece0..e34ca03715 100644 --- a/src/main/java/com/fasterxml/jackson/core/exc/StreamWriteException.java +++ b/src/main/java/com/fasterxml/jackson/core/exc/StreamWriteException.java @@ -3,44 +3,45 @@ import com.fasterxml.jackson.core.*; /** - * Intermediate base class for all write-side streaming processing problems, - * mostly content generation issues. + * Intermediate base class for all read-side streaming processing problems, including + * parsing and input value coercion problems. + *

    + * Added in 2.13 to eventually replace {@link com.fasterxml.jackson.core.JsonGenerationException}. + * + * @since 2.13 */ -public class StreamWriteException - extends JacksonException +public abstract class StreamWriteException + extends JsonProcessingException { - private final static long serialVersionUID = 3L; + private final static long serialVersionUID = 2L; protected transient JsonGenerator _processor; - public StreamWriteException(JsonGenerator g, Throwable rootCause) { + protected StreamWriteException(Throwable rootCause, JsonGenerator g) { super(rootCause); _processor = g; } - public StreamWriteException(JsonGenerator g, String msg) { - super(msg); + protected StreamWriteException(String msg, JsonGenerator g) { + super(msg, (JsonLocation) null); _processor = g; } - public StreamWriteException(JsonGenerator g, String msg, Throwable rootCause) { + protected StreamWriteException(String msg, Throwable rootCause, JsonGenerator g) { super(msg, null, rootCause); _processor = g; } /** * Fluent method that may be used to assign originating {@link JsonGenerator}, - * to be accessed using {@link #processor()}. + * to be accessed using {@link #getProcessor()}. * * @param g Generator to assign * * @return This exception instance (to allow call chaining) */ - public StreamWriteException withGenerator(JsonGenerator g) { - _processor = g; - return this; - } + public abstract StreamWriteException withGenerator(JsonGenerator g); @Override - public JsonGenerator processor() { return _processor; } + public JsonGenerator getProcessor() { return _processor; } } diff --git a/src/main/java/com/fasterxml/jackson/core/exc/WrappedIOException.java b/src/main/java/com/fasterxml/jackson/core/exc/WrappedIOException.java deleted file mode 100644 index 22efd04ec2..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/exc/WrappedIOException.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.fasterxml.jackson.core.exc; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JacksonException; - -/** - * Exception type used to wrap low-level I/O issues that are reported - * on reading and writing content using JDK streams and other sources - * and targets. - *

    - * NOTE: use of {@link java.io.UncheckedIOException} would seem like - * an alternative, but cannot be used as it is a checked exception - * unlike {@link JacksonException} used for other read/write problems. - * Because of this, an alternative is used. - * - * @since 3.0 - */ -public class WrappedIOException extends JacksonException -{ - private final static long serialVersionUID = 1L; - - /** - * Optional processor, often of parser, generator type - * (or equivalent read/write context from databinding). - */ - protected transient Object _processor; - - protected WrappedIOException(Object processor, IOException source) { - super(source.getMessage(), source); - _processor = processor; - } - - public static WrappedIOException construct(IOException e) { - return construct(e, null); - } - - public static WrappedIOException construct(IOException e, Object processor) { - return new WrappedIOException(processor, e); - } - - public WrappedIOException withProcessor(Object processor) { - _processor = processor; - return this; - } - - @Override - public Object processor() { return _processor; } - - @Override // just for co-variant type - public IOException getCause() { - return (IOException) super.getCause(); - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/exc/package-info.java b/src/main/java/com/fasterxml/jackson/core/exc/package-info.java index 89470bc85f..178fb6844f 100644 --- a/src/main/java/com/fasterxml/jackson/core/exc/package-info.java +++ b/src/main/java/com/fasterxml/jackson/core/exc/package-info.java @@ -1,5 +1,5 @@ /** - * Package for subtypes of {@link com.fasterxml.jackson.core.JacksonException} - * defined and used by streaming API. + * Package for some of {@link com.fasterxml.jackson.core.JsonProcessingException} + * subtypes contained by streaming API. */ package com.fasterxml.jackson.core.exc; diff --git a/src/main/java/com/fasterxml/jackson/core/filter/FilteringGeneratorDelegate.java b/src/main/java/com/fasterxml/jackson/core/filter/FilteringGeneratorDelegate.java index fed16909a1..e4310e92e0 100644 --- a/src/main/java/com/fasterxml/jackson/core/filter/FilteringGeneratorDelegate.java +++ b/src/main/java/com/fasterxml/jackson/core/filter/FilteringGeneratorDelegate.java @@ -1,5 +1,6 @@ package com.fasterxml.jackson.core.filter; +import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; @@ -13,15 +14,18 @@ * Specialized {@link JsonGeneratorDelegate} that allows use of * {@link TokenFilter} for outputting a subset of content that * caller tries to generate. + * + * @since 2.6 */ public class FilteringGeneratorDelegate extends JsonGeneratorDelegate { + /* - /********************************************************************** + /********************************************************** /* Configuration - /********************************************************************** + /********************************************************** */ - + /** * Object consulted to determine whether to write parts of content generator * is asked to write or not. @@ -46,9 +50,9 @@ public class FilteringGeneratorDelegate extends JsonGeneratorDelegate protected TokenFilter.Inclusion _inclusion; /* - /********************************************************************** + /********************************************************** /* Additional state - /********************************************************************** + /********************************************************** */ /** @@ -72,16 +76,34 @@ public class FilteringGeneratorDelegate extends JsonGeneratorDelegate protected int _matchCount; /* - /********************************************************************** + /********************************************************** /* Construction, initialization - /********************************************************************** + /********************************************************** */ + /** + * @param d Generator to delegate calls to + * @param f Filter to use + * @param includePath Whether to include path or not + * @param allowMultipleMatches Whether to allow multiple matches + * + * @deprecated since 2.12 Use the constructor that takes {@link TokenFilter.Inclusion} + * argument instead. + */ + @Deprecated + public FilteringGeneratorDelegate(JsonGenerator d, TokenFilter f, + boolean includePath, boolean allowMultipleMatches) + { + this(d, f, includePath ? Inclusion.INCLUDE_ALL_AND_PATH : Inclusion.ONLY_INCLUDE_ALL, allowMultipleMatches); + } + /** * @param d Generator to delegate calls to * @param f Filter to use * @param inclusion Definition of inclusion criteria * @param allowMultipleMatches Whether to allow multiple matches + * + * @since 2.12 */ public FilteringGeneratorDelegate(JsonGenerator d, TokenFilter f, TokenFilter.Inclusion inclusion, boolean allowMultipleMatches) @@ -97,14 +119,14 @@ public FilteringGeneratorDelegate(JsonGenerator d, TokenFilter f, } /* - /********************************************************************** + /********************************************************** /* Extended API - /********************************************************************** + /********************************************************** */ public TokenFilter getFilter() { return rootFilter; } - public TokenStreamContext getFilterContext() { + public JsonStreamContext getFilterContext() { return _filterContext; } @@ -119,13 +141,13 @@ public int getMatchCount() { } /* - /********************************************************************** + /********************************************************** /* Public API, accessors - /********************************************************************** + /********************************************************** */ @Override - public TokenStreamContext streamWriteContext() { + public JsonStreamContext getOutputContext() { /* 11-Apr-2015, tatu: Choice is between pre- and post-filter context; * let's expose post-filter context that correlates with the view * of caller. @@ -134,28 +156,28 @@ public TokenStreamContext streamWriteContext() { } /* - /********************************************************************** + /********************************************************** /* Public API, write methods, structural - /********************************************************************** + /********************************************************** */ @Override - public void writeStartArray() throws JacksonException + public void writeStartArray() throws IOException { // First things first: whole-sale skipping easy if (_itemFilter == null) { - _filterContext = _filterContext.createChildArrayContext(null, null, false); + _filterContext = _filterContext.createChildArrayContext(null, false); return; } if (_itemFilter == TokenFilter.INCLUDE_ALL) { // include the whole sub-tree? - _filterContext = _filterContext.createChildArrayContext(_itemFilter, null, true); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); delegate.writeStartArray(); return; } // Ok; regular checking state then _itemFilter = _filterContext.checkValue(_itemFilter); if (_itemFilter == null) { - _filterContext = _filterContext.createChildArrayContext(null, null, false); + _filterContext = _filterContext.createChildArrayContext(null, false); return; } if (_itemFilter != TokenFilter.INCLUDE_ALL) { @@ -163,32 +185,33 @@ public void writeStartArray() throws JacksonException } if (_itemFilter == TokenFilter.INCLUDE_ALL) { _checkParentPath(); - _filterContext = _filterContext.createChildArrayContext(_itemFilter, null, true); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); delegate.writeStartArray(); } else if (_itemFilter != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { _checkParentPath(false /* isMatch */); - _filterContext = _filterContext.createChildArrayContext(_itemFilter, null, true); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); delegate.writeStartArray(); } else { - _filterContext = _filterContext.createChildArrayContext(_itemFilter, null, false); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, false); } } + @SuppressWarnings("deprecation") @Override - public void writeStartArray(Object currValue) throws JacksonException + public void writeStartArray(int size) throws IOException { if (_itemFilter == null) { - _filterContext = _filterContext.createChildArrayContext(null, currValue, false); + _filterContext = _filterContext.createChildArrayContext(null, false); return; } if (_itemFilter == TokenFilter.INCLUDE_ALL) { - _filterContext = _filterContext.createChildArrayContext(_itemFilter, currValue, true); - delegate.writeStartArray(currValue); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); + delegate.writeStartArray(size); return; } _itemFilter = _filterContext.checkValue(_itemFilter); if (_itemFilter == null) { - _filterContext = _filterContext.createChildArrayContext(null, currValue, false); + _filterContext = _filterContext.createChildArrayContext(null, false); return; } if (_itemFilter != TokenFilter.INCLUDE_ALL) { @@ -196,32 +219,32 @@ public void writeStartArray(Object currValue) throws JacksonException } if (_itemFilter == TokenFilter.INCLUDE_ALL) { _checkParentPath(); - _filterContext = _filterContext.createChildArrayContext(_itemFilter, currValue, true); - delegate.writeStartArray(currValue); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); + delegate.writeStartArray(size); } else if (_itemFilter != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { _checkParentPath(false /* isMatch */); - _filterContext = _filterContext.createChildArrayContext(_itemFilter, currValue, true); - delegate.writeStartArray(currValue); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); + delegate.writeStartArray(size); } else { - _filterContext = _filterContext.createChildArrayContext(_itemFilter, currValue, false); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, false); } } @Override - public void writeStartArray(Object currValue, int size) throws JacksonException + public void writeStartArray(Object forValue) throws IOException { if (_itemFilter == null) { - _filterContext = _filterContext.createChildArrayContext(null, currValue, false); + _filterContext = _filterContext.createChildArrayContext(null, false); return; } if (_itemFilter == TokenFilter.INCLUDE_ALL) { - _filterContext = _filterContext.createChildArrayContext(_itemFilter, currValue, true); - delegate.writeStartArray(currValue, size); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); + delegate.writeStartArray(forValue); return; } _itemFilter = _filterContext.checkValue(_itemFilter); if (_itemFilter == null) { - _filterContext = _filterContext.createChildArrayContext(null, currValue, false); + _filterContext = _filterContext.createChildArrayContext(null, false); return; } if (_itemFilter != TokenFilter.INCLUDE_ALL) { @@ -229,15 +252,44 @@ public void writeStartArray(Object currValue, int size) throws JacksonException } if (_itemFilter == TokenFilter.INCLUDE_ALL) { _checkParentPath(); - _filterContext = _filterContext.createChildArrayContext(_itemFilter, currValue, true); - delegate.writeStartArray(currValue, size); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); + delegate.writeStartArray(forValue); } else { - _filterContext = _filterContext.createChildArrayContext(_itemFilter, currValue, false); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, false); } } @Override - public void writeEndArray() throws JacksonException + public void writeStartArray(Object forValue, int size) throws IOException + { + if (_itemFilter == null) { + _filterContext = _filterContext.createChildArrayContext(null, false); + return; + } + if (_itemFilter == TokenFilter.INCLUDE_ALL) { + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); + delegate.writeStartArray(forValue, size); + return; + } + _itemFilter = _filterContext.checkValue(_itemFilter); + if (_itemFilter == null) { + _filterContext = _filterContext.createChildArrayContext(null, false); + return; + } + if (_itemFilter != TokenFilter.INCLUDE_ALL) { + _itemFilter = _itemFilter.filterStartArray(); + } + if (_itemFilter == TokenFilter.INCLUDE_ALL) { + _checkParentPath(); + _filterContext = _filterContext.createChildArrayContext(_itemFilter, true); + delegate.writeStartArray(forValue, size); + } else { + _filterContext = _filterContext.createChildArrayContext(_itemFilter, false); + } + } + + @Override + public void writeEndArray() throws IOException { _filterContext = _filterContext.closeArray(delegate); @@ -247,14 +299,14 @@ public void writeEndArray() throws JacksonException } @Override - public void writeStartObject() throws JacksonException + public void writeStartObject() throws IOException { if (_itemFilter == null) { - _filterContext = _filterContext.createChildObjectContext(_itemFilter, null, false); + _filterContext = _filterContext.createChildObjectContext(_itemFilter, false); return; } if (_itemFilter == TokenFilter.INCLUDE_ALL) { - _filterContext = _filterContext.createChildObjectContext(_itemFilter, null, true); + _filterContext = _filterContext.createChildObjectContext(_itemFilter, true); delegate.writeStartObject(); return; } @@ -269,27 +321,27 @@ public void writeStartObject() throws JacksonException } if (f == TokenFilter.INCLUDE_ALL) { _checkParentPath(); - _filterContext = _filterContext.createChildObjectContext(f, null, true); + _filterContext = _filterContext.createChildObjectContext(f, true); delegate.writeStartObject(); } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { _checkParentPath(false /* isMatch */); - _filterContext = _filterContext.createChildObjectContext(f, null, true); + _filterContext = _filterContext.createChildObjectContext(f, true); delegate.writeStartObject(); } else { // filter out - _filterContext = _filterContext.createChildObjectContext(f, null, false); + _filterContext = _filterContext.createChildObjectContext(f, false); } } @Override - public void writeStartObject(Object currValue) throws JacksonException + public void writeStartObject(Object forValue) throws IOException { if (_itemFilter == null) { - _filterContext = _filterContext.createChildObjectContext(_itemFilter, currValue, false); + _filterContext = _filterContext.createChildObjectContext(_itemFilter, false); return; } if (_itemFilter == TokenFilter.INCLUDE_ALL) { - _filterContext = _filterContext.createChildObjectContext(_itemFilter, currValue, true); - delegate.writeStartObject(currValue); + _filterContext = _filterContext.createChildObjectContext(_itemFilter, true); + delegate.writeStartObject(forValue); return; } @@ -303,27 +355,27 @@ public void writeStartObject(Object currValue) throws JacksonException } if (f == TokenFilter.INCLUDE_ALL) { _checkParentPath(); - _filterContext = _filterContext.createChildObjectContext(f, currValue, true); - delegate.writeStartObject(currValue); + _filterContext = _filterContext.createChildObjectContext(f, true); + delegate.writeStartObject(forValue); } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { _checkParentPath(false /* isMatch */); - _filterContext = _filterContext.createChildObjectContext(f, currValue, true); - delegate.writeStartObject(currValue); + _filterContext = _filterContext.createChildObjectContext(f, true); + delegate.writeStartObject(forValue); } else { // filter out - _filterContext = _filterContext.createChildObjectContext(f, currValue, false); + _filterContext = _filterContext.createChildObjectContext(f, false); } } @Override - public void writeStartObject(Object currValue, int size) throws JacksonException + public void writeStartObject(Object forValue, int size) throws IOException { if (_itemFilter == null) { - _filterContext = _filterContext.createChildObjectContext(_itemFilter, currValue, false); + _filterContext = _filterContext.createChildObjectContext(_itemFilter, false); return; } if (_itemFilter == TokenFilter.INCLUDE_ALL) { - _filterContext = _filterContext.createChildObjectContext(_itemFilter, currValue, true); - delegate.writeStartObject(currValue, size); + _filterContext = _filterContext.createChildObjectContext(_itemFilter, true); + delegate.writeStartObject(forValue, size); return; } @@ -337,15 +389,15 @@ public void writeStartObject(Object currValue, int size) throws JacksonException } if (f == TokenFilter.INCLUDE_ALL) { _checkParentPath(); - _filterContext = _filterContext.createChildObjectContext(f, currValue, true); - delegate.writeStartObject(currValue, size); - } else { // filter out - _filterContext = _filterContext.createChildObjectContext(f, currValue, false); + _filterContext = _filterContext.createChildObjectContext(f, true); + delegate.writeStartObject(forValue, size); + } else { + _filterContext = _filterContext.createChildObjectContext(f, false); } } @Override - public void writeEndObject() throws JacksonException + public void writeEndObject() throws IOException { _filterContext = _filterContext.closeObject(delegate); if (_filterContext != null) { @@ -354,16 +406,16 @@ public void writeEndObject() throws JacksonException } @Override - public void writeName(String name) throws JacksonException + public void writeFieldName(String name) throws IOException { - TokenFilter state = _filterContext.setPropertyName(name); + TokenFilter state = _filterContext.setFieldName(name); if (state == null) { _itemFilter = null; return; } if (state == TokenFilter.INCLUDE_ALL) { _itemFilter = state; - delegate.writeName(name); + delegate.writeFieldName(name); return; } state = state.includeProperty(name); @@ -374,16 +426,16 @@ public void writeName(String name) throws JacksonException } @Override - public void writeName(SerializableString name) throws JacksonException + public void writeFieldName(SerializableString name) throws IOException { - TokenFilter state = _filterContext.setPropertyName(name.getValue()); + TokenFilter state = _filterContext.setFieldName(name.getValue()); if (state == null) { _itemFilter = null; return; } if (state == TokenFilter.INCLUDE_ALL) { _itemFilter = state; - delegate.writeName(name); + delegate.writeFieldName(name); return; } state = state.includeProperty(name.getValue()); @@ -395,18 +447,18 @@ public void writeName(SerializableString name) throws JacksonException // 02-Dec-2019, tatu: Not sure what else to do... so use default impl from base class @Override - public void writePropertyId(long id) throws JacksonException { - writeName(Long.toString(id)); + public void writeFieldId(long id) throws IOException { + writeFieldName(Long.toString(id)); } /* - /********************************************************************** + /********************************************************** /* Public API, write methods, text/String values - /********************************************************************** + /********************************************************** */ @Override - public void writeString(String value) throws JacksonException + public void writeString(String value) throws IOException { if (_itemFilter == null) { return; @@ -427,7 +479,7 @@ public void writeString(String value) throws JacksonException } @Override - public void writeString(char[] text, int offset, int len) throws JacksonException + public void writeString(char[] text, int offset, int len) throws IOException { if (_itemFilter == null) { return; @@ -449,7 +501,7 @@ public void writeString(char[] text, int offset, int len) throws JacksonExceptio } @Override - public void writeString(SerializableString value) throws JacksonException + public void writeString(SerializableString value) throws IOException { if (_itemFilter == null) { return; @@ -470,7 +522,7 @@ public void writeString(SerializableString value) throws JacksonException } @Override - public void writeString(Reader reader, int len) throws JacksonException { + public void writeString(Reader reader, int len) throws IOException { if (_itemFilter == null) { return; } @@ -492,7 +544,7 @@ public void writeString(Reader reader, int len) throws JacksonException { } @Override - public void writeRawUTF8String(byte[] text, int offset, int length) throws JacksonException + public void writeRawUTF8String(byte[] text, int offset, int length) throws IOException { if (_checkRawValueWrite()) { delegate.writeRawUTF8String(text, offset, length); @@ -500,7 +552,7 @@ public void writeRawUTF8String(byte[] text, int offset, int length) throws Jacks } @Override - public void writeUTF8String(byte[] text, int offset, int length) throws JacksonException + public void writeUTF8String(byte[] text, int offset, int length) throws IOException { // not exact match, but best we can do if (_checkRawValueWrite()) { @@ -509,13 +561,13 @@ public void writeUTF8String(byte[] text, int offset, int length) throws JacksonE } /* - /********************************************************************** + /********************************************************** /* Public API, write methods, binary/raw content - /********************************************************************** + /********************************************************** */ @Override - public void writeRaw(String text) throws JacksonException + public void writeRaw(String text) throws IOException { if (_checkRawValueWrite()) { delegate.writeRaw(text); @@ -523,7 +575,7 @@ public void writeRaw(String text) throws JacksonException } @Override - public void writeRaw(String text, int offset, int len) throws JacksonException + public void writeRaw(String text, int offset, int len) throws IOException { if (_checkRawValueWrite()) { delegate.writeRaw(text, offset, len); @@ -531,7 +583,7 @@ public void writeRaw(String text, int offset, int len) throws JacksonException } @Override - public void writeRaw(SerializableString text) throws JacksonException + public void writeRaw(SerializableString text) throws IOException { if (_checkRawValueWrite()) { delegate.writeRaw(text); @@ -539,7 +591,7 @@ public void writeRaw(SerializableString text) throws JacksonException } @Override - public void writeRaw(char[] text, int offset, int len) throws JacksonException + public void writeRaw(char[] text, int offset, int len) throws IOException { if (_checkRawValueWrite()) { delegate.writeRaw(text, offset, len); @@ -547,7 +599,7 @@ public void writeRaw(char[] text, int offset, int len) throws JacksonException } @Override - public void writeRaw(char c) throws JacksonException + public void writeRaw(char c) throws IOException { if (_checkRawValueWrite()) { delegate.writeRaw(c); @@ -555,7 +607,7 @@ public void writeRaw(char c) throws JacksonException } @Override - public void writeRawValue(String text) throws JacksonException + public void writeRawValue(String text) throws IOException { if (_checkRawValueWrite()) { delegate.writeRawValue(text); @@ -563,7 +615,7 @@ public void writeRawValue(String text) throws JacksonException } @Override - public void writeRawValue(String text, int offset, int len) throws JacksonException + public void writeRawValue(String text, int offset, int len) throws IOException { if (_checkRawValueWrite()) { delegate.writeRawValue(text, offset, len); @@ -571,7 +623,7 @@ public void writeRawValue(String text, int offset, int len) throws JacksonExcept } @Override - public void writeRawValue(char[] text, int offset, int len) throws JacksonException + public void writeRawValue(char[] text, int offset, int len) throws IOException { if (_checkRawValueWrite()) { delegate.writeRawValue(text, offset, len); @@ -579,7 +631,7 @@ public void writeRawValue(char[] text, int offset, int len) throws JacksonExcept } @Override - public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len) throws JacksonException + public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len) throws IOException { if (_checkBinaryWrite()) { delegate.writeBinary(b64variant, data, offset, len); @@ -587,7 +639,7 @@ public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int l } @Override - public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) throws JacksonException + public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) throws IOException { if (_checkBinaryWrite()) { return delegate.writeBinary(b64variant, data, dataLength); @@ -596,13 +648,13 @@ public int writeBinary(Base64Variant b64variant, InputStream data, int dataLengt } /* - /********************************************************************** + /********************************************************** /* Public API, write methods, other value types - /********************************************************************** + /********************************************************** */ @Override - public void writeNumber(short v) throws JacksonException + public void writeNumber(short v) throws IOException { if (_itemFilter == null) { return; @@ -623,7 +675,7 @@ public void writeNumber(short v) throws JacksonException } @Override - public void writeNumber(int v) throws JacksonException + public void writeNumber(int v) throws IOException { if (_itemFilter == null) { return; @@ -644,7 +696,7 @@ public void writeNumber(int v) throws JacksonException } @Override - public void writeNumber(long v) throws JacksonException + public void writeNumber(long v) throws IOException { if (_itemFilter == null) { return; @@ -665,7 +717,7 @@ public void writeNumber(long v) throws JacksonException } @Override - public void writeNumber(BigInteger v) throws JacksonException + public void writeNumber(BigInteger v) throws IOException { if (_itemFilter == null) { return; @@ -686,7 +738,7 @@ public void writeNumber(BigInteger v) throws JacksonException } @Override - public void writeNumber(double v) throws JacksonException + public void writeNumber(double v) throws IOException { if (_itemFilter == null) { return; @@ -707,7 +759,7 @@ public void writeNumber(double v) throws JacksonException } @Override - public void writeNumber(float v) throws JacksonException + public void writeNumber(float v) throws IOException { if (_itemFilter == null) { return; @@ -728,7 +780,7 @@ public void writeNumber(float v) throws JacksonException } @Override - public void writeNumber(BigDecimal v) throws JacksonException + public void writeNumber(BigDecimal v) throws IOException { if (_itemFilter == null) { return; @@ -749,7 +801,7 @@ public void writeNumber(BigDecimal v) throws JacksonException } @Override - public void writeNumber(String encodedValue) throws JacksonException, UnsupportedOperationException + public void writeNumber(String encodedValue) throws IOException, UnsupportedOperationException { if (_itemFilter == null) { return; @@ -770,7 +822,7 @@ public void writeNumber(String encodedValue) throws JacksonException, Unsupporte } @Override - public void writeNumber(char[] encodedValueBuffer, int offset, int length) throws JacksonException, UnsupportedOperationException + public void writeNumber(char[] encodedValueBuffer, int offset, int length) throws IOException, UnsupportedOperationException { if (_itemFilter == null) { return; @@ -791,7 +843,7 @@ public void writeNumber(char[] encodedValueBuffer, int offset, int length) throw } @Override - public void writeBoolean(boolean v) throws JacksonException + public void writeBoolean(boolean v) throws IOException { if (_itemFilter == null) { return; @@ -812,7 +864,7 @@ public void writeBoolean(boolean v) throws JacksonException } @Override - public void writeNull() throws JacksonException + public void writeNull() throws IOException { if (_itemFilter == null) { return; @@ -833,103 +885,128 @@ public void writeNull() throws JacksonException } /* - /********************************************************************** - /* Overridden property write methods - /********************************************************************** + /********************************************************** + /* Overridden field methods + /********************************************************** */ @Override - public void writeOmittedProperty(String propertyName) throws JacksonException { + public void writeOmittedField(String fieldName) throws IOException { // Hmmh. Not sure how this would work but... if (_itemFilter != null) { - delegate.writeOmittedProperty(propertyName); + delegate.writeOmittedField(fieldName); } } - + /* - /********************************************************************** + /********************************************************** /* Public API, write methods, Native Ids - /********************************************************************** + /********************************************************** */ // 25-Mar-2015, tatu: These are tricky as they sort of predate actual filtering calls. // Let's try to use current state as a clue at least... @Override - public void writeObjectId(Object id) throws JacksonException { + public void writeObjectId(Object id) throws IOException { if (_itemFilter != null) { delegate.writeObjectId(id); } } @Override - public void writeObjectRef(Object id) throws JacksonException { + public void writeObjectRef(Object id) throws IOException { if (_itemFilter != null) { delegate.writeObjectRef(id); } } @Override - public void writeTypeId(Object id) throws JacksonException { + public void writeTypeId(Object id) throws IOException { if (_itemFilter != null) { delegate.writeTypeId(id); } } /* - /********************************************************************** + /********************************************************** /* Public API, write methods, serializing Java objects - /********************************************************************** + /********************************************************** */ // Base class definitions for these seems correct to me, iff not directly delegating: /* @Override - public void writeObject(Object pojo) { -... + public void writeObject(Object pojo) throws IOException,JsonProcessingException { + if (delegateCopyMethods) { + delegate.writeObject(pojo); + return; + } + // NOTE: copied from + if (pojo == null) { + writeNull(); + } else { + if (getCodec() != null) { + getCodec().writeValue(this, pojo); + return; + } + _writeSimpleObject(pojo); + } } @Override - public void writeTree(TreeNode rootNode) { -... + public void writeTree(TreeNode rootNode) throws IOException { + if (delegateCopyMethods) { + delegate.writeTree(rootNode); + return; + } + // As with 'writeObject()', we are not check if write would work + if (rootNode == null) { + writeNull(); + } else { + if (getCodec() == null) { + throw new IllegalStateException("No ObjectCodec defined"); + } + getCodec().writeValue(this, rootNode); + } } */ /* - /********************************************************************** + /********************************************************** /* Public API, copy-through methods - /********************************************************************** + /********************************************************** */ // Base class definitions for these seems correct to me, iff not directly delegating: /* @Override - public void copyCurrentEvent(JsonParser p) { - if (delegateCopyMethods) delegate.copyCurrentEvent(p); - else super.copyCurrentEvent(p); + public void copyCurrentEvent(JsonParser jp) throws IOException { + if (delegateCopyMethods) delegate.copyCurrentEvent(jp); + else super.copyCurrentEvent(jp); } @Override - public void copyCurrentStructure(JsonParser p) { - if (delegateCopyMethods) delegate.copyCurrentStructure(p); - else super.copyCurrentStructure(p); + public void copyCurrentStructure(JsonParser jp) throws IOException { + if (delegateCopyMethods) delegate.copyCurrentStructure(jp); + else super.copyCurrentStructure(jp); } */ /* - /********************************************************************** + /********************************************************** /* Helper methods - /********************************************************************** + /********************************************************** */ - protected void _checkParentPath() throws JacksonException + protected void _checkParentPath() throws IOException { _checkParentPath(true); } - protected void _checkParentPath(boolean isMatch) throws JacksonException + protected void _checkParentPath(boolean isMatch) throws IOException { if (isMatch) { ++_matchCount; @@ -938,8 +1015,8 @@ protected void _checkParentPath(boolean isMatch) throws JacksonException if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) { _filterContext.writePath(delegate); } else if (_inclusion == Inclusion.INCLUDE_NON_NULL) { - // path has already been written, except for maybe property name - _filterContext.ensurePropertyNameWritten(delegate); + // path has already been written, except for maybe field name + _filterContext.ensureFieldNameWritten(delegate); } // also: if no multiple matches desired, short-cut checks if (isMatch && !_allowMultipleMatches) { @@ -953,17 +1030,18 @@ protected void _checkParentPath(boolean isMatch) throws JacksonException * parent for a property name to be included with value: rules are slightly * different. * - * @throws JacksonException If there is an issue with possible resulting read + * @throws IOException If there is an issue with possible resulting read */ - protected void _checkPropertyParentPath() throws JacksonException + protected void _checkPropertyParentPath() throws IOException { ++_matchCount; if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) { _filterContext.writePath(delegate); } else if (_inclusion == Inclusion.INCLUDE_NON_NULL) { - // path has already been written, except for maybe property name - _filterContext.ensurePropertyNameWritten(delegate); + // path has already been written, except for maybe field name + _filterContext.ensureFieldNameWritten(delegate); } + // also: if no multiple matches desired, short-cut checks if (!_allowMultipleMatches) { // Mark parents as "skip" so that further check calls are not made @@ -971,7 +1049,7 @@ protected void _checkPropertyParentPath() throws JacksonException } } - protected boolean _checkBinaryWrite() throws JacksonException + protected boolean _checkBinaryWrite() throws IOException { if (_itemFilter == null) { return false; @@ -986,7 +1064,7 @@ protected boolean _checkBinaryWrite() throws JacksonException return false; } - protected boolean _checkRawValueWrite() throws JacksonException + protected boolean _checkRawValueWrite() throws IOException { if (_itemFilter == null) { return false; diff --git a/src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java b/src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java index bbf63e9f03..3540d8e9d0 100644 --- a/src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java +++ b/src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java @@ -1,8 +1,12 @@ package com.fasterxml.jackson.core.filter; +import java.io.IOException; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.math.BigInteger; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; -import com.fasterxml.jackson.core.sym.PropertyNameMatcher; import com.fasterxml.jackson.core.util.JsonParserDelegate; import static com.fasterxml.jackson.core.JsonTokenId.*; @@ -11,13 +15,15 @@ * Specialized {@link JsonParserDelegate} that allows use of * {@link TokenFilter} for outputting a subset of content that * is visible to caller + * + * @since 2.6 */ public class FilteringParserDelegate extends JsonParserDelegate { /* - /********************************************************************** + /********************************************************** /* Configuration - /********************************************************************** + /********************************************************** */ /** @@ -44,9 +50,9 @@ public class FilteringParserDelegate extends JsonParserDelegate protected TokenFilter.Inclusion _inclusion; /* - /********************************************************************** + /********************************************************** /* State - /********************************************************************** + /********************************************************** */ /** @@ -90,11 +96,18 @@ public class FilteringParserDelegate extends JsonParserDelegate protected int _matchCount; /* - /********************************************************************** + /********************************************************** /* Construction, initialization - /********************************************************************** + /********************************************************** */ + @Deprecated + public FilteringParserDelegate(JsonParser p, TokenFilter f, + boolean includePath, boolean allowMultipleMatches) + { + this(p, f, includePath ? Inclusion.INCLUDE_ALL_AND_PATH : Inclusion.ONLY_INCLUDE_ALL, allowMultipleMatches); + } + /** * @param p Parser to delegate calls to * @param f Filter to use @@ -114,9 +127,9 @@ public FilteringParserDelegate(JsonParser p, TokenFilter f, } /* - /********************************************************************** + /********************************************************** /* Extended API - /********************************************************************** + /********************************************************** */ public TokenFilter getFilter() { return rootFilter; } @@ -132,13 +145,18 @@ public int getMatchCount() { } /* - /********************************************************************** + /********************************************************** /* Public API, token accessors - /********************************************************************** + /********************************************************** */ + @Override public JsonToken getCurrentToken() { return _currToken; } @Override public JsonToken currentToken() { return _currToken; } + @Deprecated // since 2.12 + @Override public final int getCurrentTokenId() { + return currentTokenId(); + } @Override public final int currentTokenId() { final JsonToken t = _currToken; return (t == null) ? JsonTokenId.ID_NO_TOKEN : t.id(); @@ -160,27 +178,39 @@ public int getMatchCount() { @Override public boolean isExpectedStartArrayToken() { return _currToken == JsonToken.START_ARRAY; } @Override public boolean isExpectedStartObjectToken() { return _currToken == JsonToken.START_OBJECT; } - @Override public JsonLocation currentLocation() { return delegate.currentLocation(); } + @Override public JsonLocation getCurrentLocation() { return delegate.getCurrentLocation(); } @Override - public TokenStreamContext streamReadContext() { + public JsonStreamContext getParsingContext() { return _filterContext(); } + // !!! TODO: Verify it works as expected: copied from standard JSON parser impl + @Override + public String getCurrentName() throws IOException { + JsonStreamContext ctxt = _filterContext(); + if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) { + JsonStreamContext parent = ctxt.getParent(); + return (parent == null) ? null : parent.getCurrentName(); + } + return ctxt.getCurrentName(); + } + + // 2.13: IMPORTANT! Must override along with older getCurrentName() @Override - public String currentName() { - TokenStreamContext ctxt = _filterContext(); + public String currentName() throws IOException { + JsonStreamContext ctxt = _filterContext(); if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) { - TokenStreamContext parent = ctxt.getParent(); - return (parent == null) ? null : parent.currentName(); + JsonStreamContext parent = ctxt.getParent(); + return (parent == null) ? null : parent.getCurrentName(); } - return ctxt.currentName(); + return ctxt.getCurrentName(); } /* - /********************************************************************** + /********************************************************** /* Public API, token state overrides - /********************************************************************** + /********************************************************** */ @Override @@ -193,23 +223,23 @@ public void clearCurrentToken() { @Override public JsonToken getLastClearedToken() { return _lastClearedToken; } -/* + @Override public void overrideCurrentName(String name) { // 14-Apr-2015, tatu: Not sure whether this can be supported, and if so, // what to do with it... Delegation won't work for sure, so let's for // now throw an exception - throw new UnsupportedOperationException("Cannot currently override name during filtering read"); + throw new UnsupportedOperationException("Can not currently override name during filtering read"); } -*/ + /* - /********************************************************************** + /********************************************************** /* Public API, traversal - /********************************************************************** + /********************************************************** */ @Override - public JsonToken nextToken() throws JacksonException + public JsonToken nextToken() throws IOException { // 23-May-2017, tatu: To be honest, code here is rather hairy and I don't like all // conditionals; and it seems odd to return `null` but NOT considering input @@ -242,7 +272,7 @@ public JsonToken nextToken() throws JacksonException if (ctxt == _headContext) { _exposedContext = null; if (ctxt.inArray()) { - t = delegate.currentToken(); + t = delegate.getCurrentToken(); // Is this guaranteed to work without further checks? // if (t != JsonToken.START_ARRAY) { _currToken = t; @@ -251,9 +281,9 @@ public JsonToken nextToken() throws JacksonException // 19-Jul-2021, tatu: [core#700]: following was commented out?! // Almost! Most likely still have the current token; - // with the sole exception of PROPERTY_NAME + // with the sole exception of FIELD_NAME t = delegate.currentToken(); - if (t != JsonToken.PROPERTY_NAME) { + if (t != JsonToken.FIELD_NAME) { _currToken = t; return t; } @@ -263,7 +293,7 @@ public JsonToken nextToken() throws JacksonException ctxt = _headContext.findChildOf(ctxt); _exposedContext = ctxt; if (ctxt == null) { // should never occur - throw _constructReadException("Unexpected problem: chain of filtered context broken, token: "+t); + throw _constructError("Unexpected problem: chain of filtered context broken"); } } } @@ -283,7 +313,7 @@ public JsonToken nextToken() throws JacksonException case ID_START_ARRAY: f = _itemFilter; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildArrayContext(f, null, true); + _headContext = _headContext.createChildArrayContext(f, true); return (_currToken = t); } if (f == null) { // does this occur? @@ -301,16 +331,16 @@ public JsonToken nextToken() throws JacksonException } _itemFilter = f; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildArrayContext(f, null, true); + _headContext = _headContext.createChildArrayContext(f, true); return (_currToken = t); } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { // TODO don't count as match? - _headContext = _headContext.createChildArrayContext(f, null, true); + _headContext = _headContext.createChildArrayContext(f, true); return (_currToken = t); } - _headContext = _headContext.createChildArrayContext(f, null, false); + _headContext = _headContext.createChildArrayContext(f, false); -// Also: only need buffering if parent path to be included + // Also: only need buffering if parent path to be included if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) { t = _nextTokenWithBuffering(_headContext); if (t != null) { @@ -323,7 +353,7 @@ public JsonToken nextToken() throws JacksonException case ID_START_OBJECT: f = _itemFilter; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildObjectContext(f, null, true); + _headContext = _headContext.createChildObjectContext(f, true); return (_currToken = t); } if (f == null) { // does this occur? @@ -341,14 +371,14 @@ public JsonToken nextToken() throws JacksonException } _itemFilter = f; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildObjectContext(f, null, true); + _headContext = _headContext.createChildObjectContext(f, true); return (_currToken = t); } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { // TODO don't count as match? - _headContext = _headContext.createChildObjectContext(f, null, true); + _headContext = _headContext.createChildObjectContext(f, true); return (_currToken = t); } - _headContext = _headContext.createChildObjectContext(f, null, false); + _headContext = _headContext.createChildObjectContext(f, false); // Also: only need buffering if parent path to be included if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) { t = _nextTokenWithBuffering(_headContext); @@ -358,7 +388,7 @@ public JsonToken nextToken() throws JacksonException } } // note: inclusion of surrounding Object handled separately via - // PROPERTY_NAME + // FIELD_NAME break; case ID_END_ARRAY: @@ -377,11 +407,11 @@ public JsonToken nextToken() throws JacksonException } break; - case ID_PROPERTY_NAME: + case ID_FIELD_NAME: { - final String name = delegate.currentName(); + final String name = delegate.getCurrentName(); // note: this will also set 'needToHandleName' - f = _headContext.setPropertyName(name); + f = _headContext.setFieldName(name); if (f == TokenFilter.INCLUDE_ALL) { _itemFilter = f; return (_currToken = t); @@ -444,7 +474,7 @@ public JsonToken nextToken() throws JacksonException // return, and the token read next could not be returned as-is, // at least not yet, but where we have not yet established that // buffering is needed. - protected final JsonToken _nextToken2() throws JacksonException + protected final JsonToken _nextToken2() throws IOException { main_loop: while (true) { @@ -459,7 +489,7 @@ protected final JsonToken _nextToken2() throws JacksonException case ID_START_ARRAY: f = _itemFilter; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildArrayContext(f, null, true); + _headContext = _headContext.createChildArrayContext(f, true); return (_currToken = t); } if (f == null) { // does this occur? @@ -477,13 +507,13 @@ protected final JsonToken _nextToken2() throws JacksonException } _itemFilter = f; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildArrayContext(f, null, true); + _headContext = _headContext.createChildArrayContext(f, true); return (_currToken = t); } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { - _headContext = _headContext.createChildArrayContext(f, null, true); + _headContext = _headContext.createChildArrayContext(f, true); return (_currToken = t); } - _headContext = _headContext.createChildArrayContext(f, null, false); + _headContext = _headContext.createChildArrayContext(f, false); // but if we didn't figure it out yet, need to buffer possible events if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) { t = _nextTokenWithBuffering(_headContext); @@ -497,7 +527,7 @@ protected final JsonToken _nextToken2() throws JacksonException case ID_START_OBJECT: f = _itemFilter; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildObjectContext(f, null, true); + _headContext = _headContext.createChildObjectContext(f, true); return (_currToken = t); } if (f == null) { // does this occur? @@ -515,13 +545,13 @@ protected final JsonToken _nextToken2() throws JacksonException } _itemFilter = f; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildObjectContext(f, null, true); + _headContext = _headContext.createChildObjectContext(f, true); return (_currToken = t); } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { - _headContext = _headContext.createChildObjectContext(f, null, true); + _headContext = _headContext.createChildObjectContext(f, true); return (_currToken = t); } - _headContext = _headContext.createChildObjectContext(f, null, false); + _headContext = _headContext.createChildObjectContext(f, false); if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) { t = _nextTokenWithBuffering(_headContext); if (t != null) { @@ -547,10 +577,10 @@ protected final JsonToken _nextToken2() throws JacksonException } continue main_loop; - case ID_PROPERTY_NAME: + case ID_FIELD_NAME: { - final String name = delegate.currentName(); - f = _headContext.setPropertyName(name); + final String name = delegate.getCurrentName(); + f = _headContext.setFieldName(name); if (f == TokenFilter.INCLUDE_ALL) { _itemFilter = f; return (_currToken = t); @@ -610,7 +640,7 @@ protected final JsonToken _nextToken2() throws JacksonException // Method called when a new potentially included context is found. protected final JsonToken _nextTokenWithBuffering(final TokenFilterContext buffRoot) - throws JacksonException + throws IOException { main_loop: while (true) { @@ -622,7 +652,7 @@ protected final JsonToken _nextTokenWithBuffering(final TokenFilterContext buffR // One simplification here: we know for a fact that the item filter is // neither null nor 'include all', for most cases; the only exception - // being PROPERTY_NAME handling + // being FIELD_NAME handling switch (t.id()) { case ID_START_ARRAY: @@ -636,20 +666,20 @@ protected final JsonToken _nextTokenWithBuffering(final TokenFilterContext buffR } _itemFilter = f; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildArrayContext(f, null, true); + _headContext = _headContext.createChildArrayContext(f, true); return _nextBuffered(buffRoot); } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { // TODO don't count as match? - _headContext = _headContext.createChildArrayContext(f, null, true); + _headContext = _headContext.createChildArrayContext(f, true); return _nextBuffered(buffRoot); } - _headContext = _headContext.createChildArrayContext(f, null, false); + _headContext = _headContext.createChildArrayContext(f, false); continue main_loop; case ID_START_OBJECT: f = _itemFilter; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildObjectContext(f, null, true); + _headContext = _headContext.createChildObjectContext(f, true); return t; } if (f == null) { // does this occur? @@ -667,14 +697,14 @@ protected final JsonToken _nextTokenWithBuffering(final TokenFilterContext buffR } _itemFilter = f; if (f == TokenFilter.INCLUDE_ALL) { - _headContext = _headContext.createChildObjectContext(f, null, true); + _headContext = _headContext.createChildObjectContext(f, true); return _nextBuffered(buffRoot); } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) { // TODO don't count as match? - _headContext = _headContext.createChildArrayContext(f, null, true); + _headContext = _headContext.createChildArrayContext(f, true); return _nextBuffered(buffRoot); } - _headContext = _headContext.createChildObjectContext(f, null, false); + _headContext = _headContext.createChildObjectContext(f, false); continue main_loop; case ID_END_ARRAY: @@ -698,10 +728,10 @@ protected final JsonToken _nextTokenWithBuffering(final TokenFilterContext buffR } continue main_loop; - case ID_PROPERTY_NAME: + case ID_FIELD_NAME: { - final String name = delegate.currentName(); - f = _headContext.setPropertyName(name); + final String name = delegate.getCurrentName(); + f = _headContext.setFieldName(name); if (f == TokenFilter.INCLUDE_ALL) { _itemFilter = f; return _nextBuffered(buffRoot); @@ -724,7 +754,7 @@ protected final JsonToken _nextTokenWithBuffering(final TokenFilterContext buffR } else { // edge case: if no more matches allowed, reset filter // to initial state to prevent missing a token in next iteration - _itemFilter = _headContext.setPropertyName(name); + _itemFilter = _headContext.setFieldName(name); } } } @@ -750,7 +780,7 @@ protected final JsonToken _nextTokenWithBuffering(final TokenFilterContext buffR } } - private JsonToken _nextBuffered(TokenFilterContext buffRoot) throws JacksonException + private JsonToken _nextBuffered(TokenFilterContext buffRoot) throws IOException { _exposedContext = buffRoot; TokenFilterContext ctxt = buffRoot; @@ -761,7 +791,7 @@ private JsonToken _nextBuffered(TokenFilterContext buffRoot) throws JacksonExcep while (true) { // all done with buffered stuff? if (ctxt == _headContext) { - throw _constructReadException("Internal error: failed to locate expected buffered tokens"); + throw _constructError("Internal error: failed to locate expected buffered tokens"); /* _exposedContext = null; break; @@ -771,7 +801,7 @@ private JsonToken _nextBuffered(TokenFilterContext buffRoot) throws JacksonExcep ctxt = _exposedContext.findChildOf(ctxt); _exposedContext = ctxt; if (ctxt == null) { // should never occur - throw _constructReadException("Unexpected problem: chain of filtered context broken"); + throw _constructError("Unexpected problem: chain of filtered context broken"); } t = _exposedContext.nextTokenToRead(); if (t != null) { @@ -780,7 +810,7 @@ private JsonToken _nextBuffered(TokenFilterContext buffRoot) throws JacksonExcep } } - private final boolean _verifyAllowedMatches() throws JacksonException { + private final boolean _verifyAllowedMatches() throws IOException { if (_matchCount == 0 || _allowMultipleMatches) { ++_matchCount; return true; @@ -789,10 +819,10 @@ private final boolean _verifyAllowedMatches() throws JacksonException { } @Override - public JsonToken nextValue() throws JacksonException { + public JsonToken nextValue() throws IOException { // Re-implemented same as ParserMinimalBase: JsonToken t = nextToken(); - if (t == JsonToken.PROPERTY_NAME) { + if (t == JsonToken.FIELD_NAME) { t = nextToken(); } return t; @@ -804,7 +834,7 @@ public JsonToken nextValue() throws JacksonException { * state correct here. */ @Override - public JsonParser skipChildren() throws JacksonException + public JsonParser skipChildren() throws IOException { if ((_currToken != JsonToken.START_OBJECT) && (_currToken != JsonToken.START_ARRAY)) { @@ -828,103 +858,137 @@ public JsonParser skipChildren() throws JacksonException } } } + /* - /********************************************************************** - /* Public API, access to token information, text; cannot simply delegate - /* due to access via `JsonToken.PROPERTY_NAME` - /********************************************************************** + /********************************************************** + /* Public API, access to token information, text + /********************************************************** */ // 19-Jul-2021, tatu: Cannot quite just delegate these methods due to oddity // of property name token, which may be buffered. - @Override public String getText() throws JacksonException { - if (_currToken == JsonToken.PROPERTY_NAME) { + @Override public String getText() throws IOException { + if (_currToken == JsonToken.FIELD_NAME) { return currentName(); } return delegate.getText(); } @Override public boolean hasTextCharacters() { - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { return false; } return delegate.hasTextCharacters(); } - @Override public char[] getTextCharacters() throws JacksonException { + @Override public char[] getTextCharacters() throws IOException { // Not optimal but is correct, unlike delegating (as underlying stream // may point to something else due to buffering) - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { return currentName().toCharArray(); } return delegate.getTextCharacters(); } - @Override public int getTextLength() throws JacksonException { - if (_currToken == JsonToken.PROPERTY_NAME) { + @Override public int getTextLength() throws IOException { + if (_currToken == JsonToken.FIELD_NAME) { return currentName().length(); } return delegate.getTextLength(); } - @Override public int getTextOffset() throws JacksonException { - if (_currToken == JsonToken.PROPERTY_NAME) { + @Override public int getTextOffset() throws IOException { + if (_currToken == JsonToken.FIELD_NAME) { return 0; } return delegate.getTextOffset(); } - @Override public String getValueAsString() throws JacksonException { - if (_currToken == JsonToken.PROPERTY_NAME) { + /* + /********************************************************** + /* Public API, access to token information, numeric + /********************************************************** + */ + + @Override + public BigInteger getBigIntegerValue() throws IOException { return delegate.getBigIntegerValue(); } + + @Override + public boolean getBooleanValue() throws IOException { return delegate.getBooleanValue(); } + + @Override + public byte getByteValue() throws IOException { return delegate.getByteValue(); } + + @Override + public short getShortValue() throws IOException { return delegate.getShortValue(); } + + @Override + public BigDecimal getDecimalValue() throws IOException { return delegate.getDecimalValue(); } + + @Override + public double getDoubleValue() throws IOException { return delegate.getDoubleValue(); } + + @Override + public float getFloatValue() throws IOException { return delegate.getFloatValue(); } + + @Override + public int getIntValue() throws IOException { return delegate.getIntValue(); } + + @Override + public long getLongValue() throws IOException { return delegate.getLongValue(); } + + @Override + public NumberType getNumberType() throws IOException { return delegate.getNumberType(); } + + @Override + public Number getNumberValue() throws IOException { return delegate.getNumberValue(); } + + /* + /********************************************************** + /* Public API, access to token information, coercion/conversion + /********************************************************** + */ + + @Override public int getValueAsInt() throws IOException { return delegate.getValueAsInt(); } + @Override public int getValueAsInt(int defaultValue) throws IOException { return delegate.getValueAsInt(defaultValue); } + @Override public long getValueAsLong() throws IOException { return delegate.getValueAsLong(); } + @Override public long getValueAsLong(long defaultValue) throws IOException { return delegate.getValueAsLong(defaultValue); } + @Override public double getValueAsDouble() throws IOException { return delegate.getValueAsDouble(); } + @Override public double getValueAsDouble(double defaultValue) throws IOException { return delegate.getValueAsDouble(defaultValue); } + @Override public boolean getValueAsBoolean() throws IOException { return delegate.getValueAsBoolean(); } + @Override public boolean getValueAsBoolean(boolean defaultValue) throws IOException { return delegate.getValueAsBoolean(defaultValue); } + + @Override public String getValueAsString() throws IOException { + if (_currToken == JsonToken.FIELD_NAME) { return currentName(); } return delegate.getValueAsString(); } - - @Override public String getValueAsString(String defaultValue) throws JacksonException { - if (_currToken == JsonToken.PROPERTY_NAME) { + @Override public String getValueAsString(String defaultValue) throws IOException { + if (_currToken == JsonToken.FIELD_NAME) { return currentName(); } return delegate.getValueAsString(defaultValue); } /* - /********************************************************************** - /* Public API, traversal methods that CAN NOT just delegate - /* and where we need to override default delegation - /********************************************************************** + /********************************************************** + /* Public API, access to token values, other + /********************************************************** */ - @Override - public String nextName() throws JacksonException { - return (nextToken() == JsonToken.PROPERTY_NAME) ? currentName() : null; - } - - @Override - public boolean nextName(SerializableString str) throws JacksonException { - return (nextToken() == JsonToken.PROPERTY_NAME) && str.getValue().equals(currentName()); - } - - @Override - public int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException { - String str = nextName(); - if (str != null) { - // 15-Nov-2017, tatu: We can not rely on name being interned here - return matcher.matchName(str); - } - if (hasToken(JsonToken.END_OBJECT)) { - return PropertyNameMatcher.MATCH_END_OBJECT; - } - return PropertyNameMatcher.MATCH_ODD_TOKEN; - } + @Override public Object getEmbeddedObject() throws IOException { return delegate.getEmbeddedObject(); } + @Override public byte[] getBinaryValue(Base64Variant b64variant) throws IOException { return delegate.getBinaryValue(b64variant); } + @Override public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException { return delegate.readBinaryValue(b64variant, out); } + @Override public JsonLocation getTokenLocation() { return delegate.getTokenLocation(); } /* - /********************************************************************** + /********************************************************** /* Internal helper methods - /********************************************************************** + /********************************************************** */ - protected TokenStreamContext _filterContext() { + protected JsonStreamContext _filterContext() { if (_exposedContext != null) { return _exposedContext; } diff --git a/src/main/java/com/fasterxml/jackson/core/filter/TokenFilter.java b/src/main/java/com/fasterxml/jackson/core/filter/TokenFilter.java index 317a37cb72..3e74749134 100644 --- a/src/main/java/com/fasterxml/jackson/core/filter/TokenFilter.java +++ b/src/main/java/com/fasterxml/jackson/core/filter/TokenFilter.java @@ -1,15 +1,17 @@ package com.fasterxml.jackson.core.filter; +import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; -import com.fasterxml.jackson.core.JacksonException; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; /** * Strategy class that can be implemented to specify actual inclusion/exclusion * criteria for filtering, used by {@link FilteringGeneratorDelegate}. + * + * @since 2.6 */ public class TokenFilter { @@ -31,9 +33,9 @@ public enum Inclusion { INCLUDE_ALL_AND_PATH, /** * Tokens will be included if any non-null filter is returned. - * The exception is if a property name returns a non-null filter, - * but the property value returns a null filter. In this case the - * property name and value will both be omitted. + * The exception is if a field name returns a non-null filter, + * but the field value returns a null filter. In this case the + * field name and value will both be omitted. */ INCLUDE_NON_NULL } @@ -239,10 +241,10 @@ public TokenFilter includeRootValue(int index) { * * @return True if scalar value is to be included; false if not * - * @throws JacksonException if there are any problems reading content (typically + * @throws IOException if there are any problems reading content (typically * via calling passed-in {@code JsonParser}) */ - public boolean includeValue(JsonParser p) throws JacksonException { + public boolean includeValue(JsonParser p) throws IOException { return _includeScalar(); } diff --git a/src/main/java/com/fasterxml/jackson/core/filter/TokenFilterContext.java b/src/main/java/com/fasterxml/jackson/core/filter/TokenFilterContext.java index 2ed56fe005..e1bc1ede6a 100644 --- a/src/main/java/com/fasterxml/jackson/core/filter/TokenFilterContext.java +++ b/src/main/java/com/fasterxml/jackson/core/filter/TokenFilterContext.java @@ -1,12 +1,16 @@ package com.fasterxml.jackson.core.filter; +import java.io.IOException; + import com.fasterxml.jackson.core.*; /** - * Alternative variant of {@link TokenStreamContext}, used when filtering + * Alternative variant of {@link JsonStreamContext}, used when filtering * content being read or written (based on {@link TokenFilter}). + * + * @since 2.6 */ -public class TokenFilterContext extends TokenStreamContext +public class TokenFilterContext extends JsonStreamContext { /** * Parent context for this context; null for root context. @@ -14,31 +18,27 @@ public class TokenFilterContext extends TokenStreamContext protected final TokenFilterContext _parent; /* - /********************************************************************** - /* Simple instance reuse slots; speed up things a bit (10-15%) for - /* docs with lots of small arrays/objects - /********************************************************************** + /********************************************************** + /* Simple instance reuse slots; speed up things + /* a bit (10-15%) for docs with lots of small + /* arrays/objects + /********************************************************** */ protected TokenFilterContext _child; /* - /********************************************************************** + /********************************************************** /* Location/state information - /********************************************************************** + /********************************************************** */ /** - * Name of the property of which value is to be parsed; only + * Name of the field of which value is to be parsed; only * used for OBJECT contexts */ protected String _currentName; - /** - * @since 3.0 - */ - protected Object _currentValue; - /** * Filter to use for items in this state (for properties of Objects, * elements of Arrays, and root-level values of root context) @@ -58,33 +58,31 @@ public class TokenFilterContext extends TokenStreamContext * included leaf is to be exposed. */ protected boolean _needToHandleName; - + /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ protected TokenFilterContext(int type, TokenFilterContext parent, - TokenFilter filter, Object currValue, boolean startHandled) + TokenFilter filter, boolean startHandled) { super(); _type = type; _parent = parent; _filter = filter; _index = -1; - _currentValue = currValue; _startHandled = startHandled; _needToHandleName = false; } protected TokenFilterContext reset(int type, - TokenFilter filter, Object currValue, boolean startWritten) + TokenFilter filter, boolean startWritten) { _type = type; _filter = filter; _index = -1; - _currentValue = currValue; _currentName = null; _startHandled = startWritten; _needToHandleName = false; @@ -92,43 +90,41 @@ protected TokenFilterContext reset(int type, } /* - /********************************************************************** + /********************************************************** /* Factory methods - /********************************************************************** + /********************************************************** */ public static TokenFilterContext createRootContext(TokenFilter filter) { // true -> since we have no start/end marker, consider start handled - return new TokenFilterContext(TYPE_ROOT, null, filter, null, true); + return new TokenFilterContext(TYPE_ROOT, null, filter, true); } - public TokenFilterContext createChildArrayContext(TokenFilter filter, Object currentValue, - boolean writeStart) { + public TokenFilterContext createChildArrayContext(TokenFilter filter, boolean writeStart) { TokenFilterContext ctxt = _child; if (ctxt == null) { - _child = ctxt = new TokenFilterContext(TYPE_ARRAY, this, filter, currentValue, writeStart); + _child = ctxt = new TokenFilterContext(TYPE_ARRAY, this, filter, writeStart); return ctxt; } - return ctxt.reset(TYPE_ARRAY, filter, currentValue, writeStart); + return ctxt.reset(TYPE_ARRAY, filter, writeStart); } - public TokenFilterContext createChildObjectContext(TokenFilter filter, Object currentValue, - boolean writeStart) { + public TokenFilterContext createChildObjectContext(TokenFilter filter, boolean writeStart) { TokenFilterContext ctxt = _child; if (ctxt == null) { - _child = ctxt = new TokenFilterContext(TYPE_OBJECT, this, filter, currentValue, writeStart); + _child = ctxt = new TokenFilterContext(TYPE_OBJECT, this, filter, writeStart); return ctxt; } - return ctxt.reset(TYPE_OBJECT, filter, currentValue, writeStart); + return ctxt.reset(TYPE_OBJECT, filter, writeStart); } /* - /********************************************************************** + /********************************************************** /* State changes - /********************************************************************** + /********************************************************** */ - public TokenFilter setPropertyName(String name) { + public TokenFilter setFieldName(String name) throws JsonProcessingException { _currentName = name; _needToHandleName = true; return _filter; @@ -156,19 +152,19 @@ public TokenFilter checkValue(TokenFilter filter) { } /** - * Method called to ensure that the property name, if present, has been written; + * Method called to ensure that field name, if present, has been written; * may result (but does not always) in a call using given generator * * @param gen Generator to use to write the property name, if necessary * - * @throws JacksonException If there is a problem writing property name (typically + * @throws IOException If there is a problem writing property name (typically * thrown by {@code JsonGenerator}) */ - public void ensurePropertyNameWritten(JsonGenerator gen) throws JacksonException + public void ensureFieldNameWritten(JsonGenerator gen) throws IOException { if (_needToHandleName) { _needToHandleName = false; - gen.writeName(_currentName); + gen.writeFieldName(_currentName); } } @@ -178,10 +174,10 @@ public void ensurePropertyNameWritten(JsonGenerator gen) throws JacksonException * * @param gen Generator to use to write the path, if necessary * - * @throws JacksonException If there is a problem writing property name (typically + * @throws IOException If there is a problem writing property name (typically * thrown by {@code JsonGenerator}) */ - public void writePath(JsonGenerator gen) throws JacksonException + public void writePath(JsonGenerator gen) throws IOException { if ((_filter == null) || (_filter == TokenFilter.INCLUDE_ALL)) { return; @@ -192,20 +188,20 @@ public void writePath(JsonGenerator gen) throws JacksonException if (_startHandled) { // even if Object started, need to start leaf-level name if (_needToHandleName) { - gen.writeName(_currentName); + gen.writeFieldName(_currentName); } } else { _startHandled = true; if (_type == TYPE_OBJECT) { gen.writeStartObject(); - gen.writeName(_currentName); // we know name must be written + gen.writeFieldName(_currentName); // we know name must be written } else if (_type == TYPE_ARRAY) { gen.writeStartArray(); } } } - private void _writePath(JsonGenerator gen) throws JacksonException + private void _writePath(JsonGenerator gen) throws IOException { if ((_filter == null) || (_filter == TokenFilter.INCLUDE_ALL)) { return; @@ -217,7 +213,7 @@ private void _writePath(JsonGenerator gen) throws JacksonException // even if Object started, need to start leaf-level name if (_needToHandleName) { _needToHandleName = false; // at parent must explicitly clear - gen.writeName(_currentName); + gen.writeFieldName(_currentName); } } else { _startHandled = true; @@ -225,7 +221,7 @@ private void _writePath(JsonGenerator gen) throws JacksonException gen.writeStartObject(); if (_needToHandleName) { _needToHandleName = false; // at parent must explicitly clear - gen.writeName(_currentName); + gen.writeFieldName(_currentName); } } else if (_type == TYPE_ARRAY) { gen.writeStartArray(); @@ -233,7 +229,7 @@ private void _writePath(JsonGenerator gen) throws JacksonException } } - public TokenFilterContext closeArray(JsonGenerator gen) throws JacksonException + public TokenFilterContext closeArray(JsonGenerator gen) throws IOException { if (_startHandled) { gen.writeEndArray(); @@ -244,7 +240,7 @@ public TokenFilterContext closeArray(JsonGenerator gen) throws JacksonException return _parent; } - public TokenFilterContext closeObject(JsonGenerator gen) throws JacksonException + public TokenFilterContext closeObject(JsonGenerator gen) throws IOException { if (_startHandled) { gen.writeEndObject(); @@ -263,20 +259,20 @@ public void skipParentChecks() { } /* - /********************************************************************** + /********************************************************** /* Accessors, mutators - /********************************************************************** + /********************************************************** */ @Override - public Object currentValue() { return _currentValue; } + public Object getCurrentValue() { return null; } @Override - public void assignCurrentValue(Object v) { } + public void setCurrentValue(Object v) { } @Override public final TokenFilterContext getParent() { return _parent; } - @Override public final String currentName() { return _currentName; } - + @Override public final String getCurrentName() { return _currentName; } + // @since 2.9 @Override public boolean hasCurrentName() { return _currentName != null; } public TokenFilter getFilter() { return _filter; } @@ -291,10 +287,10 @@ public JsonToken nextTokenToRead() { // Note: root should never be unhandled return JsonToken.START_ARRAY; } - // But otherwise at most might have PROPERTY_NAME + // But otherwise at most might have FIELD_NAME if (_needToHandleName && (_type == TYPE_OBJECT)) { _needToHandleName = false; - return JsonToken.PROPERTY_NAME; + return JsonToken.FIELD_NAME; } return null; } diff --git a/src/main/java/com/fasterxml/jackson/core/format/DataFormatDetector.java b/src/main/java/com/fasterxml/jackson/core/format/DataFormatDetector.java new file mode 100644 index 0000000000..7e2eefbd2f --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/format/DataFormatDetector.java @@ -0,0 +1,228 @@ +package com.fasterxml.jackson.core.format; + +import java.io.*; +import java.util.*; + +import com.fasterxml.jackson.core.*; + +/** + * Simple helper class that allows data format (content type) auto-detection, + * given an ordered set of {@link JsonFactory} instances to use for actual low-level + * detection. + */ +public class DataFormatDetector +{ + /** + * By default we will look ahead at most 64 bytes; in most cases, + * much less (4 bytes or so) is needed, but we will allow bit more + * leniency to support data formats that need more complex heuristics. + */ + public final static int DEFAULT_MAX_INPUT_LOOKAHEAD = 64; + + /** + * Ordered list of factories which both represent data formats to + * detect (in precedence order, starting with highest) and are used + * for actual detection. + */ + protected final JsonFactory[] _detectors; + + /** + * Strength of match we consider to be good enough to be used + * without checking any other formats. + * Default value is {@link MatchStrength#SOLID_MATCH}, + */ + protected final MatchStrength _optimalMatch; + + /** + * Strength of minimal match we accept as the answer, unless + * better matches are found. + * Default value is {@link MatchStrength#WEAK_MATCH}, + */ + protected final MatchStrength _minimalMatch; + + /** + * Maximum number of leading bytes of the input that we can read + * to determine data format. + *

    + * Default value is {@link #DEFAULT_MAX_INPUT_LOOKAHEAD}. + */ + protected final int _maxInputLookahead; + + /* + /********************************************************** + /* Construction + /********************************************************** + */ + + public DataFormatDetector(JsonFactory... detectors) { + this(detectors, MatchStrength.SOLID_MATCH, MatchStrength.WEAK_MATCH, + DEFAULT_MAX_INPUT_LOOKAHEAD); + } + + public DataFormatDetector(Collection detectors) { + this(detectors.toArray(new JsonFactory[0])); + } + + private DataFormatDetector(JsonFactory[] detectors, + MatchStrength optMatch, MatchStrength minMatch, int maxInputLookahead) { + _detectors = detectors; + _optimalMatch = optMatch; + _minimalMatch = minMatch; + _maxInputLookahead = maxInputLookahead; + } + + /** + * Method that will return a detector instance that uses given + * optimal match level (match that is considered sufficient to return, without + * trying to find stronger matches with other formats). + * + * @param optMatch Optimal match level to use + * + * @return Format detector instance with specified optimal match level + */ + public DataFormatDetector withOptimalMatch(MatchStrength optMatch) { + if (optMatch == _optimalMatch) { + return this; + } + return new DataFormatDetector(_detectors, optMatch, _minimalMatch, _maxInputLookahead); + } + /** + * Method that will return a detector instance that uses given + * minimal match level; match that may be returned unless a stronger match + * is found with other format detectors. + * + * @param minMatch Minimum match level to use + * + * @return Format detector instance with specified minimum match level + */ + public DataFormatDetector withMinimalMatch(MatchStrength minMatch) { + if (minMatch == _minimalMatch) { + return this; + } + return new DataFormatDetector(_detectors, _optimalMatch, minMatch, _maxInputLookahead); + } + + /** + * Method that will return a detector instance that allows detectors to + * read up to specified number of bytes when determining format match strength. + * + * @param lookaheadBytes Amount of look-ahead allowed + * + * @return Format detector instance with specified lookahead settings + */ + public DataFormatDetector withMaxInputLookahead(int lookaheadBytes) { + if (lookaheadBytes == _maxInputLookahead) { + return this; + } + return new DataFormatDetector(_detectors, _optimalMatch, _minimalMatch, lookaheadBytes); + } + + /* + /********************************************************** + /* Public API + /********************************************************** + */ + + /** + * Method to call to find format that content (accessible via given + * {@link InputStream}) given has, as per configuration of this detector + * instance. + * + * @param in InputStream from which to read initial content + * + * @return Matcher object which contains result; never null, even in cases + * where no match (with specified minimal match strength) is found. + * + * @throws IOException for read I/O problems + */ + public DataFormatMatcher findFormat(InputStream in) throws IOException { + return _findFormat(new InputAccessor.Std(in, new byte[_maxInputLookahead])); + } + + /** + * Method to call to find format that given content (full document) + * has, as per configuration of this detector instance. + * + * @param fullInputData Full contents to use for format detection + * + * @return Matcher object which contains result; never null, even in cases + * where no match (with specified minimal match strength) is found. + * + * @throws IOException for read I/O problems + */ + public DataFormatMatcher findFormat(byte[] fullInputData) throws IOException { + return _findFormat(new InputAccessor.Std(fullInputData)); + } + + /** + * Method to call to find format that given content (full document) + * has, as per configuration of this detector instance. + * + * @param fullInputData Full contents to use for format detection + * @param offset Offset of the first content byte + * @param len Length of content + * + * @return Matcher object which contains result; never null, even in cases + * where no match (with specified minimal match strength) is found. + * + * @throws IOException for read I/O problems + * + * @since 2.1 + */ + public DataFormatMatcher findFormat(byte[] fullInputData, int offset, int len) throws IOException { + return _findFormat(new InputAccessor.Std(fullInputData, offset, len)); + } + + /* + /********************************************************** + /* Overrides + /********************************************************** + */ + + @Override public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append('['); + final int len = _detectors.length; + if (len > 0) { + sb.append(_detectors[0].getFormatName()); + for (int i = 1; i < len; ++i) { + sb.append(", "); + sb.append(_detectors[i].getFormatName()); + } + } + sb.append(']'); + return sb.toString(); + } + + /* + /********************************************************** + /* Internal methods + /********************************************************** + */ + + private DataFormatMatcher _findFormat(InputAccessor.Std acc) throws IOException { + JsonFactory bestMatch = null; + MatchStrength bestMatchStrength = null; + for (JsonFactory f : _detectors) { + acc.reset(); + MatchStrength strength = f.hasFormat(acc); + // if not better than what we have so far (including minimal level limit), skip + if (strength == null || strength.ordinal() < _minimalMatch.ordinal()) { + continue; + } + // also, needs to better match than before + if (bestMatch != null) { + if (bestMatchStrength.ordinal() >= strength.ordinal()) { + continue; + } + } + // finally: if it's good enough match, we are done + bestMatch = f; + bestMatchStrength = strength; + if (strength.ordinal() >= _optimalMatch.ordinal()) { + break; + } + } + return acc.createMatcher(bestMatch, bestMatchStrength); + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/format/DataFormatMatcher.java b/src/main/java/com/fasterxml/jackson/core/format/DataFormatMatcher.java new file mode 100644 index 0000000000..d16cb86ecb --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/format/DataFormatMatcher.java @@ -0,0 +1,139 @@ +package com.fasterxml.jackson.core.format; + +import java.io.*; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.io.MergedStream; + +/** + * Result object constructed by {@link DataFormatDetector} when requested + * to detect format of given input data. + */ +public class DataFormatMatcher +{ + protected final InputStream _originalStream; + + /** + * Content read during format matching process + */ + protected final byte[] _bufferedData; + + /** + * Pointer to the first byte in buffer available for reading + */ + protected final int _bufferedStart; + + /** + * Number of bytes available in buffer. + */ + protected final int _bufferedLength; + + /** + * Factory that produced sufficient match (if any) + */ + protected final JsonFactory _match; + + /** + * Strength of match with {@link #_match} + */ + protected final MatchStrength _matchStrength; + + protected DataFormatMatcher(InputStream in, byte[] buffered, + int bufferedStart, int bufferedLength, + JsonFactory match, MatchStrength strength) + { + _originalStream = in; + _bufferedData = buffered; + _bufferedStart = bufferedStart; + _bufferedLength = bufferedLength; + _match = match; + _matchStrength = strength; + + // can't have negative offset or length + if ((bufferedStart | bufferedLength) < 0 + || (bufferedStart + bufferedLength) > buffered.length) { + throw new IllegalArgumentException(String.format("Illegal start/length (%d/%d) wrt input array of %d bytes", + bufferedStart, bufferedLength, buffered.length)); + } + } + + /* + /********************************************************** + /* Public API, simple accessors + /********************************************************** + */ + + /** + * Accessor to use to see if any formats matched well enough with + * the input data. + * + * @return Whether format has a match + */ + public boolean hasMatch() { return _match != null; } + + /** + * Method for accessing strength of the match, if any; if no match, + * will return {@link MatchStrength#INCONCLUSIVE}. + * + * @return Strength of match + */ + public MatchStrength getMatchStrength() { + return (_matchStrength == null) ? MatchStrength.INCONCLUSIVE : _matchStrength; + } + + /** + * Accessor for {@link JsonFactory} that represents format that data matched. + * + * @return Relevant {@link JsonFactory} to indicate matched format + */ + public JsonFactory getMatch() { return _match; } + + /** + * Accessor for getting brief textual name of matched format if any (null + * if none). Equivalent to: + *

    +     *   return hasMatch() ? getMatch().getFormatName() : null;
    +     *
    + * + * @return Name of the format that is acceptable match, if any; {@code null} if none + */ + public String getMatchedFormatName() { + return hasMatch() ? getMatch().getFormatName() : null; + } + + /* + /********************************************************** + /* Public API, factory methods + /********************************************************** + */ + + // Convenience method for trying to construct a {@link JsonParser} for + // parsing content which is assumed to be in detected data format. + // If no match was found, returns null. + public JsonParser createParserWithMatch() throws IOException { + if (_match == null) { + return null; + } + if (_originalStream == null) { + return _match.createParser(_bufferedData, _bufferedStart, _bufferedLength); + } + return _match.createParser(getDataStream()); + } + + /** + * Method to use for accessing input for which format detection has been done. + * This must be used instead of using stream passed to detector + * unless given stream itself can do buffering. + * Stream will return all content that was read during matching process, as well + * as remaining contents of the underlying stream. + * + * @return InputStream to use for reading actual content using format detected + */ + public InputStream getDataStream() { + if (_originalStream == null) { + return new ByteArrayInputStream(_bufferedData, _bufferedStart, _bufferedLength); + } + return new MergedStream(null, _originalStream, _bufferedData, _bufferedStart, _bufferedLength); + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/format/InputAccessor.java b/src/main/java/com/fasterxml/jackson/core/format/InputAccessor.java new file mode 100644 index 0000000000..bec6d0fce3 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/format/InputAccessor.java @@ -0,0 +1,146 @@ +package com.fasterxml.jackson.core.format; + +import java.io.*; + +import com.fasterxml.jackson.core.JsonFactory; + +/** + * Interface used to expose beginning of a data file to data format + * detection code. + */ +public interface InputAccessor +{ + /** + * Method to call to check if more input is available. + * Since this may result in more content to be read (at least + * one more byte), a {@link IOException} may get thrown. + * + * @return Whether there is at least one more input byte accessible + * + * @throws IOException If check for more content failed due to issue with + * underlying input abstraction + */ + boolean hasMoreBytes() throws IOException; + + /** + * Returns next byte available, if any; if no more bytes are + * available, will throw {@link java.io.EOFException}. + * + * @return Next content byte, if available + * + * @throws IOException If called and there is no more content available + */ + byte nextByte() throws IOException; + + /** + * Method that can be called to reset accessor to read from beginning of input. + */ + void reset(); + + /* + /********************************************************** + /* Standard implementation + /********************************************************** + */ + + /** + * Basic implementation that reads data from given + * {@link InputStream} and buffers it as necessary. + */ + class Std implements InputAccessor + { + protected final InputStream _in; + + protected final byte[] _buffer; + + protected final int _bufferedStart; + + /** + * End of valid bytes in the buffer (points to one past last valid) + */ + protected int _bufferedEnd; + + /** + * Pointer to next available buffered byte in {@link #_buffer}. + */ + protected int _ptr; + + // Constructor used when content to check is available via + // input stream and must be read. + public Std(InputStream in, byte[] buffer) + { + _in = in; + _buffer = buffer; + _bufferedStart = 0; + _ptr = 0; + _bufferedEnd = 0; + } + + // Constructor used when the full input (or at least enough leading bytes + // of full input) is available. + public Std(byte[] inputDocument) { + this(inputDocument, 0, inputDocument.length); + } + + // Constructor used when the full input (or at least enough leading bytes + // of full input) is available. + public Std(byte[] inputDocument, int start, int len) + { + _in = null; + _buffer = inputDocument; + _ptr = start; + _bufferedStart = start; + _bufferedEnd = start+len; + } + + @Override + public boolean hasMoreBytes() throws IOException + { + if (_ptr < _bufferedEnd) { // already got more + return true; + } + if (_in == null) { // nowhere to read from + return false; + } + int amount = _buffer.length - _ptr; + if (amount < 1) { // can not load any more + return false; + } + int count = _in.read(_buffer, _ptr, amount); + if (count <= 0) { // EOF + return false; + } + _bufferedEnd += count; + return true; + } + + @Override + public byte nextByte() throws IOException + { + // should we just try loading more automatically? + if (_ptr >= _bufferedEnd) { + if (!hasMoreBytes()) { + throw new EOFException("Failed auto-detect: could not read more than "+_ptr+" bytes (max buffer size: "+_buffer.length+")"); + } + } + return _buffer[_ptr++]; + } + + @Override + public void reset() { + _ptr = _bufferedStart; + } + + /* + /********************************************************** + /* Extended API for DataFormatDetector/Matcher + /********************************************************** + */ + + public DataFormatMatcher createMatcher(JsonFactory match, MatchStrength matchStrength) + { + return new DataFormatMatcher(_in, _buffer, _bufferedStart, (_bufferedEnd - _bufferedStart), + match, matchStrength); + } + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/format/MatchStrength.java b/src/main/java/com/fasterxml/jackson/core/format/MatchStrength.java new file mode 100644 index 0000000000..d123708359 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/format/MatchStrength.java @@ -0,0 +1,62 @@ +package com.fasterxml.jackson.core.format; + +/** + * Enumeration used to indicate strength of match between data format + * and piece of data (typically beginning of a data file). + * Values are in increasing match strength; and detectors should return + * "strongest" value: that is, it should start with strongest match + * criteria, and downgrading if criteria is not fulfilled. + */ +public enum MatchStrength +{ + /** + * Value that indicates that given data can not be in given format. + */ + NO_MATCH, + + /** + * Value that indicates that detector can not find out whether could + * be a match or not. + * This can occur for example for textual data formats t + * when there are so many leading spaces that detector can not + * find the first data byte (because detectors typically limit lookahead + * to some smallish value). + */ + INCONCLUSIVE, + + /** + * Value that indicates that given data could be of specified format (i.e. + * it can not be ruled out). This can occur for example when seen data + * is both not in canonical formats (for example: JSON data should be a JSON Array or Object + * not a scalar value, as per JSON specification) and there are known use case + * where a format detected is actually used (plain JSON Strings are actually used, even + * though specification does not indicate that as valid usage: as such, seeing a leading + * double-quote could indicate a JSON String, which plausibly could indicate + * non-standard JSON usage). + */ + WEAK_MATCH, + + /** + * Value that indicates that given data conforms to (one of) canonical form(s) of + * the data format. + *

    + * For example, when testing for XML data format, + * seeing a less-than character ("<") alone (with possible leading spaces) + * would be a strong indication that data could + * be in xml format (but see below for {@link #FULL_MATCH} description for more) + */ + SOLID_MATCH, + + /** + * Value that indicates that given data contains a signature that is deemed + * specific enough to uniquely indicate data format used. + *

    + * For example, when testing for XML data format, + * seing "<xml" as the first data bytes ("XML declaration", as per XML specification) + * could give full confidence that data is indeed in XML format. + * Not all data formats have unique leading identifiers to allow full matches; for example, + * JSON only has heuristic matches and can have at most {@link #SOLID_MATCH}) match. + */ + FULL_MATCH + ; +} diff --git a/src/main/java/com/fasterxml/jackson/core/format/package-info.java b/src/main/java/com/fasterxml/jackson/core/format/package-info.java new file mode 100644 index 0000000000..a83e41fc80 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/format/package-info.java @@ -0,0 +1,6 @@ +/** + * Package that contains interfaces needed for dynamic, pluggable + * format (auto)detection; as well as basic utility classes for + * simple format detection functionality. + */ +package com.fasterxml.jackson.core.format; diff --git a/src/main/java/com/fasterxml/jackson/core/io/CharTypes.java b/src/main/java/com/fasterxml/jackson/core/io/CharTypes.java index 2e4c68df17..fb42b62561 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/CharTypes.java +++ b/src/main/java/com/fasterxml/jackson/core/io/CharTypes.java @@ -41,7 +41,8 @@ public final class CharTypes */ protected final static int[] sInputCodesUTF8; static { - final int[] table = Arrays.copyOf(sInputCodes, sInputCodes.length); + final int[] table = new int[sInputCodes.length]; + System.arraycopy(sInputCodes, 0, table, 0, table.length); for (int c = 128; c < 256; ++c) { int code; @@ -63,7 +64,7 @@ public final class CharTypes } /** - * To support non-default (and non-standard) unquoted Object Property names mode, + * To support non-default (and -standard) unquoted field names mode, * need to have alternate checking. * Basically this is list of 8-bit ASCII characters that are legal * as part of Javascript identifier @@ -79,8 +80,9 @@ public final class CharTypes table[i] = 0; } } - // Also: '@', '#' and '*' are also to be accepted as well. - // And '-' (for hyphenated names); and '+' for sake of symmetricity... + /* As per [JACKSON-267], '@', '#' and '*' are also to be accepted as well. + * And '-' (for hyphenated names); and '+' for sake of symmetricity... + */ table['@'] = 0; table['#'] = 0; table['*'] = 0; @@ -96,8 +98,9 @@ public final class CharTypes */ protected final static int[] sInputCodesUtf8JsNames; static { + final int[] table = new int[256]; // start with 8-bit JS names - final int[] table = Arrays.copyOf(sInputCodesJsNames, sInputCodesJsNames.length); + System.arraycopy(sInputCodesJsNames, 0, table, 0, table.length); Arrays.fill(table, 128, 128, 0); sInputCodesUtf8JsNames = table; } @@ -216,6 +219,8 @@ public final class CharTypes * usually double-quote but sometimes changed to single-quote (apostrophe) * * @return 128-entry {@code int[]} that contains escape definitions + * + * @since 2.10 */ public static int[] get7BitOutputEscapes(int quoteChar) { if (quoteChar == '"') { @@ -249,7 +254,7 @@ public static char hexToChar(int ch) public static void appendQuoted(StringBuilder sb, String content) { final int[] escCodes = sOutputEscapes128; - final int escLen = escCodes.length; + int escLen = escCodes.length; for (int i = 0, len = content.length(); i < len; ++i) { char c = content.charAt(i); if (c >= escLen || escCodes[c] == 0) { diff --git a/src/main/java/com/fasterxml/jackson/core/io/ContentReference.java b/src/main/java/com/fasterxml/jackson/core/io/ContentReference.java index 8a820ea7e1..d1de891129 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/ContentReference.java +++ b/src/main/java/com/fasterxml/jackson/core/io/ContentReference.java @@ -3,7 +3,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import java.nio.charset.StandardCharsets; +import java.nio.charset.Charset; import java.util.Objects; /** @@ -13,6 +13,8 @@ * location (see {@link com.fasterxml.jackson.core.JsonLocation}) * objections, most commonly to be printed out as part of {@code Exception} * messages. + * + * @since 2.13 */ public class ContentReference // sort of: we will read back as "UNKNOWN" @@ -285,7 +287,7 @@ protected String _truncate(byte[] b, int[] offsets, int maxSnippetLen) { _truncateOffsets(offsets, b.length); final int start = offsets[0]; final int length = Math.min(offsets[1], maxSnippetLen); - return new String(b, start, length, StandardCharsets.UTF_8); + return new String(b, start, length, Charset.forName("UTF-8")); } // Method that is given alleged start/offset pair and needs to adjust diff --git a/src/main/java/com/fasterxml/jackson/core/io/DataOutputAsStream.java b/src/main/java/com/fasterxml/jackson/core/io/DataOutputAsStream.java index 6a0d31ea8a..5fa8cada20 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/DataOutputAsStream.java +++ b/src/main/java/com/fasterxml/jackson/core/io/DataOutputAsStream.java @@ -5,6 +5,8 @@ /** * Helper class to support use of {@link DataOutput} for output, directly, * without caller having to provide for implementation. + * + * @since 2.8 */ public class DataOutputAsStream extends OutputStream { @@ -34,9 +36,9 @@ public void write(byte b[], int offset, int length) throws IOException { /* @Override - public void flush() { } + public void flush() throws IOException { } @Override - public void close() { } + public void close() throws IOException { } */ } diff --git a/src/main/java/com/fasterxml/jackson/core/io/IOContext.java b/src/main/java/com/fasterxml/jackson/core/io/IOContext.java index eb05b9cff1..f57c1d3224 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/IOContext.java +++ b/src/main/java/com/fasterxml/jackson/core/io/IOContext.java @@ -26,6 +26,14 @@ public class IOContext */ protected final ContentReference _contentReference; + /** + * Old, deprecated "raw" reference to input source. + * + * @deprecated Since 2.13, use {@link #_contentReference} instead + */ + @Deprecated + protected final Object _sourceRef; + /** * Encoding used by the underlying stream, if known. */ @@ -104,22 +112,27 @@ public class IOContext * @param br BufferRecycler to use, if any ({@code null} if none) * @param contentRef Input source reference for location reporting * @param managedResource Whether input source is managed (owned) by Jackson library - * @param enc Encoding in use + * + * @since 2.13 */ - public IOContext(BufferRecycler br, ContentReference contentRef, boolean managedResource, - JsonEncoding enc) + public IOContext(BufferRecycler br, ContentReference contentRef, boolean managedResource) { _bufferRecycler = br; _contentReference = contentRef; + _sourceRef = contentRef.getRawContent(); _managedResource = managedResource; - _encoding = enc; } - public IOContext(BufferRecycler br, ContentReference contentRef, boolean managedResource) { - this(br, contentRef, managedResource, null); + @Deprecated // since 2.13 + public IOContext(BufferRecycler br, Object rawContent, boolean managedResource) { + this(br, ContentReference.rawReference(rawContent), managedResource); + } + + public void setEncoding(JsonEncoding enc) { + _encoding = enc; } - public IOContext setEncoding(JsonEncoding enc) { + public IOContext withEncoding(JsonEncoding enc) { _encoding = enc; return this; } @@ -138,11 +151,20 @@ public IOContext setEncoding(JsonEncoding enc) { * usable for error reporting purposes. * * @return Reference to input source + * + * @since 2.13 */ public ContentReference contentReference() { return _contentReference; } + /** + * @deprecated Since 2.13, use {@link #contentReference()} instead + * @return "Raw" source reference + */ + @Deprecated + public Object getSourceReference() { return _sourceRef; } + /* /********************************************************************** /* Public API, buffer management @@ -173,6 +195,8 @@ public byte[] allocReadIOBuffer() { * @param minSize Minimum size of the buffer to recycle or allocate * * @return Allocated or recycled byte buffer + * + * @since 2.4 */ public byte[] allocReadIOBuffer(int minSize) { _verifyAlloc(_readIOBuffer); @@ -199,6 +223,8 @@ public byte[] allocWriteEncodingBuffer() { * @param minSize Minimum size of the buffer to recycle or allocate * * @return Allocated or recycled byte buffer + * + * @since 2.4 */ public byte[] allocWriteEncodingBuffer(int minSize) { _verifyAlloc(_writeEncodingBuffer); @@ -225,6 +251,8 @@ public byte[] allocBase64Buffer() { * @param minSize Minimum size of the buffer to recycle or allocate * * @return Allocated or recycled byte buffer + * + * @since 2.9 */ public byte[] allocBase64Buffer(int minSize) { _verifyAlloc(_base64Buffer); @@ -236,6 +264,7 @@ public char[] allocTokenBuffer() { return (_tokenCBuffer = _bufferRecycler.allocCharBuffer(BufferRecycler.CHAR_TOKEN_BUFFER)); } + // @since 2.4 public char[] allocTokenBuffer(int minSize) { _verifyAlloc(_tokenCBuffer); return (_tokenCBuffer = _bufferRecycler.allocCharBuffer(BufferRecycler.CHAR_TOKEN_BUFFER, minSize)); diff --git a/src/main/java/com/fasterxml/jackson/core/io/InputDecorator.java b/src/main/java/com/fasterxml/jackson/core/io/InputDecorator.java index a744b6657a..cb774f4eed 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/InputDecorator.java +++ b/src/main/java/com/fasterxml/jackson/core/io/InputDecorator.java @@ -2,8 +2,6 @@ import java.io.*; -import com.fasterxml.jackson.core.JacksonException; - /** * Handler class that can be used to decorate input sources. * Typical use is to use a filter abstraction (filtered stream, @@ -16,7 +14,7 @@ public abstract class InputDecorator private static final long serialVersionUID = 1L; /** - * Method called by {@link com.fasterxml.jackson.core.json.JsonFactory} instance when + * Method called by {@link com.fasterxml.jackson.core.JsonFactory} instance when * creating parser given an {@link InputStream}, when this decorator * has been registered. * @@ -27,15 +25,15 @@ public abstract class InputDecorator * @param in Original input source * * @return InputStream to use; either 'in' as is, or decorator - * version that typically delegates to 'in' + * version that typically delogates to 'in' * - * @throws JacksonException if construction of {@link InputStream} fails + * @throws IOException if construction of {@link InputStream} fails */ public abstract InputStream decorate(IOContext ctxt, InputStream in) - throws JacksonException; + throws IOException; /** - * Method called by {@link com.fasterxml.jackson.core.json.JsonFactory} instance when + * Method called by {@link com.fasterxml.jackson.core.JsonFactory} instance when * creating parser on given "raw" byte source. * Method can either construct a {@link InputStream} for reading; or return * null to indicate that no wrapping should occur. @@ -51,13 +49,13 @@ public abstract InputStream decorate(IOContext ctxt, InputStream in) * @return Either {@link InputStream} to use as input source; or null to indicate * that contents are to be processed as-is by caller * - * @throws JacksonException if construction of {@link InputStream} fails + * @throws IOException if construction of {@link InputStream} fails */ public abstract InputStream decorate(IOContext ctxt, byte[] src, int offset, int length) - throws JacksonException; + throws IOException; /** - * Method called by {@link com.fasterxml.jackson.core.json.JsonFactory} instance when + * Method called by {@link com.fasterxml.jackson.core.JsonFactory} instance when * creating parser given an {@link DataInput}, when this decorator * has been registered. *

    @@ -70,16 +68,19 @@ public abstract InputStream decorate(IOContext ctxt, byte[] src, int offset, int * @param input Original input source * * @return InputStream to use; either 'input' as is, or decorator - * version that typically delegates to 'input' + * version that typically delogates to 'input' + * + * @throws IOException if construction of {@link DataInput} fails * - * @throws JacksonException if construction of {@link DataInput} fails + * @since 2.8 */ - public DataInput decorate(IOContext ctxt, DataInput input) throws JacksonException { + public DataInput decorate(IOContext ctxt, DataInput input) + throws IOException { throw new UnsupportedOperationException(); } /** - * Method called by {@link com.fasterxml.jackson.core.json.JsonFactory} instance when + * Method called by {@link com.fasterxml.jackson.core.JsonFactory} instance when * creating parser given an {@link Reader}, when this decorator * has been registered. * @@ -92,7 +93,7 @@ public DataInput decorate(IOContext ctxt, DataInput input) throws JacksonExcepti * @return Reader to use; either passed in argument, or something that * calls it (for example, a {@link FilterReader}) * - * @throws JacksonException if construction of {@link Reader} fails + * @throws IOException if construction of {@link Reader} fails */ - public abstract Reader decorate(IOContext ctxt, Reader r) throws JacksonException; + public abstract Reader decorate(IOContext ctxt, Reader r) throws IOException; } diff --git a/src/main/java/com/fasterxml/jackson/core/exc/UnexpectedEndOfInputException.java b/src/main/java/com/fasterxml/jackson/core/io/JsonEOFException.java similarity index 53% rename from src/main/java/com/fasterxml/jackson/core/exc/UnexpectedEndOfInputException.java rename to src/main/java/com/fasterxml/jackson/core/io/JsonEOFException.java index 978f9f46a1..c7b22f51cb 100644 --- a/src/main/java/com/fasterxml/jackson/core/exc/UnexpectedEndOfInputException.java +++ b/src/main/java/com/fasterxml/jackson/core/io/JsonEOFException.java @@ -1,18 +1,20 @@ -package com.fasterxml.jackson.core.exc; +package com.fasterxml.jackson.core.io; +import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; /** - * Specialized {@link StreamReadException} that is thrown when end-of-input - * is reached unexpectedly, usually within token being decoded, but possibly - * within intervening non-token content (for formats that have that, such - * as whitespace for textual formats) + * Specialized {@link JsonParseException} that is thrown when end-of-input + * is reached unexpectedly, either within token being decoded, or during + * skipping of intervening white-space that is not between root-level + * tokens (that is, is within JSON Object or JSON Array construct). + * + * @since 2.8 */ -public class UnexpectedEndOfInputException - extends StreamReadException +public class JsonEOFException extends JsonParseException { - private static final long serialVersionUID = 3L; + private static final long serialVersionUID = 1L; /** * Type of token that was being decoded, if parser had enough information @@ -20,7 +22,7 @@ public class UnexpectedEndOfInputException */ protected final JsonToken _token; - public UnexpectedEndOfInputException(JsonParser p, JsonToken token, String msg) { + public JsonEOFException(JsonParser p, JsonToken token, String msg) { super(p, msg); _token = token; } diff --git a/src/main/java/com/fasterxml/jackson/core/io/JsonStringEncoder.java b/src/main/java/com/fasterxml/jackson/core/io/JsonStringEncoder.java index 0b18d4b58b..9348cff89e 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/JsonStringEncoder.java +++ b/src/main/java/com/fasterxml/jackson/core/io/JsonStringEncoder.java @@ -7,7 +7,7 @@ /** * Helper class used for efficient encoding of JSON String values (including - * JSON property names) into Strings or UTF-8 byte arrays. + * JSON field names) into Strings or UTF-8 byte arrays. *

    * Note that methods in here are somewhat optimized, but not ridiculously so. * Reason is that conversion method results are expected to be cached so that @@ -74,7 +74,7 @@ public static JsonStringEncoder getInstance() { * * @return JSON-escaped String matching {@code input} */ - public char[] quoteAsCharArray(CharSequence input) + public char[] quoteAsString(String input) { final int inputLen = input.length(); char[] outputBuffer = new char[_initialCharBufSize(inputLen)]; @@ -111,9 +111,91 @@ public char[] quoteAsCharArray(CharSequence input) } char d = input.charAt(inPtr++); int escCode = escCodes[d]; - int length = (escCode < 0) ? _appendNumeric(d, qbuf) - : _appendNamed(escCode, qbuf); + int length = (escCode < 0) + ? _appendNumeric(d, qbuf) + : _appendNamed(escCode, qbuf); + ; + if ((outPtr + length) > outputBuffer.length) { + int first = outputBuffer.length - outPtr; + if (first > 0) { + System.arraycopy(qbuf, 0, outputBuffer, outPtr, first); + } + if (textBuffer == null) { + textBuffer = TextBuffer.fromInitial(outputBuffer); + } + outputBuffer = textBuffer.finishCurrentSegment(); + int second = length - first; + System.arraycopy(qbuf, first, outputBuffer, 0, second); + outPtr = second; + } else { + System.arraycopy(qbuf, 0, outputBuffer, outPtr, length); + outPtr += length; + } + } + + if (textBuffer == null) { + return Arrays.copyOfRange(outputBuffer, 0, outPtr); + } + textBuffer.setCurrentLength(outPtr); + return textBuffer.contentsAsArray(); + } + + /** + * Overloaded variant of {@link #quoteAsString(String)}. + * + * @param input Value {@link CharSequence} to process + * + * @return JSON-escaped String matching {@code input} + * + * @since 2.10 + */ + public char[] quoteAsString(CharSequence input) + { + // 15-Aug-2019, tatu: Optimize common case as JIT can't get rid of overhead otherwise + if (input instanceof String) { + return quoteAsString((String) input); + } + + TextBuffer textBuffer = null; + final int inputLen = input.length(); + char[] outputBuffer = new char[_initialCharBufSize(inputLen)]; + final int[] escCodes = CharTypes.get7BitOutputEscapes(); + final int escCodeCount = escCodes.length; + int inPtr = 0; + int outPtr = 0; + char[] qbuf = null; + + outer: + while (inPtr < inputLen) { + tight_loop: + while (true) { + char c = input.charAt(inPtr); + if (c < escCodeCount && escCodes[c] != 0) { + break tight_loop; + } + if (outPtr >= outputBuffer.length) { + if (textBuffer == null) { + textBuffer = TextBuffer.fromInitial(outputBuffer); + } + outputBuffer = textBuffer.finishCurrentSegment(); + outPtr = 0; + } + outputBuffer[outPtr++] = c; + if (++inPtr >= inputLen) { + break outer; + } + } + // something to escape; 2 or 6-char variant? + if (qbuf == null) { + qbuf = _qbuf(); + } + char d = input.charAt(inPtr++); + int escCode = escCodes[d]; + int length = (escCode < 0) + ? _appendNumeric(d, qbuf) + : _appendNamed(escCode, qbuf); + ; if ((outPtr + length) > outputBuffer.length) { int first = outputBuffer.length - outPtr; if (first > 0) { @@ -146,6 +228,8 @@ public char[] quoteAsCharArray(CharSequence input) * * @param input Value {@link CharSequence} to process * @param output {@link StringBuilder} to append escaped contents to + * + * @since 2.8 */ public void quoteAsString(CharSequence input, StringBuilder output) { @@ -186,12 +270,12 @@ public void quoteAsString(CharSequence input, StringBuilder output) * encode resulting String as UTF-8 bytes * and return results as a byte array. * - * @param text Value String to process + * @param text Value {@link String} to process * * @return UTF-8 encoded bytes of JSON-escaped {@code text} */ @SuppressWarnings("resource") - public byte[] quoteAsUTF8(CharSequence text) + public byte[] quoteAsUTF8(String text) { int inputPtr = 0; int inputEnd = text.length(); @@ -292,11 +376,112 @@ public byte[] quoteAsUTF8(CharSequence text) * Will encode given String as UTF-8 (without any escaping) and return * the resulting byte array. * - * @param text Value String to process + * @param text Value {@link String} to process * * @return UTF-8 encoded bytes of {@code text} (without any escaping) */ @SuppressWarnings("resource") + public byte[] encodeAsUTF8(String text) + { + int inputPtr = 0; + int inputEnd = text.length(); + int outputPtr = 0; + byte[] outputBuffer = new byte[_initialByteBufSize(inputEnd)]; + int outputEnd = outputBuffer.length; + ByteArrayBuilder bb = null; + + main_loop: + while (inputPtr < inputEnd) { + int c = text.charAt(inputPtr++); + + // first tight loop for ascii + while (c <= 0x7F) { + if (outputPtr >= outputEnd) { + if (bb == null) { + bb = ByteArrayBuilder.fromInitial(outputBuffer, outputPtr); + } + outputBuffer = bb.finishCurrentSegment(); + outputEnd = outputBuffer.length; + outputPtr = 0; + } + outputBuffer[outputPtr++] = (byte) c; + if (inputPtr >= inputEnd) { + break main_loop; + } + c = text.charAt(inputPtr++); + } + + // then multi-byte... + if (bb == null) { + bb = ByteArrayBuilder.fromInitial(outputBuffer, outputPtr); + } + if (outputPtr >= outputEnd) { + outputBuffer = bb.finishCurrentSegment(); + outputEnd = outputBuffer.length; + outputPtr = 0; + } + if (c < 0x800) { // 2-byte + outputBuffer[outputPtr++] = (byte) (0xc0 | (c >> 6)); + } else { // 3 or 4 bytes + // Surrogates? + if (c < SURR1_FIRST || c > SURR2_LAST) { // nope + outputBuffer[outputPtr++] = (byte) (0xe0 | (c >> 12)); + if (outputPtr >= outputEnd) { + outputBuffer = bb.finishCurrentSegment(); + outputEnd = outputBuffer.length; + outputPtr = 0; + } + outputBuffer[outputPtr++] = (byte) (0x80 | ((c >> 6) & 0x3f)); + } else { // yes, surrogate pair + if (c > SURR1_LAST) { // must be from first range + _illegal(c); + } + // and if so, followed by another from next range + if (inputPtr >= inputEnd) { + _illegal(c); + } + c = _convert(c, text.charAt(inputPtr++)); + if (c > 0x10FFFF) { // illegal, as per RFC 4627 + _illegal(c); + } + outputBuffer[outputPtr++] = (byte) (0xf0 | (c >> 18)); + if (outputPtr >= outputEnd) { + outputBuffer = bb.finishCurrentSegment(); + outputEnd = outputBuffer.length; + outputPtr = 0; + } + outputBuffer[outputPtr++] = (byte) (0x80 | ((c >> 12) & 0x3f)); + if (outputPtr >= outputEnd) { + outputBuffer = bb.finishCurrentSegment(); + outputEnd = outputBuffer.length; + outputPtr = 0; + } + outputBuffer[outputPtr++] = (byte) (0x80 | ((c >> 6) & 0x3f)); + } + } + if (outputPtr >= outputEnd) { + outputBuffer = bb.finishCurrentSegment(); + outputEnd = outputBuffer.length; + outputPtr = 0; + } + outputBuffer[outputPtr++] = (byte) (0x80 | (c & 0x3f)); + } + if (bb == null) { + return Arrays.copyOfRange(outputBuffer, 0, outputPtr); + } + return bb.completeAndCoalesce(outputPtr); + } + + /** + * Overloaded variant of {@link #encodeAsUTF8(String)}. + * + * @param text Value {@link CharSequence} to process + * + * @return UTF-8 encoded bytes of {@code text} (without any escaping) + * + * @since 2.11 + */ + @SuppressWarnings("resource") public byte[] encodeAsUTF8(CharSequence text) { int inputPtr = 0; diff --git a/src/main/java/com/fasterxml/jackson/core/io/NumberInput.java b/src/main/java/com/fasterxml/jackson/core/io/NumberInput.java index cfb2e54631..2c45db0c35 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/NumberInput.java +++ b/src/main/java/com/fasterxml/jackson/core/io/NumberInput.java @@ -35,24 +35,24 @@ public final class NumberInput public static int parseInt(char[] ch, int off, int len) { int num = ch[off + len - 1] - '0'; - + switch(len) { case 9: - num += (ch[off++] - '0') * 100000000; + num += (ch[off++] - '0') * 100000000; case 8: - num += (ch[off++] - '0') * 10000000; + num += (ch[off++] - '0') * 10000000; case 7: - num += (ch[off++] - '0') * 1000000; + num += (ch[off++] - '0') * 1000000; case 6: - num += (ch[off++] - '0') * 100000; + num += (ch[off++] - '0') * 100000; case 5: - num += (ch[off++] - '0') * 10000; + num += (ch[off++] - '0') * 10000; case 4: - num += (ch[off++] - '0') * 1000; + num += (ch[off++] - '0') * 1000; case 3: - num += (ch[off++] - '0') * 100; + num += (ch[off++] - '0') * 100; case 2: - num += (ch[off] - '0') * 10; + num += (ch[off] - '0') * 10; } return num; } @@ -201,9 +201,13 @@ public static boolean inLongRange(String s, boolean negative) if (alen < cmpLen) return true; if (alen > cmpLen) return false; - // use String.compareTo() as it is a JVM intrinsic - int diff = s.compareTo(cmp); - if (diff != 0) return (diff < 0); + // could perhaps just use String.compareTo()? + for (int i = 0; i < cmpLen; ++i) { + int diff = s.charAt(i) - cmp.charAt(i); + if (diff != 0) { + return (diff < 0); + } + } return true; } diff --git a/src/main/java/com/fasterxml/jackson/core/io/NumberOutput.java b/src/main/java/com/fasterxml/jackson/core/io/NumberOutput.java index 2e34e3e168..187a0b4e4c 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/NumberOutput.java +++ b/src/main/java/com/fasterxml/jackson/core/io/NumberOutput.java @@ -36,10 +36,17 @@ public final class NumberOutput } } + private final static String[] sSmallIntStrs = new String[] { + "0","1","2","3","4","5","6","7","8","9","10" + }; + private final static String[] sSmallIntStrs2 = new String[] { + "-1","-2","-3","-4","-5","-6","-7","-8","-9","-10" + }; + /* - /********************************************************************** + /********************************************************** /* Efficient serialization methods using raw buffers - /********************************************************************** + /********************************************************** */ /** @@ -68,11 +75,11 @@ public static int outputInt(int v, char[] b, int off) } if (v < MILLION) { // at most 2 triplets... - if (v < 10) { - b[off] = (char) ('0' + v); - return off+1; - } if (v < 1000) { + if (v < 10) { + b[off] = (char) ('0' + v); + return off+1; + } return _leading3(v, b, off); } int thousands = v / 1000; @@ -236,9 +243,49 @@ public static int outputLong(long v, byte[] b, int off) } /* - /********************************************************************** + /********************************************************** + /* Convenience serialization methods + /********************************************************** + */ + + /* !!! 05-Aug-2008, tatus: Any ways to further optimize + * these? (or need: only called by diagnostics methods?) + */ + public static String toString(int v) + { + // Lookup table for small values + if (v < sSmallIntStrs.length) { + if (v >= 0) { + return sSmallIntStrs[v]; + } + int v2 = -v - 1; + if (v2 < sSmallIntStrs2.length) { + return sSmallIntStrs2[v2]; + } + } + return Integer.toString(v); + } + + public static String toString(long v) { + if (v <= Integer.MAX_VALUE && v >= Integer.MIN_VALUE) { + return toString((int) v); + } + return Long.toString(v); + } + + public static String toString(double v) { + return Double.toString(v); + } + + // @since 2.6 + public static String toString(float v) { + return Float.toString(v); + } + + /* + /********************************************************** /* Other convenience methods - /********************************************************************** + /********************************************************** */ /** @@ -252,7 +299,8 @@ public static int outputLong(long v, byte[] b, int off) * Since 2.10 */ public static boolean notFinite(double value) { - return !Double.isFinite(value); + // before Java 8 need separate checks + return Double.isNaN(value) || Double.isInfinite(value); } /** @@ -262,15 +310,18 @@ public static boolean notFinite(double value) { * @param value {@code float} value to check * * @return True if number is NOT finite (is Infinity or NaN); false otherwise + * + * Since 2.10 */ public static boolean notFinite(float value) { - return !Float.isFinite(value); + // before Java 8 need separate checks + return Float.isNaN(value) || Float.isInfinite(value); } /* - /********************************************************************** + /********************************************************** /* Internal helper methods - /********************************************************************** + /********************************************************** */ private static int _outputUptoBillion(int v, char[] b, int off) diff --git a/src/main/java/com/fasterxml/jackson/core/io/OutputDecorator.java b/src/main/java/com/fasterxml/jackson/core/io/OutputDecorator.java index b6de45f335..652c43ce39 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/OutputDecorator.java +++ b/src/main/java/com/fasterxml/jackson/core/io/OutputDecorator.java @@ -2,8 +2,6 @@ import java.io.*; -import com.fasterxml.jackson.core.JacksonException; - /** * Handler class that can be used to decorate output destinations. * Typical use is to use a filter abstraction (filtered output stream, @@ -15,7 +13,7 @@ public abstract class OutputDecorator implements java.io.Serializable // since 2.1 { /** - * Method called by {@link com.fasterxml.jackson.core.json.JsonFactory} instance when + * Method called by {@link com.fasterxml.jackson.core.JsonFactory} instance when * creating generator for given {@link OutputStream}, when this decorator * has been registered. * @@ -25,12 +23,12 @@ public abstract class OutputDecorator * @return OutputStream to use; either passed in argument, or something that * calls it * - * @throws JacksonException if construction of decorated {@link OutputStream} fails + * @throws IOException if construction of decorated {@link OutputStream} fails */ - public abstract OutputStream decorate(IOContext ctxt, OutputStream out) throws JacksonException; + public abstract OutputStream decorate(IOContext ctxt, OutputStream out) throws IOException; /** - * Method called by {@link com.fasterxml.jackson.core.json.JsonFactory} instance when + * Method called by {@link com.fasterxml.jackson.core.JsonFactory} instance when * creating generator for given {@link Writer}, when this decorator * has been registered. * @@ -39,7 +37,7 @@ public abstract class OutputDecorator * * @return Writer to use; either passed in argument, or something that calls it * - * @throws JacksonException if construction of decorated {@link Writer} fails + * @throws IOException if construction of decorated {@link Writer} fails */ - public abstract Writer decorate(IOContext ctxt, Writer w) throws JacksonException; + public abstract Writer decorate(IOContext ctxt, Writer w) throws IOException; } diff --git a/src/main/java/com/fasterxml/jackson/core/io/SerializedString.java b/src/main/java/com/fasterxml/jackson/core/io/SerializedString.java index 0f4832c5e5..5c04a544b9 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/SerializedString.java +++ b/src/main/java/com/fasterxml/jackson/core/io/SerializedString.java @@ -36,12 +36,12 @@ public class SerializedString * search framework; and they believed this is an important optimization for * heaviest, multi-core deployed use cases. */ - // 22-Sep-2013, tatu: FWIW, there have been no reports of problems in this - // area, or anything pointing to it. So I think we are safe up to JDK7 - // and hopefully beyond. + /* + * 22-Sep-2013, tatu: FWIW, there have been no reports of problems in this + * area, or anything pointing to it. So I think we are safe up to JDK7 + * and hopefully beyond. + */ - // 09-Dec-2017, tatu: ... fine up until Java 8, Jackson 2.9, no reports. - protected /*volatile*/ byte[] _quotedUTF8Ref; protected /*volatile*/ byte[] _unquotedUTF8Ref; @@ -56,14 +56,16 @@ public SerializedString(String v) { } /* - /********************************************************************** + /********************************************************** /* Serializable overrides - /********************************************************************** + /********************************************************** */ /** * Ugly hack, to work through the requirement that _value is indeed final, * and that JDK serialization won't call ctor(s). + * + * @since 2.1 */ protected transient String _jdkSerializeValue; @@ -80,9 +82,9 @@ protected Object readResolve() { } /* - /********************************************************************** - /* Basic API - /********************************************************************** + /********************************************************** + /* API + /********************************************************** */ @Override @@ -102,7 +104,7 @@ protected Object readResolve() { public final char[] asQuotedChars() { char[] result = _quotedChars; if (result == null) { - _quotedChars = result = JSON_ENCODER.quoteAsCharArray(_value); + _quotedChars = result = JSON_ENCODER.quoteAsString(_value); } return result; } @@ -135,16 +137,16 @@ public final byte[] asUnquotedUTF8() { } /* - /********************************************************************** - /* Additional methods for appending/writing contents - /********************************************************************** + /********************************************************** + /* Additional 2.0 methods for appending/writing contents + /********************************************************** */ @Override public int appendQuoted(char[] buffer, int offset) { char[] result = _quotedChars; if (result == null) { - _quotedChars = result = JSON_ENCODER.quoteAsCharArray(_value); + _quotedChars = result = JSON_ENCODER.quoteAsString(_value); } final int length = result.length; if ((offset + length) > buffer.length) { @@ -244,9 +246,9 @@ public int putUnquotedUTF8(ByteBuffer buffer) { } /* - /********************************************************************** + /********************************************************** /* Standard method overrides - /********************************************************************** + /********************************************************** */ @Override diff --git a/src/main/java/com/fasterxml/jackson/core/io/UTF32Reader.java b/src/main/java/com/fasterxml/jackson/core/io/UTF32Reader.java index 34d46466e8..22c37d6e02 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/UTF32Reader.java +++ b/src/main/java/com/fasterxml/jackson/core/io/UTF32Reader.java @@ -22,12 +22,6 @@ public class UTF32Reader extends Reader protected InputStream _in; - /** - * Whether underlying {@link InputStream} (if any) should be closed when this - * {@code Reader} is closed or not. - */ - private final boolean _autoClose; - protected byte[] _buffer; protected int _ptr; @@ -55,16 +49,14 @@ public class UTF32Reader extends Reader protected final boolean _managedBuffers; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ - public UTF32Reader(IOContext ctxt, InputStream in, boolean autoClose, - byte[] buf, int ptr, int len, boolean isBigEndian) { + public UTF32Reader(IOContext ctxt, InputStream in, byte[] buf, int ptr, int len, boolean isBigEndian) { _context = ctxt; _in = in; - _autoClose = autoClose; _buffer = buf; _ptr = ptr; _length = len; @@ -73,9 +65,9 @@ public UTF32Reader(IOContext ctxt, InputStream in, boolean autoClose, } /* - /********************************************************************** + /********************************************************** /* Public API - /********************************************************************** + /********************************************************** */ @Override @@ -84,10 +76,8 @@ public void close() throws IOException { if (in != null) { _in = null; - if (_autoClose) { - in.close(); - } freeBuffers(); + in.close(); } } @@ -186,9 +176,9 @@ public int read(char[] cbuf, int start, int len) throws IOException } /* - /********************************************************************** + /********************************************************** /* Internal methods - /********************************************************************** + /********************************************************** */ private void reportUnexpectedEOF(int gotBytes, int needed) throws IOException { diff --git a/src/main/java/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.java b/src/main/java/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.java index f018474e73..2639364c6e 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.java +++ b/src/main/java/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.java @@ -1,14 +1,10 @@ package com.fasterxml.jackson.core.json; -import java.io.ByteArrayInputStream; -import java.io.DataInput; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; +import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.WrappedIOException; +import com.fasterxml.jackson.core.format.InputAccessor; +import com.fasterxml.jackson.core.format.MatchStrength; import com.fasterxml.jackson.core.io.*; import com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer; import com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer; @@ -25,11 +21,11 @@ public final class ByteSourceJsonBootstrapper public final static byte UTF8_BOM_1 = (byte) 0xEF; public final static byte UTF8_BOM_2 = (byte) 0xBB; public final static byte UTF8_BOM_3 = (byte) 0xBF; - + /* - /********************************************************************** + /********************************************************** /* Configuration - /********************************************************************** + /********************************************************** */ private final IOContext _context; @@ -37,9 +33,9 @@ public final class ByteSourceJsonBootstrapper private final InputStream _in; /* - /********************************************************************** + /********************************************************** /* Input buffering - /********************************************************************** + /********************************************************** */ private final byte[] _inputBuffer; @@ -55,9 +51,9 @@ public final class ByteSourceJsonBootstrapper private final boolean _bufferRecyclable; /* - /********************************************************************** + /********************************************************** /* Input location - /********************************************************************** + /********************************************************** */ /** @@ -70,9 +66,9 @@ public final class ByteSourceJsonBootstrapper // private int _inputProcessed; /* - /********************************************************************** + /********************************************************** /* Data gathered - /********************************************************************** + /********************************************************** */ /** @@ -83,9 +79,9 @@ public final class ByteSourceJsonBootstrapper private int _bytesPerChar; // 0 means "dunno yet" /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ public ByteSourceJsonBootstrapper(IOContext ctxt, InputStream in) { @@ -97,8 +93,7 @@ public ByteSourceJsonBootstrapper(IOContext ctxt, InputStream in) { _bufferRecyclable = true; } - public ByteSourceJsonBootstrapper(IOContext ctxt, - byte[] inputBuffer, int inputStart, int inputLen) { + public ByteSourceJsonBootstrapper(IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen) { _context = ctxt; _in = null; _inputBuffer = inputBuffer; @@ -110,9 +105,9 @@ public ByteSourceJsonBootstrapper(IOContext ctxt, } /* - /********************************************************************** + /********************************************************** /* Encoding detection during bootstrapping - /********************************************************************** + /********************************************************** */ /** @@ -122,9 +117,9 @@ public ByteSourceJsonBootstrapper(IOContext ctxt, * * @return {@link JsonEncoding} detected, if any; {@code JsonEncoding.UTF8} otherwise * - * @throws JacksonException If read from underlying input source fails + * @throws IOException If read from underlying input source fails */ - public JsonEncoding detectEncoding() throws JacksonException + public JsonEncoding detectEncoding() throws IOException { boolean foundEncoding = false; @@ -192,41 +187,39 @@ public JsonEncoding detectEncoding() throws JacksonException * * @return Byte (as unsigned {@code int}) read after possible UTF-8 BOM * - * @throws JacksonException If read from underlying input source fails + * @throws IOException If read from underlying input source fails + * + * @since 2.8 */ - public static int skipUTF8BOM(DataInput input) throws JacksonException + public static int skipUTF8BOM(DataInput input) throws IOException { - try { - int b = input.readUnsignedByte(); - if (b != 0xEF) { - return b; - } - // since this is not legal byte in JSON otherwise, except - // that we do get BOM; if not, report error - b = input.readUnsignedByte(); - if (b != 0xBB) { - throw new IOException("Unexpected byte 0x"+Integer.toHexString(b) - +" following 0xEF; should get 0xBB as part of UTF-8 BOM"); - } - b = input.readUnsignedByte(); - if (b != 0xBF) { - throw new IOException("Unexpected byte 0x"+Integer.toHexString(b) - +" following 0xEF 0xBB; should get 0xBF as part of UTF-8 BOM"); - } - return input.readUnsignedByte(); - } catch (IOException e) { - throw _wrapIOFailure(e); + int b = input.readUnsignedByte(); + if (b != 0xEF) { + return b; + } + // since this is not legal byte in JSON otherwise, except + // that we do get BOM; if not, report error + b = input.readUnsignedByte(); + if (b != 0xBB) { + throw new IOException("Unexpected byte 0x"+Integer.toHexString(b) + +" following 0xEF; should get 0xBB as part of UTF-8 BOM"); } + b = input.readUnsignedByte(); + if (b != 0xBF) { + throw new IOException("Unexpected byte 0x"+Integer.toHexString(b) + +" following 0xEF 0xBB; should get 0xBF as part of UTF-8 BOM"); + } + return input.readUnsignedByte(); } /* - /********************************************************************** + /********************************************************** /* Constructing a Reader - /********************************************************************** + /********************************************************** */ @SuppressWarnings("resource") - public Reader constructReader() throws JacksonException + public Reader constructReader() throws IOException { JsonEncoding enc = _context.getEncoding(); switch (enc.bits()) { @@ -239,37 +232,25 @@ public Reader constructReader() throws JacksonException if (in == null) { in = new ByteArrayInputStream(_inputBuffer, _inputPtr, _inputEnd); } else { - // Also, if we have any read but unused input (usually true), - // need to merge that input in: + /* Also, if we have any read but unused input (usually true), + * need to merge that input in: + */ if (_inputPtr < _inputEnd) { in = new MergedStream(_context, in, _inputBuffer, _inputPtr, _inputEnd); } } - try { - return new InputStreamReader(in, enc.getJavaName()); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + return new InputStreamReader(in, enc.getJavaName()); } case 32: - { - // 01-Jun-2019. tatu: Should determine like so in future: -// final boolean autoClose = _context.isResourceManaged() || isEnabled(StreamReadFeature.AUTO_CLOSE_SOURCE); - // ... but for now, do what 2.x did: - final boolean autoClose = true; - return new UTF32Reader(_context, _in, autoClose, - _inputBuffer, _inputPtr, _inputEnd, - _context.getEncoding().isBigEndian()); - } + return new UTF32Reader(_context, _in, _inputBuffer, _inputPtr, _inputEnd, + _context.getEncoding().isBigEndian()); } throw new RuntimeException("Internal error"); // should never get here } - public JsonParser constructParser(ObjectReadContext readCtxt, - int streamReadFeatures, int formatReadFeatures, + public JsonParser constructParser(int parserFeatures, ObjectCodec codec, ByteQuadsCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols, - int factoryFeatures) - throws JacksonException + int factoryFeatures) throws IOException { int prevInputPtr = _inputPtr; JsonEncoding enc = detectEncoding(); @@ -279,29 +260,170 @@ public JsonParser constructParser(ObjectReadContext readCtxt, /* 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_PROPERTY_NAMES.enabledIn(factoryFeatures)) { + if (JsonFactory.Feature.CANONICALIZE_FIELD_NAMES.enabledIn(factoryFeatures)) { ByteQuadsCanonicalizer can = rootByteSymbols.makeChild(factoryFeatures); - return new UTF8StreamJsonParser(readCtxt, _context, - streamReadFeatures, formatReadFeatures, _in, can, + return new UTF8StreamJsonParser(_context, parserFeatures, _in, codec, can, _inputBuffer, _inputPtr, _inputEnd, bytesProcessed, _bufferRecyclable); } } - return new ReaderBasedJsonParser(readCtxt, _context, streamReadFeatures, formatReadFeatures, - constructReader(), + return new ReaderBasedJsonParser(_context, parserFeatures, constructReader(), codec, rootCharSymbols.makeChild(factoryFeatures)); } /* - /********************************************************************** + /********************************************************** + /* Encoding detection for data format auto-detection + /********************************************************** + */ + + /** + * Current implementation is not as thorough as other functionality + * ({@link com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper}); + * supports UTF-8, for example. But it should work, for now, and can + * be improved as necessary. + * + * @param acc InputAccessor to use for accessing content to check + * + * @return Strength of match (never {@code null}) + * + * @throws IOException if input access fails due to read problem + */ + public static MatchStrength hasJSONFormat(InputAccessor acc) throws IOException + { + // Ideally we should see "[" or "{"; but if not, we'll accept double-quote (String) + // in future could also consider accepting non-standard matches? + + if (!acc.hasMoreBytes()) { + return MatchStrength.INCONCLUSIVE; + } + byte b = acc.nextByte(); + // Very first thing, a UTF-8 BOM? + if (b == UTF8_BOM_1) { // yes, looks like UTF-8 BOM + if (!acc.hasMoreBytes()) { + return MatchStrength.INCONCLUSIVE; + } + if (acc.nextByte() != UTF8_BOM_2) { + return MatchStrength.NO_MATCH; + } + if (!acc.hasMoreBytes()) { + return MatchStrength.INCONCLUSIVE; + } + if (acc.nextByte() != UTF8_BOM_3) { + return MatchStrength.NO_MATCH; + } + if (!acc.hasMoreBytes()) { + return MatchStrength.INCONCLUSIVE; + } + b = acc.nextByte(); + } + // Then possible leading space + int ch = skipSpace(acc, b); + if (ch < 0) { + return MatchStrength.INCONCLUSIVE; + } + // First, let's see if it looks like a structured type: + if (ch == '{') { // JSON object? + // Ideally we need to find either double-quote or closing bracket + ch = skipSpace(acc); + if (ch < 0) { + return MatchStrength.INCONCLUSIVE; + } + if (ch == '"' || ch == '}') { + return MatchStrength.SOLID_MATCH; + } + // ... should we allow non-standard? Let's not yet... can add if need be + return MatchStrength.NO_MATCH; + } + MatchStrength strength; + + if (ch == '[') { + ch = skipSpace(acc); + if (ch < 0) { + return MatchStrength.INCONCLUSIVE; + } + // closing brackets is easy; but for now, let's also accept opening... + if (ch == ']' || ch == '[') { + return MatchStrength.SOLID_MATCH; + } + return MatchStrength.SOLID_MATCH; + } else { + // plain old value is not very convincing... + strength = MatchStrength.WEAK_MATCH; + } + + if (ch == '"') { // string value + return strength; + } + if (ch <= '9' && ch >= '0') { // number + return strength; + } + if (ch == '-') { // negative number + ch = skipSpace(acc); + if (ch < 0) { + return MatchStrength.INCONCLUSIVE; + } + return (ch <= '9' && ch >= '0') ? strength : MatchStrength.NO_MATCH; + } + // or one of literals + if (ch == 'n') { // null + return tryMatch(acc, "ull", strength); + } + if (ch == 't') { // true + return tryMatch(acc, "rue", strength); + } + if (ch == 'f') { // false + return tryMatch(acc, "alse", strength); + } + return MatchStrength.NO_MATCH; + } + + private static MatchStrength tryMatch(InputAccessor acc, String matchStr, MatchStrength fullMatchStrength) + throws IOException + { + for (int i = 0, len = matchStr.length(); i < len; ++i) { + if (!acc.hasMoreBytes()) { + return MatchStrength.INCONCLUSIVE; + } + if (acc.nextByte() != matchStr.charAt(i)) { + return MatchStrength.NO_MATCH; + } + } + return fullMatchStrength; + } + + private static int skipSpace(InputAccessor acc) throws IOException + { + if (!acc.hasMoreBytes()) { + return -1; + } + return skipSpace(acc, acc.nextByte()); + } + + private static int skipSpace(InputAccessor acc, byte b) throws IOException + { + while (true) { + int ch = (int) b & 0xFF; + if (!(ch == ' ' || ch == '\r' || ch == '\n' || ch == '\t')) { + return ch; + } + if (!acc.hasMoreBytes()) { + return -1; + } + b = acc.nextByte(); + } + } + + /* + /********************************************************** /* Internal methods, parsing - /********************************************************************** + /********************************************************** */ /** * @return True if a BOM was succesfully found, and encoding * thereby recognized. */ - private boolean handleBOM(int quad) throws JacksonException + private boolean handleBOM(int quad) throws IOException { /* Handling of (usually) optional BOM (required for * multi-byte formats); first 32-bit charsets: @@ -318,10 +440,10 @@ private boolean handleBOM(int quad) throws JacksonException _bigEndian = false; return true; case 0x0000FFFE: // UCS-4, in-order... - _reportWeirdUCS4("2143"); // throws exception + reportWeirdUCS4("2143"); // throws exception break; // never gets here case 0xFEFF0000: // UCS-4, in-order... - _reportWeirdUCS4("3412"); // throws exception + reportWeirdUCS4("3412"); // throws exception break; // never gets here default: } @@ -349,7 +471,7 @@ private boolean handleBOM(int quad) throws JacksonException return false; } - private boolean checkUTF32(int quad) throws JacksonException + private boolean checkUTF32(int quad) throws IOException { /* Handling of (usually) optional BOM (required for * multi-byte formats); first 32-bit charsets: @@ -359,9 +481,9 @@ private boolean checkUTF32(int quad) throws JacksonException } else if ((quad & 0x00FFFFFF) == 0) { // 0x??000000 -> UTF32-LE _bigEndian = false; } else if ((quad & ~0x00FF0000) == 0) { // 0x00??0000 -> UTF32-in-order - _reportWeirdUCS4("3412"); + reportWeirdUCS4("3412"); } else if ((quad & ~0x0000FF00) == 0) { // 0x0000??00 -> UTF32-in-order - _reportWeirdUCS4("2143"); + reportWeirdUCS4("2143"); } else { // Can not be valid UTF-32 encoded JSON... return false; @@ -388,22 +510,22 @@ private boolean checkUTF16(int i16) } /* - /********************************************************************** + /********************************************************** /* Internal methods, problem reporting - /********************************************************************** + /********************************************************** */ - private void _reportWeirdUCS4(String type) throws JacksonException { - throw _createIOFailure("Unsupported UCS-4 endianness ("+type+") detected"); + private void reportWeirdUCS4(String type) throws IOException { + throw new CharConversionException("Unsupported UCS-4 endianness ("+type+") detected"); } /* - /********************************************************************** + /********************************************************** /* Internal methods, raw input access - /********************************************************************** + /********************************************************** */ - protected boolean ensureLoaded(int minimum) throws JacksonException { + protected boolean ensureLoaded(int minimum) throws IOException { /* Let's assume here buffer has enough room -- this will always * be true for the limited used this method gets */ @@ -414,11 +536,7 @@ protected boolean ensureLoaded(int minimum) throws JacksonException { if (_in == null) { // block source count = -1; } else { - try { - count = _in.read(_inputBuffer, _inputEnd, _inputBuffer.length - _inputEnd); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + count = _in.read(_inputBuffer, _inputEnd, _inputBuffer.length - _inputEnd); } if (count < 1) { return false; @@ -428,21 +546,4 @@ protected boolean ensureLoaded(int minimum) throws JacksonException { } return true; } - - /* - /********************************************************************** - /* Internal methods, exception handling - /********************************************************************** - */ - - private JacksonException _createIOFailure(String msg) throws JacksonException { - // 12-Jan-2021, tatu: Couple of alternatives, but since this is before - // actual parser created, seems best to simply fake this was "true" - // IOException - return _wrapIOFailure(new IOException(msg)); - } - - private static JacksonException _wrapIOFailure(IOException e) throws JacksonException { - return WrappedIOException.construct(e, null); - } } diff --git a/src/main/java/com/fasterxml/jackson/core/json/DupDetector.java b/src/main/java/com/fasterxml/jackson/core/json/DupDetector.java index 85122b2b7e..7b6dc4678f 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/DupDetector.java +++ b/src/main/java/com/fasterxml/jackson/core/json/DupDetector.java @@ -6,7 +6,7 @@ /** * Helper class used if - * {@link com.fasterxml.jackson.core.StreamReadFeature#STRICT_DUPLICATE_DETECTION} + * {@link com.fasterxml.jackson.core.JsonParser.Feature#STRICT_DUPLICATE_DETECTION} * is enabled. * Optimized to try to limit memory usage and processing overhead for smallest * entries, but without adding trashing (immutable objects would achieve optimal @@ -14,6 +14,8 @@ * scopes with large number of entries). Another consideration is trying to limit * actual number of compiled classes as it contributes significantly to overall * jar size (due to linkage etc). + * + * @since 2.3 */ public class DupDetector { @@ -56,7 +58,7 @@ public void reset() { public JsonLocation findLocation() { // ugly but: if (_source instanceof JsonParser) { - return ((JsonParser)_source).currentLocation(); + return ((JsonParser)_source).getCurrentLocation(); } // do generators have a way to provide Location? Apparently not... return null; @@ -64,6 +66,8 @@ public JsonLocation findLocation() { /** * @return Source object (parser / generator) used to construct this detector + * + * @since 2.7 */ public Object getSource() { return _source; @@ -77,8 +81,11 @@ public Object getSource() { * @param name Property seen * * @return {@code True} if the property had already been seen before in this context + * + * @throws JsonParseException to report possible operation problem (default implementation + * never throws it) */ - public boolean isDup(String name) + public boolean isDup(String name) throws JsonParseException { if (_firstName == null) { _firstName = name; diff --git a/src/main/java/com/fasterxml/jackson/core/json/JsonFactory.java b/src/main/java/com/fasterxml/jackson/core/json/JsonFactory.java deleted file mode 100644 index ac846aef51..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/json/JsonFactory.java +++ /dev/null @@ -1,480 +0,0 @@ -/* Jackson JSON-processor. - * - * Copyright (c) 2007- Tatu Saloranta, tatu.saloranta@iki.fi - */ -package com.fasterxml.jackson.core.json; - -import java.io.*; -import java.util.List; -import java.util.Locale; - -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.base.TextualTSFactory; -import com.fasterxml.jackson.core.io.*; -import com.fasterxml.jackson.core.json.async.NonBlockingJsonParser; -import com.fasterxml.jackson.core.sym.BinaryNameMatcher; -import com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer; -import com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer; -import com.fasterxml.jackson.core.sym.PropertyNameMatcher; -import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; -import com.fasterxml.jackson.core.util.Named; - -/** - * JSON-backed {@link TokenStreamFactory} implementation that will create - * token readers ("parsers") and writers ("generators") for handling - * JSON-encoded content. - *

    - * Note that this class used to reside at main com.fasterxml.jackson.core - * in 2.x, but moved here to denote its changed role as implementation, not base - * class for factories. - */ -public class JsonFactory - extends TextualTSFactory - implements java.io.Serializable -{ - private static final long serialVersionUID = 1; - - /* - /********************************************************************** - /* Constants - /********************************************************************** - */ - - /** - * Name used to identify JSON format - * (and returned by {@link #getFormatName()} - */ - public final static String FORMAT_NAME_JSON = "JSON"; - - /** - * Bitfield (set of flags) of all parser features that are enabled - * by default. - */ - final static int DEFAULT_JSON_PARSER_FEATURE_FLAGS = JsonReadFeature.collectDefaults(); - - /** - * Bitfield (set of flags) of all generator features that are enabled - * by default. - */ - final static int DEFAULT_JSON_GENERATOR_FEATURE_FLAGS = JsonWriteFeature.collectDefaults(); - - public final static SerializableString DEFAULT_ROOT_VALUE_SEPARATOR = DefaultPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR; - - public final static char DEFAULT_QUOTE_CHAR = '"'; - - /* - /********************************************************************** - /* Configuration - /********************************************************************** - */ - - /** - * Definition of custom character escapes to use for generators created - * by this factory, if any. If null, standard data format specific - * escapes are used. - */ - protected final CharacterEscapes _characterEscapes; - - /** - * Separator used between root-level values, if any; null indicates - * "do not add separator". - * Default separator is a single space character. - */ - protected final SerializableString _rootValueSeparator; - - /** - * Optional threshold used for automatically escaping character above certain character - * code value: either {@code 0} to indicate that no threshold is specified, or value - * at or above 127 to indicate last character code that is NOT automatically escaped - * (but depends on other configuration rules for checking). - */ - protected final int _maximumNonEscapedChar; - - /** - * Character used for quoting property names (if property name quoting has not - * been disabled with {@link JsonWriteFeature#QUOTE_PROPERTY_NAMES}) - * and JSON String values. - */ - protected final char _quoteChar; - - /* - /********************************************************************** - /* Symbol table management - /********************************************************************** - */ - - /** - * Each factory comes equipped with a shared root symbol table. - * It should not be linked back to the original blueprint, to - * avoid contents from leaking between factories. - */ - protected final transient CharsToNameCanonicalizer _rootCharSymbols = CharsToNameCanonicalizer.createRoot(); - - /** - * Alternative to the basic symbol table, some stream-based - * parsers use different name canonicalization method. - */ - protected final transient ByteQuadsCanonicalizer _byteSymbolCanonicalizer = ByteQuadsCanonicalizer.createRoot(); - - /* - /********************************************************************** - /* Construction - /********************************************************************** - */ - - /** - * Default constructor used to create factory instances. - * Creation of a factory instance is a light-weight operation, - * but it is still a good idea to reuse limited number of - * factory instances (and quite often just a single instance): - * factories are used as context for storing some reused - * processing objects (such as symbol tables parsers use) - * and this reuse only works within context of a single - * factory instance. - */ - public JsonFactory() { - super(DEFAULT_JSON_PARSER_FEATURE_FLAGS, DEFAULT_JSON_GENERATOR_FEATURE_FLAGS); - _rootValueSeparator = DEFAULT_ROOT_VALUE_SEPARATOR; - _characterEscapes = null; - _maximumNonEscapedChar = 0; // disabled - _quoteChar = DEFAULT_QUOTE_CHAR; - } - - /** - * Copy constructor. - * - * @param src Original factory to copy configuration from - */ - protected JsonFactory(JsonFactory src) - { - super(src); - _rootValueSeparator = src._rootValueSeparator; - _characterEscapes = src._characterEscapes; - _maximumNonEscapedChar = src._maximumNonEscapedChar; - _quoteChar = src._quoteChar; - } - - /** - * Constructors used by {@link JsonFactoryBuilder} for instantiation. - * - * @param b Builder that has configuration to use - * - * @since 3.0 - */ - protected JsonFactory(JsonFactoryBuilder b) - { - super(b); - _rootValueSeparator = b.rootValueSeparator(); - _characterEscapes = b.characterEscapes(); - _maximumNonEscapedChar = b.highestNonEscapedChar(); - _quoteChar = b.quoteChar(); - } - - @Override - public JsonFactoryBuilder rebuild() { - return new JsonFactoryBuilder(this); - } - - /** - * Main factory method to use for constructing {@link JsonFactory} instances with - * different configuration. - * - * @return Builder instance to use - */ - public static JsonFactoryBuilder builder() { - return new JsonFactoryBuilder(); - } - - /** - * Method for constructing a new {@link JsonFactory} that has - * the same settings as this instance, but is otherwise - * independent (i.e. nothing is actually shared, symbol tables - * are separate). - * - * @return Copy of this factory instance - */ - @Override - public JsonFactory copy() { - return new JsonFactory(this); - } - - @Override - public TokenStreamFactory snapshot() { - return this; - } - - /* - /********************************************************************** - /* Serializable overrides - /********************************************************************** - */ - - /** - * Method that we need to override to actually make restoration go - * through constructors etc; called by JDK serialization system. - * - * @return A properly initialized copy of this factory instance - */ - protected Object readResolve() { - return new JsonFactory(this); - } - - /* - /********************************************************************** - /* Capability introspection - /********************************************************************** - */ - - /** - * Accessor for getting version of the core package, given a parser instance. - * Left for sub-classes to implement. - * - * @return Version of this generator (derived from version declared for - * {@code jackson-core} jar that contains the class - */ - @Override - public Version version() { - return PackageVersion.VERSION; - } - - @Override - public boolean canParseAsync() { - // Jackson 2.9 and later do support async parsing for JSON - return true; - } - - /** - * Checked whether specified parser feature is enabled. - * - * @param f Feature to check - * - * @return {@code True} if feature is enabled; {@code false} otherwise - */ - public final boolean isEnabled(JsonReadFeature f) { - return (_formatReadFeatures & f.getMask()) != 0; - } - - /** - * Check whether specified generator feature is enabled. - * - * @param f Feature to check - * - * @return {@code True} if feature is enabled; {@code false} otherwise - */ - public final boolean isEnabled(JsonWriteFeature f) { - return (_formatWriteFeatures & f.getMask()) != 0; - } - - /* - /********************************************************************** - /* Format support - /********************************************************************** - */ - - /** - * Method that can be used to quickly check whether given schema - * is something that parsers and/or generators constructed by this - * factory could use. Note that this means possible use, at the level - * of data format (i.e. schema is for same data format as parsers and - * generators this factory constructs); individual schema instances - * may have further usage restrictions. - */ - @Override - public boolean canUseSchema(FormatSchema schema) { - return false; // no FormatSchema for json - } - - /** - * Method that returns short textual id identifying format - * this factory supports. - *

    - * Note: sub-classes should override this method; default - * implementation will return null for all sub-classes - */ - @Override - public String getFormatName() { - return FORMAT_NAME_JSON; - } - - @Override - public Class getFormatReadFeatureType() { return JsonReadFeature.class; } - - @Override - public Class getFormatWriteFeatureType() { return JsonWriteFeature.class; } - - /* - /********************************************************************** - /* Configuration accessors - /********************************************************************** - */ - - /** - * Method for accessing custom escapes factory uses for {@link JsonGenerator}s - * it creates. - * - * @return CharacterEscapes configured to be used by parser instances - */ - public CharacterEscapes getCharacterEscapes() { return _characterEscapes; } - - public String getRootValueSeparator() { - return (_rootValueSeparator == null) ? null : _rootValueSeparator.getValue(); - } - - /* - /********************************************************************** - /* Parser factories, non-blocking (async) sources - /********************************************************************** - */ - - @Override - public JsonParser createNonBlockingByteArrayParser(ObjectReadContext readCtxt) - throws JacksonException - { - IOContext ioCtxt = _createNonBlockingContext(null); - ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChild(_factoryFeatures); - return new NonBlockingJsonParser(readCtxt, ioCtxt, - readCtxt.getStreamReadFeatures(_streamReadFeatures), - readCtxt.getFormatReadFeatures(_formatReadFeatures), - can); - } - - protected IOContext _createNonBlockingContext(Object srcRef) { - return new IOContext(_getBufferRecycler(), - ContentReference.rawReference(srcRef), false); - } - - /* - /********************************************************************** - /* Factory methods used by factory for creating parser instances - /********************************************************************** - */ - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, - InputStream in) throws JacksonException - { - return new ByteSourceJsonBootstrapper(ioCtxt, in) - .constructParser(readCtxt, - readCtxt.getStreamReadFeatures(_streamReadFeatures), - readCtxt.getFormatReadFeatures(_formatReadFeatures), - _byteSymbolCanonicalizer, _rootCharSymbols, _factoryFeatures); - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, - Reader r) throws JacksonException - { - return new ReaderBasedJsonParser(readCtxt, ioCtxt, - readCtxt.getStreamReadFeatures(_streamReadFeatures), - readCtxt.getFormatReadFeatures(_formatReadFeatures), - r, - _rootCharSymbols.makeChild(_factoryFeatures)); - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, - char[] data, int offset, int len, - boolean recyclable) throws JacksonException - { - return new ReaderBasedJsonParser(readCtxt, ioCtxt, - readCtxt.getStreamReadFeatures(_streamReadFeatures), - readCtxt.getFormatReadFeatures(_formatReadFeatures), - null, - _rootCharSymbols.makeChild(_factoryFeatures), - data, offset, offset+len, recyclable); - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, - byte[] data, int offset, int len) - throws JacksonException - { - return new ByteSourceJsonBootstrapper(ioCtxt, data, offset, len) - .constructParser(readCtxt, - readCtxt.getStreamReadFeatures(_streamReadFeatures), - readCtxt.getFormatReadFeatures(_formatReadFeatures), - _byteSymbolCanonicalizer, _rootCharSymbols, _factoryFeatures); - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, - DataInput input) - throws JacksonException - { - // 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.getStreamReadFeatures(_streamReadFeatures), - readCtxt.getFormatReadFeatures(_formatReadFeatures), - input, can, firstByte); - } - - /* - /********************************************************************** - /* Factory methods used by factory for creating generator instances - /********************************************************************** - */ - - @Override - protected JsonGenerator _createGenerator(ObjectWriteContext writeCtxt, - IOContext ioCtxt, Writer out) - throws JacksonException - { - SerializableString rootSep = writeCtxt.getRootValueSeparator(_rootValueSeparator); - // May get Character-Escape overrides from context; if not, use factory's own - // (which default to `null`) - CharacterEscapes charEsc = writeCtxt.getCharacterEscapes(); - if (charEsc == null) { - charEsc = _characterEscapes; - } - // 14-Jan-2019, tatu: Should we make this configurable via databind layer? - final int maxNonEscaped = _maximumNonEscapedChar; - // NOTE: JSON generator does not use schema - return new WriterBasedJsonGenerator(writeCtxt, ioCtxt, - writeCtxt.getStreamWriteFeatures(_streamWriteFeatures), - writeCtxt.getFormatWriteFeatures(_formatWriteFeatures), - out, - rootSep, writeCtxt.getPrettyPrinter(), charEsc, maxNonEscaped, _quoteChar); - } - - @Override - protected JsonGenerator _createUTF8Generator(ObjectWriteContext writeCtxt, - IOContext ioCtxt, OutputStream out) throws JacksonException - { - SerializableString rootSep = writeCtxt.getRootValueSeparator(_rootValueSeparator); - // May get Character-Escape overrides from context; if not, use factory's own - // (which default to `null`) - CharacterEscapes charEsc = writeCtxt.getCharacterEscapes(); - if (charEsc == null) { - charEsc = _characterEscapes; - } - // 14-Jan-2019, tatu: Should we make this configurable via databind layer? - final int maxNonEscaped = _maximumNonEscapedChar; - // NOTE: JSON generator does not use schema - - return new UTF8JsonGenerator(writeCtxt, ioCtxt, - writeCtxt.getStreamWriteFeatures(_streamWriteFeatures), - writeCtxt.getFormatWriteFeatures(_formatWriteFeatures), - out, - rootSep, charEsc, writeCtxt.getPrettyPrinter(), maxNonEscaped, _quoteChar); - } - - /* - /********************************************************************** - /* Other factory methods - /********************************************************************** - */ - - @Override - public PropertyNameMatcher constructNameMatcher(List matches, boolean alreadyInterned) { - return BinaryNameMatcher.constructFrom(matches, alreadyInterned); - } - - @Override - public PropertyNameMatcher constructCINameMatcher(List matches, boolean alreadyInterned, - Locale locale) { - return BinaryNameMatcher.constructCaseInsensitive(locale, matches, alreadyInterned); - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/json/JsonGeneratorBase.java b/src/main/java/com/fasterxml/jackson/core/json/JsonGeneratorBase.java deleted file mode 100644 index ef46dffa11..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/json/JsonGeneratorBase.java +++ /dev/null @@ -1,284 +0,0 @@ -package com.fasterxml.jackson.core.json; - -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.base.GeneratorBase; -import com.fasterxml.jackson.core.io.CharTypes; -import com.fasterxml.jackson.core.io.CharacterEscapes; -import com.fasterxml.jackson.core.io.IOContext; -import com.fasterxml.jackson.core.util.JacksonFeatureSet; - -/** - * Intermediate base class shared by JSON-backed generators - * like {@link UTF8JsonGenerator} and {@link WriterBasedJsonGenerator}. - */ -public abstract class JsonGeneratorBase extends GeneratorBase -{ - /* - /********************************************************************** - /* Constants - /********************************************************************** - */ - - /** - * This is the default set of escape codes, over 7-bit ASCII range - * (first 128 character codes), used for single-byte UTF-8 characters. - */ - protected final static int[] DEFAULT_OUTPUT_ESCAPES = CharTypes.get7BitOutputEscapes(); - - /* - /********************************************************************** - /* Configuration, basic I/O, features - /********************************************************************** - */ - - /** - * Low-level I/O context used mostly for buffer recycling. - */ - protected final IOContext _ioContext; - - /** - * Bit flag composed of bits that indicate which - * {@link com.fasterxml.jackson.core.json.JsonWriteFeature}s - * are enabled. - */ - protected final int _formatWriteFeatures; - - /* - /********************************************************************** - /* Configuration, output escaping - /********************************************************************** - */ - - /** - * Currently active set of output escape code definitions (whether - * and how to escape or not) for 7-bit ASCII range (first 128 - * character codes). Defined separately to make potentially - * customizable - */ - protected int[] _outputEscapes = DEFAULT_OUTPUT_ESCAPES; - - /** - * Definition of custom character escapes to use for generators created - * by this factory, if any. If null, standard data format specific - * escapes are used. - *

    - * NOTE: although typically set during construction (in constructor), - * can not be made final in 3.0 due to some edge use cases (JSONP support). - */ - protected CharacterEscapes _characterEscapes; - - /** - * Value between 128 (0x80) and 65535 (0xFFFF) that indicates highest - * Unicode code point that will not need escaping; or 0 to indicate - * that all characters can be represented without escaping. - * Typically used to force escaping of some portion of character set; - * for example to always escape non-ASCII characters (if value was 127). - *

    - * NOTE: not all sub-classes make use of this setting. - */ - protected final int _maximumNonEscapedChar; - - /* - /********************************************************************** - /* Configuration, other - /********************************************************************** - */ - - /** - * Object that handles pretty-printing (usually additional - * white space to make results more human-readable) during - * output. If null, no pretty-printing is done. - */ - protected final PrettyPrinter _cfgPrettyPrinter; - - /** - * Separator to use, if any, between root-level values. - */ - protected final SerializableString _rootValueSeparator; - - /** - * Flag that is set if quoting is not to be added around - * JSON Object property names. - */ - protected final boolean _cfgUnqNames; - - /** - * Flag set to indicate that implicit conversion from number - * to JSON String is needed (as per - * {@link com.fasterxml.jackson.core.json.JsonWriteFeature#WRITE_NUMBERS_AS_STRINGS}). - */ - protected final boolean _cfgNumbersAsStrings; - - /* - /********************************************************************** - /* Output state - /********************************************************************** - */ - - /** - * Object that keeps track of the current contextual state of the generator. - */ - protected JsonWriteContext _streamWriteContext; - - /* - /********************************************************************** - /* Life-cycle - /********************************************************************** - */ - - protected JsonGeneratorBase(ObjectWriteContext writeCtxt, IOContext ctxt, - int streamWriteFeatures, int formatWriteFeatures, - SerializableString rootValueSeparator, PrettyPrinter pp, - CharacterEscapes charEsc, int maxNonEscaped) - { - super(writeCtxt, streamWriteFeatures); - _ioContext = ctxt; - _formatWriteFeatures = formatWriteFeatures; - // By default we use this feature to determine additional quoting - if (JsonWriteFeature.ESCAPE_NON_ASCII.enabledIn(formatWriteFeatures)) { - // note! Lowest effective value is 127 (0 is used as marker, but values - // from 1 through 126 have no effect different from 127), so: - maxNonEscaped = 127; - } - _maximumNonEscapedChar = maxNonEscaped; - _cfgUnqNames = !JsonWriteFeature.QUOTE_PROPERTY_NAMES.enabledIn(formatWriteFeatures); - _cfgNumbersAsStrings = JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS.enabledIn(formatWriteFeatures); - _rootValueSeparator = rootValueSeparator; - - _cfgPrettyPrinter = pp; - - final DupDetector dups = StreamWriteFeature.STRICT_DUPLICATE_DETECTION.enabledIn(streamWriteFeatures) - ? DupDetector.rootDetector(this) : null; - _streamWriteContext = JsonWriteContext.createRootContext(dups); - - // 03-Oct-2017, tatu: Not clean (shouldn't call non-static methods from ctor), - // but for now best way to avoid code duplication - setCharacterEscapes(charEsc); - } - - /* - /********************************************************************** - /* Versioned, accessors, capabilities - /********************************************************************** - */ - - @Override public Version version() { return PackageVersion.VERSION; } - - public boolean isEnabled(JsonWriteFeature f) { return f.enabledIn(_formatWriteFeatures); } - - @Override - public JacksonFeatureSet streamWriteCapabilities() { - return DEFAULT_WRITE_CAPABILITIES; - } - - /* - /********************************************************************** - /* Overridden configuration methods - /********************************************************************** - */ - - @Override - public int getHighestNonEscapedChar() { - return _maximumNonEscapedChar; - } - - @Override - public abstract JsonGenerator setCharacterEscapes(CharacterEscapes esc); - - /** - * Method for accessing custom escapes factory uses for {@link JsonGenerator}s - * it creates. - */ - @Override - public CharacterEscapes getCharacterEscapes() { - return _characterEscapes; - } - - /* - /********************************************************************** - /* Overridden output state handling methods - /********************************************************************** - */ - - @Override - public final TokenStreamContext streamWriteContext() { return _streamWriteContext; } - - @Override - public final Object currentValue() { - return _streamWriteContext.currentValue(); - } - - @Override - public final void assignCurrentValue(Object v) { - _streamWriteContext.assignCurrentValue(v); - } - - /* - /********************************************************************** - /* Partial API, structural - /********************************************************************** - */ - - @Override - public void writeStartArray(Object currentValue, int size) throws JacksonException { - writeStartArray(currentValue); - } - - @Override - public void writeStartObject(Object currentValue, int size) throws JacksonException { - writeStartObject(currentValue); - } - - /* - /********************************************************************** - /* Partial API, Object property names/ids - /********************************************************************** - */ - - @Override - public void writePropertyId(long id) throws JacksonException { - writeName(Long.toString(id)); - } - - /* - /********************************************************************** - /* Shared helper methods - /********************************************************************** - */ - - protected void _verifyPrettyValueWrite(String typeMsg, int status) throws JacksonException - { - // If we have a pretty printer, it knows what to do: - switch (status) { - case JsonWriteContext.STATUS_OK_AFTER_COMMA: // array - _cfgPrettyPrinter.writeArrayValueSeparator(this); - break; - case JsonWriteContext.STATUS_OK_AFTER_COLON: - _cfgPrettyPrinter.writeObjectFieldValueSeparator(this); - break; - case JsonWriteContext.STATUS_OK_AFTER_SPACE: - _cfgPrettyPrinter.writeRootValueSeparator(this); - break; - case JsonWriteContext.STATUS_OK_AS_IS: - // First entry, but of which context? - if (_streamWriteContext.inArray()) { - _cfgPrettyPrinter.beforeArrayValues(this); - } else if (_streamWriteContext.inObject()) { - _cfgPrettyPrinter.beforeObjectEntries(this); - } - break; - case JsonWriteContext.STATUS_EXPECT_NAME: - _reportCantWriteValueExpectName(typeMsg); - break; - default: - _throwInternal(); - break; - } - } - - protected void _reportCantWriteValueExpectName(String typeMsg) throws JacksonException - { - throw _constructWriteException("Cannot %s, expecting a property name (context: %s)", - typeMsg, _streamWriteContext.typeDesc()); - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/json/JsonGeneratorImpl.java b/src/main/java/com/fasterxml/jackson/core/json/JsonGeneratorImpl.java new file mode 100644 index 0000000000..c84e85551b --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/json/JsonGeneratorImpl.java @@ -0,0 +1,251 @@ +package com.fasterxml.jackson.core.json; + +import java.io.IOException; + +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.base.GeneratorBase; +import com.fasterxml.jackson.core.io.CharTypes; +import com.fasterxml.jackson.core.io.CharacterEscapes; +import com.fasterxml.jackson.core.io.IOContext; +import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; +import com.fasterxml.jackson.core.util.JacksonFeatureSet; +import com.fasterxml.jackson.core.util.VersionUtil; + +/** + * Intermediate base class shared by JSON-backed generators + * like {@link UTF8JsonGenerator} and {@link WriterBasedJsonGenerator}. + * + * @since 2.1 + */ +public abstract class JsonGeneratorImpl extends GeneratorBase +{ + /* + /********************************************************** + /* Constants + /********************************************************** + */ + + /** + * This is the default set of escape codes, over 7-bit ASCII range + * (first 128 character codes), used for single-byte UTF-8 characters. + */ + protected final static int[] sOutputEscapes = CharTypes.get7BitOutputEscapes(); + + /** + * Default capabilities for JSON generator implementations which do not + * different from "general textual" defaults + * + * @since 2.12 + */ + protected final static JacksonFeatureSet JSON_WRITE_CAPABILITIES + = DEFAULT_TEXTUAL_WRITE_CAPABILITIES; + + /* + /********************************************************** + /* Configuration, basic I/O + /********************************************************** + */ + + protected final IOContext _ioContext; + + /* + /********************************************************** + /* Configuration, output escaping + /********************************************************** + */ + + /** + * Currently active set of output escape code definitions (whether + * and how to escape or not) for 7-bit ASCII range (first 128 + * character codes). Defined separately to make potentially + * customizable + */ + protected int[] _outputEscapes = sOutputEscapes; + + /** + * Value between 128 (0x80) and 65535 (0xFFFF) that indicates highest + * Unicode code point that will not need escaping; or 0 to indicate + * that all characters can be represented without escaping. + * Typically used to force escaping of some portion of character set; + * for example to always escape non-ASCII characters (if value was 127). + *

    + * NOTE: not all sub-classes make use of this setting. + */ + protected int _maximumNonEscapedChar; + + /** + * Definition of custom character escapes to use for generators created + * by this factory, if any. If null, standard data format specific + * escapes are used. + */ + protected CharacterEscapes _characterEscapes; + + /* + /********************************************************** + /* Configuration, other + /********************************************************** + */ + + /** + * Separator to use, if any, between root-level values. + * + * @since 2.1 + */ + protected SerializableString _rootValueSeparator + = DefaultPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR; + + /** + * Flag that is set if quoting is not to be added around + * JSON Object property names. + * + * @since 2.7 + */ + protected boolean _cfgUnqNames; + + /* + /********************************************************** + /* Life-cycle + /********************************************************** + */ + + @SuppressWarnings("deprecation") + public JsonGeneratorImpl(IOContext ctxt, int features, ObjectCodec codec) + { + super(features, codec); + _ioContext = ctxt; + if (Feature.ESCAPE_NON_ASCII.enabledIn(features)) { + // inlined `setHighestNonEscapedChar()` + _maximumNonEscapedChar = 127; + } + _cfgUnqNames = !Feature.QUOTE_FIELD_NAMES.enabledIn(features); + } + + /* + /********************************************************** + /* Versioned + /********************************************************** + */ + + @Override + public Version version() { + return VersionUtil.versionFor(getClass()); + } + + /* + /********************************************************** + /* Overridden configuration methods + /********************************************************** + */ + + @SuppressWarnings("deprecation") + @Override + public JsonGenerator enable(Feature f) { + super.enable(f); + if (f == Feature.QUOTE_FIELD_NAMES) { + _cfgUnqNames = false; + } + return this; + } + + @SuppressWarnings("deprecation") + @Override + public JsonGenerator disable(Feature f) { + super.disable(f); + if (f == Feature.QUOTE_FIELD_NAMES) { + _cfgUnqNames = true; + } + return this; + } + + @SuppressWarnings("deprecation") + @Override + protected void _checkStdFeatureChanges(int newFeatureFlags, int changedFeatures) { + super._checkStdFeatureChanges(newFeatureFlags, changedFeatures); + _cfgUnqNames = !Feature.QUOTE_FIELD_NAMES.enabledIn(newFeatureFlags); + } + + @Override + public JsonGenerator setHighestNonEscapedChar(int charCode) { + _maximumNonEscapedChar = (charCode < 0) ? 0 : charCode; + return this; + } + + @Override + public int getHighestEscapedChar() { + return _maximumNonEscapedChar; + } + + @Override + public JsonGenerator setCharacterEscapes(CharacterEscapes esc) + { + _characterEscapes = esc; + if (esc == null) { // revert to standard escapes + _outputEscapes = sOutputEscapes; + } else { + _outputEscapes = esc.getEscapeCodesForAscii(); + } + return this; + } + + /** + * Method for accessing custom escapes factory uses for {@link JsonGenerator}s + * it creates. + */ + @Override + public CharacterEscapes getCharacterEscapes() { + return _characterEscapes; + } + + @Override + public JsonGenerator setRootValueSeparator(SerializableString sep) { + _rootValueSeparator = sep; + return this; + } + + @Override + public JacksonFeatureSet getWriteCapabilities() { + return JSON_WRITE_CAPABILITIES; + } + + /* + /********************************************************** + /* Shared helper methods + /********************************************************** + */ + + protected void _verifyPrettyValueWrite(String typeMsg, int status) throws IOException + { + // If we have a pretty printer, it knows what to do: + switch (status) { + case JsonWriteContext.STATUS_OK_AFTER_COMMA: // array + _cfgPrettyPrinter.writeArrayValueSeparator(this); + break; + case JsonWriteContext.STATUS_OK_AFTER_COLON: + _cfgPrettyPrinter.writeObjectFieldValueSeparator(this); + break; + case JsonWriteContext.STATUS_OK_AFTER_SPACE: + _cfgPrettyPrinter.writeRootValueSeparator(this); + break; + case JsonWriteContext.STATUS_OK_AS_IS: + // First entry, but of which context? + if (_writeContext.inArray()) { + _cfgPrettyPrinter.beforeArrayValues(this); + } else if (_writeContext.inObject()) { + _cfgPrettyPrinter.beforeObjectEntries(this); + } + break; + case JsonWriteContext.STATUS_EXPECT_NAME: + _reportCantWriteValueExpectName(typeMsg); + break; + default: + _throwInternal(); + break; + } + } + + protected void _reportCantWriteValueExpectName(String typeMsg) throws IOException + { + _reportError(String.format("Can not %s, expecting field name (context: %s)", + typeMsg, _writeContext.typeDesc())); + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/json/JsonParserBase.java b/src/main/java/com/fasterxml/jackson/core/json/JsonParserBase.java deleted file mode 100644 index af639b3d37..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/json/JsonParserBase.java +++ /dev/null @@ -1,396 +0,0 @@ -package com.fasterxml.jackson.core.json; - -import java.math.BigInteger; -import java.util.Arrays; - -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.base.ParserBase; -import com.fasterxml.jackson.core.exc.InputCoercionException; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.io.IOContext; -import com.fasterxml.jackson.core.io.NumberInput; -import com.fasterxml.jackson.core.util.JacksonFeatureSet; - -/** - * Another intermediate base class, only used by actual JSON-backed parser - * implementations. - * - * @since 3.0 - */ -public abstract class JsonParserBase - extends ParserBase -{ - private final static char[] NO_CHARS = new char[0]; - - /* - /********************************************************************** - /* JSON-specific configuration - /********************************************************************** - */ - - /** - * Bit flag for {@link JsonReadFeature}s that are enabled. - */ - protected int _formatReadFeatures; - - /* - /********************************************************************** - /* Parsing state - /********************************************************************** - */ - - /** - * Information about parser context, context in which - * the next token is to be parsed (root, array, object). - */ - protected JsonReadContext _streamReadContext; - - /** - * Secondary token related to the next token after current one; - * used if its type is known. This may be value token that - * follows {@link JsonToken#PROPERTY_NAME}, for example. - */ - protected JsonToken _nextToken; - - /* - /********************************************************************** - /* Helper buffer recycling - /********************************************************************** - */ - - /** - * Temporary buffer that is needed if an Object property name is accessed - * using {@link #getTextCharacters} method (instead of String - * returning alternatives) - */ - private char[] _nameCopyBuffer = NO_CHARS; - - /** - * Flag set to indicate whether the Object property name is available - * from the name copy buffer or not (in addition to its String - * representation being available via read context) - */ - protected boolean _nameCopied; - - /* - /********************************************************************** - /* Life-cycle - /********************************************************************** - */ - - protected JsonParserBase(ObjectReadContext readCtxt, - IOContext ctxt, int streamReadFeatures, int formatReadFeatures) { - super(readCtxt, ctxt, streamReadFeatures); - _formatReadFeatures = formatReadFeatures; - DupDetector dups = StreamReadFeature.STRICT_DUPLICATE_DETECTION.enabledIn(streamReadFeatures) - ? DupDetector.rootDetector(this) : null; - _streamReadContext = JsonReadContext.createRootContext(dups); - } - - /* - /********************************************************************** - /* Versioned, capabilities, config - /********************************************************************** - */ - - @Override public Version version() { return PackageVersion.VERSION; } - - @Override - public JacksonFeatureSet streamReadCapabilities() { - // For now, JSON settings do not differ from general defaults: - return DEFAULT_READ_CAPABILITIES; - } - - /* - /********************************************************************** - /* ParserBase method implementions/overrides - /********************************************************************** - */ - - @Override public TokenStreamContext streamReadContext() { return _streamReadContext; } - - @Override - public Object currentValue() { - return _streamReadContext.currentValue(); - } - - @Override - public void assignCurrentValue(Object v) { - _streamReadContext.assignCurrentValue(v); - } - - /** - * Method that can be called to get the name associated with - * the current event. - */ - @Override public String currentName() { - // [JACKSON-395]: start markers require information from parent - if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) { - JsonReadContext parent = _streamReadContext.getParent(); - if (parent != null) { - return parent.currentName(); - } - } - return _streamReadContext.currentName(); - } - - @Override - public boolean hasTextCharacters() { - if (_currToken == JsonToken.VALUE_STRING) { return true; } // usually true - if (_currToken == JsonToken.PROPERTY_NAME) { return _nameCopied; } - return false; - } - - // 03-Nov-2019, tatu: Will not recycle "name copy buffer" any more as it seems - // unlikely to be of much real benefit - /* - @Override - protected void _releaseBuffers() { - super._releaseBuffers(); - char[] buf = _nameCopyBuffer; - if (buf != null) { - _nameCopyBuffer = null; - _ioContext.releaseNameCopyBuffer(buf); - } - } - */ - - /* - /********************************************************************** - /* Numeric parsing method implementations - /********************************************************************** - */ - - @Override - protected void _parseNumericValue(int expType) - throws JacksonException, InputCoercionException - { - // Int or float? - if (_currToken == JsonToken.VALUE_NUMBER_INT) { - int len = _intLength; - // First: optimization for simple int - if (len <= 9) { - int i = _textBuffer.contentsAsInt(_numberNegative); - _numberInt = i; - _numTypesValid = NR_INT; - return; - } - if (len <= 18) { // definitely fits AND is easy to parse using 2 int parse calls - long l = _textBuffer.contentsAsLong(_numberNegative); - // Might still fit in int, need to check - if (len == 10) { - if (_numberNegative) { - if (l >= MIN_INT_L) { - _numberInt = (int) l; - _numTypesValid = NR_INT; - return; - } - } else { - if (l <= MAX_INT_L) { - _numberInt = (int) l; - _numTypesValid = NR_INT; - return; - } - } - } - _numberLong = l; - _numTypesValid = NR_LONG; - return; - } - _parseSlowInt(expType); - return; - } - if (_currToken == JsonToken.VALUE_NUMBER_FLOAT) { - _parseSlowFloat(expType); - return; - } - throw _constructNotNumericType(_currToken, expType); - } - - @Override - protected int _parseIntValue() throws JacksonException - { - // Inlined variant of: _parseNumericValue(NR_INT) - if (_currToken == JsonToken.VALUE_NUMBER_INT) { - if (_intLength <= 9) { - int i = _textBuffer.contentsAsInt(_numberNegative); - _numberInt = i; - _numTypesValid = NR_INT; - return i; - } - } - // if not optimizable, use more generic - _parseNumericValue(NR_INT); - if ((_numTypesValid & NR_INT) == 0) { - convertNumberToInt(); - } - return _numberInt; - } - - private void _parseSlowFloat(int expType) throws JacksonException - { - /* Nope: floating point. Here we need to be careful to get - * optimal parsing strategy: choice is between accurate but - * slow (BigDecimal) and lossy but fast (Double). For now - * let's only use BD when explicitly requested -- it can - * still be constructed correctly at any point since we do - * retain textual representation - */ - try { - if (expType == NR_BIGDECIMAL) { - _numberBigDecimal = _textBuffer.contentsAsDecimal(); - _numTypesValid = NR_BIGDECIMAL; - } else { - // Otherwise double has to do - _numberDouble = _textBuffer.contentsAsDouble(); - _numTypesValid = NR_DOUBLE; - } - } catch (NumberFormatException nex) { - // Can this ever occur? Due to overflow, maybe? - throw _constructReadException("Malformed numeric value (%s)", - _longNumberDesc(_textBuffer.contentsAsString())); - } - } - - private void _parseSlowInt(int expType) throws JacksonException - { - String numStr = _textBuffer.contentsAsString(); - try { - int len = _intLength; - char[] buf = _textBuffer.getTextBuffer(); - int offset = _textBuffer.getTextOffset(); - if (_numberNegative) { - ++offset; - } - // Some long cases still... - if (NumberInput.inLongRange(buf, offset, len, _numberNegative)) { - // Probably faster to construct a String, call parse, than to use BigInteger - _numberLong = Long.parseLong(numStr); - _numTypesValid = NR_LONG; - } else { - // 16-Oct-2018, tatu: Need to catch "too big" early due to [jackson-core#488] - if ((expType == NR_INT) || (expType == NR_LONG)) { - _reportTooLongIntegral(expType, numStr); - } - if ((expType == NR_DOUBLE) || (expType == NR_FLOAT)) { - _numberDouble = NumberInput.parseDouble(numStr); - _numTypesValid = NR_DOUBLE; - } else { - // nope, need the heavy guns... (rare case) - _numberBigInt = new BigInteger(numStr); - _numTypesValid = NR_BIGINT; - } - } - } catch (NumberFormatException nex) { - // Can this ever occur? Due to overflow, maybe? - throw _constructReadException("Malformed numeric value (%s)", - _longNumberDesc(numStr)); - } - } - - protected void _reportTooLongIntegral(int expType, String rawNum) throws JacksonException - { - if (expType == NR_INT) { - _reportOverflowInt(rawNum); - } - _reportOverflowLong(rawNum); - } - - /* - /********************************************************************** - /* Internal/package methods: config access - /********************************************************************** - */ - - public boolean isEnabled(JsonReadFeature f) { return f.enabledIn(_formatReadFeatures); } - - /* - /********************************************************************** - /* Internal/package methods: buffer handling - /********************************************************************** - */ - - protected char[] currentNameInBuffer() { - if (_nameCopied) { - return _nameCopyBuffer; - } - final String name = _streamReadContext.currentName(); - final int nameLen = name.length(); - if (_nameCopyBuffer.length < nameLen) { - _nameCopyBuffer = new char[Math.max(32, nameLen)]; - } - name.getChars(0, nameLen, _nameCopyBuffer, 0); - _nameCopied = true; - return _nameCopyBuffer; - } - - /* - /********************************************************************** - /* Internal/package methods: Error reporting - /********************************************************************** - */ - - protected char _handleUnrecognizedCharacterEscape(char ch) throws StreamReadException { - // It is possible we allow all kinds of non-standard escapes... - if (isEnabled(JsonReadFeature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER)) { - return ch; - } - // and if allowing single-quoted names, String values, single-quote needs to be escapable regardless - if (ch == '\'' && isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)) { - return ch; - } - _reportError("Unrecognized character escape "+_getCharDesc(ch)); - return ch; - } - - // Promoted from `ParserBase` in 3.0 - protected void _reportMismatchedEndMarker(int actCh, char expCh) throws StreamReadException { - TokenStreamContext ctxt = streamReadContext(); - _reportError(String.format( - "Unexpected close marker '%s': expected '%c' (for %s starting at %s)", - (char) actCh, expCh, ctxt.typeDesc(), ctxt.startLocation(_contentReference()))); - } - - // Method called to report a problem with unquoted control character. - // Note: it is possible to suppress some instances of - // exception by enabling {@link JsonReadFeature#ALLOW_UNESCAPED_CONTROL_CHARS}. - protected void _throwUnquotedSpace(int i, String ctxtDesc) throws StreamReadException { - // It is possible to allow unquoted control chars: - if (!isEnabled(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS) || i > INT_SPACE) { - char c = (char) i; - String msg = "Illegal unquoted character ("+_getCharDesc(c)+"): has to be escaped using backslash to be included in "+ctxtDesc; - _reportError(msg); - } - } - - // @return Description to use as "valid tokens" in an exception message about - // invalid (unrecognized) JSON token: called when parser finds something that - // looks like unquoted textual token - protected String _validJsonTokenList() { - return _validJsonValueList(); - } - - // @return Description to use as "valid JSON values" in an exception message about - // invalid (unrecognized) JSON value: called when parser finds something that - // does not look like a value or separator. - protected String _validJsonValueList() { - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { - return "(JSON String, Number (or 'NaN'/'INF'/'+INF'), Array, Object or token 'null', 'true' or 'false')"; - } - return "(JSON String, Number, Array, Object or token 'null', 'true' or 'false')"; - } - - /* - /********************************************************************** - /* Internal/package methods: Other - /********************************************************************** - */ - - protected static int[] growArrayBy(int[] arr, int more) - { - if (arr == null) { - return new int[more]; - } - return Arrays.copyOf(arr, arr.length + more); - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/json/JsonReadContext.java b/src/main/java/com/fasterxml/jackson/core/json/JsonReadContext.java index f817d62420..2e5b4f3a2b 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/JsonReadContext.java +++ b/src/main/java/com/fasterxml/jackson/core/json/JsonReadContext.java @@ -1,15 +1,14 @@ package com.fasterxml.jackson.core.json; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.core.io.ContentReference; /** - * Extension of {@link TokenStreamContext}, which implements + * Extension of {@link JsonStreamContext}, which implements * core methods needed, and also exposes * more complete API to parser implementation classes. */ -public final class JsonReadContext extends TokenStreamContext +public final class JsonReadContext extends JsonStreamContext { // // // Configuration @@ -23,32 +22,35 @@ public final class JsonReadContext extends TokenStreamContext protected DupDetector _dups; /* - /********************************************************************** + /********************************************************** /* Simple instance reuse slots; speeds up things a bit (10-15%) /* for docs with lots of small arrays/objects (for which /* allocation was visible in profile stack frames) - /********************************************************************** + /********************************************************** */ protected JsonReadContext _child; /* - /********************************************************************** + /********************************************************** /* Location/state information (minus source reference) - /********************************************************************** + /********************************************************** */ protected String _currentName; + /** + * @since 2.5 + */ protected Object _currentValue; protected int _lineNr; protected int _columnNr; /* - /********************************************************************** + /********************************************************** /* Instance construction, config, reuse - /********************************************************************** + /********************************************************** */ public JsonReadContext(JsonReadContext parent, DupDetector dups, int type, int lineNr, int colNr) { @@ -67,14 +69,14 @@ public JsonReadContext(JsonReadContext parent, DupDetector dups, int type, int l * Clears up state (including "current value"), changes type to one specified; * resets current duplicate-detection state (if any). * Parent link left as-is since it is {@code final}. + *

    + * NOTE: Public since 2.12. * * @param type Type to assign to this context node * @param lineNr Line of the starting position of this context * @param colNr Column of the starting position of this context - * - * @return This context instance (to allow call-chaining) */ - public JsonReadContext reset(int type, int lineNr, int colNr) { + public void reset(int type, int lineNr, int colNr) { _type = type; _index = -1; _lineNr = lineNr; @@ -84,7 +86,6 @@ public JsonReadContext reset(int type, int lineNr, int colNr) { if (_dups != null) { _dups.reset(); } - return this; } /* @@ -99,19 +100,19 @@ public JsonReadContext withDupDetector(DupDetector dups) { } @Override - public Object currentValue() { + public Object getCurrentValue() { return _currentValue; } @Override - public void assignCurrentValue(Object v) { + public void setCurrentValue(Object v) { _currentValue = v; } /* - /********************************************************************** + /********************************************************** /* Factory methods - /********************************************************************** + /********************************************************** */ public static JsonReadContext createRootContext(int lineNr, int colNr, DupDetector dups) { @@ -145,16 +146,14 @@ public JsonReadContext createChildObjectContext(int lineNr, int colNr) { } /* - /********************************************************************** + /********************************************************** /* Abstract method implementations, overrides - /********************************************************************** + /********************************************************** */ - /** - * @since 3.0 - */ - @Override public String currentName() { return _currentName; } + @Override public String getCurrentName() { return _currentName; } + // @since 2.9 @Override public boolean hasCurrentName() { return _currentName != null; } @Override public JsonReadContext getParent() { return _parent; } @@ -163,25 +162,32 @@ public JsonReadContext createChildObjectContext(int lineNr, int colNr) { public JsonLocation startLocation(ContentReference srcRef) { // We don't keep track of offsets at this level (only reader does) long totalChars = -1L; - return new JsonLocation(ContentReference.rawReference(srcRef), - totalChars, _lineNr, _columnNr); + return new JsonLocation(srcRef, totalChars, _lineNr, _columnNr); + } + + @Override + @Deprecated // since 2.13 + public JsonLocation getStartLocation(Object rawSrc) { + return startLocation(ContentReference.rawReference(rawSrc)); } /* - /********************************************************************** + /********************************************************** /* Extended API - /********************************************************************** + /********************************************************** */ /** * Method that can be used to both clear the accumulated references - * (specifically value set with {@link #assignCurrentValue(Object)}) + * (specifically value set with {@link #setCurrentValue(Object)}) * that should not be retained, and returns parent (as would * {@link #getParent()} do). Typically called when closing the active * context when encountering {@link JsonToken#END_ARRAY} or * {@link JsonToken#END_OBJECT}. * * @return Parent context of this context node, if any; {@code null} for root context + * + * @since 2.7 */ public JsonReadContext clearAndGetParent() { _currentValue = null; @@ -194,9 +200,9 @@ public DupDetector getDupDetector() { } /* - /********************************************************************** + /********************************************************** /* State changes - /********************************************************************** + /********************************************************** */ public boolean expectComma() { @@ -208,26 +214,16 @@ public boolean expectComma() { return (_type != TYPE_ROOT && ix > 0); } - /** - * Method that parser is to call when it reads a name of Object property. - * - * @param name Property name that has been read - * - * @throws StreamReadException if duplicate check restriction is violated (which - * assumes that duplicate-detection is enabled) - */ - public void setCurrentName(String name) throws StreamReadException - { + public void setCurrentName(String name) throws JsonProcessingException { _currentName = name; if (_dups != null) { _checkDup(_dups, name); } } - private void _checkDup(DupDetector dd, String name) throws StreamReadException - { + private void _checkDup(DupDetector dd, String name) throws JsonProcessingException { if (dd.isDup(name)) { Object src = dd.getSource(); - throw new StreamReadException(((src instanceof JsonParser) ? ((JsonParser) src) : null), - "Duplicate Object property \""+name+"\""); + throw new JsonParseException(((src instanceof JsonParser) ? ((JsonParser) src) : null), + "Duplicate field '"+name+"'"); } } } diff --git a/src/main/java/com/fasterxml/jackson/core/json/JsonReadFeature.java b/src/main/java/com/fasterxml/jackson/core/json/JsonReadFeature.java index 743c181acf..304b320a12 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/JsonReadFeature.java +++ b/src/main/java/com/fasterxml/jackson/core/json/JsonReadFeature.java @@ -4,9 +4,9 @@ /** * Token reader (parser) features specific to JSON backend. - *

    - * NOTE: Jackson 2.x had these mixed with non-JSON-specific features within - * JsonParser.Feature enumeration. + * Eventual replacement for JSON-specific {@link com.fasterxml.jackson.core.JsonParser.Feature}s. + * + * @since 2.10 */ public enum JsonReadFeature implements FormatFeature @@ -25,7 +25,7 @@ public enum JsonReadFeature * disabled by default for parsers and must be * explicitly enabled. */ - ALLOW_JAVA_COMMENTS(false), + ALLOW_JAVA_COMMENTS(false, JsonParser.Feature.ALLOW_COMMENTS), /** * Feature that determines whether parser will allow use @@ -39,7 +39,7 @@ public enum JsonReadFeature * disabled by default for parsers and must be * explicitly enabled. */ - ALLOW_YAML_COMMENTS(false), + ALLOW_YAML_COMMENTS(false, JsonParser.Feature.ALLOW_YAML_COMMENTS), // // // Support for non-standard data format constructs: quoting/escaping @@ -50,23 +50,21 @@ public enum JsonReadFeature * this is in addition to other acceptable markers. *

    * Since JSON specification requires use of double quotes for - * property names, + * field names, * this is a non-standard feature, and as such disabled by default. */ - ALLOW_SINGLE_QUOTES(false), + ALLOW_SINGLE_QUOTES(false, JsonParser.Feature.ALLOW_SINGLE_QUOTES), /** * Feature that determines whether parser will allow use - * of unquoted Object property names (which is allowed by Javascript, + * of unquoted field names (which is allowed by Javascript, * but not by JSON specification). *

    * Since JSON specification requires use of double quotes for - * Object property names, + * field names, * this is a non-standard feature, and as such disabled by default. - *

    - * NOTE: in Jackson 2.x, was called {@code ALLOW_UNQUOTED_FIELD_NAMES} */ - ALLOW_UNQUOTED_PROPERTY_NAMES(false), + ALLOW_UNQUOTED_FIELD_NAMES(false, JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES), /** * Feature that determines whether parser will allow @@ -79,7 +77,8 @@ public enum JsonReadFeature * Since JSON specification requires quoting for all control characters, * this is a non-standard feature, and as such disabled by default. */ - ALLOW_UNESCAPED_CONTROL_CHARS(false), + @SuppressWarnings("deprecation") + ALLOW_UNESCAPED_CONTROL_CHARS(false, JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS), /** * Feature that can be enabled to accept quoting of all character @@ -90,7 +89,8 @@ public enum JsonReadFeature * Since JSON specification requires quoting for all control characters, * this is a non-standard feature, and as such disabled by default. */ - ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER(false), + @SuppressWarnings("deprecation") + ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER(false, JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER), // // // Support for non-standard data format constructs: number representations @@ -104,7 +104,8 @@ public enum JsonReadFeature * Since JSON specification does not allow leading zeroes, * this is a non-standard feature, and as such disabled by default. */ - ALLOW_LEADING_ZEROS_FOR_NUMBERS(false), + @SuppressWarnings("deprecation") + ALLOW_LEADING_ZEROS_FOR_NUMBERS(false, JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS), /** * Feature that determines whether parser will allow @@ -114,8 +115,11 @@ public enum JsonReadFeature *

    * Since JSON specification does not allow leading decimal, * this is a non-standard feature, and as such disabled by default. + * + * @since 2.11 */ - ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS(false), + @SuppressWarnings("deprecation") + ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS(false, JsonParser.Feature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS), /** * Feature that allows parser to recognize set of @@ -135,7 +139,8 @@ public enum JsonReadFeature * Since JSON specification does not allow use of such values, * this is a non-standard feature, and as such disabled by default. */ - ALLOW_NON_NUMERIC_NUMBERS(false), + @SuppressWarnings("deprecation") + ALLOW_NON_NUMERIC_NUMBERS(false, JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS), // // // Support for non-standard data format constructs: array/value separators @@ -153,7 +158,8 @@ public enum JsonReadFeature * Since the JSON specification does not allow missing values this is a non-compliant JSON * feature and is disabled by default. */ - ALLOW_MISSING_VALUES(false), + @SuppressWarnings("deprecation") + ALLOW_MISSING_VALUES(false, JsonParser.Feature.ALLOW_MISSING_VALUES), /** * Feature that determines whether {@link JsonParser} will allow for a single trailing @@ -174,12 +180,19 @@ public enum JsonReadFeature * Since the JSON specification does not permit trailing commas, this is a non-standard * feature, and as such disabled by default. */ - ALLOW_TRAILING_COMMA(false), + @SuppressWarnings("deprecation") + ALLOW_TRAILING_COMMA(false, JsonParser.Feature.ALLOW_TRAILING_COMMA), ; final private boolean _defaultState; final private int _mask; + /** + * For backwards compatibility we may need to map to one of existing {@link JsonParser.Feature}s; + * if so, this is the feature to enable/disable. + */ + final private JsonParser.Feature _mappedFeature; + /** * Method that calculates bit set (flags) of all features that * are enabled by default. @@ -197,9 +210,11 @@ public static int collectDefaults() return flags; } - private JsonReadFeature(boolean defaultState) { + private JsonReadFeature(boolean defaultState, + JsonParser.Feature mapTo) { _defaultState = defaultState; _mask = (1 << ordinal()); + _mappedFeature = mapTo; } @Override @@ -208,4 +223,6 @@ private JsonReadFeature(boolean defaultState) { public int getMask() { return _mask; } @Override public boolean enabledIn(int flags) { return (flags & _mask) != 0; } + + public JsonParser.Feature mappedFeature() { return _mappedFeature; } } diff --git a/src/main/java/com/fasterxml/jackson/core/json/JsonWriteContext.java b/src/main/java/com/fasterxml/jackson/core/json/JsonWriteContext.java index 7e6168fda7..b81adf6d9b 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/JsonWriteContext.java +++ b/src/main/java/com/fasterxml/jackson/core/json/JsonWriteContext.java @@ -1,14 +1,13 @@ package com.fasterxml.jackson.core.json; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamWriteException; /** - * Extension of {@link TokenStreamContext}, which implements + * Extension of {@link JsonStreamContext}, which implements * core methods needed, and also exposes * more complete API to generator implementation classes. */ -public class JsonWriteContext extends TokenStreamContext +public class JsonWriteContext extends JsonStreamContext { // // // Return values for writeValue() @@ -29,26 +28,29 @@ public class JsonWriteContext extends TokenStreamContext protected DupDetector _dups; /* - /********************************************************************** + /********************************************************** /* Simple instance reuse slots; speed up things a bit (10-15%) /* for docs with lots of small arrays/objects - /********************************************************************** + /********************************************************** */ protected JsonWriteContext _child; /* - /********************************************************************** + /********************************************************** /* Location/state information (minus source reference) - /********************************************************************** + /********************************************************** */ /** - * Name of the Object property of which value is to be written; only + * Name of the field of which value is to be written; only * used for OBJECT contexts */ protected String _currentName; + /** + * @since 2.5 + */ protected Object _currentValue; /** @@ -58,11 +60,20 @@ public class JsonWriteContext extends TokenStreamContext protected boolean _gotName; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ + protected JsonWriteContext(int type, JsonWriteContext parent, DupDetector dups) { + super(); + _type = type; + _parent = parent; + _dups = dups; + _index = -1; + } + + /* @since 2.10 */ protected JsonWriteContext(int type, JsonWriteContext parent, DupDetector dups, Object currValue) { super(); @@ -73,12 +84,37 @@ protected JsonWriteContext(int type, JsonWriteContext parent, DupDetector dups, _currentValue = currValue; } + /** + * Internal method to allow instance reuse: DO NOT USE unless you absolutely + * know what you are doing. + * Clears up state (including "current value"), changes type to one specified; + * resets current duplicate-detection state (if any). + * Parent link left as-is since it is {@code final}. + *

    + * NOTE: Public since 2.12. + * + * @param type Type to assign to this context node + * + * @return This context instance to allow call-chaining + */ + public JsonWriteContext reset(int type) { + _type = type; + _index = -1; + _currentName = null; + _gotName = false; + _currentValue = null; + if (_dups != null) { _dups.reset(); } + return this; + } + /** * Internal method to allow instance reuse: DO NOT USE unless you absolutely * know what you are doing. * Clears up state, changes type to one specified, assigns "current value"; * resets current duplicate-detection state (if any). * Parent link left as-is since it is {@code final}. + *

    + * NOTE: Public since 2.12. * * @param type Type to assign to this context node * @param currValue Current value to assign to this context node @@ -87,7 +123,7 @@ protected JsonWriteContext(int type, JsonWriteContext parent, DupDetector dups, * * @since 2.10 */ - protected JsonWriteContext reset(int type, Object currValue) { + public JsonWriteContext reset(int type, Object currValue) { _type = type; _index = -1; _currentName = null; @@ -103,26 +139,44 @@ public JsonWriteContext withDupDetector(DupDetector dups) { } @Override - public Object currentValue() { + public Object getCurrentValue() { return _currentValue; } @Override - public void assignCurrentValue(Object v) { + public void setCurrentValue(Object v) { _currentValue = v; } - + /* - /********************************************************************** + /********************************************************** /* Factory methods - /********************************************************************** + /********************************************************** + */ + + /** + * @deprecated Since 2.3; use method that takes argument + * + * @return Context instance created */ + @Deprecated + public static JsonWriteContext createRootContext() { return createRootContext(null); } public static JsonWriteContext createRootContext(DupDetector dd) { - return new JsonWriteContext(TYPE_ROOT, null, dd, null); + return new JsonWriteContext(TYPE_ROOT, null, dd); } + public JsonWriteContext createChildArrayContext() { + JsonWriteContext ctxt = _child; + if (ctxt == null) { + _child = ctxt = new JsonWriteContext(TYPE_ARRAY, this, + (_dups == null) ? null : _dups.child()); + return ctxt; + } + return ctxt.reset(TYPE_ARRAY); + } + /* @since 2.10 */ public JsonWriteContext createChildArrayContext(Object currValue) { JsonWriteContext ctxt = _child; if (ctxt == null) { @@ -133,6 +187,17 @@ public JsonWriteContext createChildArrayContext(Object currValue) { return ctxt.reset(TYPE_ARRAY, currValue); } + public JsonWriteContext createChildObjectContext() { + JsonWriteContext ctxt = _child; + if (ctxt == null) { + _child = ctxt = new JsonWriteContext(TYPE_OBJECT, this, + (_dups == null) ? null : _dups.child()); + return ctxt; + } + return ctxt.reset(TYPE_OBJECT); + } + + /* @since 2.10 */ public JsonWriteContext createChildObjectContext(Object currValue) { JsonWriteContext ctxt = _child; if (ctxt == null) { @@ -144,18 +209,21 @@ public JsonWriteContext createChildObjectContext(Object currValue) { } @Override public final JsonWriteContext getParent() { return _parent; } - @Override public final String currentName() { return _currentName; } + @Override public final String getCurrentName() { return _currentName; } + // @since 2.9 @Override public boolean hasCurrentName() { return _currentName != null; } /** * Method that can be used to both clear the accumulated references - * (specifically value set with {@link #assignCurrentValue(Object)}) + * (specifically value set with {@link #setCurrentValue(Object)}) * that should not be retained, and returns parent (as would * {@link #getParent()} do). Typically called when closing the active * context when encountering {@link JsonToken#END_ARRAY} or * {@link JsonToken#END_OBJECT}. * * @return Parent context of this context node, if any; {@code null} for root context + * + * @since 2.7 */ public JsonWriteContext clearAndGetParent() { _currentValue = null; @@ -168,17 +236,15 @@ public DupDetector getDupDetector() { } /** - * Method that generator is to call when it writes a name of Object property. + * Method that writer is to call before it writes a name of Object property. * * @param name Property name being written * - * @return Index of the Object property (0-based) + * @return Index of the field entry (0-based) * - * @throws StreamWriteException if duplicate check restriction is violated (which - * assumes that duplicate-detection is enabled) + * @throws JsonProcessingException if duplicate check restriction is violated */ - public int writeName(String name) throws StreamWriteException - { + public int writeFieldName(String name) throws JsonProcessingException { if ((_type != TYPE_OBJECT) || _gotName) { return STATUS_EXPECT_VALUE; } @@ -188,15 +254,14 @@ public int writeName(String name) throws StreamWriteException return (_index < 0) ? STATUS_OK_AS_IS : STATUS_OK_AFTER_COMMA; } - private final void _checkDup(DupDetector dd, String name) throws StreamWriteException - { + private final void _checkDup(DupDetector dd, String name) throws JsonProcessingException { if (dd.isDup(name)) { Object src = dd.getSource(); - throw new StreamWriteException(((src instanceof JsonGenerator) ? ((JsonGenerator) src) : null), - "Duplicate Object property \""+name+"\""); + throw new JsonGenerationException("Duplicate field '"+name+"'", + ((src instanceof JsonGenerator) ? ((JsonGenerator) src) : null)); } } - + public int writeValue() { // Most likely, object: if (_type == TYPE_OBJECT) { diff --git a/src/main/java/com/fasterxml/jackson/core/json/JsonWriteFeature.java b/src/main/java/com/fasterxml/jackson/core/json/JsonWriteFeature.java index ca52d1df0f..41f6845ce5 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/JsonWriteFeature.java +++ b/src/main/java/com/fasterxml/jackson/core/json/JsonWriteFeature.java @@ -4,24 +4,27 @@ /** * Token writer features specific to JSON backend. + * + * @since 2.10 */ public enum JsonWriteFeature implements FormatFeature { - // // // Support for non-standard JSON constructs: Quoting/escaping + // // // Support for non-standard data format constructs: comments + + // // Quoting/ecsaping-related features /** - * Feature that determines whether JSON Object property names are + * Feature that determines whether JSON Object field names are * quoted using double-quotes, as specified by JSON specification * or not. Ability to disable quoting was added to support use * cases where they are not usually expected, which most commonly * occurs when used straight from Javascript. *

    - * Note: in Jackson 2.x, was called {@code QUOTE_FIELD_NAMES} - *

    * Feature is enabled by default (since it is required by JSON specification). */ - QUOTE_PROPERTY_NAMES(true), + @SuppressWarnings("deprecation") + QUOTE_FIELD_NAMES(true, JsonGenerator.Feature.QUOTE_FIELD_NAMES), /** * Feature that determines whether "NaN" ("not a number", that is, not @@ -35,10 +38,9 @@ public enum JsonWriteFeature *

    * Feature is enabled by default. */ - WRITE_NAN_AS_STRINGS(true), + @SuppressWarnings("deprecation") + WRITE_NAN_AS_STRINGS(true, JsonGenerator.Feature.QUOTE_NON_NUMERIC_NUMBERS), - // // // Support for escaping variations - /** * Feature that forces all regular number values to be written as JSON Strings, * instead of as JSON Numbers. @@ -55,8 +57,9 @@ public enum JsonWriteFeature *

    * Feature is disabled by default. */ - WRITE_NUMBERS_AS_STRINGS(false), - + @SuppressWarnings("deprecation") + WRITE_NUMBERS_AS_STRINGS(false, JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS), + /** * Feature that specifies that all characters beyond 7-bit ASCII * range (i.e. code points of 128 and above) need to be output @@ -66,7 +69,8 @@ public enum JsonWriteFeature *

    * Feature is disabled by default. */ - ESCAPE_NON_ASCII(false), + @SuppressWarnings("deprecation") + ESCAPE_NON_ASCII(false, JsonGenerator.Feature.ESCAPE_NON_ASCII), //23-Nov-2015, tatu: for [core#223], if and when it gets implemented /* @@ -95,6 +99,12 @@ public enum JsonWriteFeature final private boolean _defaultState; final private int _mask; + /** + * For backwards compatibility we may need to map to one of existing {@link JsonGenerator.Feature}s; + * if so, this is the feature to enable/disable. + */ + final private JsonGenerator.Feature _mappedFeature; + /** * Method that calculates bit set (flags) of all features that * are enabled by default. @@ -112,9 +122,11 @@ public static int collectDefaults() return flags; } - private JsonWriteFeature(boolean defaultState) { + private JsonWriteFeature(boolean defaultState, + JsonGenerator.Feature mapTo) { _defaultState = defaultState; _mask = (1 << ordinal()); + _mappedFeature = mapTo; } @Override @@ -123,4 +135,6 @@ private JsonWriteFeature(boolean defaultState) { public int getMask() { return _mask; } @Override public boolean enabledIn(int flags) { return (flags & _mask) != 0; } + + public JsonGenerator.Feature mappedFeature() { return _mappedFeature; } } diff --git a/src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java b/src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java index 468bfe4f06..da788986c6 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java +++ b/src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java @@ -3,8 +3,7 @@ import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.exc.WrappedIOException; +import com.fasterxml.jackson.core.base.ParserBase; import com.fasterxml.jackson.core.io.CharTypes; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer; @@ -18,19 +17,33 @@ * conversion tasks. */ public class ReaderBasedJsonParser - extends JsonParserBase + extends ParserBase { - private final static int FEAT_MASK_TRAILING_COMMA = JsonReadFeature.ALLOW_TRAILING_COMMA.getMask(); - private final static int FEAT_MASK_ALLOW_MISSING = JsonReadFeature.ALLOW_MISSING_VALUES.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_TRAILING_COMMA = Feature.ALLOW_TRAILING_COMMA.getMask(); + + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_LEADING_ZEROS = Feature.ALLOW_NUMERIC_LEADING_ZEROS.getMask(); + + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_NON_NUM_NUMBERS = Feature.ALLOW_NON_NUMERIC_NUMBERS.getMask(); + + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_ALLOW_MISSING = Feature.ALLOW_MISSING_VALUES.getMask(); + private final static int FEAT_MASK_ALLOW_SINGLE_QUOTES = Feature.ALLOW_SINGLE_QUOTES.getMask(); + private final static int FEAT_MASK_ALLOW_UNQUOTED_NAMES = Feature.ALLOW_UNQUOTED_FIELD_NAMES.getMask(); + + private final static int FEAT_MASK_ALLOW_JAVA_COMMENTS = Feature.ALLOW_COMMENTS.getMask(); + private final static int FEAT_MASK_ALLOW_YAML_COMMENTS = Feature.ALLOW_YAML_COMMENTS.getMask(); // Latin1 encoding is not supported, but we do use 8-bit subset for // pre-processing task, to simplify first pass, keep it fast. protected final static int[] _icLatin1 = CharTypes.getInputCodeLatin1(); /* - /********************************************************************** + /********************************************************** /* Input configuration - /********************************************************************** + /********************************************************** */ /** @@ -56,19 +69,21 @@ public class ReaderBasedJsonParser protected boolean _bufferRecyclable; /* - /********************************************************************** + /********************************************************** /* Configuration - /********************************************************************** + /********************************************************** */ - protected final CharsToNameCanonicalizer _symbols; + protected ObjectCodec _objectCodec; - protected final int _hashSeed; + final protected CharsToNameCanonicalizer _symbols; + + final protected int _hashSeed; /* - /********************************************************************** + /********************************************************** /* Parsing state - /********************************************************************** + /********************************************************** */ /** @@ -83,17 +98,25 @@ public class ReaderBasedJsonParser * name token was read. Used for calculating token location when requested; * combined with {@link #_currInputProcessed}, may be updated appropriately * as needed. + * + * @since 2.7 */ protected long _nameStartOffset; + /** + * @since 2.7 + */ protected int _nameStartRow; + /** + * @since 2.7 + */ protected int _nameStartCol; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ /** @@ -101,26 +124,27 @@ public class ReaderBasedJsonParser * (or needs to, in case of bootstrapping having read some of contents) * and it may or may not be recyclable use standard recycle context. * - * @param readCtxt Object read context to use * @param ctxt I/O context to use - * @param stdFeatures Standard stream read features enabled - * @param formatFeatures Format-specific read features enabled + * @param features Standard stream read features enabled * @param r Reader used for reading actual content, if any; {@code null} if none + * @param codec {@code ObjectCodec} to delegate object deserialization to * @param st Name canonicalizer to use * @param inputBuffer Input buffer to read initial content from (before Reader) * @param start Pointer in {@code inputBuffer} that has the first content character to decode * @param end Pointer past the last content character in {@code inputBuffer} * @param bufferRecyclable Whether {@code inputBuffer} passed is managed by Jackson core * (and thereby needs recycling) + * + * @since 2.4 */ - public ReaderBasedJsonParser(ObjectReadContext readCtxt, IOContext ctxt, - int stdFeatures, int formatFeatures, Reader r, - CharsToNameCanonicalizer st, + public ReaderBasedJsonParser(IOContext ctxt, int features, Reader r, + ObjectCodec codec, CharsToNameCanonicalizer st, char[] inputBuffer, int start, int end, boolean bufferRecyclable) { - super(readCtxt, ctxt, stdFeatures, formatFeatures); + super(ctxt, features); _reader = r; + _objectCodec = codec; _inputBuffer = inputBuffer; _inputPtr = start; _inputEnd = end; @@ -136,51 +160,59 @@ public ReaderBasedJsonParser(ObjectReadContext readCtxt, IOContext ctxt, * Constructor called when input comes as a {@link java.io.Reader}, and buffer allocation * can be done using default mechanism. * - * @param readCtxt Object read context to use * @param ctxt I/O context to use - * @param stdFeatures Standard stream read features enabled - * @param formatFeatures Format-specific read features enabled + * @param features Standard stream read features enabled * @param r Reader used for reading actual content, if any; {@code null} if none + * @param codec {@code ObjectCodec} to delegate object deserialization to * @param st Name canonicalizer to use */ - public ReaderBasedJsonParser(ObjectReadContext readCtxt, IOContext ctxt, - int stdFeatures, int formatFeatures, Reader r, - CharsToNameCanonicalizer st) + public ReaderBasedJsonParser(IOContext ctxt, int features, Reader r, + ObjectCodec codec, CharsToNameCanonicalizer st) { - super(readCtxt, ctxt, stdFeatures, formatFeatures); + super(ctxt, features); _reader = r; _inputBuffer = ctxt.allocTokenBuffer(); _inputPtr = 0; _inputEnd = 0; + _objectCodec = codec; _symbols = st; _hashSeed = st.hashSeed(); _bufferRecyclable = true; } /* - /********************************************************************** + /********************************************************** /* Base method defs, overrides - /********************************************************************** + /********************************************************** */ + @Override public ObjectCodec getCodec() { return _objectCodec; } + @Override public void setCodec(ObjectCodec c) { _objectCodec = c; } + + @Override // @since 2.12 + public JacksonFeatureSet getReadCapabilities() { + return JSON_READ_CAPABILITIES; + } + @Override - public int releaseBuffered(Writer w) throws JacksonException { + public int releaseBuffered(Writer w) throws IOException { int count = _inputEnd - _inputPtr; if (count < 1) { return 0; } // let's just advance ptr to end int origPtr = _inputPtr; _inputPtr += count; - try { - w.write(_inputBuffer, origPtr, count); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + w.write(_inputBuffer, origPtr, count); return count; } - @Override public Object streamReadInputSource() { return _reader; } + @Override public Object getInputSource() { return _reader; } - protected char getNextChar(String eofMsg, JsonToken forToken) throws JacksonException { + @Deprecated // since 2.8 + protected char getNextChar(String eofMsg) throws IOException { + return getNextChar(eofMsg, null); + } + + protected char getNextChar(String eofMsg, JsonToken forToken) throws IOException { if (_inputPtr >= _inputEnd) { if (!_loadMore()) { _reportInvalidEOF(eofMsg, forToken); @@ -190,7 +222,7 @@ protected char getNextChar(String eofMsg, JsonToken forToken) throws JacksonExce } @Override - protected void _closeInput() { + protected void _closeInput() throws IOException { /* 25-Nov-2008, tatus: As per [JACKSON-16] we are not to call close() * on the underlying Reader, unless we "own" it, or auto-closing * feature is enabled. @@ -199,12 +231,8 @@ protected void _closeInput() { * means that buffer recycling won't work correctly. */ if (_reader != null) { - if (_ioContext.isResourceManaged() || isEnabled(StreamReadFeature.AUTO_CLOSE_SOURCE)) { - try { - _reader.close(); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + if (_ioContext.isResourceManaged() || isEnabled(Feature.AUTO_CLOSE_SOURCE)) { + _reader.close(); } _reader = null; } @@ -217,7 +245,7 @@ protected void _closeInput() { * separately (if need be). */ @Override - protected void _releaseBuffers() + protected void _releaseBuffers() throws IOException { super._releaseBuffers(); // merge new symbols, if any @@ -233,24 +261,19 @@ protected void _releaseBuffers() } /* - /********************************************************************** + /********************************************************** /* Low-level access, supporting - /********************************************************************** + /********************************************************** */ - protected void _loadMoreGuaranteed() throws JacksonException { + protected void _loadMoreGuaranteed() throws IOException { if (!_loadMore()) { _reportInvalidEOF(); } } - protected boolean _loadMore() throws JacksonException + protected boolean _loadMore() throws IOException { if (_reader != null) { - int count; - try { - count = _reader.read(_inputBuffer, 0, _inputBuffer.length); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + int count = _reader.read(_inputBuffer, 0, _inputBuffer.length); if (count > 0) { final int bufSize = _inputEnd; _currInputProcessed += bufSize; @@ -270,16 +293,16 @@ protected boolean _loadMore() throws JacksonException _closeInput(); // Should never return 0, so let's fail if (count == 0) { - _reportBadReader(_inputBuffer.length); + throw new IOException("Reader returned 0 characters when trying to read "+_inputEnd); } } return false; } /* - /********************************************************************** + /********************************************************** /* Public API, data access - /********************************************************************** + /********************************************************** */ /** @@ -289,7 +312,7 @@ protected boolean _loadMore() throws JacksonException * Method can be called for any event. */ @Override - public final String getText() throws JacksonException + public final String getText() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { @@ -301,42 +324,38 @@ public final String getText() throws JacksonException return _getText2(_currToken); } - @Override - public int getText(Writer writer) throws JacksonException + @Override // since 2.8 + public int getText(Writer writer) throws IOException { - final JsonToken t = _currToken; - - try { - if (t == JsonToken.VALUE_STRING) { - if (_tokenIncomplete) { - _tokenIncomplete = false; - _finishString(); // only strings can be incomplete - } - return _textBuffer.contentsToWriter(writer); - } - if (t == JsonToken.PROPERTY_NAME) { - String n = _streamReadContext.currentName(); - writer.write(n); - return n.length(); + JsonToken t = _currToken; + if (t == JsonToken.VALUE_STRING) { + if (_tokenIncomplete) { + _tokenIncomplete = false; + _finishString(); // only strings can be incomplete } - if (t != null) { - if (t.isNumeric()) { - return _textBuffer.contentsToWriter(writer); - } - char[] ch = t.asCharArray(); - writer.write(ch); - return ch.length; + return _textBuffer.contentsToWriter(writer); + } + if (t == JsonToken.FIELD_NAME) { + String n = _parsingContext.getCurrentName(); + writer.write(n); + return n.length(); + } + if (t != null) { + if (t.isNumeric()) { + return _textBuffer.contentsToWriter(writer); } - } catch (IOException e) { - throw _wrapIOFailure(e); + char[] ch = t.asCharArray(); + writer.write(ch); + return ch.length; } return 0; } // // // Let's override default impls for improved performance + // @since 2.1 @Override - public final String getValueAsString() throws JacksonException + public final String getValueAsString() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { @@ -345,14 +364,15 @@ public final String getValueAsString() throws JacksonException } return _textBuffer.contentsAsString(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return currentName(); + if (_currToken == JsonToken.FIELD_NAME) { + return getCurrentName(); } return super.getValueAsString(null); } + // @since 2.1 @Override - public final String getValueAsString(String defValue) throws JacksonException { + public final String getValueAsString(String defValue) throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { _tokenIncomplete = false; @@ -360,8 +380,8 @@ public final String getValueAsString(String defValue) throws JacksonException { } return _textBuffer.contentsAsString(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return currentName(); + if (_currToken == JsonToken.FIELD_NAME) { + return getCurrentName(); } return super.getValueAsString(defValue); } @@ -371,8 +391,8 @@ protected final String _getText2(JsonToken t) { return null; } switch (t.id()) { - case ID_PROPERTY_NAME: - return _streamReadContext.currentName(); + case ID_FIELD_NAME: + return _parsingContext.getCurrentName(); case ID_STRING: // fall through @@ -385,12 +405,23 @@ protected final String _getText2(JsonToken t) { } @Override - public final char[] getTextCharacters() throws JacksonException + public final char[] getTextCharacters() throws IOException { if (_currToken != null) { // null only before/after document switch (_currToken.id()) { - case ID_PROPERTY_NAME: - return currentNameInBuffer(); + case ID_FIELD_NAME: + if (!_nameCopied) { + String name = _parsingContext.getCurrentName(); + int nameLen = name.length(); + if (_nameCopyBuffer == null) { + _nameCopyBuffer = _ioContext.allocNameCopyBuffer(nameLen); + } else if (_nameCopyBuffer.length < nameLen) { + _nameCopyBuffer = new char[nameLen]; + } + name.getChars(0, nameLen, _nameCopyBuffer, 0); + _nameCopied = true; + } + return _nameCopyBuffer; case ID_STRING: if (_tokenIncomplete) { _tokenIncomplete = false; @@ -408,12 +439,12 @@ public final char[] getTextCharacters() throws JacksonException } @Override - public final int getTextLength() throws JacksonException + public final int getTextLength() throws IOException { if (_currToken != null) { // null only before/after document switch (_currToken.id()) { - case ID_PROPERTY_NAME: - return _streamReadContext.currentName().length(); + case ID_FIELD_NAME: + return _parsingContext.getCurrentName().length(); case ID_STRING: if (_tokenIncomplete) { _tokenIncomplete = false; @@ -431,12 +462,12 @@ public final int getTextLength() throws JacksonException } @Override - public final int getTextOffset() throws JacksonException + public final int getTextOffset() throws IOException { // Most have offset of 0, only some may have other values: if (_currToken != null) { switch (_currToken.id()) { - case ID_PROPERTY_NAME: + case ID_FIELD_NAME: return 0; case ID_STRING: if (_tokenIncomplete) { @@ -454,7 +485,7 @@ public final int getTextOffset() throws JacksonException } @Override - public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException + public byte[] getBinaryValue(Base64Variant b64variant) throws IOException { if ((_currToken == JsonToken.VALUE_EMBEDDED_OBJECT) && (_binaryValue != null)) { return _binaryValue; @@ -467,11 +498,11 @@ public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException try { _binaryValue = _decodeBase64(b64variant); } catch (IllegalArgumentException iae) { - throw _constructReadException("Failed to decode VALUE_STRING as base64 (%s): %s", - b64variant, iae.getMessage()); + throw _constructError("Failed to decode VALUE_STRING as base64 ("+b64variant+"): "+iae.getMessage()); } - // let's clear incomplete only now; allows for accessing other - // textual content in error cases + /* let's clear incomplete only now; allows for accessing other + * textual content in error cases + */ _tokenIncomplete = false; } else { // may actually require conversion... if (_binaryValue == null) { @@ -485,16 +516,12 @@ public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException } @Override - public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws JacksonException + public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException { // if we have already read the token, just use whatever we may have if (!_tokenIncomplete || _currToken != JsonToken.VALUE_STRING) { byte[] b = getBinaryValue(b64variant); - try { - out.write(b); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + out.write(b); return b.length; } // otherwise do "real" incremental parsing... @@ -506,7 +533,7 @@ public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws Ja } } - protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buffer) throws JacksonException + protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buffer) throws IOException { int outputPtr = 0; final int outputEnd = buffer.length - 3; @@ -535,11 +562,7 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buf // enough room? If not, flush if (outputPtr > outputEnd) { outputCount += outputPtr; - try { - out.write(buffer, 0, outputPtr); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + out.write(buffer, 0, outputPtr); outputPtr = 0; } @@ -567,7 +590,7 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buf // First branch: can get padding (-> 1 byte) if (bits < 0) { if (bits != Base64Variant.BASE64_VALUE_PADDING) { - // could also just be missing padding + // as per [JACKSON-631], could also just be 'missing' padding if (ch == '"') { decodedData >>= 4; buffer[outputPtr++] = (byte) decodedData; @@ -587,7 +610,7 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buf ch = _inputBuffer[_inputPtr++]; if (!b64variant.usesPaddingChar(ch)) { if (_decodeBase64Escape(b64variant, ch, 3) != Base64Variant.BASE64_VALUE_PADDING) { - _reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); + throw reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); } } // Got 12 bits, only need 8, need to shift @@ -606,7 +629,7 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buf bits = b64variant.decodeBase64Char(ch); if (bits < 0) { if (bits != Base64Variant.BASE64_VALUE_PADDING) { - // as per could also just be missing padding + // as per [JACKSON-631], could also just be 'missing' padding if (ch == '"') { decodedData >>= 2; buffer[outputPtr++] = (byte) (decodedData >> 8); @@ -641,19 +664,15 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buf _tokenIncomplete = false; if (outputPtr > 0) { outputCount += outputPtr; - try { - out.write(buffer, 0, outputPtr); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + out.write(buffer, 0, outputPtr); } return outputCount; } /* - /********************************************************************** + /********************************************************** /* Public API, traversal - /********************************************************************** + /********************************************************** */ /** @@ -661,13 +680,13 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buf * to indicate end-of-input */ @Override - public final JsonToken nextToken() throws JacksonException + public final JsonToken nextToken() throws IOException { - /* First: Object Property names are special -- we will always tokenize - * (part of) value along with the property name to simplify + /* First: field names are special -- we will always tokenize + * (part of) value along with field name to simplify * state handling. If so, can and need to use secondary token: */ - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { return _nextAfterName(); } // But if we didn't already have a name, and (partially?) decode number, @@ -693,11 +712,11 @@ public final JsonToken nextToken() throws JacksonException } // Nope: do we then expect a comma? - if (_streamReadContext.expectComma()) { + if (_parsingContext.expectComma()) { i = _skipComma(i); // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { if ((i == INT_RBRACKET) || (i == INT_RCURLY)) { _closeScope(i); return _currToken; @@ -708,13 +727,13 @@ public final JsonToken nextToken() throws JacksonException /* And should we now have a name? Always true for Object contexts, since * the intermediate 'expect-value' state is never retained. */ - boolean inObject = _streamReadContext.inObject(); + boolean inObject = _parsingContext.inObject(); if (inObject) { - // First, the property name itself: + // First, field name itself: _updateNameLocation(); String name = (i == INT_QUOTE) ? _parseName() : _handleOddName(i); - _streamReadContext.setCurrentName(name); - _currToken = JsonToken.PROPERTY_NAME; + _parsingContext.setCurrentName(name); + _currToken = JsonToken.FIELD_NAME; i = _skipColon(); } _updateLocation(); @@ -730,13 +749,13 @@ public final JsonToken nextToken() throws JacksonException break; case '[': if (!inObject) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } t = JsonToken.START_ARRAY; break; case '{': if (!inObject) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } t = JsonToken.START_OBJECT; break; @@ -802,15 +821,15 @@ private final JsonToken _nextAfterName() // Also: may need to start new context? if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return (_currToken = t); } @Override - public void finishToken() throws JacksonException { + public void finishToken() throws IOException { if (_tokenIncomplete) { _tokenIncomplete = false; _finishString(); // only strings can be incomplete @@ -818,18 +837,19 @@ public void finishToken() throws JacksonException { } /* - /********************************************************************** + /********************************************************** /* Public API, nextXxx() overrides - /********************************************************************** + /********************************************************** */ + // Implemented since 2.7 @Override - public boolean nextName(SerializableString sstr) throws JacksonException + public boolean nextFieldName(SerializableString sstr) throws IOException { // // // Note: most of code below is copied from nextToken() _numTypesValid = NR_UNKNOWN; - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { _nextAfterName(); return false; } @@ -850,11 +870,11 @@ public boolean nextName(SerializableString sstr) throws JacksonException return false; } - if (_streamReadContext.expectComma()) { + if (_parsingContext.expectComma()) { i = _skipComma(i); // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { if ((i == INT_RBRACKET) || (i == INT_RCURLY)) { _closeScope(i); return false; @@ -862,7 +882,7 @@ public boolean nextName(SerializableString sstr) throws JacksonException } } - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _updateLocation(); _nextTokenNotInObject(i); return false; @@ -883,7 +903,7 @@ public boolean nextName(SerializableString sstr) throws JacksonException int ptr = _inputPtr; while (true) { if (ptr == end) { // yes, match! - _streamReadContext.setCurrentName(sstr.getValue()); + _parsingContext.setCurrentName(sstr.getValue()); _isNextTokenNameYes(_skipColonFast(ptr+1)); return true; } @@ -900,12 +920,12 @@ public boolean nextName(SerializableString sstr) throws JacksonException } @Override - public String nextName() throws JacksonException + public String nextFieldName() throws IOException { // // // Note: this is almost a verbatim copy of nextToken() (minus comments) _numTypesValid = NR_UNKNOWN; - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { _nextAfterName(); return null; } @@ -923,16 +943,16 @@ public String nextName() throws JacksonException _closeScope(i); return null; } - if (_streamReadContext.expectComma()) { + if (_parsingContext.expectComma()) { i = _skipComma(i); - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { if ((i == INT_RBRACKET) || (i == INT_RCURLY)) { _closeScope(i); return null; } } } - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _updateLocation(); _nextTokenNotInObject(i); return null; @@ -940,8 +960,8 @@ public String nextName() throws JacksonException _updateNameLocation(); String name = (i == INT_QUOTE) ? _parseName() : _handleOddName(i); - _streamReadContext.setCurrentName(name); - _currToken = JsonToken.PROPERTY_NAME; + _parsingContext.setCurrentName(name); + _currToken = JsonToken.FIELD_NAME; i = _skipColon(); _updateLocation(); @@ -1000,9 +1020,9 @@ public String nextName() throws JacksonException return name; } - private final void _isNextTokenNameYes(int i) throws JacksonException + private final void _isNextTokenNameYes(int i) throws IOException { - _currToken = JsonToken.PROPERTY_NAME; + _currToken = JsonToken.FIELD_NAME; _updateLocation(); switch (i) { @@ -1050,12 +1070,12 @@ private final void _isNextTokenNameYes(int i) throws JacksonException _nextToken = _handleOddValue(i); } - protected boolean _isNextTokenNameMaybe(int i, String nameToMatch) throws JacksonException + protected boolean _isNextTokenNameMaybe(int i, String nameToMatch) throws IOException { // // // and this is back to standard nextToken() String name = (i == INT_QUOTE) ? _parseName() : _handleOddName(i); - _streamReadContext.setCurrentName(name); - _currToken = JsonToken.PROPERTY_NAME; + _parsingContext.setCurrentName(name); + _currToken = JsonToken.FIELD_NAME; i = _skipColon(); _updateLocation(); if (i == INT_QUOTE) { @@ -1110,7 +1130,7 @@ protected boolean _isNextTokenNameMaybe(int i, String nameToMatch) throws Jackso return nameToMatch.equals(name); } - private final JsonToken _nextTokenNotInObject(int i) throws JacksonException + private final JsonToken _nextTokenNotInObject(int i) throws IOException { if (i == INT_QUOTE) { _tokenIncomplete = true; @@ -1118,10 +1138,10 @@ private final JsonToken _nextTokenNotInObject(int i) throws JacksonException } switch (i) { case '[': - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); return (_currToken = JsonToken.START_ARRAY); case '{': - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); return (_currToken = JsonToken.START_OBJECT); case 't': _matchToken("true", 1); @@ -1162,10 +1182,10 @@ private final JsonToken _nextTokenNotInObject(int i) throws JacksonException // case ']': // 11-May-2020, tatu: related to [core#616], this should never be reached case ',': // 11-May-2020, tatu: [core#616] No commas in root level - if (!_streamReadContext.inRoot()) { - if ((_formatReadFeatures & FEAT_MASK_ALLOW_MISSING) != 0) { + if (!_parsingContext.inRoot()) { + if ((_features & FEAT_MASK_ALLOW_MISSING) != 0) { --_inputPtr; - return (_currToken = JsonToken.VALUE_NULL); + return (_currToken = JsonToken.VALUE_NULL); } } } @@ -1173,9 +1193,9 @@ private final JsonToken _nextTokenNotInObject(int i) throws JacksonException } // note: identical to one in UTF8StreamJsonParser @Override - public final String nextTextValue() throws JacksonException + public final String nextTextValue() throws IOException { - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -1188,9 +1208,9 @@ public final String nextTextValue() throws JacksonException return _textBuffer.contentsAsString(); } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return null; } @@ -1200,9 +1220,9 @@ public final String nextTextValue() throws JacksonException // note: identical to one in Utf8StreamParser @Override - public final int nextIntValue(int defaultValue) throws JacksonException + public final int nextIntValue(int defaultValue) throws IOException { - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -1211,9 +1231,9 @@ public final int nextIntValue(int defaultValue) throws JacksonException return getIntValue(); } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return defaultValue; } @@ -1223,9 +1243,9 @@ public final int nextIntValue(int defaultValue) throws JacksonException // note: identical to one in Utf8StreamParser @Override - public final long nextLongValue(long defaultValue) throws JacksonException + public final long nextLongValue(long defaultValue) throws IOException { - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -1234,9 +1254,9 @@ public final long nextLongValue(long defaultValue) throws JacksonException return getLongValue(); } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return defaultValue; } @@ -1246,9 +1266,9 @@ public final long nextLongValue(long defaultValue) throws JacksonException // note: identical to one in UTF8StreamJsonParser @Override - public final Boolean nextBooleanValue() throws JacksonException + public final Boolean nextBooleanValue() throws IOException { - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -1260,9 +1280,9 @@ public final Boolean nextBooleanValue() throws JacksonException return Boolean.FALSE; } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return null; } @@ -1276,15 +1296,16 @@ public final Boolean nextBooleanValue() throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, number parsing - /********************************************************************** + /********************************************************** */ - protected final JsonToken _parseFloatThatStartsWithPeriod() throws JacksonException + // @since 2.11, [core#611] + protected final JsonToken _parseFloatThatStartsWithPeriod() throws IOException { // [core#611]: allow optionally leading decimal point - if (!isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS)) { + if (!isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS.mappedFeature())) { return _handleOddValue('.'); } return _parseFloat(INT_PERIOD, _inputPtr-1, _inputPtr, false, 0); @@ -1310,10 +1331,10 @@ protected final JsonToken _parseFloatThatStartsWithPeriod() throws JacksonExcept * @return Type of token decoded, usually {@link JsonToken#VALUE_NUMBER_INT} * or {@link JsonToken#VALUE_NUMBER_FLOAT} * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - protected final JsonToken _parsePosNumber(int ch) throws JacksonException + protected final JsonToken _parsePosNumber(int ch) throws IOException { /* Although we will always be complete with respect to textual * representation (that is, all characters will be parsed), @@ -1358,7 +1379,7 @@ protected final JsonToken _parsePosNumber(int ch) throws JacksonException --ptr; // need to push back following separator _inputPtr = ptr; // As per #105, need separating space between root values; check here - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(ch); } int len = ptr-startPtr; @@ -1367,7 +1388,7 @@ protected final JsonToken _parsePosNumber(int ch) throws JacksonException } private final JsonToken _parseFloat(int ch, int startPtr, int ptr, boolean neg, int intLen) - throws JacksonException + throws IOException { final int inputLen = _inputEnd; int fractLen = 0; @@ -1387,7 +1408,7 @@ private final JsonToken _parseFloat(int ch, int startPtr, int ptr, boolean neg, } // must be followed by sequence of ints, one minimum if (fractLen == 0) { - _reportUnexpectedNumberChar(ch, "Decimal point not followed by a digit"); + reportUnexpectedNumberChar(ch, "Decimal point not followed by a digit"); } } int expLen = 0; @@ -1415,13 +1436,13 @@ private final JsonToken _parseFloat(int ch, int startPtr, int ptr, boolean neg, } // must be followed by sequence of ints, one minimum if (expLen == 0) { - _reportUnexpectedNumberChar(ch, "Exponent indicator not followed by a digit"); + reportUnexpectedNumberChar(ch, "Exponent indicator not followed by a digit"); } } --ptr; // need to push back following separator _inputPtr = ptr; // As per #105, need separating space between root values; check here - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(ch); } int len = ptr-startPtr; @@ -1430,7 +1451,7 @@ private final JsonToken _parseFloat(int ch, int startPtr, int ptr, boolean neg, return resetFloat(neg, intLen, fractLen, expLen); } - protected final JsonToken _parseNegNumber() throws JacksonException + protected final JsonToken _parseNegNumber() throws IOException { int ptr = _inputPtr; int startPtr = ptr-1; // to include sign/digit already read @@ -1470,7 +1491,7 @@ protected final JsonToken _parseNegNumber() throws JacksonException } --ptr; _inputPtr = ptr; - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(ch); } int len = ptr-startPtr; @@ -1491,10 +1512,10 @@ protected final JsonToken _parseNegNumber() throws JacksonException * @return Type of token decoded, usually {@link JsonToken#VALUE_NUMBER_INT} * or {@link JsonToken#VALUE_NUMBER_FLOAT} * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - private final JsonToken _parseNumber2(boolean neg, int startPtr) throws JacksonException + private final JsonToken _parseNumber2(boolean neg, int startPtr) throws IOException { _inputPtr = neg ? (startPtr+1) : startPtr; char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); @@ -1564,7 +1585,7 @@ private final JsonToken _parseNumber2(boolean neg, int startPtr) throws JacksonE } // must be followed by sequence of ints, one minimum if (fractLen == 0) { - _reportUnexpectedNumberChar(c, "Decimal point not followed by a digit"); + reportUnexpectedNumberChar(c, "Decimal point not followed by a digit"); } } @@ -1577,7 +1598,7 @@ private final JsonToken _parseNumber2(boolean neg, int startPtr) throws JacksonE outBuf[outPtr++] = c; // Not optional, can require that we get one more char c = (_inputPtr < _inputEnd) ? _inputBuffer[_inputPtr++] - : getNextChar("expected a digit for number exponent", JsonToken.VALUE_NUMBER_FLOAT); + : getNextChar("expected a digit for number exponent"); // Sign indicator? if (c == '-' || c == '+') { if (outPtr >= outBuf.length) { @@ -1587,7 +1608,7 @@ private final JsonToken _parseNumber2(boolean neg, int startPtr) throws JacksonE outBuf[outPtr++] = c; // Likewise, non optional: c = (_inputPtr < _inputEnd) ? _inputBuffer[_inputPtr++] - : getNextChar("expected a digit for number exponent", JsonToken.VALUE_NUMBER_FLOAT); + : getNextChar("expected a digit for number exponent"); } exp_loop: @@ -1606,14 +1627,14 @@ private final JsonToken _parseNumber2(boolean neg, int startPtr) throws JacksonE } // must be followed by sequence of ints, one minimum if (expLen == 0) { - _reportUnexpectedNumberChar(c, "Exponent indicator not followed by a digit"); + reportUnexpectedNumberChar(c, "Exponent indicator not followed by a digit"); } } // Ok; unless we hit end-of-input, need to push last char read back if (!eof) { --_inputPtr; - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(c); } } @@ -1624,7 +1645,7 @@ private final JsonToken _parseNumber2(boolean neg, int startPtr) throws JacksonE // Method called when we have seen one zero, and want to ensure // it is not followed by another - private final char _verifyNoLeadingZeroes() throws JacksonException + private final char _verifyNoLeadingZeroes() throws IOException { // Fast case first: if (_inputPtr < _inputEnd) { @@ -1638,7 +1659,7 @@ private final char _verifyNoLeadingZeroes() throws JacksonException return _verifyNLZ2(); } - private char _verifyNLZ2() throws JacksonException + private char _verifyNLZ2() throws IOException { if (_inputPtr >= _inputEnd && !_loadMore()) { return '0'; @@ -1647,8 +1668,8 @@ private char _verifyNLZ2() throws JacksonException if (ch < '0' || ch > '9') { return '0'; } - if (!isEnabled(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS)) { - _reportInvalidNumber("Leading zeroes not allowed"); + if ((_features & FEAT_MASK_LEADING_ZEROS) == 0) { + reportInvalidNumber("Leading zeroes not allowed"); } // if so, just need to skip either all zeroes (if followed by number); or all but one (if non-number) ++_inputPtr; // Leading zero to be skipped @@ -1669,7 +1690,7 @@ private char _verifyNLZ2() throws JacksonException // Method called if expected numeric value (due to leading sign) does not // look like a number - protected JsonToken _handleInvalidNumberStart(int ch, boolean negative) throws JacksonException + protected JsonToken _handleInvalidNumberStart(int ch, boolean negative) throws IOException { if (ch == 'I') { if (_inputPtr >= _inputEnd) { @@ -1681,20 +1702,20 @@ protected JsonToken _handleInvalidNumberStart(int ch, boolean negative) throws J if (ch == 'N') { String match = negative ? "-INF" :"+INF"; _matchToken(match, 3); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN(match, negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY); } _reportError("Non-standard token '"+match+"': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow"); } else if (ch == 'n') { String match = negative ? "-Infinity" :"+Infinity"; _matchToken(match, 3); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN(match, negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY); } _reportError("Non-standard token '"+match+"': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow"); } } - _reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); + reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); return null; } @@ -1707,10 +1728,10 @@ protected JsonToken _handleInvalidNumberStart(int ch, boolean negative) throws J * * @param ch First character of likely white space to skip * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid white space) */ - private final void _verifyRootSpace(int ch) throws JacksonException + private final void _verifyRootSpace(int ch) throws IOException { // caller had pushed it back, before calling; reset ++_inputPtr; @@ -1730,12 +1751,12 @@ private final void _verifyRootSpace(int ch) throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, secondary parsing - /********************************************************************** + /********************************************************** */ - protected final String _parseName() throws JacksonException + protected final String _parseName() throws IOException { // First: let's try to see if we have a simple name: one that does // not cross input buffer boundary, and does not contain escape sequences. @@ -1761,7 +1782,7 @@ protected final String _parseName() throws JacksonException return _parseName2(start, hash, INT_QUOTE); } - private String _parseName2(int startPtr, int hash, int endChar) throws JacksonException + private String _parseName2(int startPtr, int hash, int endChar) throws IOException { _textBuffer.resetWithShared(_inputBuffer, startPtr, (_inputPtr - startPtr)); @@ -1774,7 +1795,7 @@ private String _parseName2(int startPtr, int hash, int endChar) throws JacksonEx while (true) { if (_inputPtr >= _inputEnd) { if (!_loadMore()) { - _reportInvalidEOF(" in property name", JsonToken.PROPERTY_NAME); + _reportInvalidEOF(" in field name", JsonToken.FIELD_NAME); } } char c = _inputBuffer[_inputPtr++]; @@ -1817,26 +1838,26 @@ private String _parseName2(int startPtr, int hash, int endChar) throws JacksonEx /** * Method called when we see non-white space character other - * than double quote, when expecting an Object property name. + * than double quote, when expecting a field name. * In standard mode will just throw an expection; but * in non-standard modes may be able to parse name. * - * @param i First not-yet-decoded character of possible "odd name" to decode + * @param i First undecoded character of possible "odd name" to decode * * @return Name decoded, if allowed and successful * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid name) */ - protected String _handleOddName(int i) throws JacksonException + protected String _handleOddName(int i) throws IOException { - // Allow single quotes? - if (i == '\'' && isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)) { + // [JACKSON-173]: allow single quotes + if (i == '\'' && (_features & FEAT_MASK_ALLOW_SINGLE_QUOTES) != 0) { return _parseAposName(); } - // Allow unquoted names if feature enabled: - if (!isEnabled(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES)) { - _reportUnexpectedChar(i, "was expecting double-quote to start property name"); + // [JACKSON-69]: allow unquoted names if feature enabled: + if ((_features & FEAT_MASK_ALLOW_UNQUOTED_NAMES) == 0) { + _reportUnexpectedChar(i, "was expecting double-quote to start field name"); } final int[] codes = CharTypes.getInputCodeLatin1JsNames(); final int maxCode = codes.length; @@ -1844,13 +1865,13 @@ protected String _handleOddName(int i) throws JacksonException // Also: first char must be a valid name char, but NOT be number boolean firstOk; - if (i < maxCode) { // identifier, or a number ([jackson-core#102]) + if (i < maxCode) { // identifier, or a number ([Issue#102]) firstOk = (codes[i] == 0); } else { firstOk = Character.isJavaIdentifierPart((char) i); } if (!firstOk) { - _reportUnexpectedChar(i, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start property name"); + _reportUnexpectedChar(i, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name"); } int ptr = _inputPtr; int hash = _hashSeed; @@ -1879,9 +1900,9 @@ protected String _handleOddName(int i) throws JacksonException return _handleOddName2(start, hash, codes); } - protected String _parseAposName() throws JacksonException + protected String _parseAposName() throws IOException { - // Note: mostly copy of _parseName() + // Note: mostly copy of_parseFieldName int ptr = _inputPtr; int hash = _hashSeed; final int inputLen = _inputEnd; @@ -1919,10 +1940,10 @@ protected String _parseAposName() throws JacksonException * * @return Type of value decoded, if allowed and successful * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid white space) */ - protected JsonToken _handleOddValue(int i) throws JacksonException + protected JsonToken _handleOddValue(int i) throws IOException { // Most likely an error, unless we are to allow single-quote-strings switch (i) { @@ -1932,22 +1953,23 @@ protected JsonToken _handleOddValue(int i) throws JacksonException * Also, no separation to fast/slow parsing; we'll just do * one regular (~= slowish) parsing, to keep code simple */ - if (isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)) { + if ((_features & FEAT_MASK_ALLOW_SINGLE_QUOTES) != 0) { return _handleApos(); } break; case ']': - // 28-Mar-2016: [core#116]: If Feature.ALLOW_MISSING_VALUES is enabled - // we may allow "missing values", that is, encountering a trailing - // comma or closing marker where value would be expected - if (!_streamReadContext.inArray()) { + /* 28-Mar-2016: [core#116]: If Feature.ALLOW_MISSING_VALUES is enabled + * we may allow "missing values", that is, encountering a trailing + * comma or closing marker where value would be expected + */ + if (!_parsingContext.inArray()) { break; } // fall through case ',': // 11-May-2020, tatu: [core#616] No commas in root level - if (!_streamReadContext.inRoot()) { - if ((_formatReadFeatures & FEAT_MASK_ALLOW_MISSING) != 0) { + if (!_parsingContext.inRoot()) { + if ((_features & FEAT_MASK_ALLOW_MISSING) != 0) { --_inputPtr; return JsonToken.VALUE_NULL; } @@ -1955,14 +1977,14 @@ protected JsonToken _handleOddValue(int i) throws JacksonException break; case 'N': _matchToken("NaN", 1); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN("NaN", Double.NaN); } _reportError("Non-standard token 'NaN': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow"); break; case 'I': _matchToken("Infinity", 1); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN("Infinity", Double.POSITIVE_INFINITY); } _reportError("Non-standard token 'Infinity': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow"); @@ -1984,7 +2006,7 @@ protected JsonToken _handleOddValue(int i) throws JacksonException return null; } - protected JsonToken _handleApos() throws JacksonException + protected JsonToken _handleApos() throws IOException { char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); int outPtr = _textBuffer.getCurrentSegmentSize(); @@ -2025,7 +2047,7 @@ protected JsonToken _handleApos() throws JacksonException return JsonToken.VALUE_STRING; } - private String _handleOddName2(int startPtr, int hash, int[] codes) throws JacksonException + private String _handleOddName2(int startPtr, int hash, int[] codes) throws IOException { _textBuffer.resetWithShared(_inputBuffer, startPtr, (_inputPtr - startPtr)); char[] outBuf = _textBuffer.getCurrentSegment(); @@ -2069,7 +2091,8 @@ private String _handleOddName2(int startPtr, int hash, int[] codes) throws Jacks } } - protected final void _finishString() throws JacksonException + @Override + protected final void _finishString() throws IOException { /* First: let's try to see if we have simple String value: one * that does not cross input buffer boundary, and does not @@ -2103,7 +2126,7 @@ protected final void _finishString() throws JacksonException _finishString2(); } - protected void _finishString2() throws JacksonException + protected void _finishString2() throws IOException { char[] outBuf = _textBuffer.getCurrentSegment(); int outPtr = _textBuffer.getCurrentSegmentSize(); @@ -2148,10 +2171,10 @@ protected void _finishString2() throws JacksonException * if it is not needed. This can be done bit faster if contents * need not be stored for future access. * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid white space) */ - protected final void _skipString() throws JacksonException + protected final void _skipString() throws IOException { _tokenIncomplete = false; @@ -2194,14 +2217,14 @@ protected final void _skipString() throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, other parsing - /********************************************************************** + /********************************************************** */ // We actually need to check the character value here // (to see if we have \n following \r). - protected final void _skipCR() throws JacksonException { + protected final void _skipCR() throws IOException { if (_inputPtr < _inputEnd || _loadMore()) { if (_inputBuffer[_inputPtr] == '\n') { ++_inputPtr; @@ -2211,7 +2234,7 @@ protected final void _skipCR() throws JacksonException { _currInputRowStart = _inputPtr; } - private final int _skipColon() throws JacksonException + private final int _skipColon() throws IOException { if ((_inputPtr + 4) >= _inputEnd) { return _skipColon2(false); @@ -2265,7 +2288,7 @@ private final int _skipColon() throws JacksonException return _skipColon2(false); } - private final int _skipColon2(boolean gotColon) throws JacksonException + private final int _skipColon2(boolean gotColon) throws IOException { while (_inputPtr < _inputEnd || _loadMore()) { int i = (int) _inputBuffer[_inputPtr++]; @@ -2283,7 +2306,7 @@ private final int _skipColon2(boolean gotColon) throws JacksonException return i; } if (i != INT_COLON) { - _reportUnexpectedChar(i, "was expecting a colon to separate property name and value"); + _reportUnexpectedChar(i, "was expecting a colon to separate field name and value"); } gotColon = true; continue; @@ -2299,13 +2322,13 @@ private final int _skipColon2(boolean gotColon) throws JacksonException } } } - _reportInvalidEOF(" within/between "+_streamReadContext.typeDesc()+" entries", + _reportInvalidEOF(" within/between "+_parsingContext.typeDesc()+" entries", null); return -1; } // Variant called when we know there's at least 4 more bytes available - private final int _skipColonFast(int ptr) throws JacksonException + private final int _skipColonFast(int ptr) throws IOException { int i = (int) _inputBuffer[ptr++]; if (i == INT_COLON) { // common case, no leading space @@ -2353,10 +2376,10 @@ private final int _skipColonFast(int ptr) throws JacksonException } // Primary loop: no reloading, comment handling - private final int _skipComma(int i) throws JacksonException + private final int _skipComma(int i) throws IOException { if (i != INT_COMMA) { - _reportUnexpectedChar(i, "was expecting comma to separate "+_streamReadContext.typeDesc()+" entries"); + _reportUnexpectedChar(i, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries"); } while (_inputPtr < _inputEnd) { i = (int) _inputBuffer[_inputPtr++]; @@ -2381,7 +2404,7 @@ private final int _skipComma(int i) throws JacksonException return _skipAfterComma2(); } - private final int _skipAfterComma2() throws JacksonException + private final int _skipAfterComma2() throws IOException { while (_inputPtr < _inputEnd || _loadMore()) { int i = (int) _inputBuffer[_inputPtr++]; @@ -2408,10 +2431,10 @@ private final int _skipAfterComma2() throws JacksonException } } } - throw _constructReadException("Unexpected end-of-input within/between "+_streamReadContext.typeDesc()+" entries"); + throw _constructError("Unexpected end-of-input within/between "+_parsingContext.typeDesc()+" entries"); } - private final int _skipWSOrEnd() throws JacksonException + private final int _skipWSOrEnd() throws IOException { // Let's handle first character separately since it is likely that // it is either non-whitespace; or we have longer run of white space @@ -2462,7 +2485,7 @@ private final int _skipWSOrEnd() throws JacksonException return _skipWSOrEnd2(); } - private int _skipWSOrEnd2() throws JacksonException + private int _skipWSOrEnd2() throws IOException { while (true) { if (_inputPtr >= _inputEnd) { @@ -2495,9 +2518,9 @@ private int _skipWSOrEnd2() throws JacksonException } } - private void _skipComment() throws JacksonException + private void _skipComment() throws IOException { - if (!isEnabled(JsonReadFeature.ALLOW_JAVA_COMMENTS)) { + if ((_features & FEAT_MASK_ALLOW_JAVA_COMMENTS) == 0) { _reportUnexpectedChar('/', "maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser)"); } // First: check which comment (if either) it is: @@ -2514,7 +2537,7 @@ private void _skipComment() throws JacksonException } } - private void _skipCComment() throws JacksonException + private void _skipCComment() throws IOException { // Ok: need the matching '*/' while ((_inputPtr < _inputEnd) || _loadMore()) { @@ -2545,16 +2568,16 @@ private void _skipCComment() throws JacksonException _reportInvalidEOF(" in a comment", null); } - private boolean _skipYAMLComment() throws JacksonException + private boolean _skipYAMLComment() throws IOException { - if (!isEnabled(JsonReadFeature.ALLOW_YAML_COMMENTS)) { + if ((_features & FEAT_MASK_ALLOW_YAML_COMMENTS) == 0) { return false; } _skipLine(); return true; } - private void _skipLine() throws JacksonException + private void _skipLine() throws IOException { // Ok: need to find EOF or linefeed while ((_inputPtr < _inputEnd) || _loadMore()) { @@ -2575,7 +2598,7 @@ private void _skipLine() throws JacksonException } @Override - protected char _decodeEscaped() throws JacksonException + protected char _decodeEscaped() throws IOException { if (_inputPtr >= _inputEnd) { if (!_loadMore()) { @@ -2628,7 +2651,7 @@ protected char _decodeEscaped() throws JacksonException return (char) value; } - private final void _matchTrue() throws JacksonException { + private final void _matchTrue() throws IOException { int ptr = _inputPtr; if ((ptr + 3) < _inputEnd) { final char[] b = _inputBuffer; @@ -2644,7 +2667,7 @@ private final void _matchTrue() throws JacksonException { _matchToken("true", 1); } - private final void _matchFalse() throws JacksonException { + private final void _matchFalse() throws IOException { int ptr = _inputPtr; if ((ptr + 4) < _inputEnd) { final char[] b = _inputBuffer; @@ -2660,7 +2683,7 @@ private final void _matchFalse() throws JacksonException { _matchToken("false", 1); } - private final void _matchNull() throws JacksonException { + private final void _matchNull() throws IOException { int ptr = _inputPtr; if ((ptr + 3) < _inputEnd) { final char[] b = _inputBuffer; @@ -2677,7 +2700,7 @@ private final void _matchNull() throws JacksonException { } // Helper method for checking whether input matches expected token - protected final void _matchToken(String matchStr, int i) throws JacksonException + protected final void _matchToken(String matchStr, int i) throws IOException { final int len = matchStr.length(); if ((_inputPtr + len) >= _inputEnd) { @@ -2697,7 +2720,7 @@ protected final void _matchToken(String matchStr, int i) throws JacksonException } } - private final void _matchToken2(String matchStr, int i) throws JacksonException + private final void _matchToken2(String matchStr, int i) throws IOException { final int len = matchStr.length(); do { @@ -2718,7 +2741,7 @@ private final void _matchToken2(String matchStr, int i) throws JacksonException } } - private final void _checkMatchEnd(String matchStr, int i, int c) throws JacksonException { + private final void _checkMatchEnd(String matchStr, int i, int c) throws IOException { // but actually only alphanums are problematic char ch = (char) c; if (Character.isJavaIdentifierPart(ch)) { @@ -2727,9 +2750,9 @@ private final void _checkMatchEnd(String matchStr, int i, int c) throws JacksonE } /* - /********************************************************************** + /********************************************************** /* Binary access - /********************************************************************** + /********************************************************** */ /** @@ -2740,11 +2763,11 @@ private final void _checkMatchEnd(String matchStr, int i, int c) throws JacksonE * * @return Fully decoded value of base64 content * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid content) */ @SuppressWarnings("resource") - protected byte[] _decodeBase64(Base64Variant b64variant) throws JacksonException + protected byte[] _decodeBase64(Base64Variant b64variant) throws IOException { ByteArrayBuilder builder = _getByteArrayBuilder(); @@ -2812,7 +2835,7 @@ protected byte[] _decodeBase64(Base64Variant b64variant) throws JacksonException ch = _inputBuffer[_inputPtr++]; if (!b64variant.usesPaddingChar(ch)) { if (_decodeBase64Escape(b64variant, ch, 3) != Base64Variant.BASE64_VALUE_PADDING) { - _reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); + throw reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); } } // Got 12 bits, only need 8, need to shift @@ -2863,15 +2886,15 @@ protected byte[] _decodeBase64(Base64Variant b64variant) throws JacksonException } /* - /********************************************************************** - /* Internal methods, location updating - /********************************************************************** + /********************************************************** + /* Internal methods, location updating (refactored in 2.7) + /********************************************************** */ @Override - public JsonLocation currentTokenLocation() + public JsonLocation getTokenLocation() { - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { long total = _currInputProcessed + (_nameStartOffset-1); return new JsonLocation(_contentReference(), -1L, total, _nameStartRow, _nameStartCol); @@ -2881,7 +2904,7 @@ public JsonLocation currentTokenLocation() } @Override - public JsonLocation currentLocation() { + public JsonLocation getCurrentLocation() { final int col = _inputPtr - _currInputRowStart + 1; // 1-based return new JsonLocation(_contentReference(), -1L, _currInputProcessed + _inputPtr, @@ -2907,16 +2930,16 @@ private final void _updateNameLocation() } /* - /********************************************************************** + /********************************************************** /* Error reporting - /********************************************************************** + /********************************************************** */ - protected void _reportInvalidToken(String matchedPart) throws JacksonException { + protected void _reportInvalidToken(String matchedPart) throws IOException { _reportInvalidToken(matchedPart, _validJsonTokenList()); } - protected void _reportInvalidToken(String matchedPart, String msg) throws JacksonException + protected void _reportInvalidToken(String matchedPart, String msg) throws IOException { /* Let's just try to find what appears to be the token, using * regular Java identifier character rules. It's just a heuristic, @@ -2935,31 +2958,30 @@ protected void _reportInvalidToken(String matchedPart, String msg) throws Jackso break; } } - throw _constructReadException("Unrecognized token '%s': was expecting %s", sb, msg); + _reportError("Unrecognized token '%s': was expecting %s", sb, msg); } /* - /********************************************************************** + /********************************************************** /* Internal methods, other - /********************************************************************** + /********************************************************** */ - private void _closeScope(int i) throws StreamReadException - { + private void _closeScope(int i) throws JsonParseException { if (i == INT_RBRACKET) { _updateLocation(); - if (!_streamReadContext.inArray()) { + if (!_parsingContext.inArray()) { _reportMismatchedEndMarker(i, '}'); } - _streamReadContext = _streamReadContext.clearAndGetParent(); + _parsingContext = _parsingContext.clearAndGetParent(); _currToken = JsonToken.END_ARRAY; } if (i == INT_RCURLY) { _updateLocation(); - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _reportMismatchedEndMarker(i, ']'); } - _streamReadContext = _streamReadContext.clearAndGetParent(); + _parsingContext = _parsingContext.clearAndGetParent(); _currToken = JsonToken.END_OBJECT; } } diff --git a/src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java b/src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java index 382015c653..3d2fd99777 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java +++ b/src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java @@ -1,15 +1,10 @@ package com.fasterxml.jackson.core.json; -import java.io.DataInput; -import java.io.EOFException; -import java.io.IOException; -import java.io.OutputStream; -import java.io.Writer; +import java.io.*; import java.util.Arrays; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.exc.WrappedIOException; +import com.fasterxml.jackson.core.base.ParserBase; import com.fasterxml.jackson.core.io.CharTypes; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer; @@ -37,12 +32,27 @@ * checks are simplified NOT to check for control characters. * * + * + * @since 2.8 */ public class UTF8DataInputJsonParser - extends JsonParserBase + extends ParserBase { final static byte BYTE_LF = (byte) '\n'; + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_TRAILING_COMMA = Feature.ALLOW_TRAILING_COMMA.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_LEADING_ZEROS = Feature.ALLOW_NUMERIC_LEADING_ZEROS.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_NON_NUM_NUMBERS = Feature.ALLOW_NON_NUMERIC_NUMBERS.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_ALLOW_MISSING = Feature.ALLOW_MISSING_VALUES.getMask(); + private final static int FEAT_MASK_ALLOW_SINGLE_QUOTES = Feature.ALLOW_SINGLE_QUOTES.getMask(); + private final static int FEAT_MASK_ALLOW_UNQUOTED_NAMES = Feature.ALLOW_UNQUOTED_FIELD_NAMES.getMask(); + private final static int FEAT_MASK_ALLOW_JAVA_COMMENTS = Feature.ALLOW_COMMENTS.getMask(); + private final static int FEAT_MASK_ALLOW_YAML_COMMENTS = Feature.ALLOW_YAML_COMMENTS.getMask(); + // This is the main input-code lookup table, fetched eagerly private final static int[] _icUTF8 = CharTypes.getInputCodeUtf8(); @@ -51,20 +61,27 @@ public class UTF8DataInputJsonParser protected final static int[] _icLatin1 = CharTypes.getInputCodeLatin1(); /* - /********************************************************************** + /********************************************************** /* Configuration - /********************************************************************** + /********************************************************** */ /** - * Symbol table that contains Object Property names encountered so far + * Codec used for data binding when (if) requested; typically full + * ObjectMapper, but that abstract is not part of core + * package. */ - protected final ByteQuadsCanonicalizer _symbols; + protected ObjectCodec _objectCodec; + + /** + * Symbol table that contains field names encountered so far + */ + final protected ByteQuadsCanonicalizer _symbols; /* - /********************************************************************** + /********************************************************** /* Parsing state - /********************************************************************** + /********************************************************** */ /** @@ -85,9 +102,9 @@ public class UTF8DataInputJsonParser private int _quad1; /* - /********************************************************************** + /********************************************************** /* Current input data - /********************************************************************** + /********************************************************** */ protected DataInput _inputData; @@ -99,46 +116,61 @@ public class UTF8DataInputJsonParser protected int _nextByte = -1; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ - public UTF8DataInputJsonParser(ObjectReadContext readCtxt, IOContext ctxt, - int stdFeatures, int formatFeatures, DataInput inputData, - ByteQuadsCanonicalizer sym, + public UTF8DataInputJsonParser(IOContext ctxt, int features, DataInput inputData, + ObjectCodec codec, ByteQuadsCanonicalizer sym, int firstByte) { - super(readCtxt, ctxt, stdFeatures, formatFeatures); + super(ctxt, features); + _objectCodec = codec; _symbols = sym; _inputData = inputData; _nextByte = firstByte; } + @Override + public ObjectCodec getCodec() { + return _objectCodec; + } + + @Override + public void setCodec(ObjectCodec c) { + _objectCodec = c; + } + + @Override // @since 2.12 + public JacksonFeatureSet getReadCapabilities() { + return JSON_READ_CAPABILITIES; + } + /* - /********************************************************************** + /********************************************************** /* Overrides for life-cycle - /********************************************************************** + /********************************************************** */ @Override - public int releaseBuffered(OutputStream out) { + public int releaseBuffered(OutputStream out) throws IOException { return 0; } @Override - public Object streamReadInputSource() { + public Object getInputSource() { return _inputData; } /* - /********************************************************************** + /********************************************************** /* Overrides, low-level reading - /********************************************************************** + /********************************************************** */ @Override - protected void _closeInput() { } + protected void _closeInput() throws IOException { } /** * Method called to release internal buffers owned by the base @@ -147,7 +179,7 @@ protected void _closeInput() { } * separately (if need be). */ @Override - protected void _releaseBuffers() + protected void _releaseBuffers() throws IOException { super._releaseBuffers(); // Merge found symbols, if any: @@ -155,13 +187,13 @@ protected void _releaseBuffers() } /* - /********************************************************************** + /********************************************************** /* Public API, data access - /********************************************************************** + /********************************************************** */ @Override - public String getText() throws JacksonException + public String getText() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { @@ -174,39 +206,35 @@ public String getText() throws JacksonException } @Override - public int getText(Writer writer) throws JacksonException + public int getText(Writer writer) throws IOException { JsonToken t = _currToken; - try { - if (t == JsonToken.VALUE_STRING) { - if (_tokenIncomplete) { - _tokenIncomplete = false; - _finishString(); // only strings can be incomplete - } - return _textBuffer.contentsToWriter(writer); - } - if (t == JsonToken.PROPERTY_NAME) { - String n = _streamReadContext.currentName(); - writer.write(n); - return n.length(); + if (t == JsonToken.VALUE_STRING) { + if (_tokenIncomplete) { + _tokenIncomplete = false; + _finishString(); // only strings can be incomplete } - if (t != null) { - if (t.isNumeric()) { - return _textBuffer.contentsToWriter(writer); - } - char[] ch = t.asCharArray(); - writer.write(ch); - return ch.length; + return _textBuffer.contentsToWriter(writer); + } + if (t == JsonToken.FIELD_NAME) { + String n = _parsingContext.getCurrentName(); + writer.write(n); + return n.length(); + } + if (t != null) { + if (t.isNumeric()) { + return _textBuffer.contentsToWriter(writer); } - } catch (IOException e) { - throw _wrapIOFailure(e); + char[] ch = t.asCharArray(); + writer.write(ch); + return ch.length; } return 0; } // // // Let's override default impls for improved performance @Override - public String getValueAsString() throws JacksonException + public String getValueAsString() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { @@ -215,14 +243,14 @@ public String getValueAsString() throws JacksonException } return _textBuffer.contentsAsString(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return currentName(); + if (_currToken == JsonToken.FIELD_NAME) { + return getCurrentName(); } return super.getValueAsString(null); } @Override - public String getValueAsString(String defValue) throws JacksonException + public String getValueAsString(String defValue) throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { @@ -231,14 +259,14 @@ public String getValueAsString(String defValue) throws JacksonException } return _textBuffer.contentsAsString(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return currentName(); + if (_currToken == JsonToken.FIELD_NAME) { + return getCurrentName(); } return super.getValueAsString(defValue); } @Override - public int getValueAsInt() throws JacksonException + public int getValueAsInt() throws IOException { JsonToken t = _currToken; if ((t == JsonToken.VALUE_NUMBER_INT) || (t == JsonToken.VALUE_NUMBER_FLOAT)) { @@ -257,7 +285,7 @@ public int getValueAsInt() throws JacksonException } @Override - public int getValueAsInt(int defValue) throws JacksonException + public int getValueAsInt(int defValue) throws IOException { JsonToken t = _currToken; if ((t == JsonToken.VALUE_NUMBER_INT) || (t == JsonToken.VALUE_NUMBER_FLOAT)) { @@ -281,8 +309,8 @@ protected final String _getText2(JsonToken t) return null; } switch (t.id()) { - case ID_PROPERTY_NAME: - return _streamReadContext.currentName(); + case ID_FIELD_NAME: + return _parsingContext.getCurrentName(); case ID_STRING: // fall through @@ -295,13 +323,25 @@ protected final String _getText2(JsonToken t) } @Override - public char[] getTextCharacters() throws JacksonException + public char[] getTextCharacters() throws IOException { if (_currToken != null) { // null only before/after document switch (_currToken.id()) { - case ID_PROPERTY_NAME: - return currentNameInBuffer(); + case ID_FIELD_NAME: + if (!_nameCopied) { + String name = _parsingContext.getCurrentName(); + int nameLen = name.length(); + if (_nameCopyBuffer == null) { + _nameCopyBuffer = _ioContext.allocNameCopyBuffer(nameLen); + } else if (_nameCopyBuffer.length < nameLen) { + _nameCopyBuffer = new char[nameLen]; + } + name.getChars(0, nameLen, _nameCopyBuffer, 0); + _nameCopied = true; + } + return _nameCopyBuffer; + case ID_STRING: if (_tokenIncomplete) { _tokenIncomplete = false; @@ -320,7 +360,7 @@ public char[] getTextCharacters() throws JacksonException } @Override - public int getTextLength() throws JacksonException + public int getTextLength() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { @@ -329,8 +369,8 @@ public int getTextLength() throws JacksonException } return _textBuffer.size(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return _streamReadContext.currentName().length(); + if (_currToken == JsonToken.FIELD_NAME) { + return _parsingContext.getCurrentName().length(); } if (_currToken != null) { // null only before/after document if (_currToken.isNumeric()) { @@ -342,12 +382,12 @@ public int getTextLength() throws JacksonException } @Override - public int getTextOffset() throws JacksonException + public int getTextOffset() throws IOException { // Most have offset of 0, only some may have other values: if (_currToken != null) { switch (_currToken.id()) { - case ID_PROPERTY_NAME: + case ID_FIELD_NAME: return 0; case ID_STRING: if (_tokenIncomplete) { @@ -365,7 +405,7 @@ public int getTextOffset() throws JacksonException } @Override - public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException + public byte[] getBinaryValue(Base64Variant b64variant) throws IOException { if (_currToken != JsonToken.VALUE_STRING && (_currToken != JsonToken.VALUE_EMBEDDED_OBJECT || _binaryValue == null)) { @@ -377,9 +417,8 @@ public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException if (_tokenIncomplete) { try { _binaryValue = _decodeBase64(b64variant); - } catch (IOException e) { - throw _constructReadException("Failed to decode VALUE_STRING as base64 (%s): %s", - b64variant, e.getMessage()); + } catch (IllegalArgumentException iae) { + throw _constructError("Failed to decode VALUE_STRING as base64 ("+b64variant+"): "+iae.getMessage()); } /* let's clear incomplete only now; allows for accessing other * textual content in error cases @@ -397,32 +436,25 @@ public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException } @Override - public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws JacksonException + public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException { // if we have already read the token, just use whatever we may have if (!_tokenIncomplete || _currToken != JsonToken.VALUE_STRING) { byte[] b = getBinaryValue(b64variant); - try { - out.write(b); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + out.write(b); return b.length; } // otherwise do "real" incremental parsing... byte[] buf = _ioContext.allocBase64Buffer(); try { return _readBinary(b64variant, out, buf); - } catch (IOException e) { - throw _wrapIOFailure(e); } finally { _ioContext.releaseBase64Buffer(buf); } } protected int _readBinary(Base64Variant b64variant, OutputStream out, - byte[] buffer) - throws IOException + byte[] buffer) throws IOException { int outputPtr = 0; final int outputEnd = buffer.length - 3; @@ -486,7 +518,7 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, if (!b64variant.usesPaddingChar(ch)) { if ((ch != INT_BACKSLASH) || _decodeBase64Escape(b64variant, ch, 3) != Base64Variant.BASE64_VALUE_PADDING) { - _reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); + throw reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); } } // Got 12 bits, only need 8, need to shift @@ -542,9 +574,9 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, } /* - /********************************************************************** + /********************************************************** /* Public API, traversal, basic - /********************************************************************** + /********************************************************** */ /** @@ -552,25 +584,18 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, * to indicate end-of-input */ @Override - public JsonToken nextToken() throws JacksonException { + public JsonToken nextToken() throws IOException + { if (_closed) { return null; } - // First: Object property names are special -- we will always tokenize - // (part of) value along with property name to simplify - // state handling. If so, can and need to use secondary token: - try { - if (_currToken == JsonToken.PROPERTY_NAME) { - return _nextAfterName(); - } - return _nextToken(); - } catch (IOException e) { - throw _wrapIOFailure(e); + /* First: field names are special -- we will always tokenize + * (part of) value along with field name to simplify + * state handling. If so, can and need to use secondary token: + */ + if (_currToken == JsonToken.FIELD_NAME) { + return _nextAfterName(); } - } - - private final JsonToken _nextToken() throws IOException - { // But if we didn't already have a name, and (partially?) decode number, // need to ensure no numeric information is leaked _numTypesValid = NR_UNKNOWN; @@ -594,14 +619,14 @@ private final JsonToken _nextToken() throws IOException } // Nope: do we then expect a comma? - if (_streamReadContext.expectComma()) { + if (_parsingContext.expectComma()) { if (i != INT_COMMA) { - _reportUnexpectedChar(i, "was expecting comma to separate "+_streamReadContext.typeDesc()+" entries"); + _reportUnexpectedChar(i, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries"); } i = _skipWS(); // Was that a trailing comma? - if (isEnabled(JsonReadFeature.ALLOW_TRAILING_COMMA)) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { if (i == INT_RBRACKET || i == INT_RCURLY) { _closeScope(i); return _currToken; @@ -613,13 +638,13 @@ private final JsonToken _nextToken() throws IOException * Object contexts, since the intermediate 'expect-value' * state is never retained. */ - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { return _nextTokenNotInObject(i); } - // So first parse the property name itself: + // So first parse the field name itself: String n = _parseName(i); - _streamReadContext.setCurrentName(n); - _currToken = JsonToken.PROPERTY_NAME; + _parsingContext.setCurrentName(n); + _currToken = JsonToken.FIELD_NAME; i = _skipColon(); @@ -688,10 +713,10 @@ private final JsonToken _nextTokenNotInObject(int i) throws IOException } switch (i) { case '[': - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); return (_currToken = JsonToken.START_ARRAY); case '{': - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); return (_currToken = JsonToken.START_OBJECT); case 't': _matchToken("true", 1); @@ -732,15 +757,15 @@ private final JsonToken _nextAfterName() // Also: may need to start new context? if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return (_currToken = t); } @Override - public void finishToken() throws JacksonException { + public void finishToken() throws IOException { if (_tokenIncomplete) { _tokenIncomplete = false; _finishString(); // only strings can be incomplete @@ -748,29 +773,21 @@ public void finishToken() throws JacksonException { } /* - /********************************************************************** - /* Public API, traversal, nextXxxValue/nextName - /********************************************************************** + /********************************************************** + /* Public API, traversal, nextXxxValue/nextFieldName + /********************************************************** */ // Can not implement without look-ahead... -// public boolean nextName(SerializableString str) throws JacksonException +// public boolean nextFieldName(SerializableString str) throws IOException @Override - public String nextName() throws JacksonException { - try { - return _nextName(); - } catch (IOException e) { - throw _wrapIOFailure(e); - } - } - - private final String _nextName() throws IOException + public String nextFieldName() throws IOException { // // // Note: this is almost a verbatim copy of nextToken() _numTypesValid = NR_UNKNOWN; - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { _nextAfterName(); return null; } @@ -787,14 +804,14 @@ private final String _nextName() throws IOException } // Nope: do we then expect a comma? - if (_streamReadContext.expectComma()) { + if (_parsingContext.expectComma()) { if (i != INT_COMMA) { - _reportUnexpectedChar(i, "was expecting comma to separate "+_streamReadContext.typeDesc()+" entries"); + _reportUnexpectedChar(i, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries"); } i = _skipWS(); // Was that a trailing comma? - if (isEnabled(JsonReadFeature.ALLOW_TRAILING_COMMA)) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { if (i == INT_RBRACKET || i == INT_RCURLY) { _closeScope(i); return null; @@ -802,14 +819,14 @@ private final String _nextName() throws IOException } } - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _nextTokenNotInObject(i); return null; } final String nameStr = _parseName(i); - _streamReadContext.setCurrentName(nameStr); - _currToken = JsonToken.PROPERTY_NAME; + _parsingContext.setCurrentName(nameStr); + _currToken = JsonToken.FIELD_NAME; i = _skipColon(); if (i == INT_QUOTE) { @@ -863,10 +880,10 @@ private final String _nextName() throws IOException } @Override - public String nextTextValue() throws JacksonException + public String nextTextValue() throws IOException { // two distinct cases; either got name and we know next type, or 'other' - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -879,9 +896,9 @@ public String nextTextValue() throws JacksonException return _textBuffer.contentsAsString(); } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return null; } @@ -889,10 +906,10 @@ public String nextTextValue() throws JacksonException } @Override - public int nextIntValue(int defaultValue) throws JacksonException + public int nextIntValue(int defaultValue) throws IOException { // two distinct cases; either got name and we know next type, or 'other' - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -901,9 +918,9 @@ public int nextIntValue(int defaultValue) throws JacksonException return getIntValue(); } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return defaultValue; } @@ -911,10 +928,10 @@ public int nextIntValue(int defaultValue) throws JacksonException } @Override - public long nextLongValue(long defaultValue) throws JacksonException + public long nextLongValue(long defaultValue) throws IOException { // two distinct cases; either got name and we know next type, or 'other' - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -923,9 +940,9 @@ public long nextLongValue(long defaultValue) throws JacksonException return getLongValue(); } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return defaultValue; } @@ -933,10 +950,10 @@ public long nextLongValue(long defaultValue) throws JacksonException } @Override - public Boolean nextBooleanValue() throws JacksonException + public Boolean nextBooleanValue() throws IOException { // two distinct cases; either got name and we know next type, or 'other' - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -948,9 +965,9 @@ public Boolean nextBooleanValue() throws JacksonException return Boolean.FALSE; } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return null; } @@ -966,15 +983,16 @@ public Boolean nextBooleanValue() throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, number parsing - /********************************************************************** + /********************************************************** */ + // @since 2.11, [core#611] protected final JsonToken _parseFloatThatStartsWithPeriod() throws IOException { // [core#611]: allow optionally leading decimal point - if (!isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS)) { + if (!isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS.mappedFeature())) { return _handleUnexpectedValue(INT_PERIOD); } char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); @@ -1001,8 +1019,8 @@ protected final JsonToken _parseFloatThatStartsWithPeriod() throws IOException * @return Type of token decoded, usually {@link JsonToken#VALUE_NUMBER_INT} * or {@link JsonToken#VALUE_NUMBER_FLOAT} * - * @throws IOException for low-level I/O - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ protected JsonToken _parsePosNumber(int c) throws IOException { @@ -1041,7 +1059,7 @@ protected JsonToken _parsePosNumber(int c) throws IOException } _textBuffer.setCurrentLength(outPtr); // As per [core#105], need separating space between root values; check here - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(); } else { _nextByte = c; @@ -1088,7 +1106,7 @@ protected JsonToken _parseNegNumber() throws IOException _textBuffer.setCurrentLength(outPtr); // As per [core#105], need separating space between root values; check here _nextByte = c; - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(); } // And there we have it! @@ -1102,8 +1120,8 @@ protected JsonToken _parseNegNumber() throws IOException * * @return Character immediately following zeroes * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ private final int _handleLeadingZeroes() throws IOException { @@ -1113,8 +1131,8 @@ private final int _handleLeadingZeroes() throws IOException return ch; } // we may want to allow leading zeroes them, after all... - if (!isEnabled(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS)) { - _reportInvalidNumber("Leading zeroes not allowed"); + if ((_features & FEAT_MASK_LEADING_ZEROS) == 0) { + reportInvalidNumber("Leading zeroes not allowed"); } // if so, just need to skip either all zeroes (if followed by number); or all but one (if non-number) while (ch == INT_0) { @@ -1147,7 +1165,7 @@ private final JsonToken _parseFloat(char[] outBuf, int outPtr, int c, } // must be followed by sequence of ints, one minimum if (fractLen == 0) { - _reportUnexpectedNumberChar(c, "Decimal point not followed by a digit"); + reportUnexpectedNumberChar(c, "Decimal point not followed by a digit"); } } @@ -1179,14 +1197,14 @@ private final JsonToken _parseFloat(char[] outBuf, int outPtr, int c, } // must be followed by sequence of ints, one minimum if (expLen == 0) { - _reportUnexpectedNumberChar(c, "Exponent indicator not followed by a digit"); + reportUnexpectedNumberChar(c, "Exponent indicator not followed by a digit"); } } // Ok; unless we hit end-of-input, need to push last char read back // As per #105, need separating space between root values; check here _nextByte = c; - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(); } _textBuffer.setCurrentLength(outPtr); @@ -1203,7 +1221,7 @@ private final JsonToken _parseFloat(char[] outBuf, int outPtr, int c, * If we did want, we could rearrange things to require space before * next read, but initially let's just do nothing. */ - private final void _verifyRootSpace() throws JacksonException + private final void _verifyRootSpace() throws IOException { int ch = _nextByte; if (ch <= INT_SPACE) { @@ -1217,9 +1235,9 @@ private final void _verifyRootSpace() throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, secondary parsing - /********************************************************************** + /********************************************************** */ protected final String _parseName(int i) throws IOException @@ -1356,8 +1374,7 @@ private final String _parseMediumName2(int q3, final int q2) throws IOException return _parseLongName(i, q2, q3); } - private final String _parseLongName(int q, final int q2, int q3) - throws IOException + private final String _parseLongName(int q, final int q2, int q3) throws IOException { _quadBuffer[0] = _quad1; _quadBuffer[1] = q2; @@ -1523,7 +1540,7 @@ protected final String parseEscapedName(int[] quads, int qlen, int currQuad, int /** * Method called when we see non-white space character other - * than double quote, when expecting a property name. + * than double quote, when expecting a field name. * In standard mode will just throw an exception; but * in non-standard modes may be able to parse name. * @@ -1531,17 +1548,17 @@ protected final String parseEscapedName(int[] quads, int qlen, int currQuad, int * * @return Name decoded, if allowed and successful * - * @throws IOException for low-level I/O problem - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid name) */ protected String _handleOddName(int ch) throws IOException { - if (ch == '\'' && isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)) { + if (ch == '\'' && (_features & FEAT_MASK_ALLOW_SINGLE_QUOTES) != 0) { return _parseAposName(); } - if (!isEnabled(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES)) { + if ((_features & FEAT_MASK_ALLOW_UNQUOTED_NAMES) == 0) { char c = (char) _decodeCharForError(ch); - _reportUnexpectedChar(c, "was expecting double-quote to start property name"); + _reportUnexpectedChar(c, "was expecting double-quote to start field name"); } /* Also: note that although we use a different table here, * it does NOT handle UTF-8 decoding. It'll just pass those @@ -1550,7 +1567,7 @@ protected String _handleOddName(int ch) throws IOException final int[] codes = CharTypes.getInputCodeUtf8JsNames(); // Also: must start with a valid character... if (codes[ch] != 0) { - _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start property name"); + _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name"); } /* Ok, now; instead of ultra-optimizing parsing here (as with @@ -1696,12 +1713,12 @@ protected String _parseAposName() throws IOException } /* - /********************************************************************** + /********************************************************** /* Internal methods, symbol (name) handling - /********************************************************************** + /********************************************************** */ - private final String findName(int q1, int lastQuadBytes) throws StreamReadException + private final String findName(int q1, int lastQuadBytes) throws JsonParseException { q1 = pad(q1, lastQuadBytes); // Usually we'll find it from the canonical symbol table already @@ -1714,7 +1731,7 @@ private final String findName(int q1, int lastQuadBytes) throws StreamReadExcept return addName(_quadBuffer, 1, lastQuadBytes); } - private final String findName(int q1, int q2, int lastQuadBytes) throws StreamReadException + private final String findName(int q1, int q2, int lastQuadBytes) throws JsonParseException { q2 = pad(q2, lastQuadBytes); // Usually we'll find it from the canonical symbol table already @@ -1728,7 +1745,7 @@ private final String findName(int q1, int q2, int lastQuadBytes) throws StreamRe return addName(_quadBuffer, 2, lastQuadBytes); } - private final String findName(int q1, int q2, int q3, int lastQuadBytes) throws StreamReadException + private final String findName(int q1, int q2, int q3, int lastQuadBytes) throws JsonParseException { q3 = pad(q3, lastQuadBytes); String name = _symbols.findName(q1, q2, q3); @@ -1742,7 +1759,7 @@ private final String findName(int q1, int q2, int q3, int lastQuadBytes) throws return addName(quads, 3, lastQuadBytes); } - private final String findName(int[] quads, int qlen, int lastQuad, int lastQuadBytes) throws StreamReadException + private final String findName(int[] quads, int qlen, int lastQuad, int lastQuadBytes) throws JsonParseException { if (qlen >= quads.length) { _quadBuffer = quads = _growArrayBy(quads, quads.length); @@ -1761,7 +1778,7 @@ private final String findName(int[] quads, int qlen, int lastQuad, int lastQuadB * multi-byte chars (if any), and then construct Name instance * and add it to the symbol table. */ - private final String addName(int[] quads, int qlen, int lastQuadBytes) throws StreamReadException + private final String addName(int[] quads, int qlen, int lastQuadBytes) throws JsonParseException { /* Ok: must decode UTF-8 chars. No other validation is * needed, since unescaping has been done earlier as necessary @@ -1811,7 +1828,7 @@ private final String addName(int[] quads, int qlen, int lastQuadBytes) throws St needed = ch = 1; // never really gets this far } if ((ix + needed) > byteLen) { - _reportInvalidEOF(" in property name", JsonToken.PROPERTY_NAME); + _reportInvalidEOF(" in field name", JsonToken.FIELD_NAME); } // Ok, always need at least one more: @@ -1870,60 +1887,53 @@ private final String addName(int[] quads, int qlen, int lastQuadBytes) throws St } /* - /********************************************************************** + /********************************************************** /* Internal methods, String value parsing - /********************************************************************** + /********************************************************** */ - protected void _finishString() throws JacksonException + @Override + protected void _finishString() throws IOException { int outPtr = 0; char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); final int[] codes = _icUTF8; final int outEnd = outBuf.length; - try { - do { - int c = _inputData.readUnsignedByte(); - if (codes[c] != 0) { - if (c == INT_QUOTE) { - _textBuffer.setCurrentLength(outPtr); - return; - } - _finishString2(outBuf, outPtr, c); + do { + int c = _inputData.readUnsignedByte(); + if (codes[c] != 0) { + if (c == INT_QUOTE) { + _textBuffer.setCurrentLength(outPtr); return; } - outBuf[outPtr++] = (char) c; - } while (outPtr < outEnd); - _finishString2(outBuf, outPtr, _inputData.readUnsignedByte()); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _finishString2(outBuf, outPtr, c); + return; + } + outBuf[outPtr++] = (char) c; + } while (outPtr < outEnd); + _finishString2(outBuf, outPtr, _inputData.readUnsignedByte()); } - private String _finishAndReturnString() throws JacksonException + private String _finishAndReturnString() throws IOException { int outPtr = 0; char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); final int[] codes = _icUTF8; final int outEnd = outBuf.length; - try { - do { - int c = _inputData.readUnsignedByte(); - if (codes[c] != 0) { - if (c == INT_QUOTE) { - return _textBuffer.setCurrentAndReturn(outPtr); - } - _finishString2(outBuf, outPtr, c); - return _textBuffer.contentsAsString(); + do { + int c = _inputData.readUnsignedByte(); + if (codes[c] != 0) { + if (c == INT_QUOTE) { + return _textBuffer.setCurrentAndReturn(outPtr); } - outBuf[outPtr++] = (char) c; - } while (outPtr < outEnd); - _finishString2(outBuf, outPtr, _inputData.readUnsignedByte()); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _finishString2(outBuf, outPtr, c); + return _textBuffer.contentsAsString(); + } + outBuf[outPtr++] = (char) c; + } while (outPtr < outEnd); + _finishString2(outBuf, outPtr, _inputData.readUnsignedByte()); return _textBuffer.contentsAsString(); } @@ -1997,8 +2007,8 @@ private final void _finishString2(char[] outBuf, int outPtr, int c) * if it is not needed. This can be done bit faster if contents * need not be stored for future access. * - * @throws IOException for low-level I/O problem - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ protected void _skipString() throws IOException { @@ -2055,8 +2065,8 @@ protected void _skipString() throws IOException * * @return Token that was successfully decoded (if successful) * - * @throws IOException for low-level I/O - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ protected JsonToken _handleUnexpectedValue(int c) throws IOException @@ -2064,17 +2074,20 @@ protected JsonToken _handleUnexpectedValue(int c) // Most likely an error, unless we are to allow single-quote-strings switch (c) { case ']': - if (!_streamReadContext.inArray()) { + if (!_parsingContext.inArray()) { break; } // fall through case ',': + /* !!! TODO: 08-May-2016, tatu: To support `Feature.ALLOW_MISSING_VALUES` would + * need handling here... + */ // 11-May-2020, tatu: [core#616] No commas in root level - if (!_streamReadContext.inRoot()) { - if (isEnabled(JsonReadFeature.ALLOW_MISSING_VALUES)) { -// _inputPtr--; - _nextByte = c; - return JsonToken.VALUE_NULL; + if (!_parsingContext.inRoot()) { + if ((_features & FEAT_MASK_ALLOW_MISSING) != 0) { +// _inputPtr--; + _nextByte = c; + return JsonToken.VALUE_NULL; } } // fall through @@ -2083,20 +2096,20 @@ protected JsonToken _handleUnexpectedValue(int c) // been handled earlier _reportUnexpectedChar(c, "expected a value"); case '\'': - if (isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)) { + if ((_features & FEAT_MASK_ALLOW_SINGLE_QUOTES) != 0) { return _handleApos(); } break; case 'N': _matchToken("NaN", 1); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN("NaN", Double.NaN); } _reportError("Non-standard token 'NaN': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow"); break; case 'I': _matchToken("Infinity", 1); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN("Infinity", Double.POSITIVE_INFINITY); } _reportError("Non-standard token 'Infinity': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow"); @@ -2207,12 +2220,12 @@ protected JsonToken _handleInvalidNumberStart(int ch, boolean neg) break; } _matchToken(match, 3); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN(match, neg ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY); } _reportError("Non-standard token '"+match+"': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow"); } - _reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); + reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); return null; } @@ -2242,9 +2255,9 @@ private final void _checkMatchEnd(String matchStr, int i, int ch) throws IOExcep } /* - /********************************************************************** + /********************************************************** /* Internal methods, ws skipping, escape/unescape - /********************************************************************** + /********************************************************** */ private final int _skipWS() throws IOException @@ -2275,6 +2288,8 @@ private final int _skipWS() throws IOException /** * Alternative to {@link #_skipWS} that handles possible {@link EOFException} * caused by trying to read past the end of {@link InputData}. + * + * @since 2.9 */ private final int _skipWSOrEnd() throws IOException { @@ -2408,7 +2423,7 @@ private final int _skipColon2(int i, boolean gotColon) throws IOException return i; } if (i != INT_COLON) { - _reportUnexpectedChar(i, "was expecting a colon to separate property name and value"); + _reportUnexpectedChar(i, "was expecting a colon to separate field name and value"); } gotColon = true; } else { @@ -2423,7 +2438,7 @@ private final int _skipColon2(int i, boolean gotColon) throws IOException private final void _skipComment() throws IOException { - if (!isEnabled(JsonReadFeature.ALLOW_JAVA_COMMENTS)) { + if ((_features & FEAT_MASK_ALLOW_JAVA_COMMENTS) == 0) { _reportUnexpectedChar('/', "maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser)"); } int c = _inputData.readUnsignedByte(); @@ -2478,7 +2493,7 @@ private final void _skipCComment() throws IOException private final boolean _skipYAMLComment() throws IOException { - if (!isEnabled(JsonReadFeature.ALLOW_YAML_COMMENTS)) { + if ((_features & FEAT_MASK_ALLOW_YAML_COMMENTS) == 0) { return false; } _skipLine(); @@ -2524,15 +2539,7 @@ private final void _skipLine() throws IOException } @Override - protected char _decodeEscaped() throws JacksonException { - try { - return _decodeEscaped2(); - } catch (IOException e) { - throw _wrapIOFailure(e); - } - } - - private char _decodeEscaped2() throws IOException + protected char _decodeEscaped() throws IOException { int c = _inputData.readUnsignedByte(); @@ -2622,9 +2629,9 @@ protected int _decodeCharForError(int firstByte) throws IOException } /* - /********************************************************************** - /* Internal methods, UTF8 decoding - /********************************************************************** + /********************************************************** + /* Internal methods,UTF8 decoding + /********************************************************** */ private final int _decodeUtf8_2(int c) throws IOException @@ -2720,18 +2727,18 @@ private final void _skipUtf8_4() throws IOException } /* - /********************************************************************** + /********************************************************** /* Internal methods, error reporting - /********************************************************************** + /********************************************************** */ - protected void _reportInvalidToken(int ch, String matchedPart) throws JacksonException + protected void _reportInvalidToken(int ch, String matchedPart) throws IOException { _reportInvalidToken(ch, matchedPart, _validJsonTokenList()); } protected void _reportInvalidToken(int ch, String matchedPart, String msg) - throws JacksonException + throws IOException { StringBuilder sb = new StringBuilder(matchedPart); @@ -2739,23 +2746,19 @@ protected void _reportInvalidToken(int ch, String matchedPart, String msg) * regular Java identifier character rules. It's just a heuristic, * nothing fancy here (nor fast). */ - try { - while (true) { - char c = (char) _decodeCharForError(ch); - if (!Character.isJavaIdentifierPart(c)) { - break; - } - sb.append(c); - ch = _inputData.readUnsignedByte(); + while (true) { + char c = (char) _decodeCharForError(ch); + if (!Character.isJavaIdentifierPart(c)) { + break; } - } catch (IOException e) { - ; // ok since we are just trying to get token for diagnostics + sb.append(c); + ch = _inputData.readUnsignedByte(); } _reportError("Unrecognized token '"+sb.toString()+"': was expecting "+msg); } protected void _reportInvalidChar(int c) - throws StreamReadException + throws JsonParseException { // Either invalid WS or illegal UTF-8 start char if (c < INT_SPACE) { @@ -2765,13 +2768,13 @@ protected void _reportInvalidChar(int c) } protected void _reportInvalidInitial(int mask) - throws StreamReadException + throws JsonParseException { _reportError("Invalid UTF-8 start byte 0x"+Integer.toHexString(mask)); } private void _reportInvalidOther(int mask) - throws StreamReadException + throws JsonParseException { _reportError("Invalid UTF-8 middle byte 0x"+Integer.toHexString(mask)); } @@ -2797,8 +2800,9 @@ private static int[] _growArrayBy(int[] arr, int more) * @param b64variant Type of base64 encoding expected in context * * @return Fully decoded value of base64 content - * - * @throws IOException for low-level I/O problem + * + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid content) */ @SuppressWarnings("resource") protected final byte[] _decodeBase64(Base64Variant b64variant) throws IOException @@ -2854,7 +2858,7 @@ protected final byte[] _decodeBase64(Base64Variant b64variant) throws IOExceptio if (!b64variant.usesPaddingChar(ch)) { if ((ch != INT_BACKSLASH) || _decodeBase64Escape(b64variant, ch, 3) != Base64Variant.BASE64_VALUE_PADDING) { - _reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); + throw reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); } } // Got 12 bits, only need 8, need to shift @@ -2900,17 +2904,17 @@ protected final byte[] _decodeBase64(Base64Variant b64variant) throws IOExceptio } /* - /********************************************************************** - /* Improved location updating - /********************************************************************** + /********************************************************** + /* Improved location updating (refactored in 2.7) + /********************************************************** */ @Override - public JsonLocation currentTokenLocation() { + public JsonLocation getTokenLocation() { // 03-Jan-2020, tatu: Should probably track this, similar to how // streaming parsers do it, but... not done yet -// if (_currToken == JsonToken.PROPERTY_NAME) { +// if (_currToken == JsonToken.FIELD_NAME) { // return new JsonLocation(_getSourceReference(), // -1L, -1L, _nameStartRow, _nameStartCol); // } @@ -2921,7 +2925,7 @@ public JsonLocation currentTokenLocation() { } @Override - public JsonLocation currentLocation() { + public JsonLocation getCurrentLocation() { // No column tracking since we do not have pointers, DataInput has no offset final int col = -1; return new JsonLocation(_contentReference(), -1L, -1L, @@ -2929,24 +2933,24 @@ public JsonLocation currentLocation() { } /* - /********************************************************************** + /********************************************************** /* Internal methods, other - /********************************************************************** + /********************************************************** */ - private void _closeScope(int i) throws StreamReadException { + private void _closeScope(int i) throws JsonParseException { if (i == INT_RBRACKET) { - if (!_streamReadContext.inArray()) { + if (!_parsingContext.inArray()) { _reportMismatchedEndMarker(i, '}'); } - _streamReadContext = _streamReadContext.clearAndGetParent(); + _parsingContext = _parsingContext.clearAndGetParent(); _currToken = JsonToken.END_ARRAY; } if (i == INT_RCURLY) { - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _reportMismatchedEndMarker(i, ']'); } - _streamReadContext = _streamReadContext.clearAndGetParent(); + _parsingContext = _parsingContext.clearAndGetParent(); _currToken = JsonToken.END_OBJECT; } } diff --git a/src/main/java/com/fasterxml/jackson/core/json/UTF8JsonGenerator.java b/src/main/java/com/fasterxml/jackson/core/json/UTF8JsonGenerator.java index a26ca7bd0c..67297e5096 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/UTF8JsonGenerator.java +++ b/src/main/java/com/fasterxml/jackson/core/json/UTF8JsonGenerator.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.core.io.NumberOutput; public class UTF8JsonGenerator - extends JsonGeneratorBase + extends JsonGeneratorImpl { private final static byte BYTE_u = (byte) 'u'; @@ -36,26 +36,28 @@ public class UTF8JsonGenerator private final static byte[] FALSE_BYTES = { 'f', 'a', 'l', 's', 'e' }; /* - /********************************************************************** + /********************************************************** /* Configuration - /********************************************************************** + /********************************************************** */ /** * Underlying output stream used for writing JSON content. */ - protected final OutputStream _outputStream; + final protected OutputStream _outputStream; /** * Character used for quoting JSON Object property names * and String values. + * + * @since 2.8 */ - protected final byte _quoteChar; + protected byte _quoteChar; /* - /********************************************************************** + /********************************************************** /* Output buffering - /********************************************************************** + /********************************************************** */ /** @@ -106,44 +108,53 @@ public class UTF8JsonGenerator protected boolean _bufferRecyclable; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ - public UTF8JsonGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, - int streamWriteFeatures, int formatWriteFeatures, OutputStream out, - SerializableString rootValueSep, CharacterEscapes charEsc, - PrettyPrinter pp, int maxNonEscaped, char quoteChar) + // @since 2.10 + @SuppressWarnings("deprecation") + public UTF8JsonGenerator(IOContext ctxt, int features, ObjectCodec codec, + OutputStream out, char quoteChar) { - super(writeCtxt, ioCtxt, streamWriteFeatures, formatWriteFeatures, - rootValueSep, pp, charEsc, maxNonEscaped); + super(ctxt, features, codec); _outputStream = out; _quoteChar = (byte) quoteChar; + if (quoteChar != '"') { // since 2.10 + _outputEscapes = CharTypes.get7BitOutputEscapes(quoteChar); + } _bufferRecyclable = true; - _outputBuffer = ioCtxt.allocWriteEncodingBuffer(); + _outputBuffer = ctxt.allocWriteEncodingBuffer(); _outputEnd = _outputBuffer.length; - // To be exact, each char can take up to 6 bytes when escaped (Unicode - // escape with backslash, 'u' and 4 hex digits); but to avoid fluctuation, - // we will actually round down to only do up to 1/8 number of chars + + /* To be exact, each char can take up to 6 bytes when escaped (Unicode + * escape with backslash, 'u' and 4 hex digits); but to avoid fluctuation, + * we will actually round down to only do up to 1/8 number of chars + */ _outputMaxContiguous = _outputEnd >> 3; - _charBuffer = ioCtxt.allocConcatBuffer(); + _charBuffer = ctxt.allocConcatBuffer(); _charBufferLength = _charBuffer.length; - setCharacterEscapes(charEsc); + // By default we use this feature to determine additional quoting + if (isEnabled(Feature.ESCAPE_NON_ASCII)) { + setHighestNonEscapedChar(127); + } } - public UTF8JsonGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, - int streamWriteFeatures, int formatWriteFeatures, OutputStream out, - SerializableString rootValueSep, CharacterEscapes charEsc, - PrettyPrinter pp, int maxNonEscaped, char quoteChar, + // @since 2.10 + public UTF8JsonGenerator(IOContext ctxt, int features, ObjectCodec codec, + OutputStream out, char quoteChar, byte[] outputBuffer, int outputOffset, boolean bufferRecyclable) { - super(writeCtxt, ioCtxt, streamWriteFeatures, formatWriteFeatures, - rootValueSep, pp, charEsc, maxNonEscaped); + + super(ctxt, features, codec); _outputStream = out; _quoteChar = (byte) quoteChar; + if (quoteChar != '"') { // since 2.10 + _outputEscapes = CharTypes.get7BitOutputEscapes(quoteChar); + } _bufferRecyclable = bufferRecyclable; _outputTail = outputOffset; @@ -151,58 +162,58 @@ public UTF8JsonGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, _outputEnd = _outputBuffer.length; // up to 6 bytes per char (see above), rounded up to 1/8 _outputMaxContiguous = (_outputEnd >> 3); - _charBuffer = ioCtxt.allocConcatBuffer(); + _charBuffer = ctxt.allocConcatBuffer(); _charBufferLength = _charBuffer.length; + } - setCharacterEscapes(charEsc); + @Deprecated // since 2.10 + public UTF8JsonGenerator(IOContext ctxt, int features, ObjectCodec codec, + OutputStream out) { + this(ctxt, features, codec, out, JsonFactory.DEFAULT_QUOTE_CHAR); } - @Override - public JsonGenerator setCharacterEscapes(CharacterEscapes esc) + @Deprecated // since 2.10 + public UTF8JsonGenerator(IOContext ctxt, int features, ObjectCodec codec, + OutputStream out, + byte[] outputBuffer, int outputOffset, boolean bufferRecyclable) { - _characterEscapes = esc; - if (esc == null) { - _outputEscapes = (_quoteChar == '"') ? DEFAULT_OUTPUT_ESCAPES - : CharTypes.get7BitOutputEscapes(_quoteChar); - } else { - _outputEscapes = esc.getEscapeCodesForAscii(); - } - return this; + this(ctxt, features, codec, out, JsonFactory.DEFAULT_QUOTE_CHAR, + outputBuffer, outputOffset, bufferRecyclable); } /* - /********************************************************************** + /********************************************************** /* Overridden configuration methods - /********************************************************************** + /********************************************************** */ @Override - public Object streamWriteOutputTarget() { + public Object getOutputTarget() { return _outputStream; } @Override - public int streamWriteOutputBuffered() { + public int getOutputBuffered() { // Assuming tail is always valid, set to 0 on close return _outputTail; } /* - /********************************************************************** - /* Overridden write methods - /********************************************************************** + /********************************************************** + /* Overridden methods + /********************************************************** */ @Override - public void writeName(String name) throws JacksonException + public void writeFieldName(String name) throws IOException { if (_cfgPrettyPrinter != null) { - _writePPName(name); + _writePPFieldName(name); return; } - final int status = _streamWriteContext.writeName(name); + final int status = _writeContext.writeFieldName(name); if (status == JsonWriteContext.STATUS_EXPECT_VALUE) { - _reportError("Cannot write a property name, expecting a value"); + _reportError("Can not write a field name, expecting a value"); } if (status == JsonWriteContext.STATUS_OK_AFTER_COMMA) { // need comma if (_outputTail >= _outputEnd) { @@ -210,6 +221,9 @@ public void writeName(String name) throws JacksonException } _outputBuffer[_outputTail++] = BYTE_COMMA; } + /* To support [JACKSON-46], we'll do this: + * (Question: should quoting of spaces (etc) still be enabled?) + */ if (_cfgUnqNames) { _writeStringSegments(name, false); return; @@ -241,15 +255,15 @@ public void writeName(String name) throws JacksonException } @Override - public void writeName(SerializableString name) throws JacksonException + public void writeFieldName(SerializableString name) throws IOException { if (_cfgPrettyPrinter != null) { - _writePPName(name); + _writePPFieldName(name); return; } - final int status = _streamWriteContext.writeName(name.getValue()); + final int status = _writeContext.writeFieldName(name.getValue()); if (status == JsonWriteContext.STATUS_EXPECT_VALUE) { - _reportError("Cannot write a property name, expecting a value"); + _reportError("Can not write a field name, expecting a value"); } if (status == JsonWriteContext.STATUS_OK_AFTER_COMMA) { if (_outputTail >= _outputEnd) { @@ -277,7 +291,7 @@ public void writeName(SerializableString name) throws JacksonException _outputBuffer[_outputTail++] = _quoteChar; } - private final void _writeUnq(SerializableString name) throws JacksonException { + private final void _writeUnq(SerializableString name) throws IOException { int len = name.appendQuotedUTF8(_outputBuffer, _outputTail); if (len < 0) { _writeBytes(name.asQuotedUTF8()); @@ -285,18 +299,18 @@ private final void _writeUnq(SerializableString name) throws JacksonException { _outputTail += len; } } - + /* - /********************************************************************** + /********************************************************** /* Output method implementations, structural - /********************************************************************** + /********************************************************** */ @Override - public final void writeStartArray() throws JacksonException + public final void writeStartArray() throws IOException { _verifyValueWrite("start an array"); - _streamWriteContext = _streamWriteContext.createChildArrayContext(null); + _writeContext = _writeContext.createChildArrayContext(); if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartArray(this); } else { @@ -307,11 +321,11 @@ public final void writeStartArray() throws JacksonException } } - @Override - public final void writeStartArray(Object forValue) throws JacksonException + @Override // since 2.12 + public final void writeStartArray(Object currentValue) throws IOException { _verifyValueWrite("start an array"); - _streamWriteContext = _streamWriteContext.createChildArrayContext(forValue); + _writeContext = _writeContext.createChildArrayContext(currentValue); if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartArray(this); } else { @@ -321,12 +335,12 @@ public final void writeStartArray(Object forValue) throws JacksonException _outputBuffer[_outputTail++] = BYTE_LBRACKET; } } - - @Override - public final void writeStartArray(Object forValue, int len) throws JacksonException + + @Override // since 2.12 + public void writeStartArray(Object currentValue, int size) throws IOException { _verifyValueWrite("start an array"); - _streamWriteContext = _streamWriteContext.createChildArrayContext(forValue); + _writeContext = _writeContext.createChildArrayContext(currentValue); if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartArray(this); } else { @@ -338,27 +352,27 @@ public final void writeStartArray(Object forValue, int len) throws JacksonExcept } @Override - public final void writeEndArray() throws JacksonException + public final void writeEndArray() throws IOException { - if (!_streamWriteContext.inArray()) { - _reportError("Current context not Array but "+_streamWriteContext.typeDesc()); + if (!_writeContext.inArray()) { + _reportError("Current context not Array but "+_writeContext.typeDesc()); } if (_cfgPrettyPrinter != null) { - _cfgPrettyPrinter.writeEndArray(this, _streamWriteContext.getEntryCount()); + _cfgPrettyPrinter.writeEndArray(this, _writeContext.getEntryCount()); } else { if (_outputTail >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = BYTE_RBRACKET; } - _streamWriteContext = _streamWriteContext.clearAndGetParent(); + _writeContext = _writeContext.clearAndGetParent(); } @Override - public final void writeStartObject() throws JacksonException + public final void writeStartObject() throws IOException { _verifyValueWrite("start an object"); - _streamWriteContext = _streamWriteContext.createChildObjectContext(null); + _writeContext = _writeContext.createChildObjectContext(); if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartObject(this); } else { @@ -369,28 +383,12 @@ public final void writeStartObject() throws JacksonException } } - @Override - public void writeStartObject(Object forValue) throws JacksonException - { - _verifyValueWrite("start an object"); - JsonWriteContext ctxt = _streamWriteContext.createChildObjectContext(forValue); - _streamWriteContext = ctxt; - if (_cfgPrettyPrinter != null) { - _cfgPrettyPrinter.writeStartObject(this); - } else { - if (_outputTail >= _outputEnd) { - _flushBuffer(); - } - _outputBuffer[_outputTail++] = '{'; - } - } - - @Override - public void writeStartObject(Object forValue, int size) throws JacksonException + @Override // since 2.8 + public void writeStartObject(Object forValue) throws IOException { _verifyValueWrite("start an object"); - JsonWriteContext ctxt = _streamWriteContext.createChildObjectContext(forValue); - _streamWriteContext = ctxt; + JsonWriteContext ctxt = _writeContext.createChildObjectContext(forValue); + _writeContext = ctxt; if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartObject(this); } else { @@ -402,29 +400,29 @@ public void writeStartObject(Object forValue, int size) throws JacksonException } @Override - public final void writeEndObject() throws JacksonException + public final void writeEndObject() throws IOException { - if (!_streamWriteContext.inObject()) { - _reportError("Current context not Object but "+_streamWriteContext.typeDesc()); + if (!_writeContext.inObject()) { + _reportError("Current context not Object but "+_writeContext.typeDesc()); } if (_cfgPrettyPrinter != null) { - _cfgPrettyPrinter.writeEndObject(this, _streamWriteContext.getEntryCount()); + _cfgPrettyPrinter.writeEndObject(this, _writeContext.getEntryCount()); } else { if (_outputTail >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = BYTE_RCURLY; } - _streamWriteContext = _streamWriteContext.clearAndGetParent(); + _writeContext = _writeContext.clearAndGetParent(); } - // Specialized version of {@code _writeName}, off-lined + // Specialized version of _writeFieldName, off-lined // to keep the "fast path" as simple (and hopefully fast) as possible. - protected final void _writePPName(String name) throws JacksonException + protected final void _writePPFieldName(String name) throws IOException { - int status = _streamWriteContext.writeName(name); + int status = _writeContext.writeFieldName(name); if (status == JsonWriteContext.STATUS_EXPECT_VALUE) { - _reportError("Cannot write a property name, expecting a value"); + _reportError("Can not write a field name, expecting a value"); } if ((status == JsonWriteContext.STATUS_OK_AFTER_COMMA)) { _cfgPrettyPrinter.writeObjectEntrySeparator(this); @@ -460,11 +458,11 @@ protected final void _writePPName(String name) throws JacksonException _outputBuffer[_outputTail++] = _quoteChar; } - protected final void _writePPName(SerializableString name) throws JacksonException + protected final void _writePPFieldName(SerializableString name) throws IOException { - final int status = _streamWriteContext.writeName(name.getValue()); + final int status = _writeContext.writeFieldName(name.getValue()); if (status == JsonWriteContext.STATUS_EXPECT_VALUE) { - _reportError("Cannot write a property name, expecting a value"); + _reportError("Can not write a field name, expecting a value"); } if (status == JsonWriteContext.STATUS_OK_AFTER_COMMA) { _cfgPrettyPrinter.writeObjectEntrySeparator(this); @@ -492,15 +490,15 @@ protected final void _writePPName(SerializableString name) throws JacksonExcepti _outputBuffer[_outputTail++] = _quoteChar; } } - + /* - /********************************************************************** + /********************************************************** /* Output method implementations, textual - /********************************************************************** + /********************************************************** */ @Override - public void writeString(String text) throws JacksonException + public void writeString(String text) throws IOException { _verifyValueWrite(WRITE_STRING); if (text == null) { @@ -525,7 +523,7 @@ public void writeString(String text) throws JacksonException } @Override - public void writeString(Reader reader, int len) throws JacksonException { + public void writeString(Reader reader, int len) throws IOException { _verifyValueWrite(WRITE_STRING); if (reader == null) { _reportError("null reader"); @@ -544,13 +542,7 @@ public void writeString(Reader reader, int len) throws JacksonException { // read while (toRead > 0){ int toReadNow = Math.min(toRead, buf.length); - int numRead; - - try { - numRead = reader.read(buf, 0, toReadNow); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + int numRead = reader.read(buf, 0, toReadNow); if(numRead <= 0){ break; } @@ -574,7 +566,7 @@ public void writeString(Reader reader, int len) throws JacksonException { } @Override - public void writeString(char[] text, int offset, int len) throws JacksonException + public void writeString(char[] text, int offset, int len) throws IOException { _verifyValueWrite(WRITE_STRING); if (_outputTail >= _outputEnd) { @@ -598,7 +590,7 @@ public void writeString(char[] text, int offset, int len) throws JacksonExceptio } @Override - public final void writeString(SerializableString text) throws JacksonException + public final void writeString(SerializableString text) throws IOException { _verifyValueWrite(WRITE_STRING); if (_outputTail >= _outputEnd) { @@ -618,7 +610,7 @@ public final void writeString(SerializableString text) throws JacksonException } @Override - public void writeRawUTF8String(byte[] text, int offset, int length) throws JacksonException + public void writeRawUTF8String(byte[] text, int offset, int length) throws IOException { _verifyValueWrite(WRITE_STRING); if (_outputTail >= _outputEnd) { @@ -633,7 +625,7 @@ public void writeRawUTF8String(byte[] text, int offset, int length) throws Jacks } @Override - public void writeUTF8String(byte[] text, int offset, int len) throws JacksonException + public void writeUTF8String(byte[] text, int offset, int len) throws IOException { _verifyValueWrite(WRITE_STRING); if (_outputTail >= _outputEnd) { @@ -653,13 +645,13 @@ public void writeUTF8String(byte[] text, int offset, int len) throws JacksonExce } /* - /********************************************************************** + /********************************************************** /* Output method implementations, unprocessed ("raw") - /********************************************************************** + /********************************************************** */ @Override - public void writeRaw(String text) throws JacksonException { + public void writeRaw(String text) throws IOException { final int len = text.length(); final char[] buf = _charBuffer; if (len <= buf.length) { @@ -671,7 +663,7 @@ public void writeRaw(String text) throws JacksonException { } @Override - public void writeRaw(String text, int offset, int len) throws JacksonException + public void writeRaw(String text, int offset, int len) throws IOException { final char[] buf = _charBuffer; final int cbufLen = buf.length; @@ -715,7 +707,7 @@ public void writeRaw(String text, int offset, int len) throws JacksonException } @Override - public void writeRaw(SerializableString text) throws JacksonException + public void writeRaw(SerializableString text) throws IOException { int len = text.appendUnquotedUTF8(_outputBuffer, _outputTail); if (len < 0) { @@ -725,8 +717,9 @@ public void writeRaw(SerializableString text) throws JacksonException } } + // since 2.5 @Override - public void writeRawValue(SerializableString text) throws JacksonException { + public void writeRawValue(SerializableString text) throws IOException { _verifyValueWrite(WRITE_RAW); int len = text.appendUnquotedUTF8(_outputBuffer, _outputTail); if (len < 0) { @@ -738,7 +731,7 @@ public void writeRawValue(SerializableString text) throws JacksonException { // @TODO: rewrite for speed... @Override - public final void writeRaw(char[] cbuf, int offset, int len) throws JacksonException + public final void writeRaw(char[] cbuf, int offset, int len) throws IOException { // First: if we have 3 x charCount spaces, we know it'll fit just fine { @@ -780,7 +773,7 @@ public final void writeRaw(char[] cbuf, int offset, int len) throws JacksonExcep } @Override - public void writeRaw(char ch) throws JacksonException + public void writeRaw(char ch) throws IOException { if ((_outputTail + 3) >= _outputEnd) { _flushBuffer(); @@ -800,7 +793,7 @@ public void writeRaw(char ch) throws JacksonException * Helper method called when it is possible that output of raw section * to output may cross buffer boundary */ - private final void _writeSegmentedRaw(char[] cbuf, int offset, int len) throws JacksonException + private final void _writeSegmentedRaw(char[] cbuf, int offset, int len) throws IOException { final int end = _outputEnd; final byte[] bbuf = _outputBuffer; @@ -842,8 +835,10 @@ private final void _writeSegmentedRaw(char[] cbuf, int offset, int len) throws J * Caller has to take care of ensuring there's no split surrogate * pair at the end (that is, last char can not be first part of a * surrogate char pair). + * + * @since 2.8.2 */ - private void _writeRawSegment(char[] cbuf, int offset, int end) throws JacksonException + private void _writeRawSegment(char[] cbuf, int offset, int end) throws IOException { main_loop: while (offset < end) { @@ -869,15 +864,15 @@ private void _writeRawSegment(char[] cbuf, int offset, int end) throws JacksonEx } /* - /********************************************************************** + /********************************************************** /* Output method implementations, base64-encoded binary - /********************************************************************** + /********************************************************** */ @Override public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len) - throws JacksonException + throws IOException, JsonGenerationException { _verifyValueWrite(WRITE_BINARY); // Starting quotes @@ -896,7 +891,7 @@ public void writeBinary(Base64Variant b64variant, @Override public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) - throws JacksonException + throws IOException, JsonGenerationException { _verifyValueWrite(WRITE_BINARY); // Starting quotes @@ -928,13 +923,13 @@ public int writeBinary(Base64Variant b64variant, } /* - /********************************************************************** + /********************************************************** /* Output method implementations, primitive - /********************************************************************** + /********************************************************** */ @Override - public void writeNumber(short s) throws JacksonException + public void writeNumber(short s) throws IOException { _verifyValueWrite(WRITE_NUMBER); // up to 5 digits and possible minus sign @@ -948,7 +943,7 @@ public void writeNumber(short s) throws JacksonException _outputTail = NumberOutput.outputInt(s, _outputBuffer, _outputTail); } - private final void _writeQuotedShort(short s) throws JacksonException { + private final void _writeQuotedShort(short s) throws IOException { if ((_outputTail + 8) >= _outputEnd) { _flushBuffer(); } @@ -958,7 +953,7 @@ private final void _writeQuotedShort(short s) throws JacksonException { } @Override - public void writeNumber(int i) throws JacksonException + public void writeNumber(int i) throws IOException { _verifyValueWrite(WRITE_NUMBER); // up to 10 digits and possible minus sign @@ -972,7 +967,7 @@ public void writeNumber(int i) throws JacksonException _outputTail = NumberOutput.outputInt(i, _outputBuffer, _outputTail); } - private final void _writeQuotedInt(int i) throws JacksonException + private final void _writeQuotedInt(int i) throws IOException { if ((_outputTail + 13) >= _outputEnd) { _flushBuffer(); @@ -983,7 +978,7 @@ private final void _writeQuotedInt(int i) throws JacksonException } @Override - public void writeNumber(long l) throws JacksonException + public void writeNumber(long l) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (_cfgNumbersAsStrings) { @@ -997,7 +992,7 @@ public void writeNumber(long l) throws JacksonException _outputTail = NumberOutput.outputLong(l, _outputBuffer, _outputTail); } - private final void _writeQuotedLong(long l) throws JacksonException + private final void _writeQuotedLong(long l) throws IOException { if ((_outputTail + 23) >= _outputEnd) { _flushBuffer(); @@ -1008,7 +1003,7 @@ private final void _writeQuotedLong(long l) throws JacksonException } @Override - public void writeNumber(BigInteger value) throws JacksonException + public void writeNumber(BigInteger value) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (value == null) { @@ -1020,12 +1015,13 @@ public void writeNumber(BigInteger value) throws JacksonException } } + @SuppressWarnings("deprecation") @Override - public void writeNumber(double d) throws JacksonException + public void writeNumber(double d) throws IOException { if (_cfgNumbersAsStrings || (NumberOutput.notFinite(d) - && JsonWriteFeature.WRITE_NAN_AS_STRINGS.enabledIn(_formatWriteFeatures))) { + && Feature.QUOTE_NON_NUMERIC_NUMBERS.enabledIn(_features))) { writeString(String.valueOf(d)); return; } @@ -1034,12 +1030,13 @@ public void writeNumber(double d) throws JacksonException writeRaw(String.valueOf(d)); } + @SuppressWarnings("deprecation") @Override - public void writeNumber(float f) throws JacksonException + public void writeNumber(float f) throws IOException { if (_cfgNumbersAsStrings || (NumberOutput.notFinite(f) - && JsonWriteFeature.WRITE_NAN_AS_STRINGS.enabledIn(_formatWriteFeatures))) { + && Feature.QUOTE_NON_NUMERIC_NUMBERS.enabledIn(_features))) { writeString(String.valueOf(f)); return; } @@ -1049,7 +1046,7 @@ public void writeNumber(float f) throws JacksonException } @Override - public void writeNumber(BigDecimal value) throws JacksonException + public void writeNumber(BigDecimal value) throws IOException { // Don't really know max length for big decimal, no point checking _verifyValueWrite(WRITE_NUMBER); @@ -1063,7 +1060,7 @@ public void writeNumber(BigDecimal value) throws JacksonException } @Override - public void writeNumber(String encodedValue) throws JacksonException + public void writeNumber(String encodedValue) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (encodedValue == null) { @@ -1076,7 +1073,7 @@ public void writeNumber(String encodedValue) throws JacksonException } @Override - public void writeNumber(char[] encodedValueBuffer, int offset, int length) throws JacksonException { + public void writeNumber(char[] encodedValueBuffer, int offset, int length) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (_cfgNumbersAsStrings) { _writeQuotedRaw(encodedValueBuffer, offset, length); @@ -1085,7 +1082,7 @@ public void writeNumber(char[] encodedValueBuffer, int offset, int length) throw } } - private final void _writeQuotedRaw(String value) throws JacksonException + private final void _writeQuotedRaw(String value) throws IOException { if (_outputTail >= _outputEnd) { _flushBuffer(); @@ -1098,7 +1095,7 @@ private final void _writeQuotedRaw(String value) throws JacksonException _outputBuffer[_outputTail++] = _quoteChar; } - private void _writeQuotedRaw(char[] text, int offset, int length) throws JacksonException + private void _writeQuotedRaw(char[] text, int offset, int length) throws IOException { if (_outputTail >= _outputEnd) { _flushBuffer(); @@ -1112,7 +1109,7 @@ private void _writeQuotedRaw(char[] text, int offset, int length) throws Jackson } @Override - public void writeBoolean(boolean state) throws JacksonException + public void writeBoolean(boolean state) throws IOException { _verifyValueWrite(WRITE_BOOLEAN); if ((_outputTail + 5) >= _outputEnd) { @@ -1125,22 +1122,22 @@ public void writeBoolean(boolean state) throws JacksonException } @Override - public void writeNull() throws JacksonException + public void writeNull() throws IOException { _verifyValueWrite(WRITE_NULL); _writeNull(); } /* - /********************************************************************** + /********************************************************** /* Implementations for other methods - /********************************************************************** + /********************************************************** */ @Override - protected final void _verifyValueWrite(String typeMsg) throws JacksonException + protected final void _verifyValueWrite(String typeMsg) throws IOException { - final int status = _streamWriteContext.writeValue(); + final int status = _writeContext.writeValue(); if (_cfgPrettyPrinter != null) { // Otherwise, pretty printer knows what to do... _verifyPrettyValueWrite(typeMsg, status); @@ -1176,35 +1173,35 @@ protected final void _verifyValueWrite(String typeMsg) throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Low-level output handling - /********************************************************************** + /********************************************************** */ @Override - public void flush() throws JacksonException + public void flush() throws IOException { _flushBuffer(); if (_outputStream != null) { - if (isEnabled(StreamWriteFeature.FLUSH_PASSED_TO_STREAM)) { - try { - _outputStream.flush(); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + if (isEnabled(Feature.FLUSH_PASSED_TO_STREAM)) { + _outputStream.flush(); } } } @Override - public void close() throws JacksonException + public void close() throws IOException { super.close(); + /* 05-Dec-2008, tatu: To add [JACKSON-27], need to close open + * scopes. + */ + // First: let's see that we still have buffers... if ((_outputBuffer != null) - && isEnabled(StreamWriteFeature.AUTO_CLOSE_CONTENT)) { + && isEnabled(Feature.AUTO_CLOSE_JSON_CONTENT)) { while (true) { - TokenStreamContext ctxt = streamWriteContext(); + JsonStreamContext ctxt = getOutputContext(); if (ctxt.inArray()) { writeEndArray(); } else if (ctxt.inObject()) { @@ -1217,21 +1214,18 @@ && isEnabled(StreamWriteFeature.AUTO_CLOSE_CONTENT)) { _flushBuffer(); _outputTail = 0; // just to ensure we don't think there's anything buffered - /* We are not to call close() on the underlying Reader, unless we "own" it, - * or auto-closing feature is enabled. - * One downside: when using UTF8Writer, underlying buffer(s) - * may not be properly recycled if we don't close the writer. + /* 25-Nov-2008, tatus: As per [JACKSON-16] we are not to call close() + * on the underlying Reader, unless we "own" it, or auto-closing + * feature is enabled. + * One downside: when using UTF8Writer, underlying buffer(s) + * may not be properly recycled if we don't close the writer. */ if (_outputStream != null) { - try { - if (_ioContext.isResourceManaged() || isEnabled(StreamWriteFeature.AUTO_CLOSE_TARGET)) { - _outputStream.close(); - } else if (isEnabled(StreamWriteFeature.FLUSH_PASSED_TO_STREAM)) { - // If we can't close it, we should at least flush - _outputStream.flush(); - } - } catch (IOException e) { - throw _wrapIOFailure(e); + if (_ioContext.isResourceManaged() || isEnabled(Feature.AUTO_CLOSE_TARGET)) { + _outputStream.close(); + } else if (isEnabled(Feature.FLUSH_PASSED_TO_STREAM)) { + // If we can't close it, we should at least flush + _outputStream.flush(); } } // Internal buffer(s) generator has can now be released as well @@ -1254,23 +1248,19 @@ protected void _releaseBuffers() } /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, raw bytes - /********************************************************************** + /********************************************************** */ - private final void _writeBytes(byte[] bytes) throws JacksonException + private final void _writeBytes(byte[] bytes) throws IOException { final int len = bytes.length; if ((_outputTail + len) > _outputEnd) { _flushBuffer(); // still not enough? if (len > MAX_BYTES_TO_BUFFER) { - try { - _outputStream.write(bytes, 0, len); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _outputStream.write(bytes, 0, len); return; } } @@ -1278,17 +1268,13 @@ private final void _writeBytes(byte[] bytes) throws JacksonException _outputTail += len; } - private final void _writeBytes(byte[] bytes, int offset, int len) throws JacksonException + private final void _writeBytes(byte[] bytes, int offset, int len) throws IOException { if ((_outputTail + len) > _outputEnd) { _flushBuffer(); // still not enough? if (len > MAX_BYTES_TO_BUFFER) { - try { - _outputStream.write(bytes, offset, len); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _outputStream.write(bytes, offset, len); return; } } @@ -1297,9 +1283,9 @@ private final void _writeBytes(byte[] bytes, int offset, int len) throws Jackson } /* - /********************************************************************** + /********************************************************** /* Internal methods, mid-level writing, String segments - /********************************************************************** + /********************************************************** */ /** @@ -1309,7 +1295,7 @@ private final void _writeBytes(byte[] bytes, int offset, int len) throws Jackson * to single-segment writes (instead of maximum slices that * would fit in copy buffer) */ - private final void _writeStringSegments(String text, boolean addQuotes) throws JacksonException + private final void _writeStringSegments(String text, boolean addQuotes) throws IOException { if (addQuotes) { if (_outputTail >= _outputEnd) { @@ -1345,7 +1331,7 @@ private final void _writeStringSegments(String text, boolean addQuotes) throws J * the output buffer. If so, we will need to choose smaller output * chunks to write at a time. */ - private final void _writeStringSegments(char[] cbuf, int offset, int totalLen) throws JacksonException + private final void _writeStringSegments(char[] cbuf, int offset, int totalLen) throws IOException { do { int len = Math.min(_outputMaxContiguous, totalLen); @@ -1358,7 +1344,7 @@ private final void _writeStringSegments(char[] cbuf, int offset, int totalLen) t } while (totalLen > 0); } - private final void _writeStringSegments(String text, int offset, int totalLen) throws JacksonException + private final void _writeStringSegments(String text, int offset, int totalLen) throws IOException { do { int len = Math.min(_outputMaxContiguous, totalLen); @@ -1372,9 +1358,9 @@ private final void _writeStringSegments(String text, int offset, int totalLen) t } /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, text segments - /********************************************************************** + /********************************************************** */ /** @@ -1386,7 +1372,7 @@ private final void _writeStringSegments(String text, int offset, int totalLen) t * potentially enough space for other cases (but not necessarily flushed) */ private final void _writeStringSegment(char[] cbuf, int offset, int len) - throws JacksonException + throws IOException { // note: caller MUST ensure (via flushing) there's room for ASCII only @@ -1419,7 +1405,7 @@ private final void _writeStringSegment(char[] cbuf, int offset, int len) } } - private final void _writeStringSegment(String text, int offset, int len) throws JacksonException + private final void _writeStringSegment(String text, int offset, int len) throws IOException { // note: caller MUST ensure (via flushing) there's room for ASCII only // Fast+tight loop for ASCII-only, no-escaping-needed output @@ -1454,7 +1440,7 @@ private final void _writeStringSegment(String text, int offset, int len) throws * Secondary method called when content contains characters to escape, * and/or multi-byte UTF-8 characters. */ - private final void _writeStringSegment2(final char[] cbuf, int offset, final int end) throws JacksonException + private final void _writeStringSegment2(final char[] cbuf, int offset, final int end) throws IOException { // Ok: caller guarantees buffer can have room; but that may require flushing: if ((_outputTail + 6 * (end - offset)) > _outputEnd) { @@ -1493,7 +1479,7 @@ private final void _writeStringSegment2(final char[] cbuf, int offset, final int _outputTail = outputPtr; } - private final void _writeStringSegment2(final String text, int offset, final int end) throws JacksonException + private final void _writeStringSegment2(final String text, int offset, final int end) throws IOException { if ((_outputTail + 6 * (end - offset)) > _outputEnd) { _flushBuffer(); @@ -1532,17 +1518,17 @@ private final void _writeStringSegment2(final String text, int offset, final int } /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, text segment /* with additional escaping (ASCII or such) - /********************************************************************** + /********************************************************** */ /** * Same as _writeStringSegment2(char[], ...) _outputEnd) { @@ -1585,7 +1571,7 @@ private final void _writeStringSegmentASCII2(final char[] cbuf, int offset, fina _outputTail = outputPtr; } - private final void _writeStringSegmentASCII2(final String text, int offset, final int end) throws JacksonException + private final void _writeStringSegmentASCII2(final String text, int offset, final int end) throws IOException { // Ok: caller guarantees buffer can have room; but that may require flushing: if ((_outputTail + 6 * (end - offset)) > _outputEnd) { @@ -1630,17 +1616,17 @@ private final void _writeStringSegmentASCII2(final String text, int offset, fina } /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, text segment /* with fully custom escaping (and possibly escaping of non-ASCII - /********************************************************************** + /********************************************************** */ /** * Same as _writeStringSegmentASCII2(char[], ...) _outputEnd) { @@ -1697,7 +1683,7 @@ private final void _writeCustomStringSegment2(final char[] cbuf, int offset, fin _outputTail = outputPtr; } - private final void _writeCustomStringSegment2(final String text, int offset, final int end) throws JacksonException + private final void _writeCustomStringSegment2(final String text, int offset, final int end) throws IOException { // Ok: caller guarantees buffer can have room; but that may require flushing: if ((_outputTail + 6 * (end - offset)) > _outputEnd) { @@ -1755,7 +1741,7 @@ private final void _writeCustomStringSegment2(final String text, int offset, fin } private final int _writeCustomEscape(byte[] outputBuffer, int outputPtr, SerializableString esc, int remainingChars) - throws JacksonException + throws IOException, JsonGenerationException { byte[] raw = esc.asUnquotedUTF8(); // must be escaped at this point, shouldn't double-quote int len = raw.length; @@ -1769,7 +1755,7 @@ private final int _writeCustomEscape(byte[] outputBuffer, int outputPtr, Seriali private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, int outputEnd, byte[] raw, int remainingChars) - throws JacksonException + throws IOException, JsonGenerationException { final int len = raw.length; if ((outputPtr + len) > outputEnd) { @@ -1777,11 +1763,7 @@ private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, in _flushBuffer(); outputPtr = _outputTail; if (len > outputBuffer.length) { // very unlikely, but possible... - try { - _outputStream.write(raw, 0, len); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _outputStream.write(raw, 0, len); return outputPtr; } } @@ -1797,9 +1779,9 @@ private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, in } /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, "raw UTF-8" segments - /********************************************************************** + /********************************************************** */ /** @@ -1808,7 +1790,7 @@ private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, in * chunk writes. */ private final void _writeUTF8Segments(byte[] utf8, int offset, int totalLen) - throws JacksonException + throws IOException, JsonGenerationException { do { int len = Math.min(_outputMaxContiguous, totalLen); @@ -1819,7 +1801,7 @@ private final void _writeUTF8Segments(byte[] utf8, int offset, int totalLen) } private final void _writeUTF8Segment(byte[] utf8, final int offset, final int len) - throws JacksonException + throws IOException, JsonGenerationException { // fast loop to see if escaping is needed; don't copy, just look final int[] escCodes = _outputEscapes; @@ -1842,7 +1824,7 @@ private final void _writeUTF8Segment(byte[] utf8, final int offset, final int le } private final void _writeUTF8Segment2(final byte[] utf8, int offset, int len) - throws JacksonException + throws IOException, JsonGenerationException { int outputPtr = _outputTail; @@ -1876,14 +1858,14 @@ private final void _writeUTF8Segment2(final byte[] utf8, int offset, int len) } /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, base64 encoded - /********************************************************************** + /********************************************************** */ protected final void _writeBinary(Base64Variant b64variant, byte[] input, int inputPtr, final int inputEnd) - throws JacksonException + throws IOException, JsonGenerationException { // Encoding is by chunks of 3 input, 4 output chars, so: int safeInputEnd = inputEnd - 3; @@ -1926,7 +1908,7 @@ protected final void _writeBinary(Base64Variant b64variant, // write-method called when length is definitely known protected final int _writeBinary(Base64Variant b64variant, InputStream data, byte[] readBuffer, int bytesLeft) - throws JacksonException + throws IOException, JsonGenerationException { int inputPtr = 0; int inputEnd = 0; @@ -1986,7 +1968,7 @@ protected final int _writeBinary(Base64Variant b64variant, // write method when length is unknown protected final int _writeBinary(Base64Variant b64variant, InputStream data, byte[] readBuffer) - throws JacksonException + throws IOException, JsonGenerationException { int inputPtr = 0; int inputEnd = 0; @@ -2042,7 +2024,7 @@ protected final int _writeBinary(Base64Variant b64variant, private final int _readMore(InputStream in, byte[] readBuffer, int inputPtr, int inputEnd, - int maxRead) throws JacksonException + int maxRead) throws IOException { // anything to shift to front? int i = 0; @@ -2058,12 +2040,7 @@ private final int _readMore(InputStream in, if (length == 0) { break; } - int count; - try { - count = in.read(readBuffer, inputEnd, length); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + int count = in.read(readBuffer, inputEnd, length); if (count < 0) { return inputEnd; } @@ -2073,9 +2050,9 @@ private final int _readMore(InputStream in, } /* - /********************************************************************** + /********************************************************** /* Internal methods, character escapes/encoding - /********************************************************************** + /********************************************************** */ /** @@ -2084,7 +2061,7 @@ private final int _readMore(InputStream in, * text (meaning it is not to be escaped or quoted) */ private final int _outputRawMultiByteChar(int ch, char[] cbuf, int inputOffset, int inputEnd) - throws JacksonException + throws IOException { // Let's handle surrogates gracefully (as 4 byte output): if (ch >= SURR1_FIRST) { @@ -2106,7 +2083,7 @@ private final int _outputRawMultiByteChar(int ch, char[] cbuf, int inputOffset, return inputOffset; } - protected final void _outputSurrogates(int surr1, int surr2) throws JacksonException + protected final void _outputSurrogates(int surr1, int surr2) throws IOException { int c = _decodeSurrogate(surr1, surr2); if ((_outputTail + 4) > _outputEnd) { @@ -2126,9 +2103,9 @@ protected final void _outputSurrogates(int surr1, int surr2) throws JacksonExcep * * @return New output position after appending * - * @throws JacksonException + * @throws IOException */ - private final int _outputMultiByteChar(int ch, int outputPtr) throws JacksonException + private final int _outputMultiByteChar(int ch, int outputPtr) throws IOException { byte[] bbuf = _outputBuffer; if (ch >= SURR1_FIRST && ch <= SURR2_LAST) { // yes, outside of BMP; add an escape @@ -2152,7 +2129,7 @@ private final int _outputMultiByteChar(int ch, int outputPtr) throws JacksonExce return outputPtr; } - private final void _writeNull() throws JacksonException + private final void _writeNull() throws IOException { if ((_outputTail + 4) >= _outputEnd) { _flushBuffer(); @@ -2166,7 +2143,7 @@ private final void _writeNull() throws JacksonException * * @param charToEscape Character to escape using escape sequence (\\uXXXX) */ - private int _writeGenericEscape(int charToEscape, int outputPtr) throws JacksonException + private int _writeGenericEscape(int charToEscape, int outputPtr) throws IOException { final byte[] bbuf = _outputBuffer; bbuf[outputPtr++] = BYTE_BACKSLASH; @@ -2186,16 +2163,12 @@ private int _writeGenericEscape(int charToEscape, int outputPtr) throws JacksonE return outputPtr; } - protected final void _flushBuffer() throws JacksonException + protected final void _flushBuffer() throws IOException { int len = _outputTail; if (len > 0) { _outputTail = 0; - try { - _outputStream.write(_outputBuffer, 0, len); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _outputStream.write(_outputBuffer, 0, len); } } } diff --git a/src/main/java/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.java b/src/main/java/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.java index f657c3655c..5ad5502d63 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.java +++ b/src/main/java/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.java @@ -3,12 +3,10 @@ import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.exc.WrappedIOException; +import com.fasterxml.jackson.core.base.ParserBase; import com.fasterxml.jackson.core.io.CharTypes; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer; -import com.fasterxml.jackson.core.sym.PropertyNameMatcher; import com.fasterxml.jackson.core.util.*; import static com.fasterxml.jackson.core.JsonTokenId.*; @@ -18,12 +16,22 @@ * based on a {@link java.io.InputStream} as the input source. */ public class UTF8StreamJsonParser - extends JsonParserBase + extends ParserBase { final static byte BYTE_LF = (byte) '\n'; - private final static int FEAT_MASK_TRAILING_COMMA = JsonReadFeature.ALLOW_TRAILING_COMMA.getMask(); - private final static int FEAT_MASK_ALLOW_MISSING = JsonReadFeature.ALLOW_MISSING_VALUES.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_TRAILING_COMMA = Feature.ALLOW_TRAILING_COMMA.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_LEADING_ZEROS = Feature.ALLOW_NUMERIC_LEADING_ZEROS.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_NON_NUM_NUMBERS = Feature.ALLOW_NON_NUMERIC_NUMBERS.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_ALLOW_MISSING = Feature.ALLOW_MISSING_VALUES.getMask(); + private final static int FEAT_MASK_ALLOW_SINGLE_QUOTES = Feature.ALLOW_SINGLE_QUOTES.getMask(); + private final static int FEAT_MASK_ALLOW_UNQUOTED_NAMES = Feature.ALLOW_UNQUOTED_FIELD_NAMES.getMask(); + private final static int FEAT_MASK_ALLOW_JAVA_COMMENTS = Feature.ALLOW_COMMENTS.getMask(); + private final static int FEAT_MASK_ALLOW_YAML_COMMENTS = Feature.ALLOW_YAML_COMMENTS.getMask(); // This is the main input-code lookup table, fetched eagerly private final static int[] _icUTF8 = CharTypes.getInputCodeUtf8(); @@ -33,20 +41,27 @@ public class UTF8StreamJsonParser protected final static int[] _icLatin1 = CharTypes.getInputCodeLatin1(); /* - /********************************************************************** + /********************************************************** /* Configuration - /********************************************************************** + /********************************************************** */ /** - * Symbol table that contains property names encountered so far + * Codec used for data binding when (if) requested; typically full + * ObjectMapper, but that abstract is not part of core + * package. */ - protected final ByteQuadsCanonicalizer _symbols; + protected ObjectCodec _objectCodec; + + /** + * Symbol table that contains field names encountered so far + */ + final protected ByteQuadsCanonicalizer _symbols; /* - /********************************************************************** + /********************************************************** /* Parsing state - /********************************************************************** + /********************************************************** */ /** @@ -66,35 +81,38 @@ public class UTF8StreamJsonParser */ private int _quad1; - /** - * Temporary input pointer - */ - private int _quadPtr; - /** * Value of {@link #_inputPtr} at the time when the first character of * name token was read. Used for calculating token location when requested; * combined with {@link #_currInputProcessed}, may be updated appropriately * as needed. + * + * @since 2.7 */ protected int _nameStartOffset; + /** + * @since 2.7 + */ protected int _nameStartRow; + /** + * @since 2.7 + */ protected int _nameStartCol; /* - /********************************************************************** + /********************************************************** /* Input buffering (from former 'StreamBasedParserBase') - /********************************************************************** + /********************************************************** */ protected InputStream _inputStream; /* - /********************************************************************** + /********************************************************** /* Current input data - /********************************************************************** + /********************************************************** */ /** @@ -114,21 +132,48 @@ public class UTF8StreamJsonParser protected boolean _bufferRecyclable; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** + */ + + /** + * Constructor called when caller wants to provide input buffer directly + * (or needs to, in case of bootstrapping having read some of contents) + * and it may or may not be recyclable use standard recycle context. + * + * @param ctxt I/O context to use + * @param features Standard stream read features enabled + * @param in InputStream used for reading actual content, if any; {@code null} if none + * @param codec {@code ObjectCodec} to delegate object deserialization to + * @param sym Name canonicalizer to use + * @param inputBuffer Input buffer to read initial content from (before Reader) + * @param start Pointer in {@code inputBuffer} that has the first content character to decode + * @param end Pointer past the last content character in {@code inputBuffer} + * @param bufferRecyclable Whether {@code inputBuffer} passed is managed by Jackson core + * (and thereby needs recycling) + * + * @deprecated Since 2.10 */ + @Deprecated + public UTF8StreamJsonParser(IOContext ctxt, int features, InputStream in, + ObjectCodec codec, ByteQuadsCanonicalizer sym, + byte[] inputBuffer, int start, int end, + boolean bufferRecyclable) + { + this(ctxt, features, in, codec, sym, + inputBuffer, start, end, 0, bufferRecyclable); + } /** * Constructor called when caller wants to provide input buffer directly * (or needs to, in case of bootstrapping having read some of contents) * and it may or may not be recyclable use standard recycle context. * - * @param readCtxt Object read context to use * @param ctxt I/O context to use - * @param stdFeatures Standard stream read features enabled - * @param formatReadFeatures Format-specific read features enabled + * @param features Standard stream read features enabled * @param in InputStream used for reading actual content, if any; {@code null} if none + * @param codec {@code ObjectCodec} to delegate object deserialization to * @param sym Name canonicalizer to use * @param inputBuffer Input buffer to read initial content from (before Reader) * @param start Pointer in {@code inputBuffer} that has the first content character to decode @@ -137,15 +182,14 @@ public class UTF8StreamJsonParser * @param bufferRecyclable Whether {@code inputBuffer} passed is managed by Jackson core * (and thereby needs recycling) */ - public UTF8StreamJsonParser(ObjectReadContext readCtxt, IOContext ctxt, - int stdFeatures, int formatReadFeatures, - InputStream in, - ByteQuadsCanonicalizer sym, + public UTF8StreamJsonParser(IOContext ctxt, int features, InputStream in, + ObjectCodec codec, ByteQuadsCanonicalizer sym, byte[] inputBuffer, int start, int end, int bytesPreProcessed, boolean bufferRecyclable) { - super(readCtxt, ctxt, stdFeatures, formatReadFeatures); + super(ctxt, features); _inputStream = in; + _objectCodec = codec; _symbols = sym; _inputBuffer = inputBuffer; _inputPtr = start; @@ -156,14 +200,29 @@ public UTF8StreamJsonParser(ObjectReadContext readCtxt, IOContext ctxt, _bufferRecyclable = bufferRecyclable; } + @Override + public ObjectCodec getCodec() { + return _objectCodec; + } + + @Override + public void setCodec(ObjectCodec c) { + _objectCodec = c; + } + + @Override // @since 2.12 + public JacksonFeatureSet getReadCapabilities() { + return JSON_READ_CAPABILITIES; + } + /* - /********************************************************************** + /********************************************************** /* Overrides for life-cycle - /********************************************************************** + /********************************************************** */ @Override - public int releaseBuffered(OutputStream out) throws JacksonException + public int releaseBuffered(OutputStream out) throws IOException { int count = _inputEnd - _inputPtr; if (count < 1) { @@ -172,26 +231,22 @@ public int releaseBuffered(OutputStream out) throws JacksonException // let's just advance ptr to end int origPtr = _inputPtr; _inputPtr += count; - try { - out.write(_inputBuffer, origPtr, count); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + out.write(_inputBuffer, origPtr, count); return count; } @Override - public Object streamReadInputSource() { + public Object getInputSource() { return _inputStream; } /* - /********************************************************************** + /********************************************************** /* Overrides, low-level reading - /********************************************************************** + /********************************************************** */ - protected final boolean _loadMore() throws JacksonException + protected final boolean _loadMore() throws IOException { if (_inputStream != null) { int space = _inputBuffer.length; @@ -199,12 +254,7 @@ protected final boolean _loadMore() throws JacksonException return false; } - int count; - try { - count = _inputStream.read(_inputBuffer, 0, space); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + int count = _inputStream.read(_inputBuffer, 0, space); if (count > 0) { final int bufSize = _inputEnd; @@ -225,24 +275,20 @@ protected final boolean _loadMore() throws JacksonException _closeInput(); // Should never return 0, so let's fail if (count == 0) { - _reportBadInputStream(_inputBuffer.length); + throw new IOException("InputStream.read() returned 0 characters when trying to read "+_inputBuffer.length+" bytes"); } } return false; } @Override - protected void _closeInput() + protected void _closeInput() throws IOException { // We are not to call close() on the underlying InputStream // unless we "own" it, or auto-closing feature is enabled. if (_inputStream != null) { - if (_ioContext.isResourceManaged() || isEnabled(StreamReadFeature.AUTO_CLOSE_SOURCE)) { - try { - _inputStream.close(); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + if (_ioContext.isResourceManaged() || isEnabled(Feature.AUTO_CLOSE_SOURCE)) { + _inputStream.close(); } _inputStream = null; } @@ -255,7 +301,7 @@ protected void _closeInput() * separately (if need be). */ @Override - protected void _releaseBuffers() + protected void _releaseBuffers() throws IOException { super._releaseBuffers(); // Merge found symbols, if any: @@ -274,13 +320,13 @@ protected void _releaseBuffers() } /* - /********************************************************************** + /********************************************************** /* Public API, data access - /********************************************************************** + /********************************************************** */ @Override - public String getText() throws JacksonException + public String getText() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { @@ -292,41 +338,38 @@ public String getText() throws JacksonException return _getText2(_currToken); } - @Override - public int getText(Writer writer) throws JacksonException + @Override // since 2.8 + public int getText(Writer writer) throws IOException { - try { - JsonToken t = _currToken; - if (t == JsonToken.VALUE_STRING) { - if (_tokenIncomplete) { - _tokenIncomplete = false; - _finishString(); // only strings can be incomplete - } - return _textBuffer.contentsToWriter(writer); - } - if (t == JsonToken.PROPERTY_NAME) { - String n = _streamReadContext.currentName(); - writer.write(n); - return n.length(); + JsonToken t = _currToken; + if (t == JsonToken.VALUE_STRING) { + if (_tokenIncomplete) { + _tokenIncomplete = false; + _finishString(); // only strings can be incomplete } - if (t != null) { - if (t.isNumeric()) { - return _textBuffer.contentsToWriter(writer); - } - char[] ch = t.asCharArray(); - writer.write(ch); - return ch.length; + return _textBuffer.contentsToWriter(writer); + } + if (t == JsonToken.FIELD_NAME) { + String n = _parsingContext.getCurrentName(); + writer.write(n); + return n.length(); + } + if (t != null) { + if (t.isNumeric()) { + return _textBuffer.contentsToWriter(writer); } - } catch (IOException e) { - throw _wrapIOFailure(e); + char[] ch = t.asCharArray(); + writer.write(ch); + return ch.length; } return 0; } // // // Let's override default impls for improved performance - + + // @since 2.1 @Override - public String getValueAsString() throws JacksonException + public String getValueAsString() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { @@ -335,14 +378,15 @@ public String getValueAsString() throws JacksonException } return _textBuffer.contentsAsString(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return currentName(); + if (_currToken == JsonToken.FIELD_NAME) { + return getCurrentName(); } return super.getValueAsString(null); } - + + // @since 2.1 @Override - public String getValueAsString(String defValue) throws JacksonException + public String getValueAsString(String defValue) throws IOException { if (_currToken == JsonToken.VALUE_STRING) { if (_tokenIncomplete) { @@ -351,15 +395,15 @@ public String getValueAsString(String defValue) throws JacksonException } return _textBuffer.contentsAsString(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return currentName(); + if (_currToken == JsonToken.FIELD_NAME) { + return getCurrentName(); } return super.getValueAsString(defValue); } // since 2.6 @Override - public int getValueAsInt() throws JacksonException + public int getValueAsInt() throws IOException { JsonToken t = _currToken; if ((t == JsonToken.VALUE_NUMBER_INT) || (t == JsonToken.VALUE_NUMBER_FLOAT)) { @@ -379,7 +423,7 @@ public int getValueAsInt() throws JacksonException // since 2.6 @Override - public int getValueAsInt(int defValue) throws JacksonException + public int getValueAsInt(int defValue) throws IOException { JsonToken t = _currToken; if ((t == JsonToken.VALUE_NUMBER_INT) || (t == JsonToken.VALUE_NUMBER_FLOAT)) { @@ -403,8 +447,8 @@ protected final String _getText2(JsonToken t) return null; } switch (t.id()) { - case ID_PROPERTY_NAME: - return _streamReadContext.currentName(); + case ID_FIELD_NAME: + return _parsingContext.getCurrentName(); case ID_STRING: // fall through @@ -417,13 +461,25 @@ protected final String _getText2(JsonToken t) } @Override - public char[] getTextCharacters() throws JacksonException + public char[] getTextCharacters() throws IOException { if (_currToken != null) { // null only before/after document switch (_currToken.id()) { - case ID_PROPERTY_NAME: - return currentNameInBuffer(); + case ID_FIELD_NAME: + if (!_nameCopied) { + String name = _parsingContext.getCurrentName(); + int nameLen = name.length(); + if (_nameCopyBuffer == null) { + _nameCopyBuffer = _ioContext.allocNameCopyBuffer(nameLen); + } else if (_nameCopyBuffer.length < nameLen) { + _nameCopyBuffer = new char[nameLen]; + } + name.getChars(0, nameLen, _nameCopyBuffer, 0); + _nameCopied = true; + } + return _nameCopyBuffer; + case ID_STRING: if (_tokenIncomplete) { _tokenIncomplete = false; @@ -442,13 +498,13 @@ public char[] getTextCharacters() throws JacksonException } @Override - public int getTextLength() throws JacksonException + public int getTextLength() throws IOException { if (_currToken != null) { // null only before/after document switch (_currToken.id()) { - case ID_PROPERTY_NAME: - return _streamReadContext.currentName().length(); + case ID_FIELD_NAME: + return _parsingContext.getCurrentName().length(); case ID_STRING: if (_tokenIncomplete) { _tokenIncomplete = false; @@ -467,12 +523,12 @@ public int getTextLength() throws JacksonException } @Override - public int getTextOffset() throws JacksonException + public int getTextOffset() throws IOException { // Most have offset of 0, only some may have other values: if (_currToken != null) { switch (_currToken.id()) { - case ID_PROPERTY_NAME: + case ID_FIELD_NAME: return 0; case ID_STRING: if (_tokenIncomplete) { @@ -490,7 +546,7 @@ public int getTextOffset() throws JacksonException } @Override - public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException + public byte[] getBinaryValue(Base64Variant b64variant) throws IOException { if (_currToken != JsonToken.VALUE_STRING && (_currToken != JsonToken.VALUE_EMBEDDED_OBJECT || _binaryValue == null)) { @@ -501,7 +557,7 @@ public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException try { _binaryValue = _decodeBase64(b64variant); } catch (IllegalArgumentException iae) { - throw _constructReadException("Failed to decode VALUE_STRING as base64 ("+b64variant+"): "+iae.getMessage()); + throw _constructError("Failed to decode VALUE_STRING as base64 ("+b64variant+"): "+iae.getMessage()); } // let's clear incomplete only now; allows for accessing other textual content in error cases _tokenIncomplete = false; @@ -517,31 +573,25 @@ public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException } @Override - public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws JacksonException + public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException { // if we have already read the token, just use whatever we may have if (!_tokenIncomplete || _currToken != JsonToken.VALUE_STRING) { byte[] b = getBinaryValue(b64variant); - try { - out.write(b); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + out.write(b); return b.length; } // otherwise do "real" incremental parsing... byte[] buf = _ioContext.allocBase64Buffer(); try { return _readBinary(b64variant, out, buf); - } catch (IOException e) { - throw _wrapIOFailure(e); } finally { _ioContext.releaseBase64Buffer(buf); } } protected int _readBinary(Base64Variant b64variant, OutputStream out, - byte[] buffer) throws IOException + byte[] buffer) throws IOException { int outputPtr = 0; final int outputEnd = buffer.length - 3; @@ -618,7 +668,7 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, ch = _inputBuffer[_inputPtr++] & 0xFF; if (!b64variant.usesPaddingChar(ch)) { if (_decodeBase64Escape(b64variant, ch, 3) != Base64Variant.BASE64_VALUE_PADDING) { - _reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); + throw reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); } } // Got 12 bits, only need 8, need to shift @@ -678,9 +728,9 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, } /* - /********************************************************************** + /********************************************************** /* Public API, traversal, basic - /********************************************************************** + /********************************************************** */ /** @@ -688,13 +738,13 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, * to indicate end-of-input */ @Override - public JsonToken nextToken() throws JacksonException + public JsonToken nextToken() throws IOException { - /* First: property names are special -- we will always tokenize - * (part of) value along with property name to simplify + /* First: field names are special -- we will always tokenize + * (part of) value along with field name to simplify * state handling. If so, can and need to use secondary token: */ - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { return _nextAfterName(); } // But if we didn't already have a name, and (partially?) decode number, @@ -723,13 +773,13 @@ public JsonToken nextToken() throws JacksonException } // Nope: do we then expect a comma? - if (_streamReadContext.expectComma()) { + if (_parsingContext.expectComma()) { if (i != INT_COMMA) { - _reportUnexpectedChar(i, "was expecting comma to separate "+_streamReadContext.typeDesc()+" entries"); + _reportUnexpectedChar(i, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries"); } i = _skipWS(); // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { if ((i == INT_RBRACKET) || (i == INT_RCURLY)) { return _closeScope(i); } @@ -739,15 +789,15 @@ public JsonToken nextToken() throws JacksonException /* And should we now have a name? Always true for Object contexts * since the intermediate 'expect-value' state is never retained. */ - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _updateLocation(); return _nextTokenNotInObject(i); } - // So first parse the property name itself: + // So first parse the field name itself: _updateNameLocation(); String n = _parseName(i); - _streamReadContext.setCurrentName(n); - _currToken = JsonToken.PROPERTY_NAME; + _parsingContext.setCurrentName(n); + _currToken = JsonToken.FIELD_NAME; i = _skipColon(); _updateLocation(); @@ -808,7 +858,7 @@ public JsonToken nextToken() throws JacksonException return _currToken; } - private final JsonToken _nextTokenNotInObject(int i) throws JacksonException + private final JsonToken _nextTokenNotInObject(int i) throws IOException { if (i == INT_QUOTE) { _tokenIncomplete = true; @@ -816,10 +866,10 @@ private final JsonToken _nextTokenNotInObject(int i) throws JacksonException } switch (i) { case '[': - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); return (_currToken = JsonToken.START_ARRAY); case '{': - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); return (_currToken = JsonToken.START_OBJECT); case 't': _matchTrue(); @@ -862,15 +912,15 @@ private final JsonToken _nextAfterName() // Also: may need to start new context? if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return (_currToken = t); } @Override - public void finishToken() throws JacksonException { + public void finishToken() throws IOException { if (_tokenIncomplete) { _tokenIncomplete = false; _finishString(); // only strings can be incomplete @@ -878,125 +928,17 @@ public void finishToken() throws JacksonException { } /* - /********************************************************************** - /* Public API, traversal, nextName() variants - /********************************************************************** + /********************************************************** + /* Public API, traversal, nextXxxValue/nextFieldName + /********************************************************** */ @Override - public String nextName() throws JacksonException - { - // // // Note: this is almost a verbatim copy of nextToken() - - _numTypesValid = NR_UNKNOWN; - if (_currToken == JsonToken.PROPERTY_NAME) { - _nextAfterName(); - return null; - } - if (_tokenIncomplete) { - _skipString(); - } - int i = _skipWSOrEnd(); - if (i < 0) { - close(); - _currToken = null; - return null; - } - _binaryValue = null; - - if (i == INT_RBRACKET) { - _closeArrayScope(); - _currToken = JsonToken.END_ARRAY; - return null; - } - if (i == INT_RCURLY) { - _closeObjectScope(); - _currToken = JsonToken.END_OBJECT; - return null; - } - - // Nope: do we then expect a comma? - if (_streamReadContext.expectComma()) { - if (i != INT_COMMA) { - _reportUnexpectedChar(i, "was expecting comma to separate "+_streamReadContext.typeDesc()+" entries"); - } - i = _skipWS(); - // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { - if ((i == INT_RBRACKET) || (i == INT_RCURLY)) { - _closeScope(i); - return null; - } - } - } - - if (!_streamReadContext.inObject()) { - _updateLocation(); - _nextTokenNotInObject(i); - return null; - } - - _updateNameLocation(); - final String nameStr = _parseName(i); - _streamReadContext.setCurrentName(nameStr); - _currToken = JsonToken.PROPERTY_NAME; - - i = _skipColon(); - _updateLocation(); - if (i == INT_QUOTE) { - _tokenIncomplete = true; - _nextToken = JsonToken.VALUE_STRING; - return nameStr; - } - JsonToken t; - switch (i) { - case '-': - t = _parseNegNumber(); - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - t = _parsePosNumber(i); - break; - case 'f': - _matchFalse(); - t = JsonToken.VALUE_FALSE; - break; - case 'n': - _matchNull(); - t = JsonToken.VALUE_NULL; - break; - case 't': - _matchTrue(); - t = JsonToken.VALUE_TRUE; - break; - case '[': - t = JsonToken.START_ARRAY; - break; - case '{': - t = JsonToken.START_OBJECT; - break; - - default: - t = _handleUnexpectedValue(i); - } - _nextToken = t; - return nameStr; - } - - @Override - public boolean nextName(SerializableString str) throws JacksonException + public boolean nextFieldName(SerializableString str) throws IOException { // // // Note: most of code below is copied from nextToken() _numTypesValid = NR_UNKNOWN; - if (_currToken == JsonToken.PROPERTY_NAME) { // can't have name right after name + if (_currToken == JsonToken.FIELD_NAME) { // can't have name right after name _nextAfterName(); return false; } @@ -1024,21 +966,21 @@ public boolean nextName(SerializableString str) throws JacksonException } // Nope: do we then expect a comma? - if (_streamReadContext.expectComma()) { + if (_parsingContext.expectComma()) { if (i != INT_COMMA) { - _reportUnexpectedChar(i, "was expecting comma to separate "+_streamReadContext.typeDesc()+" entries"); + _reportUnexpectedChar(i, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries"); } i = _skipWS(); // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { if ((i == INT_RBRACKET) || (i == INT_RCURLY)) { _closeScope(i); return false; } } } - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _updateLocation(); _nextTokenNotInObject(i); return false; @@ -1060,7 +1002,7 @@ public boolean nextName(SerializableString str) throws JacksonException int ptr = _inputPtr; while (true) { if (ptr == end) { // yes, match! - _streamReadContext.setCurrentName(str.getValue()); + _parsingContext.setCurrentName(str.getValue()); i = _skipColonFast(ptr+1); _isNextTokenNameYes(i); return true; @@ -1078,13 +1020,13 @@ public boolean nextName(SerializableString str) throws JacksonException } @Override - public int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException + public String nextFieldName() throws IOException { // // // Note: this is almost a verbatim copy of nextToken() _numTypesValid = NR_UNKNOWN; - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { _nextAfterName(); - return PropertyNameMatcher.MATCH_ODD_TOKEN; + return null; } if (_tokenIncomplete) { _skipString(); @@ -1093,72 +1035,53 @@ public int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException if (i < 0) { close(); _currToken = null; - return PropertyNameMatcher.MATCH_ODD_TOKEN; + return null; } _binaryValue = null; if (i == INT_RBRACKET) { _closeArrayScope(); _currToken = JsonToken.END_ARRAY; - return PropertyNameMatcher.MATCH_ODD_TOKEN; + return null; } if (i == INT_RCURLY) { _closeObjectScope(); _currToken = JsonToken.END_OBJECT; - return PropertyNameMatcher.MATCH_END_OBJECT; + return null; } // Nope: do we then expect a comma? - if (_streamReadContext.expectComma()) { + if (_parsingContext.expectComma()) { if (i != INT_COMMA) { - _reportUnexpectedChar(i, "was expecting comma to separate "+_streamReadContext.typeDesc()+" entries"); + _reportUnexpectedChar(i, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries"); } i = _skipWS(); // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { - boolean isEndObject = (i == INT_RCURLY); - if (isEndObject || (i == INT_RBRACKET)) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((i == INT_RBRACKET) || (i == INT_RCURLY)) { _closeScope(i); - return isEndObject ? PropertyNameMatcher.MATCH_END_OBJECT : PropertyNameMatcher.MATCH_ODD_TOKEN; + return null; } } } - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _updateLocation(); _nextTokenNotInObject(i); - return PropertyNameMatcher.MATCH_ODD_TOKEN; + return null; } _updateNameLocation(); - - String name; - int match = _matchName(matcher, i); - if (match >= 0) { // gotcha! (expected case) - _inputPtr = _quadPtr; - name = matcher.nameLookup()[match]; - } else { - // !!! TODO 12-Dec-2017, tatu: Should probably try to use symbol table - // for cases where quads were decoded ok, but no match? - /* - if (match == PropertyNameMatcher.MATCH_UNKNOWN_NAME) { - throw new RuntimeException("No name match!"); - } - */ - name = _parseName(i); - match = matcher.matchName(name); - } - - _streamReadContext.setCurrentName(name); - _currToken = JsonToken.PROPERTY_NAME; - // Otherwise, try again... + final String nameStr = _parseName(i); + _parsingContext.setCurrentName(nameStr); + _currToken = JsonToken.FIELD_NAME; i = _skipColon(); _updateLocation(); - if (i == INT_QUOTE) { // optimize commonest case, String value + if (i == INT_QUOTE) { _tokenIncomplete = true; _nextToken = JsonToken.VALUE_STRING; - return match; + return nameStr; } JsonToken t; switch (i) { @@ -1203,11 +1126,11 @@ public int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException t = _handleUnexpectedValue(i); } _nextToken = t; - return match; + return nameStr; } // Variant called when we know there's at least 4 more bytes available - private final int _skipColonFast(int ptr) throws JacksonException + private final int _skipColonFast(int ptr) throws IOException { int i = _inputBuffer[ptr++]; if (i == INT_COLON) { // common case, no leading space @@ -1255,9 +1178,9 @@ private final int _skipColonFast(int ptr) throws JacksonException return _skipColon2(false); } - private final void _isNextTokenNameYes(int i) throws JacksonException + private final void _isNextTokenNameYes(int i) throws IOException { - _currToken = JsonToken.PROPERTY_NAME; + _currToken = JsonToken.FIELD_NAME; _updateLocation(); switch (i) { @@ -1305,14 +1228,14 @@ private final void _isNextTokenNameYes(int i) throws JacksonException _nextToken = _handleUnexpectedValue(i); } - private final boolean _isNextTokenNameMaybe(int i, SerializableString str) throws JacksonException + private final boolean _isNextTokenNameMaybe(int i, SerializableString str) throws IOException { // // // and this is back to standard nextToken() String n = _parseName(i); - _streamReadContext.setCurrentName(n); + _parsingContext.setCurrentName(n); final boolean match = n.equals(str.getValue()); - _currToken = JsonToken.PROPERTY_NAME; + _currToken = JsonToken.FIELD_NAME; i = _skipColon(); _updateLocation(); @@ -1368,240 +1291,11 @@ private final boolean _isNextTokenNameMaybe(int i, SerializableString str) throw return match; } - protected final int _matchName(PropertyNameMatcher matcher, int i) throws JacksonException - { - if (i != INT_QUOTE) { - return -1; - } - // First: can we optimize out bounds checks for first rounds of processing? - int qptr = _inputPtr; - if ((qptr + 13) > _inputEnd) { // Need up to 12 chars, plus one trailing (quote) - return -1; - } - - final byte[] input = _inputBuffer; - final int[] codes = _icLatin1; - - int q = input[qptr++] & 0xFF; - - if (codes[q] != 0) { - if (q == INT_QUOTE) { // special case, "" - return matcher.matchName(""); - } - return -1; - } - - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// 12-Dec-2017, tatu: we would need something like this for "null masking", to handle -// special case of trailing "null chars": but for now it does not seem necessary. -// So cross that bridge if we ever get there -// q = _padLastQuadNoCheck(q, (-1 << 8)); - } else { - q = (q << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q = _padLastQuadNoCheck(q, (-1 << 16)); - } else { - q = (q << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q = _padLastQuadNoCheck(q, (-1 << 24)); - } else { - q = (q << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] == 0) { - _quad1 = q; - return _matchMediumName(matcher, qptr, i); - } - if (i != INT_QUOTE) { - return -1; - } - } - } - } - _quadPtr = qptr; -//System.err.printf("_matchName(0x%08x): %d\n", q, matcher.matchByQuad(q)); - return matcher.matchByQuad(q); - } - - protected final int _matchMediumName(PropertyNameMatcher matcher, int qptr, int q2) throws JacksonException - { - final byte[] input = _inputBuffer; - final int[] codes = _icLatin1; - - // Ok, got 5 name bytes so far, with `q2` last one we got - int i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q2 = _padLastQuadNoCheck(q2, (-1 << 8)); - } else { - q2 = (q2 << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q2 = _padLastQuadNoCheck(q2, (-1 << 16)); - } else { - q2 = (q2 << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q2 = _padLastQuadNoCheck(q2, (-1 << 24)); - } else { - q2 = (q2 << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] == 0) { - return _matchMediumName2(matcher, qptr, i, q2); - } - if (i != INT_QUOTE) { - return -1; - } - } - } - } - _quadPtr = qptr; -//System.err.printf("_matchMediumName(0x%08x,0x%08x): %d\n", _quad1, q2, matcher.matchByQuad(_quad1, q2)); - return matcher.matchByQuad(_quad1, q2); - } - - protected final int _matchMediumName2(PropertyNameMatcher matcher, int qptr, - int q3, final int q2) throws JacksonException - { - final byte[] input = _inputBuffer; - final int[] codes = _icLatin1; - - // Got 9 name bytes so far, q3 being the last - int i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q3 = _padLastQuadNoCheck(q3, (-1 << 8)); - } else { - q3 = (q3 << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q3 = _padLastQuadNoCheck(q3, (-1 << 16)); - } else { - q3 = (q3 << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q3 = _padLastQuadNoCheck(q3, (-1 << 24)); - } else { - q3 = (q3 << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] == 0) { - _quadBuffer[0] = _quad1; - _quadBuffer[1] = q2; - _quadBuffer[2] = q3; - return _matchLongName(matcher, qptr, i); - } - if (i != INT_QUOTE) { - return -1; - } - } - } - } - _quadPtr = qptr; - return matcher.matchByQuad(_quad1, q2, q3); - } - - protected final int _matchLongName(PropertyNameMatcher matcher, int qptr, - int q) throws JacksonException - { - final byte[] input = _inputBuffer; - final int[] codes = _icLatin1; - int qlen = 3; - - while ((qptr + 4) <= _inputEnd) { - int i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } - _quadPtr = qptr; - return matcher.matchByQuad(_quadBuffer, qlen); - } - q = (q << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q = _padLastQuadNoCheck(q, (-1 << 8)); - break; - } - q = (q << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q = _padLastQuadNoCheck(q, (-1 << 16)); - break; - } - q = (q << 8) | i; - i = input[qptr++] & 0xFF; - if (codes[i] != 0) { - if (i != INT_QUOTE) { - return -1; - } -// q = _padLastQuadNoCheck(q, (-1 << 24)); - break; - } - // Nope, no end in sight. Need to grow quad array etc - if (qlen >= _quadBuffer.length) { - _quadBuffer = growArrayBy(_quadBuffer, qlen); - } - _quadBuffer[qlen++] = q; - q = i; - } - // Let's offline if we hit buffer boundary (otherwise would need to [try to] - // align input, which is bit complicated and may not always be possible) - return -1; - } - - // 12-Dec-2017, tatu: Might need this to cover case of trailing "null chars" - // (Unicode character point 0); but since we have fallback lookup, does not - // actually look like this is necessary for our fast patch. - /* - private final static int _padLastQuadNoCheck(int q, int mask) { - return q; - } - */ - - /* - /********************************************************************** - /* Public API, traversal, nextXxxValue() variants - /********************************************************************** - */ - @Override - public String nextTextValue() throws JacksonException + public String nextTextValue() throws IOException { // two distinct cases; either got name and we know next type, or 'other' - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -1614,9 +1308,9 @@ public String nextTextValue() throws JacksonException return _textBuffer.contentsAsString(); } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return null; } @@ -1625,10 +1319,10 @@ public String nextTextValue() throws JacksonException } @Override - public int nextIntValue(int defaultValue) throws JacksonException + public int nextIntValue(int defaultValue) throws IOException { // two distinct cases; either got name and we know next type, or 'other' - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -1637,9 +1331,9 @@ public int nextIntValue(int defaultValue) throws JacksonException return getIntValue(); } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return defaultValue; } @@ -1648,10 +1342,10 @@ public int nextIntValue(int defaultValue) throws JacksonException } @Override - public long nextLongValue(long defaultValue) throws JacksonException + public long nextLongValue(long defaultValue) throws IOException { // two distinct cases; either got name and we know next type, or 'other' - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -1660,9 +1354,9 @@ public long nextLongValue(long defaultValue) throws JacksonException return getLongValue(); } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return defaultValue; } @@ -1671,10 +1365,10 @@ public long nextLongValue(long defaultValue) throws JacksonException } @Override - public Boolean nextBooleanValue() throws JacksonException + public Boolean nextBooleanValue() throws IOException { // two distinct cases; either got name and we know next type, or 'other' - if (_currToken == JsonToken.PROPERTY_NAME) { // mostly copied from '_nextAfterName' + if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName' _nameCopied = false; JsonToken t = _nextToken; _nextToken = null; @@ -1686,9 +1380,9 @@ public Boolean nextBooleanValue() throws JacksonException return Boolean.FALSE; } if (t == JsonToken.START_ARRAY) { - _streamReadContext = _streamReadContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildArrayContext(_tokenInputRow, _tokenInputCol); } else if (t == JsonToken.START_OBJECT) { - _streamReadContext = _streamReadContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); + _parsingContext = _parsingContext.createChildObjectContext(_tokenInputRow, _tokenInputCol); } return null; } @@ -1704,15 +1398,16 @@ public Boolean nextBooleanValue() throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, number parsing - /********************************************************************** + /********************************************************** */ - protected final JsonToken _parseFloatThatStartsWithPeriod() throws JacksonException + // @since 2.11, [core#611] + protected final JsonToken _parseFloatThatStartsWithPeriod() throws IOException { // [core#611]: allow optionally leading decimal point - if (!isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS)) { + if (!isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS.mappedFeature())) { return _handleUnexpectedValue(INT_PERIOD); } return _parseFloat(_textBuffer.emptyAndGetCurrentSegment(), @@ -1739,10 +1434,10 @@ protected final JsonToken _parseFloatThatStartsWithPeriod() throws JacksonExcept * @return Type of token decoded, usually {@link JsonToken#VALUE_NUMBER_INT} * or {@link JsonToken#VALUE_NUMBER_FLOAT} * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems */ - protected JsonToken _parsePosNumber(int c) throws JacksonException + protected JsonToken _parsePosNumber(int c) throws IOException { char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); // One special case: if first char is 0, must not be followed by a digit @@ -1774,14 +1469,14 @@ protected JsonToken _parsePosNumber(int c) throws JacksonException --_inputPtr; // to push back trailing char (comma etc) _textBuffer.setCurrentLength(outPtr); // As per #105, need separating space between root values; check here - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(c); } // And there we have it! return resetInt(false, intLen); } - protected JsonToken _parseNegNumber() throws JacksonException + protected JsonToken _parseNegNumber() throws IOException { char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); int outPtr = 0; @@ -1831,7 +1526,7 @@ protected JsonToken _parseNegNumber() throws JacksonException --_inputPtr; // to push back trailing char (comma etc) _textBuffer.setCurrentLength(outPtr); // As per #105, need separating space between root values; check here - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(c); } @@ -1842,7 +1537,7 @@ protected JsonToken _parseNegNumber() throws JacksonException // Method called to handle parsing when input is split across buffer boundary // (or output is longer than segment used to store it) private final JsonToken _parseNumber2(char[] outBuf, int outPtr, boolean negative, - int intPartLength) throws JacksonException + int intPartLength) throws IOException { // Ok, parse the rest while (true) { @@ -1867,7 +1562,7 @@ private final JsonToken _parseNumber2(char[] outBuf, int outPtr, boolean negativ --_inputPtr; // to push back trailing char (comma etc) _textBuffer.setCurrentLength(outPtr); // As per #105, need separating space between root values; check here - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(_inputBuffer[_inputPtr] & 0xFF); } @@ -1878,7 +1573,7 @@ private final JsonToken _parseNumber2(char[] outBuf, int outPtr, boolean negativ // Method called when we have seen one zero, and want to ensure // it is not followed by another - private final int _verifyNoLeadingZeroes() throws JacksonException + private final int _verifyNoLeadingZeroes() throws IOException { // Ok to have plain "0" if (_inputPtr >= _inputEnd && !_loadMore()) { @@ -1889,9 +1584,9 @@ private final int _verifyNoLeadingZeroes() throws JacksonException if (ch < INT_0 || ch > INT_9) { return INT_0; } - // Optionally may accept leading zeroes: - if (!isEnabled(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS)) { - _reportInvalidNumber("Leading zeroes not allowed"); + // [JACKSON-358]: we may want to allow them, after all... + if ((_features & FEAT_MASK_LEADING_ZEROS) == 0) { + reportInvalidNumber("Leading zeroes not allowed"); } // if so, just need to skip either all zeroes (if followed by number); or all but one (if non-number) ++_inputPtr; // Leading zero to be skipped @@ -1911,7 +1606,7 @@ private final int _verifyNoLeadingZeroes() throws JacksonException } private final JsonToken _parseFloat(char[] outBuf, int outPtr, int c, - boolean negative, int integerPartLength) throws JacksonException + boolean negative, int integerPartLength) throws IOException { int fractLen = 0; boolean eof = false; @@ -1943,7 +1638,7 @@ private final JsonToken _parseFloat(char[] outBuf, int outPtr, int c, } // must be followed by sequence of ints, one minimum if (fractLen == 0) { - _reportUnexpectedNumberChar(c, "Decimal point not followed by a digit"); + reportUnexpectedNumberChar(c, "Decimal point not followed by a digit"); } } @@ -1989,7 +1684,7 @@ private final JsonToken _parseFloat(char[] outBuf, int outPtr, int c, } // must be followed by sequence of ints, one minimum if (expLen == 0) { - _reportUnexpectedNumberChar(c, "Exponent indicator not followed by a digit"); + reportUnexpectedNumberChar(c, "Exponent indicator not followed by a digit"); } } @@ -1997,7 +1692,7 @@ private final JsonToken _parseFloat(char[] outBuf, int outPtr, int c, if (!eof) { --_inputPtr; // As per [core#105], need separating space between root values; check here - if (_streamReadContext.inRoot()) { + if (_parsingContext.inRoot()) { _verifyRootSpace(c); } } @@ -2016,10 +1711,10 @@ private final JsonToken _parseFloat(char[] outBuf, int outPtr, int c, * * @param ch First character of likely white space to skip * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems (invalid white space) + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid white space) */ - private final void _verifyRootSpace(int ch) throws JacksonException + private final void _verifyRootSpace(int ch) throws IOException { // caller had pushed it back, before calling; reset ++_inputPtr; @@ -2040,12 +1735,12 @@ private final void _verifyRootSpace(int ch) throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, secondary parsing - /********************************************************************** + /********************************************************** */ - - protected final String _parseName(int i) throws JacksonException + + protected final String _parseName(int i) throws IOException { if (i != INT_QUOTE) { return _handleOddName(i); @@ -2107,7 +1802,7 @@ protected final String _parseName(int i) throws JacksonException return parseName(0, q, 0); // quoting or invalid char } - protected final String parseMediumName(int q2) throws JacksonException + protected final String parseMediumName(int q2) throws IOException { final byte[] input = _inputBuffer; final int[] codes = _icLatin1; @@ -2147,7 +1842,8 @@ protected final String parseMediumName(int q2) throws JacksonException return parseMediumName2(i, q2); } - protected final String parseMediumName2(int q3, final int q2) throws JacksonException + // @since 2.6 + protected final String parseMediumName2(int q3, final int q2) throws IOException { final byte[] input = _inputBuffer; final int[] codes = _icLatin1; @@ -2187,7 +1883,7 @@ protected final String parseMediumName2(int q3, final int q2) throws JacksonExce return parseLongName(i, q2, q3); } - protected final String parseLongName(int q, final int q2, int q3) throws JacksonException + protected final String parseLongName(int q, final int q2, int q3) throws IOException { _quadBuffer[0] = _quad1; _quadBuffer[1] = q2; @@ -2252,11 +1948,11 @@ protected final String parseLongName(int q, final int q2, int q3) throws Jackson // Method called when not even first 8 bytes are guaranteed // to come consecutively. Happens rarely, so this is offlined; // plus we'll also do full checks for escaping etc. - protected String slowParseName() throws JacksonException + protected String slowParseName() throws IOException { if (_inputPtr >= _inputEnd) { if (!_loadMore()) { - _reportInvalidEOF(": was expecting closing '\"' for name", JsonToken.PROPERTY_NAME); + _reportInvalidEOF(": was expecting closing '\"' for name", JsonToken.FIELD_NAME); } } int i = _inputBuffer[_inputPtr++] & 0xFF; @@ -2266,16 +1962,16 @@ protected String slowParseName() throws JacksonException return parseEscapedName(_quadBuffer, 0, 0, i, 0); } - private final String parseName(int q1, int ch, int lastQuadBytes) throws JacksonException { + private final String parseName(int q1, int ch, int lastQuadBytes) throws IOException { return parseEscapedName(_quadBuffer, 0, q1, ch, lastQuadBytes); } - private final String parseName(int q1, int q2, int ch, int lastQuadBytes) throws JacksonException { + private final String parseName(int q1, int q2, int ch, int lastQuadBytes) throws IOException { _quadBuffer[0] = q1; return parseEscapedName(_quadBuffer, 1, q2, ch, lastQuadBytes); } - private final String parseName(int q1, int q2, int q3, int ch, int lastQuadBytes) throws JacksonException { + private final String parseName(int q1, int q2, int q3, int ch, int lastQuadBytes) throws IOException { _quadBuffer[0] = q1; _quadBuffer[1] = q2; return parseEscapedName(_quadBuffer, 2, q3, ch, lastQuadBytes); @@ -2286,7 +1982,7 @@ private final String parseName(int q1, int q2, int q3, int ch, int lastQuadBytes // input buffer boundary). Needs to be able to handle more exceptional // cases, gets slower, and hence is offlined to a separate method. protected final String parseEscapedName(int[] quads, int qlen, int currQuad, int ch, - int currQuadBytes) throws JacksonException + int currQuadBytes) throws IOException { // This may seem weird, but here we do not want to worry about // UTF-8 decoding yet. Rather, we'll assume that part is ok (if not it will get @@ -2356,7 +2052,7 @@ protected final String parseEscapedName(int[] quads, int qlen, int currQuad, int } if (_inputPtr >= _inputEnd) { if (!_loadMore()) { - _reportInvalidEOF(" in property name", JsonToken.PROPERTY_NAME); + _reportInvalidEOF(" in field name", JsonToken.FIELD_NAME); } } ch = _inputBuffer[_inputPtr++] & 0xFF; @@ -2377,7 +2073,7 @@ protected final String parseEscapedName(int[] quads, int qlen, int currQuad, int /** * Method called when we see non-white space character other - * than double quote, when expecting a property name. + * than double quote, when expecting a field name. * In standard mode will just throw an exception; but * in non-standard modes may be able to parse name. * @@ -2385,19 +2081,19 @@ protected final String parseEscapedName(int[] quads, int qlen, int currQuad, int * * @return Name decoded, if allowed and successful * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems (invalid name) + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid name) */ - protected String _handleOddName(int ch) throws JacksonException + protected String _handleOddName(int ch) throws IOException { // First: may allow single quotes - if (ch == INT_APOS && isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)) { + if (ch == INT_APOS && (_features & FEAT_MASK_ALLOW_SINGLE_QUOTES) != 0) { return _parseAposName(); } - // Allow unquoted names only if feature enabled: - if (!isEnabled(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES)) { + // Allow unquoted names if feature enabled: + if ((_features & FEAT_MASK_ALLOW_UNQUOTED_NAMES) == 0) { char c = (char) _decodeCharForError(ch); - _reportUnexpectedChar(c, "was expecting double-quote to start property name"); + _reportUnexpectedChar(c, "was expecting double-quote to start field name"); } /* Also: note that although we use a different table here, * it does NOT handle UTF-8 decoding. It'll just pass those @@ -2406,7 +2102,7 @@ protected String _handleOddName(int ch) throws JacksonException final int[] codes = CharTypes.getInputCodeUtf8JsNames(); // Also: must start with a valid character... if (codes[ch] != 0) { - _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start property name"); + _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name"); } // Ok, now; instead of ultra-optimizing parsing here (as with regular @@ -2432,7 +2128,7 @@ protected String _handleOddName(int ch) throws JacksonException } if (_inputPtr >= _inputEnd) { if (!_loadMore()) { - _reportInvalidEOF(" in property name", JsonToken.PROPERTY_NAME); + _reportInvalidEOF(" in field name", JsonToken.FIELD_NAME); } } ch = _inputBuffer[_inputPtr] & 0xFF; @@ -2459,11 +2155,11 @@ protected String _handleOddName(int ch) throws JacksonException // main reason being to try to avoid slowing down fast path // for valid JSON -- more alternatives, more code, generally // bit slower execution. - protected String _parseAposName() throws JacksonException + protected String _parseAposName() throws IOException { if (_inputPtr >= _inputEnd) { if (!_loadMore()) { - _reportInvalidEOF(": was expecting closing '\'' for property name", JsonToken.PROPERTY_NAME); + _reportInvalidEOF(": was expecting closing '\'' for field name", JsonToken.FIELD_NAME); } } int ch = _inputBuffer[_inputPtr++] & 0xFF; @@ -2541,7 +2237,7 @@ protected String _parseAposName() throws JacksonException } if (_inputPtr >= _inputEnd) { if (!_loadMore()) { - _reportInvalidEOF(" in property name", JsonToken.PROPERTY_NAME); + _reportInvalidEOF(" in field name", JsonToken.FIELD_NAME); } } ch = _inputBuffer[_inputPtr++] & 0xFF; @@ -2561,12 +2257,12 @@ protected String _parseAposName() throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, symbol (name) handling - /********************************************************************** + /********************************************************** */ - private final String findName(int q1, int lastQuadBytes) throws StreamReadException + private final String findName(int q1, int lastQuadBytes) throws JsonParseException { q1 = _padLastQuad(q1, lastQuadBytes); // Usually we'll find it from the canonical symbol table already @@ -2579,7 +2275,7 @@ private final String findName(int q1, int lastQuadBytes) throws StreamReadExcept return addName(_quadBuffer, 1, lastQuadBytes); } - private final String findName(int q1, int q2, int lastQuadBytes) throws StreamReadException + private final String findName(int q1, int q2, int lastQuadBytes) throws JsonParseException { q2 = _padLastQuad(q2, lastQuadBytes); // Usually we'll find it from the canonical symbol table already @@ -2593,7 +2289,7 @@ private final String findName(int q1, int q2, int lastQuadBytes) throws StreamRe return addName(_quadBuffer, 2, lastQuadBytes); } - private final String findName(int q1, int q2, int q3, int lastQuadBytes) throws StreamReadException + private final String findName(int q1, int q2, int q3, int lastQuadBytes) throws JsonParseException { q3 = _padLastQuad(q3, lastQuadBytes); String name = _symbols.findName(q1, q2, q3); @@ -2607,8 +2303,7 @@ private final String findName(int q1, int q2, int q3, int lastQuadBytes) throws return addName(quads, 3, lastQuadBytes); } - private final String findName(int[] quads, int qlen, int lastQuad, int lastQuadBytes) - throws StreamReadException + private final String findName(int[] quads, int qlen, int lastQuad, int lastQuadBytes) throws JsonParseException { if (qlen >= quads.length) { _quadBuffer = quads = growArrayBy(quads, quads.length); @@ -2626,8 +2321,7 @@ private final String findName(int[] quads, int qlen, int lastQuad, int lastQuadB * multi-byte chars (if any), and then construct Name instance * and add it to the symbol table. */ - private final String addName(int[] quads, int qlen, int lastQuadBytes) - throws StreamReadException + private final String addName(int[] quads, int qlen, int lastQuadBytes) throws JsonParseException { /* Ok: must decode UTF-8 chars. No other validation is * needed, since unescaping has been done earlier as necessary @@ -2677,7 +2371,7 @@ private final String addName(int[] quads, int qlen, int lastQuadBytes) needed = ch = 1; // never really gets this far } if ((ix + needed) > byteLen) { - _reportInvalidEOF(" in property name", JsonToken.PROPERTY_NAME); + _reportInvalidEOF(" in field name", JsonToken.FIELD_NAME); } // Ok, always need at least one more: @@ -2741,16 +2435,17 @@ private final static int _padLastQuad(int q, int bytes) { } /* - /********************************************************************** + /********************************************************** /* Internal methods, String value parsing - /********************************************************************** + /********************************************************** */ - protected void _loadMoreGuaranteed() throws JacksonException { + protected void _loadMoreGuaranteed() throws IOException { if (!_loadMore()) { _reportInvalidEOF(); } } - - protected void _finishString() throws JacksonException + + @Override + protected void _finishString() throws IOException { // First, single tight loop for ASCII content, not split across input buffer boundary: int ptr = _inputPtr; @@ -2781,7 +2476,8 @@ protected void _finishString() throws JacksonException _finishString2(outBuf, outPtr); } - protected String _finishAndReturnString() throws JacksonException + // @since 2.6 + protected String _finishAndReturnString() throws IOException { // First, single tight loop for ASCII content, not split across input buffer boundary: int ptr = _inputPtr; @@ -2813,7 +2509,7 @@ protected String _finishAndReturnString() throws JacksonException } private final void _finishString2(char[] outBuf, int outPtr) - throws JacksonException + throws IOException { int c; @@ -2901,10 +2597,10 @@ private final void _finishString2(char[] outBuf, int outPtr) * if it is not needed. This can be done bit faster if contents * need not be stored for future access. * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems (invalid String value) + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid String value) */ - protected void _skipString() throws JacksonException + protected void _skipString() throws IOException { _tokenIncomplete = false; @@ -2971,10 +2667,10 @@ protected void _skipString() throws JacksonException * * @return Type of value decoded, if allowed and successful * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid white space) */ - protected JsonToken _handleUnexpectedValue(int c) throws JacksonException + protected JsonToken _handleUnexpectedValue(int c) throws IOException { // Most likely an error, unless we are to allow single-quote-strings switch (c) { @@ -2986,7 +2682,7 @@ protected JsonToken _handleUnexpectedValue(int c) throws JacksonException * Also the case returns NULL as current token in case of ',' or ']'. */ case ']': - if (!_streamReadContext.inArray()) { + if (!_parsingContext.inArray()) { break; } // fall through @@ -2995,8 +2691,8 @@ protected JsonToken _handleUnexpectedValue(int c) throws JacksonException // we may allow "missing values", that is, encountering a trailing // comma or closing marker where value would be expected // 11-May-2020, tatu: [core#616] No commas in root level - if (!_streamReadContext.inRoot()) { - if ((_formatReadFeatures & FEAT_MASK_ALLOW_MISSING) != 0) { + if (!_parsingContext.inRoot()) { + if ((_features & FEAT_MASK_ALLOW_MISSING) != 0) { --_inputPtr; return JsonToken.VALUE_NULL; } @@ -3007,20 +2703,20 @@ protected JsonToken _handleUnexpectedValue(int c) throws JacksonException // been handled earlier _reportUnexpectedChar(c, "expected a value"); case '\'': - if (isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)) { + if ((_features & FEAT_MASK_ALLOW_SINGLE_QUOTES) != 0) { return _handleApos(); } break; case 'N': _matchToken("NaN", 1); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN("NaN", Double.NaN); } _reportError("Non-standard token 'NaN': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow"); break; case 'I': _matchToken("Infinity", 1); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN("Infinity", Double.POSITIVE_INFINITY); } _reportError("Non-standard token 'Infinity': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow"); @@ -3042,7 +2738,7 @@ protected JsonToken _handleUnexpectedValue(int c) throws JacksonException return null; } - protected JsonToken _handleApos() throws JacksonException + protected JsonToken _handleApos() throws IOException { int c = 0; // Otherwise almost verbatim copy of _finishString() @@ -3133,14 +2829,14 @@ protected JsonToken _handleApos() throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, well-known token decoding - /********************************************************************** + /********************************************************** */ // Method called if expected numeric value (due to leading sign) does not // look like a number - protected JsonToken _handleInvalidNumberStart(int ch, boolean neg) throws JacksonException + protected JsonToken _handleInvalidNumberStart(int ch, boolean neg) throws IOException { while (ch == 'I') { if (_inputPtr >= _inputEnd) { @@ -3158,18 +2854,18 @@ protected JsonToken _handleInvalidNumberStart(int ch, boolean neg) throws Jackso break; } _matchToken(match, 3); - if (isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if ((_features & FEAT_MASK_NON_NUM_NUMBERS) != 0) { return resetAsNaN(match, neg ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY); } _reportError("Non-standard token '%s': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow", match); } - _reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); + reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); return null; } // NOTE: first character already decoded - protected final void _matchTrue() throws JacksonException + protected final void _matchTrue() throws IOException { int ptr = _inputPtr; if ((ptr + 3) < _inputEnd) { @@ -3187,7 +2883,7 @@ protected final void _matchTrue() throws JacksonException _matchToken2("true", 1); } - protected final void _matchFalse() throws JacksonException + protected final void _matchFalse() throws IOException { int ptr = _inputPtr; if ((ptr + 4) < _inputEnd) { @@ -3206,7 +2902,7 @@ protected final void _matchFalse() throws JacksonException _matchToken2("false", 1); } - protected final void _matchNull() throws JacksonException + protected final void _matchNull() throws IOException { int ptr = _inputPtr; if ((ptr + 3) < _inputEnd) { @@ -3224,7 +2920,7 @@ protected final void _matchNull() throws JacksonException _matchToken2("null", 1); } - protected final void _matchToken(String matchStr, int i) throws JacksonException + protected final void _matchToken(String matchStr, int i) throws IOException { final int len = matchStr.length(); if ((_inputPtr + len) >= _inputEnd) { @@ -3244,7 +2940,7 @@ protected final void _matchToken(String matchStr, int i) throws JacksonException } } - private final void _matchToken2(String matchStr, int i) throws JacksonException + private final void _matchToken2(String matchStr, int i) throws IOException { final int len = matchStr.length(); do { @@ -3265,21 +2961,21 @@ private final void _matchToken2(String matchStr, int i) throws JacksonException } } - private final void _checkMatchEnd(String matchStr, int i, int ch) throws JacksonException { + private final void _checkMatchEnd(String matchStr, int i, int ch) throws IOException { // but actually only alphanums are problematic char c = (char) _decodeCharForError(ch); if (Character.isJavaIdentifierPart(c)) { _reportInvalidToken(matchStr.substring(0, i)); } } - + /* - /********************************************************************** + /********************************************************** /* Internal methods, ws skipping, escape/unescape - /********************************************************************** + /********************************************************** */ - private final int _skipWS() throws JacksonException + private final int _skipWS() throws IOException { while (_inputPtr < _inputEnd) { int i = _inputBuffer[_inputPtr++] & 0xFF; @@ -3304,7 +3000,7 @@ private final int _skipWS() throws JacksonException return _skipWS2(); } - private final int _skipWS2() throws JacksonException + private final int _skipWS2() throws IOException { while (_inputPtr < _inputEnd || _loadMore()) { int i = _inputBuffer[_inputPtr++] & 0xFF; @@ -3331,10 +3027,10 @@ private final int _skipWS2() throws JacksonException } } } - throw _constructReadException("Unexpected end-of-input within/between "+_streamReadContext.typeDesc()+" entries"); + throw _constructError("Unexpected end-of-input within/between "+_parsingContext.typeDesc()+" entries"); } - private final int _skipWSOrEnd() throws JacksonException + private final int _skipWSOrEnd() throws IOException { // Let's handle first character separately since it is likely that // it is either non-whitespace; or we have longer run of white space @@ -3385,7 +3081,7 @@ private final int _skipWSOrEnd() throws JacksonException return _skipWSOrEnd2(); } - private final int _skipWSOrEnd2() throws JacksonException + private final int _skipWSOrEnd2() throws IOException { while ((_inputPtr < _inputEnd) || _loadMore()) { int i = _inputBuffer[_inputPtr++] & 0xFF; @@ -3415,7 +3111,7 @@ private final int _skipWSOrEnd2() throws JacksonException return _eofAsNextChar(); } - private final int _skipColon() throws JacksonException + private final int _skipColon() throws IOException { if ((_inputPtr + 4) >= _inputEnd) { return _skipColon2(false); @@ -3470,7 +3166,7 @@ private final int _skipColon() throws JacksonException return _skipColon2(false); } - private final int _skipColon2(boolean gotColon) throws JacksonException + private final int _skipColon2(boolean gotColon) throws IOException { while (_inputPtr < _inputEnd || _loadMore()) { int i = _inputBuffer[_inputPtr++] & 0xFF; @@ -3489,7 +3185,7 @@ private final int _skipColon2(boolean gotColon) throws JacksonException return i; } if (i != INT_COLON) { - _reportUnexpectedChar(i, "was expecting a colon to separate property name and value"); + _reportUnexpectedChar(i, "was expecting a colon to separate field name and value"); } gotColon = true; } else if (i != INT_SPACE) { @@ -3503,14 +3199,14 @@ private final int _skipColon2(boolean gotColon) throws JacksonException } } } - _reportInvalidEOF(" within/between "+_streamReadContext.typeDesc()+" entries", + _reportInvalidEOF(" within/between "+_parsingContext.typeDesc()+" entries", null); return -1; } - private final void _skipComment() throws JacksonException + private final void _skipComment() throws IOException { - if (!isEnabled(JsonReadFeature.ALLOW_JAVA_COMMENTS)) { + if ((_features & FEAT_MASK_ALLOW_JAVA_COMMENTS) == 0) { _reportUnexpectedChar('/', "maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser)"); } // First: check which comment (if either) it is: @@ -3527,7 +3223,7 @@ private final void _skipComment() throws JacksonException } } - private final void _skipCComment() throws JacksonException + private final void _skipCComment() throws IOException { // Need to be UTF-8 aware here to decode content (for skipping) final int[] codes = CharTypes.getInputCodeComment(); @@ -3573,9 +3269,9 @@ private final void _skipCComment() throws JacksonException _reportInvalidEOF(" in a comment", null); } - private final boolean _skipYAMLComment() throws JacksonException + private final boolean _skipYAMLComment() throws IOException { - if (!isEnabled(JsonReadFeature.ALLOW_YAML_COMMENTS)) { + if ((_features & FEAT_MASK_ALLOW_YAML_COMMENTS) == 0) { return false; } _skipLine(); @@ -3584,7 +3280,7 @@ private final boolean _skipYAMLComment() throws JacksonException // Method for skipping contents of an input line; usually for CPP // and YAML style comments. - private final void _skipLine() throws JacksonException + private final void _skipLine() throws IOException { // Ok: need to find EOF or linefeed final int[] codes = CharTypes.getInputCodeComment(); @@ -3622,7 +3318,7 @@ private final void _skipLine() throws JacksonException } @Override - protected char _decodeEscaped() throws JacksonException + protected char _decodeEscaped() throws IOException { if (_inputPtr >= _inputEnd) { if (!_loadMore()) { @@ -3675,7 +3371,7 @@ protected char _decodeEscaped() throws JacksonException return (char) value; } - protected int _decodeCharForError(int firstByte) throws JacksonException + protected int _decodeCharForError(int firstByte) throws IOException { int c = firstByte & 0xFF; if (c > 0x7F) { // if >= 0, is ascii and fine as is @@ -3722,12 +3418,12 @@ protected int _decodeCharForError(int firstByte) throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods,UTF8 decoding - /********************************************************************** + /********************************************************** */ - private final int _decodeUtf8_2(int c) throws JacksonException + private final int _decodeUtf8_2(int c) throws IOException { if (_inputPtr >= _inputEnd) { _loadMoreGuaranteed(); @@ -3739,7 +3435,7 @@ private final int _decodeUtf8_2(int c) throws JacksonException return ((c & 0x1F) << 6) | (d & 0x3F); } - private final int _decodeUtf8_3(int c1) throws JacksonException + private final int _decodeUtf8_3(int c1) throws IOException { if (_inputPtr >= _inputEnd) { _loadMoreGuaranteed(); @@ -3761,7 +3457,7 @@ private final int _decodeUtf8_3(int c1) throws JacksonException return c; } - private final int _decodeUtf8_3fast(int c1) throws JacksonException + private final int _decodeUtf8_3fast(int c1) throws IOException { c1 &= 0x0F; int d = (int) _inputBuffer[_inputPtr++]; @@ -3779,7 +3475,7 @@ private final int _decodeUtf8_3fast(int c1) throws JacksonException // @return Character value minus 0x10000; this so that caller // can readily expand it to actual surrogates - private final int _decodeUtf8_4(int c) throws JacksonException + private final int _decodeUtf8_4(int c) throws IOException { if (_inputPtr >= _inputEnd) { _loadMoreGuaranteed(); @@ -3812,7 +3508,7 @@ private final int _decodeUtf8_4(int c) throws JacksonException return ((c << 6) | (d & 0x3F)) - 0x10000; } - private final void _skipUtf8_2() throws JacksonException + private final void _skipUtf8_2() throws IOException { if (_inputPtr >= _inputEnd) { _loadMoreGuaranteed(); @@ -3826,7 +3522,7 @@ private final void _skipUtf8_2() throws JacksonException /* Alas, can't heavily optimize skipping, since we still have to * do validity checks... */ - private final void _skipUtf8_3() throws JacksonException + private final void _skipUtf8_3() throws IOException { if (_inputPtr >= _inputEnd) { _loadMoreGuaranteed(); @@ -3845,7 +3541,7 @@ private final void _skipUtf8_3() throws JacksonException } } - private final void _skipUtf8_4(int c) throws JacksonException + private final void _skipUtf8_4(int c) throws IOException { if (_inputPtr >= _inputEnd) { _loadMoreGuaranteed(); @@ -3871,14 +3567,14 @@ private final void _skipUtf8_4(int c) throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, input loading - /********************************************************************** + /********************************************************** */ // We actually need to check the character value here // (to see if we have \n following \r). - protected final void _skipCR() throws JacksonException + protected final void _skipCR() throws IOException { if (_inputPtr < _inputEnd || _loadMore()) { if (_inputBuffer[_inputPtr] == BYTE_LF) { @@ -3889,7 +3585,7 @@ protected final void _skipCR() throws JacksonException _currInputRowStart = _inputPtr; } - private int nextByte() throws JacksonException + private int nextByte() throws IOException { if (_inputPtr >= _inputEnd) { _loadMoreGuaranteed(); @@ -3898,21 +3594,21 @@ private int nextByte() throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Internal methods, error reporting - /********************************************************************** + /********************************************************** */ - protected void _reportInvalidToken(String matchedPart, int ptr) throws JacksonException { + protected void _reportInvalidToken(String matchedPart, int ptr) throws IOException { _inputPtr = ptr; _reportInvalidToken(matchedPart, _validJsonTokenList()); } - protected void _reportInvalidToken(String matchedPart) throws JacksonException { + protected void _reportInvalidToken(String matchedPart) throws IOException { _reportInvalidToken(matchedPart, _validJsonTokenList()); } - protected void _reportInvalidToken(String matchedPart, String msg) throws JacksonException + protected void _reportInvalidToken(String matchedPart, String msg) throws IOException { /* Let's just try to find what appears to be the token, using * regular Java identifier character rules. It's just a heuristic, @@ -3939,7 +3635,7 @@ protected void _reportInvalidToken(String matchedPart, String msg) throws Jackso _reportError("Unrecognized token '%s': was expecting %s", sb, msg); } - protected void _reportInvalidChar(int c) throws StreamReadException + protected void _reportInvalidChar(int c) throws JsonParseException { // Either invalid WS or illegal UTF-8 start char if (c < INT_SPACE) { @@ -3948,24 +3644,25 @@ protected void _reportInvalidChar(int c) throws StreamReadException _reportInvalidInitial(c); } - protected void _reportInvalidInitial(int mask) throws StreamReadException { + protected void _reportInvalidInitial(int mask) throws JsonParseException { _reportError("Invalid UTF-8 start byte 0x"+Integer.toHexString(mask)); } - protected void _reportInvalidOther(int mask) throws StreamReadException { + protected void _reportInvalidOther(int mask) throws JsonParseException { _reportError("Invalid UTF-8 middle byte 0x"+Integer.toHexString(mask)); } - protected void _reportInvalidOther(int mask, int ptr) throws StreamReadException + protected void _reportInvalidOther(int mask, int ptr) + throws JsonParseException { _inputPtr = ptr; _reportInvalidOther(mask); } /* - /********************************************************************** + /********************************************************** /* Internal methods, binary access - /********************************************************************** + /********************************************************** */ /** @@ -3976,11 +3673,11 @@ protected void _reportInvalidOther(int mask, int ptr) throws StreamReadException * * @return Fully decoded value of base64 content * - * @throws WrappedIOException for low-level read issues - * @throws StreamReadException for decoding problems (invalid content) + * @throws IOException for low-level read issues, or + * {@link JsonParseException} for decoding problems (invalid content) */ @SuppressWarnings("resource") - protected final byte[] _decodeBase64(Base64Variant b64variant) throws JacksonException + protected final byte[] _decodeBase64(Base64Variant b64variant) throws IOException { ByteArrayBuilder builder = _getByteArrayBuilder(); @@ -4047,7 +3744,7 @@ protected final byte[] _decodeBase64(Base64Variant b64variant) throws JacksonExc ch = _inputBuffer[_inputPtr++] & 0xFF; if (!b64variant.usesPaddingChar(ch)) { if (_decodeBase64Escape(b64variant, ch, 3) != Base64Variant.BASE64_VALUE_PADDING) { - _reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); + throw reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '"+b64variant.getPaddingChar()+"'"); } } // Got 12 bits, only need 8, need to shift @@ -4094,16 +3791,16 @@ protected final byte[] _decodeBase64(Base64Variant b64variant) throws JacksonExc } /* - /********************************************************************** - /* Improved location updating - /********************************************************************** + /********************************************************** + /* Improved location updating (refactored in 2.7) + /********************************************************** */ // As per [core#108], must ensure we call the right method @Override - public JsonLocation currentTokenLocation() + public JsonLocation getTokenLocation() { - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { long total = _currInputProcessed + (_nameStartOffset-1); return new JsonLocation(_contentReference(), total, -1L, _nameStartRow, _nameStartCol); @@ -4114,7 +3811,7 @@ public JsonLocation currentTokenLocation() // As per [core#108], must ensure we call the right method @Override - public JsonLocation currentLocation() + public JsonLocation getCurrentLocation() { int col = _inputPtr - _currInputRowStart + 1; // 1-based return new JsonLocation(_contentReference(), @@ -4122,6 +3819,7 @@ public JsonLocation currentLocation() _currInputRow, col); } + // @since 2.7 private final void _updateLocation() { _tokenInputRow = _currInputRow; @@ -4130,6 +3828,7 @@ private final void _updateLocation() _tokenInputCol = ptr - _currInputRowStart; } + // @since 2.7 private final void _updateNameLocation() { _nameStartRow = _currInputRow; @@ -4139,12 +3838,12 @@ private final void _updateNameLocation() } /* - /********************************************************************** + /********************************************************** /* Internal methods, other - /********************************************************************** + /********************************************************** */ - private final JsonToken _closeScope(int i) throws StreamReadException { + private final JsonToken _closeScope(int i) throws JsonParseException { if (i == INT_RCURLY) { _closeObjectScope(); return (_currToken = JsonToken.END_OBJECT); @@ -4153,19 +3852,19 @@ private final JsonToken _closeScope(int i) throws StreamReadException { return (_currToken = JsonToken.END_ARRAY); } - private final void _closeArrayScope() throws StreamReadException { + private final void _closeArrayScope() throws JsonParseException { _updateLocation(); - if (!_streamReadContext.inArray()) { + if (!_parsingContext.inArray()) { _reportMismatchedEndMarker(']', '}'); } - _streamReadContext = _streamReadContext.clearAndGetParent(); + _parsingContext = _parsingContext.clearAndGetParent(); } - private final void _closeObjectScope() throws StreamReadException { + private final void _closeObjectScope() throws JsonParseException { _updateLocation(); - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _reportMismatchedEndMarker('}', ']'); } - _streamReadContext = _streamReadContext.clearAndGetParent(); + _parsingContext = _parsingContext.clearAndGetParent(); } } diff --git a/src/main/java/com/fasterxml/jackson/core/json/WriterBasedJsonGenerator.java b/src/main/java/com/fasterxml/jackson/core/json/WriterBasedJsonGenerator.java index 6ffa8892f0..6a91347431 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/WriterBasedJsonGenerator.java +++ b/src/main/java/com/fasterxml/jackson/core/json/WriterBasedJsonGenerator.java @@ -15,16 +15,16 @@ * which handles character encoding. */ public class WriterBasedJsonGenerator - extends JsonGeneratorBase + extends JsonGeneratorImpl { protected final static int SHORT_WRITE = 32; protected final static char[] HEX_CHARS = CharTypes.copyHexChars(); /* - /********************************************************************** + /********************************************************** /* Configuration - /********************************************************************** + /********************************************************** */ protected final Writer _writer; @@ -33,12 +33,12 @@ public class WriterBasedJsonGenerator * Character used for quoting JSON Object property names * and String values. */ - protected final char _quoteChar; + protected char _quoteChar; /* - /********************************************************************** + /********************************************************** /* Output buffering - /********************************************************************** + /********************************************************** */ /** @@ -79,91 +79,92 @@ public class WriterBasedJsonGenerator /** * Intermediate buffer in which characters of a String are copied * before being encoded. + * + * @since 2.10 */ protected char[] _copyBuffer; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ - public WriterBasedJsonGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, - int streamWriteFeatures, int formatWriteFeatures, Writer w, - SerializableString rootValueSep, PrettyPrinter pp, - CharacterEscapes charEsc, int maxNonEscaped, char quoteChar) + @Deprecated // since 2.10 + public WriterBasedJsonGenerator(IOContext ctxt, int features, + ObjectCodec codec, Writer w) { + this(ctxt, features, codec, w, JsonFactory.DEFAULT_QUOTE_CHAR); + } + + // @since 2.10 + public WriterBasedJsonGenerator(IOContext ctxt, int features, + ObjectCodec codec, Writer w, + char quoteChar) + { - super(writeCtxt, ioCtxt, streamWriteFeatures, formatWriteFeatures, rootValueSep, pp, - charEsc, maxNonEscaped); + super(ctxt, features, codec); _writer = w; - _outputBuffer = ioCtxt.allocConcatBuffer(); + _outputBuffer = ctxt.allocConcatBuffer(); _outputEnd = _outputBuffer.length; _quoteChar = quoteChar; - setCharacterEscapes(charEsc); - } - - @Override - public JsonGenerator setCharacterEscapes(CharacterEscapes esc) - { - _characterEscapes = esc; - if (esc == null) { - _outputEscapes = (_quoteChar == '"') ? DEFAULT_OUTPUT_ESCAPES - : CharTypes.get7BitOutputEscapes(_quoteChar); - } else { - _outputEscapes = esc.getEscapeCodesForAscii(); + if (quoteChar != '"') { // since 2.10 + _outputEscapes = CharTypes.get7BitOutputEscapes(quoteChar); } - return this; } /* - /********************************************************************** + /********************************************************** /* Overridden configuration, introspection methods - /********************************************************************** + /********************************************************** */ @Override - public Object streamWriteOutputTarget() { + public Object getOutputTarget() { return _writer; } @Override - public int streamWriteOutputBuffered() { + public int getOutputBuffered() { // Assuming tail and head are kept but... trust and verify: int len = _outputTail - _outputHead; return Math.max(0, len); } + // json does allow this so + @Override + public boolean canWriteFormattedNumbers() { return true; } + /* - /********************************************************************** + /********************************************************** /* Overridden methods - /********************************************************************** + /********************************************************** */ @Override - public void writeName(String name) throws JacksonException + public void writeFieldName(String name) throws IOException { - int status = _streamWriteContext.writeName(name); + int status = _writeContext.writeFieldName(name); if (status == JsonWriteContext.STATUS_EXPECT_VALUE) { - _reportError("Cannot write a property name, expecting a value"); + _reportError("Can not write a field name, expecting a value"); } - _writeName(name, (status == JsonWriteContext.STATUS_OK_AFTER_COMMA)); + _writeFieldName(name, (status == JsonWriteContext.STATUS_OK_AFTER_COMMA)); } @Override - public void writeName(SerializableString name) throws JacksonException + public void writeFieldName(SerializableString name) throws IOException { // Object is a value, need to verify it's allowed - int status = _streamWriteContext.writeName(name.getValue()); + int status = _writeContext.writeFieldName(name.getValue()); if (status == JsonWriteContext.STATUS_EXPECT_VALUE) { - _reportError("Cannot write a property name, expecting a value"); + _reportError("Can not write a field name, expecting a value"); } - _writeName(name, (status == JsonWriteContext.STATUS_OK_AFTER_COMMA)); + _writeFieldName(name, (status == JsonWriteContext.STATUS_OK_AFTER_COMMA)); } - protected final void _writeName(String name, boolean commaBefore) throws JacksonException + protected final void _writeFieldName(String name, boolean commaBefore) throws IOException { if (_cfgPrettyPrinter != null) { - _writePPName(name, commaBefore); + _writePPFieldName(name, commaBefore); return; } // for fast+std case, need to output up to 2 chars, comma, dquote @@ -173,7 +174,7 @@ protected final void _writeName(String name, boolean commaBefore) throws Jackson if (commaBefore) { _outputBuffer[_outputTail++] = ','; } - // Alternate mode, in which quoting of property names disabled? + // Alternate mode, in which quoting of field names disabled? if (_cfgUnqNames) { _writeString(name); return; @@ -189,10 +190,10 @@ protected final void _writeName(String name, boolean commaBefore) throws Jackson _outputBuffer[_outputTail++] = _quoteChar; } - protected final void _writeName(SerializableString name, boolean commaBefore) throws JacksonException + protected final void _writeFieldName(SerializableString name, boolean commaBefore) throws IOException { if (_cfgPrettyPrinter != null) { - _writePPName(name, commaBefore); + _writePPFieldName(name, commaBefore); return; } // for fast+std case, need to output up to 2 chars, comma, dquote @@ -202,7 +203,7 @@ protected final void _writeName(SerializableString name, boolean commaBefore) th if (commaBefore) { _outputBuffer[_outputTail++] = ','; } - // Alternate mode, in which quoting of property names disabled? + // Alternate mode, in which quoting of field names disabled? if (_cfgUnqNames) { final char[] ch = name.asQuotedChars(); writeRaw(ch, 0, ch.length); @@ -214,7 +215,7 @@ protected final void _writeName(SerializableString name, boolean commaBefore) th int len = name.appendQuoted(_outputBuffer, _outputTail); if (len < 0) { - _writeNameTail(name); + _writeFieldNameTail(name); return; } _outputTail += len; @@ -224,7 +225,7 @@ protected final void _writeName(SerializableString name, boolean commaBefore) th _outputBuffer[_outputTail++] = _quoteChar; } - private final void _writeNameTail(SerializableString name) throws JacksonException + private final void _writeFieldNameTail(SerializableString name) throws IOException { final char[] quoted = name.asQuotedChars(); writeRaw(quoted, 0, quoted.length); @@ -235,16 +236,16 @@ private final void _writeNameTail(SerializableString name) throws JacksonExcepti } /* - /********************************************************************** + /********************************************************** /* Output method implementations, structural - /********************************************************************** + /********************************************************** */ @Override - public void writeStartArray() throws JacksonException + public void writeStartArray() throws IOException { _verifyValueWrite("start an array"); - _streamWriteContext = _streamWriteContext.createChildArrayContext(null); + _writeContext = _writeContext.createChildArrayContext(); if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartArray(this); } else { @@ -255,11 +256,11 @@ public void writeStartArray() throws JacksonException } } - @Override - public void writeStartArray(Object forValue) throws JacksonException + @Override // since 2.12 + public void writeStartArray(Object currentValue) throws IOException { _verifyValueWrite("start an array"); - _streamWriteContext = _streamWriteContext.createChildArrayContext(forValue); + _writeContext = _writeContext.createChildArrayContext(currentValue); if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartArray(this); } else { @@ -270,11 +271,11 @@ public void writeStartArray(Object forValue) throws JacksonException } } - @Override - public void writeStartArray(Object forValue, int len) throws JacksonException + @Override // since 2.12 + public void writeStartArray(Object currentValue, int size) throws IOException { _verifyValueWrite("start an array"); - _streamWriteContext = _streamWriteContext.createChildArrayContext(forValue); + _writeContext = _writeContext.createChildArrayContext(currentValue); if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartArray(this); } else { @@ -284,29 +285,29 @@ public void writeStartArray(Object forValue, int len) throws JacksonException _outputBuffer[_outputTail++] = '['; } } - + @Override - public void writeEndArray() throws JacksonException + public void writeEndArray() throws IOException { - if (!_streamWriteContext.inArray()) { - _reportError("Current context not Array but "+_streamWriteContext.typeDesc()); + if (!_writeContext.inArray()) { + _reportError("Current context not Array but "+_writeContext.typeDesc()); } if (_cfgPrettyPrinter != null) { - _cfgPrettyPrinter.writeEndArray(this, _streamWriteContext.getEntryCount()); + _cfgPrettyPrinter.writeEndArray(this, _writeContext.getEntryCount()); } else { if (_outputTail >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = ']'; } - _streamWriteContext = _streamWriteContext.clearAndGetParent(); + _writeContext = _writeContext.clearAndGetParent(); } @Override - public void writeStartObject() throws JacksonException + public void writeStartObject() throws IOException { _verifyValueWrite("start an object"); - _streamWriteContext = _streamWriteContext.createChildObjectContext(null); + _writeContext = _writeContext.createChildObjectContext(); if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartObject(this); } else { @@ -317,12 +318,12 @@ public void writeStartObject() throws JacksonException } } - @Override - public void writeStartObject(Object forValue) throws JacksonException + @Override // since 2.8 + public void writeStartObject(Object forValue) throws IOException { _verifyValueWrite("start an object"); - JsonWriteContext ctxt = _streamWriteContext.createChildObjectContext(forValue); - _streamWriteContext = ctxt; + JsonWriteContext ctxt = _writeContext.createChildObjectContext(forValue); + _writeContext = ctxt; if (_cfgPrettyPrinter != null) { _cfgPrettyPrinter.writeStartObject(this); } else { @@ -334,41 +335,25 @@ public void writeStartObject(Object forValue) throws JacksonException } @Override - public void writeStartObject(Object forValue, int size) throws JacksonException + public void writeEndObject() throws IOException { - _verifyValueWrite("start an object"); - JsonWriteContext ctxt = _streamWriteContext.createChildObjectContext(forValue); - _streamWriteContext = ctxt; - if (_cfgPrettyPrinter != null) { - _cfgPrettyPrinter.writeStartObject(this); - } else { - if (_outputTail >= _outputEnd) { - _flushBuffer(); - } - _outputBuffer[_outputTail++] = '{'; - } - } - - @Override - public void writeEndObject() throws JacksonException - { - if (!_streamWriteContext.inObject()) { - _reportError("Current context not Object but "+_streamWriteContext.typeDesc()); + if (!_writeContext.inObject()) { + _reportError("Current context not Object but "+_writeContext.typeDesc()); } if (_cfgPrettyPrinter != null) { - _cfgPrettyPrinter.writeEndObject(this, _streamWriteContext.getEntryCount()); + _cfgPrettyPrinter.writeEndObject(this, _writeContext.getEntryCount()); } else { if (_outputTail >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = '}'; } - _streamWriteContext = _streamWriteContext.clearAndGetParent(); + _writeContext = _writeContext.clearAndGetParent(); } - // Specialized version of _writeName, off-lined + // Specialized version of _writeFieldName, off-lined // to keep the "fast path" as simple (and hopefully fast) as possible. - protected final void _writePPName(String name, boolean commaBefore) throws JacksonException + protected final void _writePPFieldName(String name, boolean commaBefore) throws IOException { if (commaBefore) { _cfgPrettyPrinter.writeObjectEntrySeparator(this); @@ -391,7 +376,7 @@ protected final void _writePPName(String name, boolean commaBefore) throws Jacks } } - protected final void _writePPName(SerializableString name, boolean commaBefore) throws JacksonException + protected final void _writePPFieldName(SerializableString name, boolean commaBefore) throws IOException { if (commaBefore) { _cfgPrettyPrinter.writeObjectEntrySeparator(this); @@ -415,13 +400,13 @@ protected final void _writePPName(SerializableString name, boolean commaBefore) } /* - /********************************************************************** + /********************************************************** /* Output method implementations, textual - /********************************************************************** + /********************************************************** */ @Override - public void writeString(String text) throws JacksonException + public void writeString(String text) throws IOException { _verifyValueWrite(WRITE_STRING); if (text == null) { @@ -441,7 +426,7 @@ public void writeString(String text) throws JacksonException } @Override - public void writeString(Reader reader, int len) throws JacksonException + public void writeString(Reader reader, final int len) throws IOException { _verifyValueWrite(WRITE_STRING); if (reader == null) { @@ -458,13 +443,7 @@ public void writeString(Reader reader, int len) throws JacksonException final char[] buf = _allocateCopyBuffer(); while (toRead > 0) { int toReadNow = Math.min(toRead, buf.length); - int numRead; - - try { - numRead = reader.read(buf, 0, toReadNow); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + int numRead = reader.read(buf, 0, toReadNow); if (numRead <= 0) { break; } @@ -483,7 +462,7 @@ public void writeString(Reader reader, int len) throws JacksonException } @Override - public void writeString(char[] text, int offset, int len) throws JacksonException + public void writeString(char[] text, int offset, int len) throws IOException { _verifyValueWrite(WRITE_STRING); if (_outputTail >= _outputEnd) { @@ -499,7 +478,7 @@ public void writeString(char[] text, int offset, int len) throws JacksonExceptio } @Override - public void writeString(SerializableString sstr) throws JacksonException + public void writeString(SerializableString sstr) throws IOException { _verifyValueWrite(WRITE_STRING); if (_outputTail >= _outputEnd) { @@ -518,7 +497,7 @@ public void writeString(SerializableString sstr) throws JacksonException _outputBuffer[_outputTail++] = _quoteChar; } - private void _writeString2(SerializableString sstr) throws JacksonException + private void _writeString2(SerializableString sstr) throws IOException { // Note: copied from writeRaw: char[] text = sstr.asQuotedChars(); @@ -532,11 +511,7 @@ private void _writeString2(SerializableString sstr) throws JacksonException _outputTail += len; } else { _flushBuffer(); - try { - _writer.write(text, 0, len); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(text, 0, len); } if (_outputTail >= _outputEnd) { _flushBuffer(); @@ -545,25 +520,25 @@ private void _writeString2(SerializableString sstr) throws JacksonException } @Override - public void writeRawUTF8String(byte[] text, int offset, int length) throws JacksonException { + public void writeRawUTF8String(byte[] text, int offset, int length) throws IOException { // could add support for buffering if we really want it... _reportUnsupportedOperation(); } @Override - public void writeUTF8String(byte[] text, int offset, int length) throws JacksonException { + public void writeUTF8String(byte[] text, int offset, int length) throws IOException { // could add support for buffering if we really want it... _reportUnsupportedOperation(); } - + /* - /********************************************************************** + /********************************************************** /* Output method implementations, unprocessed ("raw") - /********************************************************************** + /********************************************************** */ @Override - public void writeRaw(String text) throws JacksonException + public void writeRaw(String text) throws IOException { // Nothing to check, can just output as is int len = text.length(); @@ -583,7 +558,7 @@ public void writeRaw(String text) throws JacksonException } @Override - public void writeRaw(String text, int start, int len) throws JacksonException + public void writeRaw(String text, int start, int len) throws IOException { // Nothing to check, can just output as is int room = _outputEnd - _outputTail; @@ -603,7 +578,7 @@ public void writeRaw(String text, int start, int len) throws JacksonException // @since 2.1 @Override - public void writeRaw(SerializableString text) throws JacksonException { + public void writeRaw(SerializableString text) throws IOException { int len = text.appendUnquoted(_outputBuffer, _outputTail); if (len < 0) { writeRaw(text.getValue()); @@ -613,7 +588,7 @@ public void writeRaw(SerializableString text) throws JacksonException { } @Override - public void writeRaw(char[] text, int offset, int len) throws JacksonException + public void writeRaw(char[] text, int offset, int len) throws IOException { // Only worth buffering if it's a short write? if (len < SHORT_WRITE) { @@ -627,15 +602,11 @@ public void writeRaw(char[] text, int offset, int len) throws JacksonException } // Otherwise, better just pass through: _flushBuffer(); - try { - _writer.write(text, offset, len); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(text, offset, len); } @Override - public void writeRaw(char c) throws JacksonException + public void writeRaw(char c) throws IOException { if (_outputTail >= _outputEnd) { _flushBuffer(); @@ -643,7 +614,7 @@ public void writeRaw(char c) throws JacksonException _outputBuffer[_outputTail++] = c; } - private void writeRawLong(String text) throws JacksonException + private void writeRawLong(String text) throws IOException { int room = _outputEnd - _outputTail; // If not, need to do it by looping @@ -669,14 +640,14 @@ private void writeRawLong(String text) throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Output method implementations, base64-encoded binary - /********************************************************************** + /********************************************************** */ @Override public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len) - throws JacksonException + throws IOException, JsonGenerationException { _verifyValueWrite(WRITE_BINARY); // Starting quotes @@ -695,7 +666,7 @@ public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int l @Override public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) - throws JacksonException + throws IOException, JsonGenerationException { _verifyValueWrite(WRITE_BINARY); // Starting quotes @@ -725,15 +696,15 @@ public int writeBinary(Base64Variant b64variant, _outputBuffer[_outputTail++] = _quoteChar; return bytes; } - + /* - /********************************************************************** + /********************************************************** /* Output method implementations, primitive - /********************************************************************** + /********************************************************** */ @Override - public void writeNumber(short s) throws JacksonException + public void writeNumber(short s) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (_cfgNumbersAsStrings) { @@ -747,7 +718,7 @@ public void writeNumber(short s) throws JacksonException _outputTail = NumberOutput.outputInt(s, _outputBuffer, _outputTail); } - private void _writeQuotedShort(short s) throws JacksonException { + private void _writeQuotedShort(short s) throws IOException { if ((_outputTail + 8) >= _outputEnd) { _flushBuffer(); } @@ -757,7 +728,7 @@ private void _writeQuotedShort(short s) throws JacksonException { } @Override - public void writeNumber(int i) throws JacksonException + public void writeNumber(int i) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (_cfgNumbersAsStrings) { @@ -771,7 +742,7 @@ public void writeNumber(int i) throws JacksonException _outputTail = NumberOutput.outputInt(i, _outputBuffer, _outputTail); } - private void _writeQuotedInt(int i) throws JacksonException { + private void _writeQuotedInt(int i) throws IOException { if ((_outputTail + 13) >= _outputEnd) { _flushBuffer(); } @@ -781,7 +752,7 @@ private void _writeQuotedInt(int i) throws JacksonException { } @Override - public void writeNumber(long l) throws JacksonException + public void writeNumber(long l) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (_cfgNumbersAsStrings) { @@ -795,7 +766,7 @@ public void writeNumber(long l) throws JacksonException _outputTail = NumberOutput.outputLong(l, _outputBuffer, _outputTail); } - private void _writeQuotedLong(long l) throws JacksonException { + private void _writeQuotedLong(long l) throws IOException { if ((_outputTail + 23) >= _outputEnd) { _flushBuffer(); } @@ -807,7 +778,7 @@ private void _writeQuotedLong(long l) throws JacksonException { // !!! 05-Aug-2008, tatus: Any ways to optimize these? @Override - public void writeNumber(BigInteger value) throws JacksonException + public void writeNumber(BigInteger value) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (value == null) { @@ -819,11 +790,12 @@ public void writeNumber(BigInteger value) throws JacksonException } } + @SuppressWarnings("deprecation") @Override - public void writeNumber(double d) throws JacksonException + public void writeNumber(double d) throws IOException { if (_cfgNumbersAsStrings || - (NumberOutput.notFinite(d) && JsonWriteFeature.WRITE_NAN_AS_STRINGS.enabledIn(_formatWriteFeatures))) { + (NumberOutput.notFinite(d) && isEnabled(Feature.QUOTE_NON_NUMERIC_NUMBERS))) { writeString(String.valueOf(d)); return; } @@ -832,11 +804,12 @@ public void writeNumber(double d) throws JacksonException writeRaw(String.valueOf(d)); } + @SuppressWarnings("deprecation") @Override - public void writeNumber(float f) throws JacksonException + public void writeNumber(float f) throws IOException { if (_cfgNumbersAsStrings || - (NumberOutput.notFinite(f) && JsonWriteFeature.WRITE_NAN_AS_STRINGS.enabledIn(_formatWriteFeatures))) { + (NumberOutput.notFinite(f) && isEnabled(Feature.QUOTE_NON_NUMERIC_NUMBERS))) { writeString(String.valueOf(f)); return; } @@ -846,7 +819,7 @@ public void writeNumber(float f) throws JacksonException } @Override - public void writeNumber(BigDecimal value) throws JacksonException + public void writeNumber(BigDecimal value) throws IOException { // Don't really know max length for big decimal, no point checking _verifyValueWrite(WRITE_NUMBER); @@ -860,7 +833,7 @@ public void writeNumber(BigDecimal value) throws JacksonException } @Override - public void writeNumber(String encodedValue) throws JacksonException + public void writeNumber(String encodedValue) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (encodedValue == null) { @@ -873,7 +846,7 @@ public void writeNumber(String encodedValue) throws JacksonException } @Override - public void writeNumber(char[] encodedValueBuffer, int offset, int length) throws JacksonException { + public void writeNumber(char[] encodedValueBuffer, int offset, int length) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (_cfgNumbersAsStrings) { _writeQuotedRaw(encodedValueBuffer, offset, length); @@ -882,7 +855,7 @@ public void writeNumber(char[] encodedValueBuffer, int offset, int length) throw } } - private void _writeQuotedRaw(String value) throws JacksonException + private void _writeQuotedRaw(String value) throws IOException { if (_outputTail >= _outputEnd) { _flushBuffer(); @@ -895,7 +868,7 @@ private void _writeQuotedRaw(String value) throws JacksonException _outputBuffer[_outputTail++] = _quoteChar; } - private void _writeQuotedRaw(char[] text, int offset, int length) throws JacksonException + private void _writeQuotedRaw(char[] text, int offset, int length) throws IOException { if (_outputTail >= _outputEnd) { _flushBuffer(); @@ -909,7 +882,7 @@ private void _writeQuotedRaw(char[] text, int offset, int length) throws Jackson } @Override - public void writeBoolean(boolean state) throws JacksonException + public void writeBoolean(boolean state) throws IOException { _verifyValueWrite(WRITE_BOOLEAN); if ((_outputTail + 5) >= _outputEnd) { @@ -933,21 +906,21 @@ public void writeBoolean(boolean state) throws JacksonException } @Override - public void writeNull() throws JacksonException { + public void writeNull() throws IOException { _verifyValueWrite(WRITE_NULL); _writeNull(); } /* - /********************************************************************** + /********************************************************** /* Implementations for other methods - /********************************************************************** + /********************************************************** */ @Override - protected final void _verifyValueWrite(String typeMsg) throws JacksonException + protected final void _verifyValueWrite(String typeMsg) throws IOException { - final int status = _streamWriteContext.writeValue(); + final int status = _writeContext.writeValue(); if (_cfgPrettyPrinter != null) { // Otherwise, pretty printer knows what to do... _verifyPrettyValueWrite(typeMsg, status); @@ -980,34 +953,33 @@ protected final void _verifyValueWrite(String typeMsg) throws JacksonException } /* - /********************************************************************** + /********************************************************** /* Low-level output handling - /********************************************************************** + /********************************************************** */ @Override - public void flush() throws JacksonException + public void flush() throws IOException { _flushBuffer(); if (_writer != null) { - if (isEnabled(StreamWriteFeature.FLUSH_PASSED_TO_STREAM)) { - try { - _writer.flush(); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + if (isEnabled(Feature.FLUSH_PASSED_TO_STREAM)) { + _writer.flush(); } } } @Override - public void close() throws JacksonException + public void close() throws IOException { super.close(); + + // 05-Dec-2008, tatu: To add [JACKSON-27], need to close open scopes + // First: let's see that we still have buffers... if (_outputBuffer != null - && isEnabled(StreamWriteFeature.AUTO_CLOSE_CONTENT)) { + && isEnabled(Feature.AUTO_CLOSE_JSON_CONTENT)) { while (true) { - TokenStreamContext ctxt = streamWriteContext(); + JsonStreamContext ctxt = getOutputContext(); if (ctxt.inArray()) { writeEndArray(); } else if (ctxt.inObject()) { @@ -1021,21 +993,18 @@ && isEnabled(StreamWriteFeature.AUTO_CLOSE_CONTENT)) { _outputHead = 0; _outputTail = 0; - /* We are not to call close() on the underlying Reader, unless we "own" it, - * or auto-closing feature is enabled. - * One downside: when using UTF8Writer, underlying buffer(s) - * may not be properly recycled if we don't close the writer. + /* 25-Nov-2008, tatus: As per [JACKSON-16] we are not to call close() + * on the underlying Reader, unless we "own" it, or auto-closing + * feature is enabled. + * One downside: when using UTF8Writer, underlying buffer(s) + * may not be properly recycled if we don't close the writer. */ if (_writer != null) { - try { - if (_ioContext.isResourceManaged() || isEnabled(StreamWriteFeature.AUTO_CLOSE_TARGET)) { - _writer.close(); - } else if (isEnabled(StreamWriteFeature.FLUSH_PASSED_TO_STREAM)) { - // If we can't close it, we should at least flush - _writer.flush(); - } - } catch (IOException e) { - throw _wrapIOFailure(e); + if (_ioContext.isResourceManaged() || isEnabled(Feature.AUTO_CLOSE_TARGET)) { + _writer.close(); + } else if (isEnabled(Feature.FLUSH_PASSED_TO_STREAM)) { + // If we can't close it, we should at least flush + _writer.flush(); } } // Internal buffer(s) generator has can now be released as well @@ -1058,12 +1027,12 @@ protected void _releaseBuffers() } /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing; text, default - /********************************************************************** + /********************************************************** */ - private void _writeString(String text) throws JacksonException + private void _writeString(String text) throws IOException { /* One check first: if String won't fit in the buffer, let's * segment writes. No point in extending buffer to huge sizes @@ -1092,7 +1061,7 @@ private void _writeString(String text) throws JacksonException } } - private void _writeString2(final int len) throws JacksonException + private void _writeString2(final int len) throws IOException { // And then we'll need to verify need for escaping etc: final int end = _outputTail + len; @@ -1119,11 +1088,7 @@ private void _writeString2(final int len) throws JacksonException */ int flushLen = (_outputTail - _outputHead); if (flushLen > 0) { - try { - _writer.write(_outputBuffer, _outputHead, flushLen); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(_outputBuffer, _outputHead, flushLen); } /* In any case, tail will be the new start, so hopefully * we have room now. @@ -1137,7 +1102,7 @@ private void _writeString2(final int len) throws JacksonException * Method called to write "long strings", strings whose length exceeds * output buffer length. */ - private void _writeLongString(String text) throws JacksonException + private void _writeLongString(String text) throws IOException { // First things first: let's flush the buffer to get some more room _flushBuffer(); @@ -1170,7 +1135,7 @@ private void _writeLongString(String text) throws JacksonException * buffer, right after buffered content (if any). That's why only * length of that text is passed, as buffer and offset are implied. */ - private void _writeSegment(int end) throws JacksonException + private void _writeSegment(int end) throws IOException { final int[] escCodes = _outputEscapes; final int escLen = escCodes.length; @@ -1198,11 +1163,7 @@ private void _writeSegment(int end) throws JacksonException */ int flushLen = (ptr - start); if (flushLen > 0) { - try { - _writer.write(_outputBuffer, start, flushLen); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(_outputBuffer, start, flushLen); if (ptr >= end) { break output_loop; } @@ -1217,7 +1178,7 @@ private void _writeSegment(int end) throws JacksonException * This method called when the string content is already in * a char buffer, and need not be copied for processing. */ - private void _writeString(char[] text, int offset, int len) throws JacksonException + private void _writeString(char[] text, int offset, int len) throws IOException { if (_characterEscapes != null) { _writeStringCustom(text, offset, len); @@ -1260,11 +1221,7 @@ private void _writeString(char[] text, int offset, int len) throws JacksonExcept } } else { // Nope: better just write through _flushBuffer(); - try { - _writer.write(text, start, newAmount); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(text, start, newAmount); } // Was this the end? if (offset >= len) { // yup @@ -1277,17 +1234,17 @@ private void _writeString(char[] text, int offset, int len) throws JacksonExcept } /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, text segment /* with additional escaping (ASCII or such) - /********************************************************************** + /********************************************************** */ /* Same as "_writeString2()", except needs additional escaping * for subset of characters */ private void _writeStringASCII(final int len, final int maxNonEscaped) - throws JacksonException + throws IOException, JsonGenerationException { // And then we'll need to verify need for escaping etc: int end = _outputTail + len; @@ -1317,11 +1274,7 @@ private void _writeStringASCII(final int len, final int maxNonEscaped) } int flushLen = (_outputTail - _outputHead); if (flushLen > 0) { - try { - _writer.write(_outputBuffer, _outputHead, flushLen); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(_outputBuffer, _outputHead, flushLen); } ++_outputTail; _prependOrWriteCharacterEscape(c, escCode); @@ -1329,7 +1282,7 @@ private void _writeStringASCII(final int len, final int maxNonEscaped) } private void _writeSegmentASCII(int end, final int maxNonEscaped) - throws JacksonException + throws IOException, JsonGenerationException { final int[] escCodes = _outputEscapes; final int escLimit = Math.min(escCodes.length, maxNonEscaped+1); @@ -1359,11 +1312,7 @@ private void _writeSegmentASCII(int end, final int maxNonEscaped) } int flushLen = (ptr - start); if (flushLen > 0) { - try { - _writer.write(_outputBuffer, start, flushLen); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(_outputBuffer, start, flushLen); if (ptr >= end) { break output_loop; } @@ -1375,7 +1324,7 @@ private void _writeSegmentASCII(int end, final int maxNonEscaped) private void _writeStringASCII(char[] text, int offset, int len, final int maxNonEscaped) - throws JacksonException + throws IOException, JsonGenerationException { len += offset; // -> len marks the end from now on final int[] escCodes = _outputEscapes; @@ -1416,11 +1365,7 @@ private void _writeStringASCII(char[] text, int offset, int len, } } else { // Nope: better just write through _flushBuffer(); - try { - _writer.write(text, start, newAmount); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(text, start, newAmount); } // Was this the end? if (offset >= len) { // yup @@ -1433,17 +1378,17 @@ private void _writeStringASCII(char[] text, int offset, int len, } /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, text segment /* with custom escaping (possibly coupling with ASCII limits) - /********************************************************************** + /********************************************************** */ /* Same as "_writeString2()", except needs additional escaping * for subset of characters */ private void _writeStringCustom(final int len) - throws JacksonException + throws IOException, JsonGenerationException { // And then we'll need to verify need for escaping etc: int end = _outputTail + len; @@ -1480,11 +1425,7 @@ private void _writeStringCustom(final int len) } int flushLen = (_outputTail - _outputHead); if (flushLen > 0) { - try { - _writer.write(_outputBuffer, _outputHead, flushLen); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(_outputBuffer, _outputHead, flushLen); } ++_outputTail; _prependOrWriteCharacterEscape(c, escCode); @@ -1492,7 +1433,7 @@ private void _writeStringCustom(final int len) } private void _writeSegmentCustom(int end) - throws JacksonException + throws IOException, JsonGenerationException { final int[] escCodes = _outputEscapes; final int maxNonEscaped = (_maximumNonEscapedChar < 1) ? 0xFFFF : _maximumNonEscapedChar; @@ -1529,11 +1470,7 @@ private void _writeSegmentCustom(int end) } int flushLen = (ptr - start); if (flushLen > 0) { - try { - _writer.write(_outputBuffer, start, flushLen); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(_outputBuffer, start, flushLen); if (ptr >= end) { break output_loop; } @@ -1544,7 +1481,7 @@ private void _writeSegmentCustom(int end) } private void _writeStringCustom(char[] text, int offset, int len) - throws JacksonException + throws IOException, JsonGenerationException { len += offset; // -> len marks the end from now on final int[] escCodes = _outputEscapes; @@ -1592,11 +1529,7 @@ private void _writeStringCustom(char[] text, int offset, int len) } } else { // Nope: better just write through _flushBuffer(); - try { - _writer.write(text, start, newAmount); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(text, start, newAmount); } // Was this the end? if (offset >= len) { // yup @@ -1607,15 +1540,15 @@ private void _writeStringCustom(char[] text, int offset, int len) _appendCharacterEscape(c, escCode); } } - + /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing; binary - /********************************************************************** + /********************************************************** */ protected final void _writeBinary(Base64Variant b64variant, byte[] input, int inputPtr, final int inputEnd) - throws JacksonException + throws IOException, JsonGenerationException { // Encoding is by chunks of 3 input, 4 output chars, so: int safeInputEnd = inputEnd - 3; @@ -1658,7 +1591,7 @@ protected final void _writeBinary(Base64Variant b64variant, byte[] input, int in // write-method called when length is definitely known protected final int _writeBinary(Base64Variant b64variant, InputStream data, byte[] readBuffer, int bytesLeft) - throws JacksonException + throws IOException, JsonGenerationException { int inputPtr = 0; int inputEnd = 0; @@ -1718,7 +1651,7 @@ protected final int _writeBinary(Base64Variant b64variant, // write method when length is unknown protected final int _writeBinary(Base64Variant b64variant, InputStream data, byte[] readBuffer) - throws JacksonException + throws IOException, JsonGenerationException { int inputPtr = 0; int inputEnd = 0; @@ -1774,7 +1707,7 @@ protected final int _writeBinary(Base64Variant b64variant, private int _readMore(InputStream in, byte[] readBuffer, int inputPtr, int inputEnd, - int maxRead) throws JacksonException + int maxRead) throws IOException { // anything to shift to front? int i = 0; @@ -1790,13 +1723,7 @@ private int _readMore(InputStream in, if (length == 0) { break; } - int count; - - try { - count = in.read(readBuffer, inputEnd, length); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + int count = in.read(readBuffer, inputEnd, length); if (count < 0) { return inputEnd; } @@ -1804,14 +1731,14 @@ private int _readMore(InputStream in, } while (inputEnd < 3); return inputEnd; } - + /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, other - /********************************************************************** + /********************************************************** */ - private final void _writeNull() throws JacksonException + private final void _writeNull() throws IOException { if ((_outputTail + 4) >= _outputEnd) { _flushBuffer(); @@ -1824,11 +1751,11 @@ private final void _writeNull() throws JacksonException buf[++ptr] = 'l'; _outputTail = ptr+1; } - + /* - /********************************************************************** + /********************************************************** /* Internal methods, low-level writing, escapes - /********************************************************************** + /********************************************************** */ /** @@ -1837,7 +1764,7 @@ private final void _writeNull() throws JacksonException * Uses head and tail pointers (and updates as necessary) */ private void _prependOrWriteCharacterEscape(char ch, int escCode) - throws JacksonException + throws IOException, JsonGenerationException { if (escCode >= 0) { // \\N (2 char) if (_outputTail >= 2) { // fits, just prepend @@ -1854,11 +1781,7 @@ private void _prependOrWriteCharacterEscape(char ch, int escCode) } _outputHead = _outputTail; buf[1] = (char) escCode; - try { - _writer.write(buf, 0, 2); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(buf, 0, 2); return; } if (escCode != CharacterEscapes.ESCAPE_CUSTOM) { // std, \\uXXXX @@ -1888,22 +1811,18 @@ private void _prependOrWriteCharacterEscape(char ch, int escCode) buf = _allocateEntityBuffer(); } _outputHead = _outputTail; - try { - if (ch > 0xFF) { // beyond 8 bytes - int hi = (ch >> 8) & 0xFF; - int lo = ch & 0xFF; - buf[10] = HEX_CHARS[hi >> 4]; - buf[11] = HEX_CHARS[hi & 0xF]; - buf[12] = HEX_CHARS[lo >> 4]; - buf[13] = HEX_CHARS[lo & 0xF]; - _writer.write(buf, 8, 6); - } else { // We know it's a control char, so only the last 2 chars are non-0 - buf[6] = HEX_CHARS[ch >> 4]; - buf[7] = HEX_CHARS[ch & 0xF]; - _writer.write(buf, 2, 6); - } - } catch (IOException e) { - throw _wrapIOFailure(e); + if (ch > 0xFF) { // beyond 8 bytes + int hi = (ch >> 8) & 0xFF; + int lo = ch & 0xFF; + buf[10] = HEX_CHARS[hi >> 4]; + buf[11] = HEX_CHARS[hi & 0xF]; + buf[12] = HEX_CHARS[lo >> 4]; + buf[13] = HEX_CHARS[lo & 0xF]; + _writer.write(buf, 8, 6); + } else { // We know it's a control char, so only the last 2 chars are non-0 + buf[6] = HEX_CHARS[ch >> 4]; + buf[7] = HEX_CHARS[ch & 0xF]; + _writer.write(buf, 2, 6); } return; } @@ -1924,11 +1843,7 @@ private void _prependOrWriteCharacterEscape(char ch, int escCode) } // won't fit, write separately _outputHead = _outputTail; - try { - _writer.write(escape); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(escape); } /** @@ -1940,7 +1855,7 @@ private void _prependOrWriteCharacterEscape(char ch, int escCode) */ private int _prependOrWriteCharacterEscape(char[] buffer, int ptr, int end, char ch, int escCode) - throws JacksonException + throws IOException, JsonGenerationException { if (escCode >= 0) { // \\N (2 char) if (ptr > 1 && ptr < end) { // fits, just prepend @@ -1953,11 +1868,7 @@ private int _prependOrWriteCharacterEscape(char[] buffer, int ptr, int end, ent = _allocateEntityBuffer(); } ent[1] = (char) escCode; - try { - _writer.write(ent, 0, 2); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(ent, 0, 2); } return ptr; } @@ -1986,22 +1897,18 @@ private int _prependOrWriteCharacterEscape(char[] buffer, int ptr, int end, ent = _allocateEntityBuffer(); } _outputHead = _outputTail; - try { - if (ch > 0xFF) { // beyond 8 bytes - int hi = (ch >> 8) & 0xFF; - int lo = ch & 0xFF; - ent[10] = HEX_CHARS[hi >> 4]; - ent[11] = HEX_CHARS[hi & 0xF]; - ent[12] = HEX_CHARS[lo >> 4]; - ent[13] = HEX_CHARS[lo & 0xF]; - _writer.write(ent, 8, 6); - } else { // We know it's a control char, so only the last 2 chars are non-0 - ent[6] = HEX_CHARS[ch >> 4]; - ent[7] = HEX_CHARS[ch & 0xF]; - _writer.write(ent, 2, 6); - } - } catch (IOException e) { - throw _wrapIOFailure(e); + if (ch > 0xFF) { // beyond 8 bytes + int hi = (ch >> 8) & 0xFF; + int lo = ch & 0xFF; + ent[10] = HEX_CHARS[hi >> 4]; + ent[11] = HEX_CHARS[hi & 0xF]; + ent[12] = HEX_CHARS[lo >> 4]; + ent[13] = HEX_CHARS[lo & 0xF]; + _writer.write(ent, 8, 6); + } else { // We know it's a control char, so only the last 2 chars are non-0 + ent[6] = HEX_CHARS[ch >> 4]; + ent[7] = HEX_CHARS[ch & 0xF]; + _writer.write(ent, 2, 6); } } return ptr; @@ -2018,11 +1925,7 @@ private int _prependOrWriteCharacterEscape(char[] buffer, int ptr, int end, ptr -= len; escape.getChars(0, len, buffer, ptr); } else { // won't fit, write separately - try { - _writer.write(escape); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(escape); } return ptr; } @@ -2032,7 +1935,7 @@ private int _prependOrWriteCharacterEscape(char[] buffer, int ptr, int end, * end of standard output buffer; or if not possible, write out directly. */ private void _appendCharacterEscape(char ch, int escCode) - throws JacksonException + throws IOException, JsonGenerationException { if (escCode >= 0) { // \\N (2 char) if ((_outputTail + 2) > _outputEnd) { @@ -2076,11 +1979,7 @@ private void _appendCharacterEscape(char ch, int escCode) if ((_outputTail + len) > _outputEnd) { _flushBuffer(); if (len > _outputEnd) { // very very long escape; unlikely but theoretically possible - try { - _writer.write(escape); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(escape); return; } } @@ -2105,6 +2004,9 @@ private char[] _allocateEntityBuffer() return buf; } + /** + * @since 2.9 + */ private char[] _allocateCopyBuffer() { if (_copyBuffer == null) { _copyBuffer = _ioContext.allocNameCopyBuffer(2000); @@ -2112,17 +2014,13 @@ private char[] _allocateCopyBuffer() { return _copyBuffer; } - protected void _flushBuffer() throws JacksonException + protected void _flushBuffer() throws IOException { int len = _outputTail - _outputHead; if (len > 0) { int offset = _outputHead; _outputTail = _outputHead = 0; - try { - _writer.write(_outputBuffer, offset, len); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + _writer.write(_outputBuffer, offset, len); } } } diff --git a/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.java b/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.java index 68ac245723..9c7e2adbd5 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.java +++ b/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.ByteArrayFeeder; import com.fasterxml.jackson.core.async.NonBlockingInputFeeder; -import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.core.io.CharTypes; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.core.json.JsonReadFeature; @@ -23,8 +22,16 @@ public class NonBlockingJsonParser extends NonBlockingJsonParserBase implements ByteArrayFeeder { - private final static int FEAT_MASK_TRAILING_COMMA = JsonReadFeature.ALLOW_TRAILING_COMMA.getMask(); - private final static int FEAT_MASK_ALLOW_MISSING = JsonReadFeature.ALLOW_MISSING_VALUES.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_TRAILING_COMMA = Feature.ALLOW_TRAILING_COMMA.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_LEADING_ZEROS = Feature.ALLOW_NUMERIC_LEADING_ZEROS.getMask(); + @SuppressWarnings("deprecation") + private final static int FEAT_MASK_ALLOW_MISSING = Feature.ALLOW_MISSING_VALUES.getMask(); + private final static int FEAT_MASK_ALLOW_SINGLE_QUOTES = Feature.ALLOW_SINGLE_QUOTES.getMask(); + private final static int FEAT_MASK_ALLOW_UNQUOTED_NAMES = Feature.ALLOW_UNQUOTED_FIELD_NAMES.getMask(); + private final static int FEAT_MASK_ALLOW_JAVA_COMMENTS = Feature.ALLOW_COMMENTS.getMask(); + private final static int FEAT_MASK_ALLOW_YAML_COMMENTS = Feature.ALLOW_YAML_COMMENTS.getMask(); // This is the main input-code lookup table, fetched eagerly private final static int[] _icUTF8 = CharTypes.getInputCodeUtf8(); @@ -62,10 +69,10 @@ public class NonBlockingJsonParser /********************************************************************** */ - public NonBlockingJsonParser(ObjectReadContext readCtxt, IOContext ctxt, - int stdFeatures, int formatReadFeatures, ByteQuadsCanonicalizer sym) + public NonBlockingJsonParser(IOContext ctxt, int parserFeatures, + ByteQuadsCanonicalizer sym) { - super(readCtxt, ctxt, stdFeatures, formatReadFeatures, sym); + super(ctxt, parserFeatures, sym); } /* @@ -75,7 +82,7 @@ public NonBlockingJsonParser(ObjectReadContext readCtxt, IOContext ctxt, */ @Override - public ByteArrayFeeder nonBlockingInputFeeder() { + public ByteArrayFeeder getNonBlockingInputFeeder() { return this; } @@ -85,7 +92,7 @@ public final boolean needMoreInput() { } @Override - public void feedInput(byte[] buf, int start, int end) throws JacksonException + public void feedInput(byte[] buf, int start, int end) throws IOException { // Must not have remaining input if (_inputPtr < _inputEnd) { @@ -128,21 +135,17 @@ public void endOfInput() { * implementation */ -// public boolean nextName(SerializableString str) throws JacksonException -// public String nextTextValue() throws JacksonException -// public int nextIntValue(int defaultValue) throws JacksonException -// public long nextLongValue(long defaultValue) throws JacksonException -// public Boolean nextBooleanValue() throws JacksonException +// public boolean nextFieldName(SerializableString str) throws IOException +// public String nextTextValue() throws IOException +// public int nextIntValue(int defaultValue) throws IOException +// public long nextLongValue(long defaultValue) throws IOException +// public Boolean nextBooleanValue() throws IOException @Override - public int releaseBuffered(OutputStream out) throws JacksonException { + public int releaseBuffered(OutputStream out) throws IOException { int avail = _inputEnd - _inputPtr; if (avail > 0) { - try { - out.write(_inputBuffer, _inputPtr, avail); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + out.write(_inputBuffer, _inputPtr, avail); } return avail; } @@ -150,7 +153,7 @@ public int releaseBuffered(OutputStream out) throws JacksonException { // Should never be called: can not be implemented quite as expected // due to non-blocking behavior @Override - protected char _decodeEscaped() throws JacksonException { + protected char _decodeEscaped() throws IOException { VersionUtil.throwInternal(); return ' '; } @@ -162,7 +165,7 @@ protected char _decodeEscaped() throws JacksonException { */ @Override - public JsonToken nextToken() throws JacksonException + public JsonToken nextToken() throws IOException { // First: regardless of where we really are, need at least one more byte; // can simplify some of the checks by short-circuiting right away @@ -200,10 +203,10 @@ public JsonToken nextToken() throws JacksonException case MAJOR_ROOT: return _startValue(ch); - case MAJOR_OBJECT_PROPERTY_FIRST: // expect property-name or end-object - return _startPropertyName(ch); - case MAJOR_OBJECT_PROPERTY_NEXT: // expect comma + property-name or end-object - return _startPropertyNameAfterComma(ch); + case MAJOR_OBJECT_FIELD_FIRST: // expect field-name or end-object + return _startFieldName(ch); + case MAJOR_OBJECT_FIELD_NEXT: // expect comma + field-name or end-object + return _startFieldNameAfterComma(ch); case MAJOR_OBJECT_VALUE: // expect colon, followed by value return _startValueExpectColon(ch); @@ -220,12 +223,6 @@ public JsonToken nextToken() throws JacksonException return null; } - @Override - public void finishToken() throws JacksonException { - // 10-Nov-2017, tatu: Can not implement reliably -- should this produce - // exception or not? For now, quietly ignore - } - /** * Method called when decoding of a token has been started, but not yet completed due * to missing input; method is to continue decoding due to at least one more byte @@ -233,27 +230,27 @@ public void finishToken() throws JacksonException { * * @return Token decoded, if complete; {@link JsonToken#NOT_AVAILABLE} if not * - * @throws JacksonException (generally {@link StreamReadException}) for decoding problems + * @throws IOException (generally {@link JsonParseException}) for decoding problems */ - protected final JsonToken _finishToken() throws JacksonException + protected final JsonToken _finishToken() throws IOException { // NOTE: caller ensures there's input available... switch (_minorState) { case MINOR_ROOT_BOM: return _finishBOM(_pending32); - case MINOR_PROPERTY_LEADING_WS: - return _startPropertyName(_inputBuffer[_inputPtr++] & 0xFF); - case MINOR_PROPERTY_LEADING_COMMA: - return _startPropertyNameAfterComma(_inputBuffer[_inputPtr++] & 0xFF); + case MINOR_FIELD_LEADING_WS: + return _startFieldName(_inputBuffer[_inputPtr++] & 0xFF); + case MINOR_FIELD_LEADING_COMMA: + return _startFieldNameAfterComma(_inputBuffer[_inputPtr++] & 0xFF); // Field name states - case MINOR_PROPERTY_NAME: + case MINOR_FIELD_NAME: return _parseEscapedName(_quadLength, _pending32, _pendingBytes); - case MINOR_PROPERTY_NAME_ESCAPE: + case MINOR_FIELD_NAME_ESCAPE: return _finishFieldWithEscape(); - case MINOR_PROPERTY_APOS_NAME: + case MINOR_FIELD_APOS_NAME: return _finishAposName(_quadLength, _pending32, _pendingBytes); - case MINOR_PROPERTY_UNQUOTED_NAME: + case MINOR_FIELD_UNQUOTED_NAME: return _finishUnquotedName(_quadLength, _pending32, _pendingBytes); // Value states @@ -361,23 +358,18 @@ protected final JsonToken _finishToken() throws JacksonException * * @return Token decoded, if complete; {@link JsonToken#NOT_AVAILABLE} if not * - * @throws JacksonException (generally {@link StreamReadException}) for decoding problems + * @throws IOException (generally {@link JsonParseException}) for decoding problems */ - protected final JsonToken _finishTokenWithEOF() throws JacksonException + protected final JsonToken _finishTokenWithEOF() throws IOException { // NOTE: caller ensures there's input available... JsonToken t = _currToken; switch (_minorState) { case MINOR_ROOT_GOT_SEPARATOR: // fine, just skip some trailing space return _eofAsNextToken(); - case MINOR_PROPERTY_LEADING_COMMA: // in Object after key/value pair - _reportInvalidEOF(": expected an Object property name or END_ARRAY", JsonToken.NOT_AVAILABLE); - case MINOR_VALUE_LEADING_WS: // finished at token boundary; probably fine return _eofAsNextToken(); - case MINOR_VALUE_EXPECTING_COMMA: - _reportInvalidEOF(": expected a value token", JsonToken.NOT_AVAILABLE); - +// case MINOR_VALUE_EXPECTING_COMMA: // not fine // case MINOR_VALUE_EXPECTING_COLON: // not fine case MINOR_VALUE_TOKEN_NULL: return _finishKeywordTokenWithEOF("null", _pending32, JsonToken.VALUE_NULL); @@ -414,7 +406,7 @@ protected final JsonToken _finishTokenWithEOF() throws JacksonException return _valueComplete(JsonToken.VALUE_NUMBER_FLOAT); case MINOR_NUMBER_EXPONENT_MARKER: - _reportInvalidEOF(": expected fraction after exponent marker", JsonToken.VALUE_NUMBER_FLOAT); + _reportInvalidEOF(": was expecting fraction after exponent marker", JsonToken.VALUE_NUMBER_FLOAT); // How about comments? // Inside C-comments; not legal @@ -422,7 +414,7 @@ protected final JsonToken _finishTokenWithEOF() throws JacksonException // case MINOR_COMMENT_LEADING_SLASH: // not legal, but use default error case MINOR_COMMENT_CLOSING_ASTERISK: case MINOR_COMMENT_C: - _reportInvalidEOF(": expected closing '*/' for comment", JsonToken.NOT_AVAILABLE); + _reportInvalidEOF(": was expecting closing '*/' for comment", JsonToken.NOT_AVAILABLE); case MINOR_COMMENT_CPP: case MINOR_COMMENT_YAML: @@ -431,10 +423,7 @@ protected final JsonToken _finishTokenWithEOF() throws JacksonException default: } - - // 20-Jan-2021, tatu: There's room for improvement here: - - _reportInvalidEOF(": expected rest of token (internal state: "+_minorState+")", _currToken); + _reportInvalidEOF(": was expecting rest of token (internal state: "+_minorState+")", _currToken); return t; // never gets here } @@ -444,7 +433,7 @@ protected final JsonToken _finishTokenWithEOF() throws JacksonException /********************************************************************** */ - private final JsonToken _startDocument(int ch) throws JacksonException + private final JsonToken _startDocument(int ch) throws IOException { ch &= 0xFF; @@ -482,7 +471,7 @@ private final JsonToken _startDocument(int ch) throws JacksonException return _startValue(ch); } - private final JsonToken _finishBOM(int bytesHandled) throws JacksonException + private final JsonToken _finishBOM(int bytesHandled) throws IOException { // public final static byte UTF8_BOM_1 = (byte) 0xEF; // public final static byte UTF8_BOM_2 = (byte) 0xBB; @@ -516,21 +505,21 @@ private final JsonToken _finishBOM(int bytesHandled) throws JacksonException /* /********************************************************************** - /* Second-level decoding, primary property name decoding + /* Second-level decoding, primary field name decoding /********************************************************************** */ /** * Method that handles initial token type recognition for token - * that has to be either PROPERTY_NAME or END_OBJECT. + * that has to be either FIELD_NAME or END_OBJECT. */ - private final JsonToken _startPropertyName(int ch) throws JacksonException + private final JsonToken _startFieldName(int ch) throws IOException { // First: any leading white space? if (ch <= 0x0020) { ch = _skipWS(ch); if (ch <= 0) { - _minorState = MINOR_PROPERTY_LEADING_WS; + _minorState = MINOR_FIELD_LEADING_WS; return _currToken; } } @@ -551,13 +540,13 @@ private final JsonToken _startPropertyName(int ch) throws JacksonException return _parseEscapedName(0, 0, 0); } - private final JsonToken _startPropertyNameAfterComma(int ch) throws JacksonException + private final JsonToken _startFieldNameAfterComma(int ch) throws IOException { // First: any leading white space? if (ch <= 0x0020) { ch = _skipWS(ch); // will skip through all available ws (and comments) if (ch <= 0) { - _minorState = MINOR_PROPERTY_LEADING_COMMA; + _minorState = MINOR_FIELD_LEADING_COMMA; return _currToken; } } @@ -566,16 +555,16 @@ private final JsonToken _startPropertyNameAfterComma(int ch) throws JacksonExcep return _closeObjectScope(); } if (ch == INT_HASH) { - return _finishHashComment(MINOR_PROPERTY_LEADING_COMMA); + return _finishHashComment(MINOR_FIELD_LEADING_COMMA); } if (ch == INT_SLASH) { - return _startSlashComment(MINOR_PROPERTY_LEADING_COMMA); + return _startSlashComment(MINOR_FIELD_LEADING_COMMA); } - _reportUnexpectedChar(ch, "was expecting comma to separate "+_streamReadContext.typeDesc()+" entries"); + _reportUnexpectedChar(ch, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries"); } int ptr = _inputPtr; if (ptr >= _inputEnd) { - _minorState = MINOR_PROPERTY_LEADING_WS; + _minorState = MINOR_FIELD_LEADING_WS; return (_currToken = JsonToken.NOT_AVAILABLE); } ch = _inputBuffer[ptr]; @@ -583,14 +572,14 @@ private final JsonToken _startPropertyNameAfterComma(int ch) throws JacksonExcep if (ch <= 0x0020) { ch = _skipWS(ch); if (ch <= 0) { - _minorState = MINOR_PROPERTY_LEADING_WS; + _minorState = MINOR_FIELD_LEADING_WS; return _currToken; } } _updateTokenLocation(); if (ch != INT_QUOTE) { if (ch == INT_RCURLY) { - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { return _closeObjectScope(); } } @@ -617,7 +606,7 @@ private final JsonToken _startPropertyNameAfterComma(int ch) throws JacksonExcep * decode it if contained in input buffer. * Value may be preceded by leading white-space, but no separator (comma). */ - private final JsonToken _startValue(int ch) throws JacksonException + private final JsonToken _startValue(int ch) throws IOException { // First: any leading white space? if (ch <= 0x0020) { @@ -629,7 +618,7 @@ private final JsonToken _startValue(int ch) throws JacksonException } _updateTokenLocation(); // 17-Sep-2019, tatu: [core#563] Need to call this to update index within array - _streamReadContext.expectComma(); + _parsingContext.expectComma(); if (ch == INT_QUOTE) { return _startString(); @@ -647,7 +636,7 @@ private final JsonToken _startValue(int ch) throws JacksonException // and could be indicate by a more specific error message. case '.': // [core#611] - if (isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS)) { + if (isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS.mappedFeature())) { return _startFloatThatStartsWithPeriod(); } break; @@ -685,7 +674,7 @@ private final JsonToken _startValue(int ch) throws JacksonException // Helper method called to parse token that is either a value token in array // or end-array marker - private final JsonToken _startValueExpectComma(int ch) throws JacksonException + private final JsonToken _startValueExpectComma(int ch) throws IOException { // First: any leading white space? if (ch <= 0x0020) { @@ -708,11 +697,11 @@ private final JsonToken _startValueExpectComma(int ch) throws JacksonException if (ch == INT_HASH) { return _finishHashComment(MINOR_VALUE_EXPECTING_COMMA); } - _reportUnexpectedChar(ch, "was expecting comma to separate "+_streamReadContext.typeDesc()+" entries"); + _reportUnexpectedChar(ch, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries"); } // 17-Sep-2019, tatu: [core#563] Need to call this to update index within array - _streamReadContext.expectComma(); + _parsingContext.expectComma(); int ptr = _inputPtr; if (ptr >= _inputEnd) { @@ -762,7 +751,7 @@ private final JsonToken _startValueExpectComma(int ch) throws JacksonException return _startArrayScope(); case INT_RBRACKET: // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { return _closeArrayScope(); } break; @@ -770,7 +759,7 @@ private final JsonToken _startValueExpectComma(int ch) throws JacksonException return _startObjectScope(); case INT_RCURLY: // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { return _closeObjectScope(); } break; @@ -782,7 +771,7 @@ private final JsonToken _startValueExpectComma(int ch) throws JacksonException // Helper method called to detect type of a value token (at any level), and possibly // decode it if contained in input buffer. // Value MUST be preceded by a semi-colon (which may be surrounded by white-space) - private final JsonToken _startValueExpectColon(int ch) throws JacksonException + private final JsonToken _startValueExpectColon(int ch) throws IOException { // First: any leading white space? if (ch <= 0x0020) { @@ -800,7 +789,7 @@ private final JsonToken _startValueExpectColon(int ch) throws JacksonException return _finishHashComment(MINOR_VALUE_EXPECTING_COLON); } // can not omit colon here - _reportUnexpectedChar(ch, "was expecting a colon to separate property name and value"); + _reportUnexpectedChar(ch, "was expecting a colon to separate field name and value"); } int ptr = _inputPtr; if (ptr >= _inputEnd) { @@ -856,7 +845,7 @@ private final JsonToken _startValueExpectColon(int ch) throws JacksonException } // Method called when we have already gotten a comma (i.e. not the first value) - private final JsonToken _startValueAfterComma(int ch) throws JacksonException + private final JsonToken _startValueAfterComma(int ch) throws IOException { // First: any leading white space? if (ch <= 0x0020) { @@ -903,7 +892,7 @@ private final JsonToken _startValueAfterComma(int ch) throws JacksonException return _startArrayScope(); case INT_RBRACKET: // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { return _closeArrayScope(); } break; @@ -911,7 +900,7 @@ private final JsonToken _startValueAfterComma(int ch) throws JacksonException return _startObjectScope(); case INT_RCURLY: // Was that a trailing comma? - if ((_formatReadFeatures & FEAT_MASK_TRAILING_COMMA) != 0) { + if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) { return _closeObjectScope(); } break; @@ -920,12 +909,11 @@ private final JsonToken _startValueAfterComma(int ch) throws JacksonException return _startUnexpectedValue(true, ch); } - protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) - throws JacksonException + protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) throws IOException { switch (ch) { case INT_RBRACKET: - if (!_streamReadContext.inArray()) { + if (!_parsingContext.inArray()) { break; } // fall through @@ -934,8 +922,8 @@ protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) // we may allow "missing values", that is, encountering a trailing // comma or closing marker where value would be expected // 11-May-2020, tatu: [core#616] No commas in root level - if (!_streamReadContext.inRoot()) { - if ((_formatReadFeatures & FEAT_MASK_ALLOW_MISSING) != 0) { + if (!_parsingContext.inRoot()) { + if ((_features & FEAT_MASK_ALLOW_MISSING) != 0) { --_inputPtr; return _valueComplete(JsonToken.VALUE_NULL); } @@ -946,7 +934,7 @@ protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) // been handled earlier break; case '\'': - if (isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)) { + if ((_features & FEAT_MASK_ALLOW_SINGLE_QUOTES) != 0) { return _startAposString(); } break; @@ -968,7 +956,7 @@ protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) /********************************************************************** */ - private final int _skipWS(int ch) throws JacksonException + private final int _skipWS(int ch) throws IOException { do { if (ch != INT_SPACE) { @@ -991,9 +979,9 @@ private final int _skipWS(int ch) throws JacksonException return ch; } - private final JsonToken _startSlashComment(int fromMinorState) throws JacksonException + private final JsonToken _startSlashComment(int fromMinorState) throws IOException { - if (!isEnabled(JsonReadFeature.ALLOW_JAVA_COMMENTS)) { + if ((_features & FEAT_MASK_ALLOW_JAVA_COMMENTS) == 0) { _reportUnexpectedChar('/', "maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser)"); } @@ -1014,10 +1002,10 @@ private final JsonToken _startSlashComment(int fromMinorState) throws JacksonExc return null; } - private final JsonToken _finishHashComment(int fromMinorState) throws JacksonException + private final JsonToken _finishHashComment(int fromMinorState) throws IOException { // Could by-pass this check by refactoring, but for now simplest way... - if (!isEnabled(JsonReadFeature.ALLOW_YAML_COMMENTS)) { + if ((_features & FEAT_MASK_ALLOW_YAML_COMMENTS) == 0) { _reportUnexpectedChar('#', "maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_YAML_COMMENTS' not enabled for parser)"); } while (true) { @@ -1044,7 +1032,7 @@ private final JsonToken _finishHashComment(int fromMinorState) throws JacksonExc return _startAfterComment(fromMinorState); } - private final JsonToken _finishCppComment(int fromMinorState) throws JacksonException + private final JsonToken _finishCppComment(int fromMinorState) throws IOException { while (true) { if (_inputPtr >= _inputEnd) { @@ -1070,7 +1058,7 @@ private final JsonToken _finishCppComment(int fromMinorState) throws JacksonExce return _startAfterComment(fromMinorState); } - private final JsonToken _finishCComment(int fromMinorState, boolean gotStar) throws JacksonException + private final JsonToken _finishCComment(int fromMinorState, boolean gotStar) throws IOException { while (true) { if (_inputPtr >= _inputEnd) { @@ -1102,7 +1090,7 @@ private final JsonToken _finishCComment(int fromMinorState, boolean gotStar) thr return _startAfterComment(fromMinorState); } - private final JsonToken _startAfterComment(int fromMinorState) throws JacksonException + private final JsonToken _startAfterComment(int fromMinorState) throws IOException { // Ok, then, need one more character... if (_inputPtr >= _inputEnd) { @@ -1111,10 +1099,10 @@ private final JsonToken _startAfterComment(int fromMinorState) throws JacksonExc } int ch = _inputBuffer[_inputPtr++] & 0xFF; switch (fromMinorState) { - case MINOR_PROPERTY_LEADING_WS: - return _startPropertyName(ch); - case MINOR_PROPERTY_LEADING_COMMA: - return _startPropertyNameAfterComma(ch); + case MINOR_FIELD_LEADING_WS: + return _startFieldName(ch); + case MINOR_FIELD_LEADING_COMMA: + return _startFieldNameAfterComma(ch); case MINOR_VALUE_LEADING_WS: return _startValue(ch); case MINOR_VALUE_EXPECTING_COMMA: @@ -1135,7 +1123,7 @@ private final JsonToken _startAfterComment(int fromMinorState) throws JacksonExc /********************************************************************** */ - protected JsonToken _startFalseToken() throws JacksonException + protected JsonToken _startFalseToken() throws IOException { int ptr = _inputPtr; if ((ptr + 4) < _inputEnd) { // yes, can determine efficiently @@ -1155,7 +1143,7 @@ protected JsonToken _startFalseToken() throws JacksonException return _finishKeywordToken("false", 1, JsonToken.VALUE_FALSE); } - protected JsonToken _startTrueToken() throws JacksonException + protected JsonToken _startTrueToken() throws IOException { int ptr = _inputPtr; if ((ptr + 3) < _inputEnd) { // yes, can determine efficiently @@ -1174,7 +1162,7 @@ protected JsonToken _startTrueToken() throws JacksonException return _finishKeywordToken("true", 1, JsonToken.VALUE_TRUE); } - protected JsonToken _startNullToken() throws JacksonException + protected JsonToken _startNullToken() throws IOException { int ptr = _inputPtr; if ((ptr + 3) < _inputEnd) { // yes, can determine efficiently @@ -1194,7 +1182,7 @@ protected JsonToken _startNullToken() throws JacksonException } protected JsonToken _finishKeywordToken(String expToken, int matched, - JsonToken result) throws JacksonException + JsonToken result) throws IOException { final int end = expToken.length(); @@ -1222,7 +1210,7 @@ protected JsonToken _finishKeywordToken(String expToken, int matched, } protected JsonToken _finishKeywordTokenWithEOF(String expToken, int matched, - JsonToken result) throws JacksonException + JsonToken result) throws IOException { if (matched == expToken.length()) { return (_currToken = result); @@ -1231,7 +1219,7 @@ protected JsonToken _finishKeywordTokenWithEOF(String expToken, int matched, return _finishErrorTokenWithEOF(); } - protected JsonToken _finishNonStdToken(int type, int matched) throws JacksonException + protected JsonToken _finishNonStdToken(int type, int matched) throws IOException { final String expToken = _nonStdToken(type); final int end = expToken.length(); @@ -1261,7 +1249,7 @@ protected JsonToken _finishNonStdToken(int type, int matched) throws JacksonExce return _finishErrorToken(); } - protected JsonToken _finishNonStdTokenWithEOF(int type, int matched) throws JacksonException + protected JsonToken _finishNonStdTokenWithEOF(int type, int matched) throws IOException { final String expToken = _nonStdToken(type); if (matched == expToken.length()) { @@ -1271,7 +1259,7 @@ protected JsonToken _finishNonStdTokenWithEOF(int type, int matched) throws Jack return _finishErrorTokenWithEOF(); } - protected JsonToken _finishErrorToken() throws JacksonException + protected JsonToken _finishErrorToken() throws IOException { while (_inputPtr < _inputEnd) { int i = (int) _inputBuffer[_inputPtr++]; @@ -1293,12 +1281,12 @@ protected JsonToken _finishErrorToken() throws JacksonException return (_currToken = JsonToken.NOT_AVAILABLE); } - protected JsonToken _finishErrorTokenWithEOF() throws JacksonException + protected JsonToken _finishErrorTokenWithEOF() throws IOException { return _reportErrorToken(_textBuffer.contentsAsString()); } - protected JsonToken _reportErrorToken(String actualToken) throws JacksonException + protected JsonToken _reportErrorToken(String actualToken) throws IOException { // !!! TODO: Include non-standard ones if enabled _reportError("Unrecognized token '%s': was expecting %s", _textBuffer.contentsAsString(), @@ -1313,7 +1301,7 @@ protected JsonToken _reportErrorToken(String actualToken) throws JacksonExceptio */ // [core#611]: allow non-standard floats like ".125" - protected JsonToken _startFloatThatStartsWithPeriod() throws JacksonException + protected JsonToken _startFloatThatStartsWithPeriod() throws IOException { _numberNegative = false; _intLength = 0; @@ -1321,7 +1309,7 @@ protected JsonToken _startFloatThatStartsWithPeriod() throws JacksonException return _startFloat(outBuf, 0, INT_PERIOD); } - protected JsonToken _startPositiveNumber(int ch) throws JacksonException + protected JsonToken _startPositiveNumber(int ch) throws IOException { _numberNegative = false; char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); @@ -1371,7 +1359,7 @@ protected JsonToken _startPositiveNumber(int ch) throws JacksonException return _valueComplete(JsonToken.VALUE_NUMBER_INT); } - protected JsonToken _startNegativeNumber() throws JacksonException + protected JsonToken _startNegativeNumber() throws IOException { _numberNegative = true; if (_inputPtr >= _inputEnd) { @@ -1384,12 +1372,12 @@ protected JsonToken _startNegativeNumber() throws JacksonException return _finishNumberLeadingNegZeroes(); } // One special case: if first char is 0, must not be followed by a digit - _reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); + reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); } else if (ch > INT_9) { if (ch == 'I') { return _finishNonStdToken(NON_STD_TOKEN_MINUS_INFINITY, 2); } - _reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); + reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); } char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); outBuf[0] = '-'; @@ -1437,7 +1425,7 @@ protected JsonToken _startNegativeNumber() throws JacksonException return _valueComplete(JsonToken.VALUE_NUMBER_INT); } - protected JsonToken _startNumberLeadingZero() throws JacksonException + protected JsonToken _startNumberLeadingZero() throws IOException { int ptr = _inputPtr; if (ptr >= _inputEnd) { @@ -1471,7 +1459,7 @@ protected JsonToken _startNumberLeadingZero() throws JacksonException // (colon not possible since this is within value, not after key) // if ((ch != INT_RBRACKET) && (ch != INT_RCURLY)) { - _reportUnexpectedNumberChar(ch, + reportUnexpectedNumberChar(ch, "expected digit (0-9), decimal point (.) or exponent indicator (e/E) to follow '0'"); } } else { // leading zero case (zero followed by a digit) @@ -1482,18 +1470,18 @@ protected JsonToken _startNumberLeadingZero() throws JacksonException return _valueCompleteInt(0, "0"); } - protected JsonToken _finishNumberMinus(int ch) throws JacksonException + protected JsonToken _finishNumberMinus(int ch) throws IOException { if (ch <= INT_0) { if (ch == INT_0) { return _finishNumberLeadingNegZeroes(); } - _reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); + reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); } else if (ch > INT_9) { if (ch == 'I') { return _finishNonStdToken(NON_STD_TOKEN_MINUS_INFINITY, 2); } - _reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); + reportUnexpectedNumberChar(ch, "expected digit (0-9) to follow minus sign, for valid numeric value"); } char[] outBuf = _textBuffer.emptyAndGetCurrentSegment(); outBuf[0] = '-'; @@ -1502,7 +1490,7 @@ protected JsonToken _finishNumberMinus(int ch) throws JacksonException return _finishNumberIntegralPart(outBuf, 2); } - protected JsonToken _finishNumberLeadingZeroes() throws JacksonException + protected JsonToken _finishNumberLeadingZeroes() throws IOException { // In general, skip further zeroes (if allowed), look for legal follow-up // numeric characters; likely legal separators, or, known illegal (letters). @@ -1530,14 +1518,14 @@ protected JsonToken _finishNumberLeadingZeroes() throws JacksonException // (colon not possible since this is within value, not after key) // if ((ch != INT_RBRACKET) && (ch != INT_RCURLY)) { - _reportUnexpectedNumberChar(ch, + reportUnexpectedNumberChar(ch, "expected digit (0-9), decimal point (.) or exponent indicator (e/E) to follow '0'"); } } else { // Number between 0 and 9 // although not guaranteed, seems likely valid separator (white space, // comma, end bracket/curly); next time token needed will verify - if (!isEnabled(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS)) { - _reportInvalidNumber("Leading zeroes not allowed"); + if ((_features & FEAT_MASK_LEADING_ZEROS) == 0) { + reportInvalidNumber("Leading zeroes not allowed"); } if (ch == INT_0) { // coalesce multiple leading zeroes into just one continue; @@ -1553,7 +1541,7 @@ protected JsonToken _finishNumberLeadingZeroes() throws JacksonException } } - protected JsonToken _finishNumberLeadingNegZeroes() throws JacksonException + protected JsonToken _finishNumberLeadingNegZeroes() throws IOException { // In general, skip further zeroes (if allowed), look for legal follow-up // numeric characters; likely legal separators, or, known illegal (letters). @@ -1583,14 +1571,14 @@ protected JsonToken _finishNumberLeadingNegZeroes() throws JacksonException // (colon not possible since this is within value, not after key) // if ((ch != INT_RBRACKET) && (ch != INT_RCURLY)) { - _reportUnexpectedNumberChar(ch, + reportUnexpectedNumberChar(ch, "expected digit (0-9), decimal point (.) or exponent indicator (e/E) to follow '0'"); } } else { // Number between 1 and 9; go integral // although not guaranteed, seems likely valid separator (white space, // comma, end bracket/curly); next time token needed will verify - if (!isEnabled(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS)) { - _reportInvalidNumber("Leading zeroes not allowed"); + if ((_features & FEAT_MASK_LEADING_ZEROS) == 0) { + reportInvalidNumber("Leading zeroes not allowed"); } if (ch == INT_0) { // coalesce multiple leading zeroes into just one continue; @@ -1607,7 +1595,7 @@ protected JsonToken _finishNumberLeadingNegZeroes() throws JacksonException } } - protected JsonToken _finishNumberIntegralPart(char[] outBuf, int outPtr) throws JacksonException + protected JsonToken _finishNumberIntegralPart(char[] outBuf, int outPtr) throws IOException { int negMod = _numberNegative ? -1 : 0; @@ -1647,7 +1635,7 @@ protected JsonToken _finishNumberIntegralPart(char[] outBuf, int outPtr) throws return _valueComplete(JsonToken.VALUE_NUMBER_INT); } - protected JsonToken _startFloat(char[] outBuf, int outPtr, int ch) throws JacksonException + protected JsonToken _startFloat(char[] outBuf, int outPtr, int ch) throws IOException { int fractLen = 0; if (ch == INT_PERIOD) { @@ -1667,7 +1655,7 @@ protected JsonToken _startFloat(char[] outBuf, int outPtr, int ch) throws Jackso ch &= 0xFF; // but here we'll want to mask it to unsigned 8-bit // must be followed by sequence of ints, one minimum if (fractLen == 0) { - _reportUnexpectedNumberChar(ch, "Decimal point not followed by a digit"); + reportUnexpectedNumberChar(ch, "Decimal point not followed by a digit"); } break; } @@ -1722,7 +1710,7 @@ protected JsonToken _startFloat(char[] outBuf, int outPtr, int ch) throws Jackso // must be followed by sequence of ints, one minimum ch &= 0xFF; if (expLen == 0) { - _reportUnexpectedNumberChar(ch, "Exponent indicator not followed by a digit"); + reportUnexpectedNumberChar(ch, "Exponent indicator not followed by a digit"); } } // push back the last char @@ -1733,7 +1721,7 @@ protected JsonToken _startFloat(char[] outBuf, int outPtr, int ch) throws Jackso return _valueComplete(JsonToken.VALUE_NUMBER_FLOAT); } - protected JsonToken _finishFloatFraction() throws JacksonException + protected JsonToken _finishFloatFraction() throws IOException { int fractLen = _fractLength; char[] outBuf = _textBuffer.getBufferWithoutReset(); @@ -1757,7 +1745,7 @@ protected JsonToken _finishFloatFraction() throws JacksonException // Ok, fraction done; what have we got next? // must be followed by sequence of ints, one minimum if (fractLen == 0) { - _reportUnexpectedNumberChar(ch, "Decimal point not followed by a digit"); + reportUnexpectedNumberChar(ch, "Decimal point not followed by a digit"); } _fractLength = fractLen; _textBuffer.setCurrentLength(outPtr); @@ -1782,7 +1770,7 @@ protected JsonToken _finishFloatFraction() throws JacksonException return _valueComplete(JsonToken.VALUE_NUMBER_FLOAT); } - protected JsonToken _finishFloatExponent(boolean checkSign, int ch) throws JacksonException + protected JsonToken _finishFloatExponent(boolean checkSign, int ch) throws IOException { if (checkSign) { _minorState = MINOR_NUMBER_EXPONENT_DIGITS; @@ -1817,7 +1805,7 @@ protected JsonToken _finishFloatExponent(boolean checkSign, int ch) throws Jacks // must be followed by sequence of ints, one minimum ch &= 0xFF; if (expLen == 0) { - _reportUnexpectedNumberChar(ch, "Exponent indicator not followed by a digit"); + reportUnexpectedNumberChar(ch, "Exponent indicator not followed by a digit"); } // push back the last char --_inputPtr; @@ -1833,7 +1821,7 @@ protected JsonToken _finishFloatExponent(boolean checkSign, int ch) throws Jacks /********************************************************************** */ - private final String _fastParseName() throws JacksonException + private final String _fastParseName() throws IOException { // If so, can also unroll loops nicely // This may seem weird, but here we do NOT want to worry about UTF-8 @@ -1891,7 +1879,7 @@ private final String _fastParseName() throws JacksonException return null; } - private final String _parseMediumName(int ptr, int q2) throws JacksonException + private final String _parseMediumName(int ptr, int q2) throws IOException { final byte[] input = _inputBuffer; final int[] codes = _icLatin1; @@ -1935,7 +1923,7 @@ private final String _parseMediumName(int ptr, int q2) throws JacksonException return null; } - private final String _parseMediumName2(int ptr, int q3, final int q2) throws JacksonException + private final String _parseMediumName2(int ptr, int q3, final int q2) throws IOException { final byte[] input = _inputBuffer; final int[] codes = _icLatin1; @@ -1985,7 +1973,7 @@ private final String _parseMediumName2(int ptr, int q3, final int q2) throws Jac * and hence is offlined to a separate method. */ private final JsonToken _parseEscapedName(int qlen, int currQuad, int currQuadBytes) - throws JacksonException + throws IOException { // This may seem weird, but here we do not want to worry about // UTF-8 decoding yet. Rather, we'll assume that part is ok (if not it will get @@ -1998,7 +1986,7 @@ private final JsonToken _parseEscapedName(int qlen, int currQuad, int currQuadBy _quadLength = qlen; _pending32 = currQuad; _pendingBytes = currQuadBytes; - _minorState = MINOR_PROPERTY_NAME; + _minorState = MINOR_FIELD_NAME; return (_currToken = JsonToken.NOT_AVAILABLE); } int ch = _inputBuffer[_inputPtr++] & 0xFF; @@ -2029,8 +2017,8 @@ private final JsonToken _parseEscapedName(int qlen, int currQuad, int currQuadBy // Nope, escape sequence ch = _decodeCharEscape(); if (ch < 0) { // method has set up state about escape sequence - _minorState = MINOR_PROPERTY_NAME_ESCAPE; - _minorStateAfterSplit = MINOR_PROPERTY_NAME; + _minorState = MINOR_FIELD_NAME_ESCAPE; + _minorStateAfterSplit = MINOR_FIELD_NAME; _quadLength = qlen; _pending32 = currQuad; _pendingBytes = currQuadBytes; @@ -2097,24 +2085,25 @@ private final JsonToken _parseEscapedName(int qlen, int currQuad, int currQuadBy /** * Method called when we see non-white space character other - * than double quote, when expecting a property name. + * than double quote, when expecting a field name. * In standard mode will just throw an exception; but * in non-standard modes may be able to parse name. */ - private JsonToken _handleOddName(int ch) throws JacksonException + private JsonToken _handleOddName(int ch) throws IOException { // First: may allow single quotes switch (ch) { case '#': - // Careful, since this may alternatively be leading char of unquoted name... - if (isEnabled(JsonReadFeature.ALLOW_YAML_COMMENTS)) { - return _finishHashComment(MINOR_PROPERTY_LEADING_WS); + // Careful, since this may alternatively be leading char of + // unquoted name... + if ((_features & FEAT_MASK_ALLOW_YAML_COMMENTS) != 0) { + return _finishHashComment(MINOR_FIELD_LEADING_WS); } break; case '/': - return _startSlashComment(MINOR_PROPERTY_LEADING_WS); + return _startSlashComment(MINOR_FIELD_LEADING_WS); case '\'': - if (isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)) { + if ((_features & FEAT_MASK_ALLOW_SINGLE_QUOTES) != 0) { return _finishAposName(0, 0, 0); } break; @@ -2122,18 +2111,18 @@ private JsonToken _handleOddName(int ch) throws JacksonException return _closeArrayScope(); } // allow unquoted names if feature enabled: - if (!isEnabled(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES)) { - // !!! TODO: Decode UTF-8 characters properly... + if ((_features & FEAT_MASK_ALLOW_UNQUOTED_NAMES) == 0) { + // !!! TODO: Decode UTF-8 characters properly... // char c = (char) _decodeCharForError(ch); char c = (char) ch; - _reportUnexpectedChar(c, "was expecting double-quote to start property name"); + _reportUnexpectedChar(c, "was expecting double-quote to start field name"); } // Also: note that although we use a different table here, it does NOT handle UTF-8 // decoding. It'll just pass those high-bit codes as acceptable for later decoding. final int[] codes = CharTypes.getInputCodeUtf8JsNames(); // Also: must start with a valid character... if (codes[ch] != 0) { - _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start property name"); + _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name"); } return _finishUnquotedName(0, ch, 1); @@ -2145,7 +2134,7 @@ private JsonToken _handleOddName(int ch) throws JacksonException * Unlike other */ private JsonToken _finishUnquotedName(int qlen, int currQuad, int currQuadBytes) - throws JacksonException + throws IOException { int[] quads = _quadBuffer; final int[] codes = CharTypes.getInputCodeUtf8JsNames(); @@ -2157,7 +2146,7 @@ private JsonToken _finishUnquotedName(int qlen, int currQuad, int currQuadBytes) _quadLength = qlen; _pending32 = currQuad; _pendingBytes = currQuadBytes; - _minorState = MINOR_PROPERTY_UNQUOTED_NAME; + _minorState = MINOR_FIELD_UNQUOTED_NAME; return (_currToken = JsonToken.NOT_AVAILABLE); } int ch = _inputBuffer[_inputPtr] & 0xFF; @@ -2193,7 +2182,7 @@ private JsonToken _finishUnquotedName(int qlen, int currQuad, int currQuadBytes) } private JsonToken _finishAposName(int qlen, int currQuad, int currQuadBytes) - throws JacksonException + throws IOException { int[] quads = _quadBuffer; final int[] codes = _icLatin1; @@ -2203,7 +2192,7 @@ private JsonToken _finishAposName(int qlen, int currQuad, int currQuadBytes) _quadLength = qlen; _pending32 = currQuad; _pendingBytes = currQuadBytes; - _minorState = MINOR_PROPERTY_APOS_NAME; + _minorState = MINOR_FIELD_APOS_NAME; return (_currToken = JsonToken.NOT_AVAILABLE); } int ch = _inputBuffer[_inputPtr++] & 0xFF; @@ -2219,8 +2208,8 @@ private JsonToken _finishAposName(int qlen, int currQuad, int currQuadBytes) // Nope, escape sequence ch = _decodeCharEscape(); if (ch < 0) { // method has set up state about escape sequence - _minorState = MINOR_PROPERTY_NAME_ESCAPE; - _minorStateAfterSplit = MINOR_PROPERTY_APOS_NAME; + _minorState = MINOR_FIELD_NAME_ESCAPE; + _minorStateAfterSplit = MINOR_FIELD_APOS_NAME; _quadLength = qlen; _pending32 = currQuad; _pendingBytes = currQuadBytes; @@ -2289,12 +2278,12 @@ private JsonToken _finishAposName(int qlen, int currQuad, int currQuadBytes) return _fieldComplete(name); } - protected final JsonToken _finishFieldWithEscape() throws JacksonException + protected final JsonToken _finishFieldWithEscape() throws IOException { // First: try finishing what wasn't yet: int ch = _decodeSplitEscaped(_quoted32, _quotedDigits); if (ch < 0) { // ... if possible - _minorState = MINOR_PROPERTY_NAME_ESCAPE; + _minorState = MINOR_FIELD_NAME_ESCAPE; return JsonToken.NOT_AVAILABLE; } if (_quadLength >= _quadBuffer.length) { @@ -2335,13 +2324,13 @@ protected final JsonToken _finishFieldWithEscape() throws JacksonException currQuad = ch; currQuadBytes = 1; } - if (_minorStateAfterSplit == MINOR_PROPERTY_APOS_NAME) { + if (_minorStateAfterSplit == MINOR_FIELD_APOS_NAME) { return _finishAposName(_quadLength, currQuad, currQuadBytes); } return _parseEscapedName(_quadLength, currQuad, currQuadBytes); } - private int _decodeSplitEscaped(int value, int bytesRead) throws JacksonException + private int _decodeSplitEscaped(int value, int bytesRead) throws IOException { if (_inputPtr >= _inputEnd) { _quoted32 = value; @@ -2413,7 +2402,7 @@ private int _decodeSplitEscaped(int value, int bytesRead) throws JacksonExceptio /********************************************************************** */ - protected JsonToken _startString() throws JacksonException + protected JsonToken _startString() throws IOException { int ptr = _inputPtr; int outPtr = 0; @@ -2440,7 +2429,7 @@ protected JsonToken _startString() throws JacksonException return _finishRegularString(); } - private final JsonToken _finishRegularString() throws JacksonException + private final JsonToken _finishRegularString() throws IOException { int c; @@ -2540,7 +2529,7 @@ private final JsonToken _finishRegularString() throws JacksonException } } - protected JsonToken _startAposString() throws JacksonException + protected JsonToken _startAposString() throws IOException { int ptr = _inputPtr; int outPtr = 0; @@ -2568,7 +2557,7 @@ protected JsonToken _startAposString() throws JacksonException return _finishAposString(); } - private final JsonToken _finishAposString() throws JacksonException + private final JsonToken _finishAposString() throws IOException { int c; final int[] codes = _icUTF8; @@ -2666,7 +2655,7 @@ private final JsonToken _finishAposString() throws JacksonException } private final boolean _decodeSplitMultiByte(int c, int type, boolean gotNext) - throws JacksonException + throws IOException { switch (type) { case 1: @@ -2719,7 +2708,7 @@ private final boolean _decodeSplitMultiByte(int c, int type, boolean gotNext) } private final boolean _decodeSplitUTF8_3(int prev, int prevCount, int next) - throws JacksonException + throws IOException { if (prevCount == 1) { if ((next & 0xC0) != 0x080) { @@ -2744,7 +2733,7 @@ private final boolean _decodeSplitUTF8_3(int prev, int prevCount, int next) // @return Character value minus 0x10000; this so that caller // can readily expand it to actual surrogates private final boolean _decodeSplitUTF8_4(int prev, int prevCount, int next) - throws JacksonException + throws IOException { if (prevCount == 1) { if ((next & 0xC0) != 0x080) { @@ -2791,7 +2780,7 @@ private final boolean _decodeSplitUTF8_4(int prev, int prevCount, int next) /********************************************************************** */ - private final int _decodeCharEscape() throws JacksonException + private final int _decodeCharEscape() throws IOException { int left = _inputEnd - _inputPtr; if (left < 5) { // offline boundary-checking case: @@ -2800,7 +2789,7 @@ private final int _decodeCharEscape() throws JacksonException return _decodeFastCharEscape(); } - private final int _decodeFastCharEscape() throws JacksonException + private final int _decodeFastCharEscape() throws IOException { int c = (int) _inputBuffer[_inputPtr++]; switch (c) { @@ -2865,7 +2854,7 @@ private final int _decodeFastCharEscape() throws JacksonException /********************************************************************** */ - private final int _decodeUTF8_2(int c, int d) throws JacksonException + private final int _decodeUTF8_2(int c, int d) throws IOException { if ((d & 0xC0) != 0x080) { _reportInvalidOther(d & 0xFF, _inputPtr); @@ -2873,7 +2862,7 @@ private final int _decodeUTF8_2(int c, int d) throws JacksonException return ((c & 0x1F) << 6) | (d & 0x3F); } - private final int _decodeUTF8_3(int c, int d, int e) throws JacksonException + private final int _decodeUTF8_3(int c, int d, int e) throws IOException { c &= 0x0F; if ((d & 0xC0) != 0x080) { @@ -2888,7 +2877,7 @@ private final int _decodeUTF8_3(int c, int d, int e) throws JacksonException // @return Character value minus 0x10000; this so that caller // can readily expand it to actual surrogates - private final int _decodeUTF8_4(int c, int d, int e, int f) throws JacksonException + private final int _decodeUTF8_4(int c, int d, int e, int f) throws IOException { if ((d & 0xC0) != 0x080) { _reportInvalidOther(d & 0xFF, _inputPtr); diff --git a/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParserBase.java b/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParserBase.java index 90e6c3444f..975d7fdfca 100644 --- a/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParserBase.java +++ b/src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParserBase.java @@ -3,12 +3,12 @@ import java.io.*; import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.base.ParserBase; import com.fasterxml.jackson.core.io.IOContext; -import com.fasterxml.jackson.core.json.JsonParserBase; import com.fasterxml.jackson.core.json.JsonReadContext; -import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer; import com.fasterxml.jackson.core.util.ByteArrayBuilder; +import com.fasterxml.jackson.core.util.JacksonFeatureSet; import static com.fasterxml.jackson.core.JsonTokenId.*; @@ -16,7 +16,7 @@ * Intermediate base class for non-blocking JSON parsers. */ public abstract class NonBlockingJsonParserBase - extends JsonParserBase + extends ParserBase { /* /********************************************************************** @@ -36,8 +36,8 @@ public abstract class NonBlockingJsonParserBase */ protected final static int MAJOR_ROOT = 1; - protected final static int MAJOR_OBJECT_PROPERTY_FIRST = 2; - protected final static int MAJOR_OBJECT_PROPERTY_NEXT = 3; + protected final static int MAJOR_OBJECT_FIELD_FIRST = 2; + protected final static int MAJOR_OBJECT_FIELD_NEXT = 3; protected final static int MAJOR_OBJECT_VALUE = 4; @@ -74,19 +74,19 @@ public abstract class NonBlockingJsonParserBase */ protected final static int MINOR_ROOT_GOT_SEPARATOR = 3; - // state before property name itself, waiting for quote (or unquoted name) - protected final static int MINOR_PROPERTY_LEADING_WS = 4; - // state before property name, expecting comma (or closing curly), then property name - protected final static int MINOR_PROPERTY_LEADING_COMMA = 5; + // state before field name itself, waiting for quote (or unquoted name) + protected final static int MINOR_FIELD_LEADING_WS = 4; + // state before field name, expecting comma (or closing curly), then field name + protected final static int MINOR_FIELD_LEADING_COMMA = 5; - // State within regular (double-quoted) property name - protected final static int MINOR_PROPERTY_NAME = 7; - // State within regular (double-quoted) property name, within escape (having + // State within regular (double-quoted) field name + protected final static int MINOR_FIELD_NAME = 7; + // State within regular (double-quoted) field name, within escape (having // encountered either just backslash, or backslash and 'u' and 0 - 3 hex digits, - protected final static int MINOR_PROPERTY_NAME_ESCAPE = 8; + protected final static int MINOR_FIELD_NAME_ESCAPE = 8; - protected final static int MINOR_PROPERTY_APOS_NAME = 9; - protected final static int MINOR_PROPERTY_UNQUOTED_NAME = 10; + protected final static int MINOR_FIELD_APOS_NAME = 9; + protected final static int MINOR_FIELD_UNQUOTED_NAME = 10; protected final static int MINOR_VALUE_LEADING_WS = 12; protected final static int MINOR_VALUE_EXPECTING_COMMA = 13; @@ -132,12 +132,12 @@ public abstract class NonBlockingJsonParserBase /* /********************************************************************** - /* Helper objects, symbols (property names) + /* Helper objects, symbols (field names) /********************************************************************** */ /** - * Symbol table that contains property names encountered so far + * Symbol table that contains field names encountered so far */ final protected ByteQuadsCanonicalizer _symbols; @@ -247,10 +247,10 @@ public abstract class NonBlockingJsonParserBase /********************************************************************** */ - public NonBlockingJsonParserBase(ObjectReadContext readCtxt, IOContext ctxt, - int stdFeatures, int formatFeatures, ByteQuadsCanonicalizer sym) + public NonBlockingJsonParserBase(IOContext ctxt, int parserFeatures, + ByteQuadsCanonicalizer sym) { - super(readCtxt, ctxt, stdFeatures, formatFeatures); + super(ctxt, parserFeatures); _symbols = sym; _currToken = null; _majorState = MAJOR_INITIAL; @@ -258,8 +258,23 @@ public NonBlockingJsonParserBase(ObjectReadContext readCtxt, IOContext ctxt, } @Override + public ObjectCodec getCodec() { + return null; + } + + @Override + public void setCodec(ObjectCodec c) { + throw new UnsupportedOperationException("Can not use ObjectMapper with non-blocking parser"); + } + + @Override // since 2.9 public boolean canParseAsync() { return true; } + @Override // @since 2.12 + public JacksonFeatureSet getReadCapabilities() { + return JSON_READ_CAPABILITIES; + } + /* /********************************************************** /* Test support @@ -277,10 +292,10 @@ protected ByteQuadsCanonicalizer symbolTableForTests() { */ @Override - public abstract int releaseBuffered(OutputStream out) throws JacksonException; + public abstract int releaseBuffered(OutputStream out) throws IOException; @Override - protected void _releaseBuffers() throws JacksonException + protected void _releaseBuffers() throws IOException { super._releaseBuffers(); // Merge found symbols, if any: @@ -289,13 +304,13 @@ protected void _releaseBuffers() throws JacksonException } @Override - public Object streamReadInputSource() { + public Object getInputSource() { // since input is "pushed", to traditional source... return null; } @Override - protected void _closeInput() { + protected void _closeInput() throws IOException { // 30-May-2017, tatu: Seems like this is the most certain way to prevent // further decoding... not the optimal place, but due to inheritance // hierarchy most convenient. @@ -316,7 +331,7 @@ public boolean hasTextCharacters() // yes; is or can be made available efficiently as char[] return _textBuffer.hasTextAsCharacters(); } - if (_currToken == JsonToken.PROPERTY_NAME) { + if (_currToken == JsonToken.FIELD_NAME) { // not necessarily; possible but: return _nameCopied; } @@ -325,7 +340,7 @@ public boolean hasTextCharacters() } @Override - public JsonLocation currentLocation() + public JsonLocation getCurrentLocation() { int col = _inputPtr - _currInputRowStart + 1; // 1-based // Since we track CR and LF separately, max should gives us right answer @@ -336,7 +351,7 @@ public JsonLocation currentLocation() } @Override - public JsonLocation currentTokenLocation() + public JsonLocation getTokenLocation() { return new JsonLocation(_contentReference(), _tokenInputTotal, -1L, _tokenInputRow, _tokenInputCol); @@ -355,7 +370,7 @@ public JsonLocation currentTokenLocation() * Method can be called for any event. */ @Override - public String getText() throws JacksonException + public String getText() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { return _textBuffer.contentsAsString(); @@ -371,8 +386,8 @@ protected final String _getText2(JsonToken t) switch (t.id()) { case ID_NOT_AVAILABLE: return null; - case ID_PROPERTY_NAME: - return _streamReadContext.currentName(); + case ID_FIELD_NAME: + return _parsingContext.getCurrentName(); case ID_STRING: // fall through case ID_NUMBER_INT: @@ -384,69 +399,79 @@ protected final String _getText2(JsonToken t) } @Override // since 2.8 - public int getText(Writer writer) throws JacksonException + public int getText(Writer writer) throws IOException { JsonToken t = _currToken; - try { - if (t == JsonToken.VALUE_STRING) { + if (t == JsonToken.VALUE_STRING) { + return _textBuffer.contentsToWriter(writer); + } + if (t == JsonToken.FIELD_NAME) { + String n = _parsingContext.getCurrentName(); + writer.write(n); + return n.length(); + } + if (t != null) { + if (t.isNumeric()) { return _textBuffer.contentsToWriter(writer); } - if (t == JsonToken.PROPERTY_NAME) { - String n = _streamReadContext.currentName(); - writer.write(n); - return n.length(); + if (t == JsonToken.NOT_AVAILABLE) { + _reportError("Current token not available: can not call this method"); } - if (t != null) { - if (t.isNumeric()) { - return _textBuffer.contentsToWriter(writer); - } - if (t == JsonToken.NOT_AVAILABLE) { - _reportError("Current token not available: can not call this method"); - } - char[] ch = t.asCharArray(); - writer.write(ch); - return ch.length; - } - } catch (IOException e) { - throw _wrapIOFailure(e); + char[] ch = t.asCharArray(); + writer.write(ch); + return ch.length; } return 0; } // // // Let's override default impls for improved performance - + + // @since 2.1 @Override - public String getValueAsString() throws JacksonException + public String getValueAsString() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { return _textBuffer.contentsAsString(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return currentName(); + if (_currToken == JsonToken.FIELD_NAME) { + return getCurrentName(); } return super.getValueAsString(null); } - + + // @since 2.1 @Override - public String getValueAsString(String defValue) throws JacksonException + public String getValueAsString(String defValue) throws IOException { if (_currToken == JsonToken.VALUE_STRING) { return _textBuffer.contentsAsString(); } - if (_currToken == JsonToken.PROPERTY_NAME) { - return currentName(); + if (_currToken == JsonToken.FIELD_NAME) { + return getCurrentName(); } return super.getValueAsString(defValue); } @Override - public char[] getTextCharacters() throws JacksonException + public char[] getTextCharacters() throws IOException { if (_currToken != null) { // null only before/after document switch (_currToken.id()) { - case ID_PROPERTY_NAME: - return currentNameInBuffer(); + case ID_FIELD_NAME: + if (!_nameCopied) { + String name = _parsingContext.getCurrentName(); + int nameLen = name.length(); + if (_nameCopyBuffer == null) { + _nameCopyBuffer = _ioContext.allocNameCopyBuffer(nameLen); + } else if (_nameCopyBuffer.length < nameLen) { + _nameCopyBuffer = new char[nameLen]; + } + name.getChars(0, nameLen, _nameCopyBuffer, 0); + _nameCopied = true; + } + return _nameCopyBuffer; + case ID_STRING: // fall through case ID_NUMBER_INT: @@ -461,13 +486,13 @@ public char[] getTextCharacters() throws JacksonException } @Override - public int getTextLength() throws JacksonException + public int getTextLength() throws IOException { if (_currToken != null) { // null only before/after document switch (_currToken.id()) { - case ID_PROPERTY_NAME: - return _streamReadContext.currentName().length(); + case ID_FIELD_NAME: + return _parsingContext.getCurrentName().length(); case ID_STRING: // fall through case ID_NUMBER_INT: @@ -482,12 +507,12 @@ public int getTextLength() throws JacksonException } @Override - public int getTextOffset() throws JacksonException + public int getTextOffset() throws IOException { // Most have offset of 0, only some may have other values: if (_currToken != null) { switch (_currToken.id()) { - case ID_PROPERTY_NAME: + case ID_FIELD_NAME: return 0; case ID_STRING: // fall through @@ -507,7 +532,7 @@ public int getTextOffset() throws JacksonException */ @Override - public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException + public byte[] getBinaryValue(Base64Variant b64variant) throws IOException { if (_currToken != JsonToken.VALUE_STRING) { _reportError("Current token (%s) not VALUE_STRING or VALUE_EMBEDDED_OBJECT, can not access as binary", @@ -523,19 +548,15 @@ public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException } @Override - public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws JacksonException + public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException { byte[] b = getBinaryValue(b64variant); - try { - out.write(b); - } catch (IOException e) { - throw _wrapIOFailure(e); - } + out.write(b); return b.length; } @Override - public Object getEmbeddedObject() throws JacksonException + public Object getEmbeddedObject() throws IOException { if (_currToken == JsonToken.VALUE_EMBEDDED_OBJECT ) { return _binaryValue; @@ -549,32 +570,32 @@ public Object getEmbeddedObject() throws JacksonException /********************************************************************** */ - protected final JsonToken _startArrayScope() throws JacksonException + protected final JsonToken _startArrayScope() throws IOException { - _streamReadContext = _streamReadContext.createChildArrayContext(-1, -1); + _parsingContext = _parsingContext.createChildArrayContext(-1, -1); _majorState = MAJOR_ARRAY_ELEMENT_FIRST; _majorStateAfterValue = MAJOR_ARRAY_ELEMENT_NEXT; return (_currToken = JsonToken.START_ARRAY); } - protected final JsonToken _startObjectScope() throws JacksonException + protected final JsonToken _startObjectScope() throws IOException { - _streamReadContext = _streamReadContext.createChildObjectContext(-1, -1); - _majorState = MAJOR_OBJECT_PROPERTY_FIRST; - _majorStateAfterValue = MAJOR_OBJECT_PROPERTY_NEXT; + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + _majorState = MAJOR_OBJECT_FIELD_FIRST; + _majorStateAfterValue = MAJOR_OBJECT_FIELD_NEXT; return (_currToken = JsonToken.START_OBJECT); } - protected final JsonToken _closeArrayScope() throws JacksonException + protected final JsonToken _closeArrayScope() throws IOException { - if (!_streamReadContext.inArray()) { + if (!_parsingContext.inArray()) { _reportMismatchedEndMarker(']', '}'); } - JsonReadContext ctxt = _streamReadContext.getParent(); - _streamReadContext = ctxt; + JsonReadContext ctxt = _parsingContext.getParent(); + _parsingContext = ctxt; int st; if (ctxt.inObject()) { - st = MAJOR_OBJECT_PROPERTY_NEXT; + st = MAJOR_OBJECT_FIELD_NEXT; } else if (ctxt.inArray()) { st = MAJOR_ARRAY_ELEMENT_NEXT; } else { @@ -585,16 +606,16 @@ protected final JsonToken _closeArrayScope() throws JacksonException return (_currToken = JsonToken.END_ARRAY); } - protected final JsonToken _closeObjectScope() throws JacksonException + protected final JsonToken _closeObjectScope() throws IOException { - if (!_streamReadContext.inObject()) { + if (!_parsingContext.inObject()) { _reportMismatchedEndMarker('}', ']'); } - JsonReadContext ctxt = _streamReadContext.getParent(); - _streamReadContext = ctxt; + JsonReadContext ctxt = _parsingContext.getParent(); + _parsingContext = ctxt; int st; if (ctxt.inObject()) { - st = MAJOR_OBJECT_PROPERTY_NEXT; + st = MAJOR_OBJECT_FIELD_NEXT; } else if (ctxt.inArray()) { st = MAJOR_ARRAY_ELEMENT_NEXT; } else { @@ -611,7 +632,7 @@ protected final JsonToken _closeObjectScope() throws JacksonException /********************************************************** */ - protected final String _findName(int q1, int lastQuadBytes) throws JacksonException + protected final String _findName(int q1, int lastQuadBytes) throws JsonParseException { q1 = _padLastQuad(q1, lastQuadBytes); // Usually we'll find it from the canonical symbol table already @@ -624,7 +645,7 @@ protected final String _findName(int q1, int lastQuadBytes) throws JacksonExcept return _addName(_quadBuffer, 1, lastQuadBytes); } - protected final String _findName(int q1, int q2, int lastQuadBytes) throws JacksonException + protected final String _findName(int q1, int q2, int lastQuadBytes) throws JsonParseException { q2 = _padLastQuad(q2, lastQuadBytes); // Usually we'll find it from the canonical symbol table already @@ -638,7 +659,7 @@ protected final String _findName(int q1, int q2, int lastQuadBytes) throws Jacks return _addName(_quadBuffer, 2, lastQuadBytes); } - protected final String _findName(int q1, int q2, int q3, int lastQuadBytes) throws JacksonException + protected final String _findName(int q1, int q2, int q3, int lastQuadBytes) throws JsonParseException { q3 = _padLastQuad(q3, lastQuadBytes); String name = _symbols.findName(q1, q2, q3); @@ -656,8 +677,7 @@ protected final String _findName(int q1, int q2, int q3, int lastQuadBytes) thro // table miss. It needs to demultiplex individual bytes, decode // multi-byte chars (if any), and then construct Name instance // and add it to the symbol table. - protected final String _addName(int[] quads, int qlen, int lastQuadBytes) - throws JacksonException + protected final String _addName(int[] quads, int qlen, int lastQuadBytes) throws JsonParseException { /* Ok: must decode UTF-8 chars. No other validation is * needed, since unescaping has been done earlier as necessary @@ -707,7 +727,7 @@ protected final String _addName(int[] quads, int qlen, int lastQuadBytes) needed = ch = 1; // never really gets this far } if ((ix + needed) > byteLen) { - _reportInvalidEOF(" in property name", JsonToken.PROPERTY_NAME); + _reportInvalidEOF(" in field name", JsonToken.FIELD_NAME); } // Ok, always need at least one more: @@ -778,30 +798,30 @@ protected final static int _padLastQuad(int q, int bytes) { // Helper method called at point when all input has been exhausted and // input feeder has indicated no more input will be forthcoming. - protected final JsonToken _eofAsNextToken() throws JacksonException { + protected final JsonToken _eofAsNextToken() throws IOException { _majorState = MAJOR_CLOSED; - if (!_streamReadContext.inRoot()) { + if (!_parsingContext.inRoot()) { _handleEOF(); } close(); return (_currToken = null); } - protected final JsonToken _fieldComplete(String name) throws JacksonException + protected final JsonToken _fieldComplete(String name) throws IOException { _majorState = MAJOR_OBJECT_VALUE; - _streamReadContext.setCurrentName(name); - return (_currToken = JsonToken.PROPERTY_NAME); + _parsingContext.setCurrentName(name); + return (_currToken = JsonToken.FIELD_NAME); } - protected final JsonToken _valueComplete(JsonToken t) throws JacksonException + protected final JsonToken _valueComplete(JsonToken t) throws IOException { _majorState = _majorStateAfterValue; _currToken = t; return t; } - protected final JsonToken _valueCompleteInt(int value, String asText) throws JacksonException + protected final JsonToken _valueCompleteInt(int value, String asText) throws IOException { _textBuffer.resetWithString(asText); _intLength = asText.length(); @@ -813,21 +833,12 @@ protected final JsonToken _valueCompleteInt(int value, String asText) throws Jac return t; } - protected final String _nonStdToken(int type) { - return NON_STD_TOKENS[type]; - } - - /* - /********************************************************************** - /* Internal methods, error reporting, related - /********************************************************************** - */ - - protected final JsonToken _valueNonStdNumberComplete(int type) throws JacksonException + @SuppressWarnings("deprecation") + protected final JsonToken _valueNonStdNumberComplete(int type) throws IOException { String tokenStr = NON_STD_TOKENS[type]; _textBuffer.resetWithString(tokenStr); - if (!isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)) { + if (!isEnabled(Feature.ALLOW_NON_NUMERIC_NUMBERS)) { _reportError("Non-standard token '%s': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow", tokenStr); } @@ -838,6 +849,16 @@ protected final JsonToken _valueNonStdNumberComplete(int type) throws JacksonExc return (_currToken = JsonToken.VALUE_NUMBER_FLOAT); } + protected final String _nonStdToken(int type) { + return NON_STD_TOKENS[type]; + } + + /* + /********************************************************************** + /* Internal methods, error reporting, related + /********************************************************************** + */ + protected final void _updateTokenLocation() { _tokenInputRow = Math.max(_currInputRow, _currInputRowAlt); @@ -846,7 +867,7 @@ protected final void _updateTokenLocation() _tokenInputTotal = _currInputProcessed + (ptr - _currBufferStart); } - protected void _reportInvalidChar(int c) throws JacksonException { + protected void _reportInvalidChar(int c) throws JsonParseException { // Either invalid WS or illegal UTF-8 start char if (c < INT_SPACE) { _throwInvalidSpace(c); @@ -854,16 +875,16 @@ protected void _reportInvalidChar(int c) throws JacksonException { _reportInvalidInitial(c); } - protected void _reportInvalidInitial(int mask) throws JacksonException { + protected void _reportInvalidInitial(int mask) throws JsonParseException { _reportError("Invalid UTF-8 start byte 0x"+Integer.toHexString(mask)); } - protected void _reportInvalidOther(int mask, int ptr) throws JacksonException { + protected void _reportInvalidOther(int mask, int ptr) throws JsonParseException { _inputPtr = ptr; _reportInvalidOther(mask); } - protected void _reportInvalidOther(int mask) throws JacksonException { + protected void _reportInvalidOther(int mask) throws JsonParseException { _reportError("Invalid UTF-8 middle byte 0x"+Integer.toHexString(mask)); } } diff --git a/src/main/java/com/fasterxml/jackson/core/package-info.java b/src/main/java/com/fasterxml/jackson/core/package-info.java index 135bac9b3b..cf300844b1 100644 --- a/src/main/java/com/fasterxml/jackson/core/package-info.java +++ b/src/main/java/com/fasterxml/jackson/core/package-info.java @@ -1,6 +1,6 @@ /** * Main public API classes of the core streaming JSON - * processor: most importantly {@link com.fasterxml.jackson.core.json.JsonFactory} + * processor: most importantly {@link com.fasterxml.jackson.core.JsonFactory} * used for constructing * JSON parser ({@link com.fasterxml.jackson.core.JsonParser}) * and generator @@ -17,14 +17,9 @@ *parsers and generators (iff using mapping-supporting factory: which *is part of Mapping API, not core) * - *

  • {@link com.fasterxml.jackson.core.ObjectReadContext} is included so that - * reference to the object capable of deserializing - * Objects from token streams (usually, com.fasterxml.jackson.databind.ObjectMapper) - * can be exposed, without adding direct dependency to implementation. - *
  • - *
  • {@link com.fasterxml.jackson.core.ObjectWriteContext} is included so that - * reference to the object capable of serializing - * Objects from token streams (usually, com.fasterxml.jackson.databind.ObjectMapper) + *
  • {@link com.fasterxml.jackson.core.ObjectCodec} is included so that + * reference to the object capable of serializing/deserializing + * Objects to/from JSON (usually, com.fasterxml.jackson.databind.ObjectMapper) * can be exposed, without adding direct dependency to implementation. *
  • * diff --git a/src/main/java/com/fasterxml/jackson/core/sym/BinaryNameMatcher.java b/src/main/java/com/fasterxml/jackson/core/sym/BinaryNameMatcher.java deleted file mode 100644 index ead68756ba..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/sym/BinaryNameMatcher.java +++ /dev/null @@ -1,811 +0,0 @@ -package com.fasterxml.jackson.core.sym; - -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -import com.fasterxml.jackson.core.util.Named; - -/** - * Simplified static symbol table used instead of global quad-based canonicalizer - * when we have smaller set of symbols (like properties of a POJO class). - * - * @since 3.0 - */ -public final class BinaryNameMatcher - extends HashedMatcherBase - implements java.io.Serializable -{ - private static final long serialVersionUID = 1L; - - // Limit to 32k entries as well as 32k-int (i.e. 128kb) strings so that both - // size and offset (in string table) can be encoded in a single int. - - public final static int MAX_ENTRIES = 0x7FFF; - - private final static int MAX_LENGTH_IN_QUADS = 0x7FFF; - - /* - /********************************************************************** - /* First, main hash area info - /********************************************************************** - */ - - /** - * Primary hash information area: consists of 2 * _hashSize - * entries of 16 bytes (4 ints), arranged in a cascading lookup - * structure (details of which may be tweaked depending on expected rates - * of collisions). - */ - private int[] _hashArea; - - /** - * Number of slots for primary entries within {@link #_hashArea}; which is - * at most 1/8 of actual size of the underlying array (4-int slots, - * primary covers only half of the area; plus, additional area for longer - * symbols after hash area). - */ - private int _hashSize; - - /** - * Offset within {@link #_hashArea} where secondary entries start - */ - private int _secondaryStart; - - /** - * Offset within {@link #_hashArea} where tertiary entries start - */ - private int _tertiaryStart; - - /** - * Constant that determines size of buckets for tertiary entries: - * 1 << _tertiaryShift is the size, and shift value - * is also used for translating from primary offset into - * tertiary bucket (shift right by 4 + _tertiaryShift). - *

    - * Default value is 2, for buckets of 4 slots; grows bigger with - * bigger table sizes. - */ - private int _tertiaryShift; - - /** - * Total number of Strings in the symbol table - */ - private int _count; - - /* - /********************************************************************** - /* Then information on collisions etc - /********************************************************************** - */ - - /** - * Pointer to the offset within spill-over area where there is room - * for more spilled over entries (if any). - * Spill over area is within fixed-size portion of {@link #_hashArea}. - */ - private int _spilloverEnd; - - /** - * Offset within {@code _hashArea} that follows main slots and contains - * quads for longer names (13 bytes or longer), and points to the - * first available int that may be used for appending quads of the next - * long name. - * Note that long name area follows immediately after the fixed-size - * main hash area ({@code _hashArea}). - */ - private int _longNameOffset; - - /* - /********************************************************************** - /* Life-cycle: constructors - /********************************************************************** - */ - - /** - * Constructor used for creating per-{@code TokenStreamFactory} "root" - * symbol tables (for formats that use such approach): ones used for merging - * and sharing common symbols - * - * @param matcher Backup matcher used if efficient primary matching cannot be used - * @param nameLookup Set of names to match - * @param hashSize Estimated basic hash area size to use (slightly bigger than number - * of entries in {@code nameLookup} array - */ - private BinaryNameMatcher(SimpleNameMatcher matcher, String[] nameLookup, int hashSize) - { - super(matcher, nameLookup); - _count = 0; - _hashSize = hashSize; // 8x, 4 ints per entry for main area, then sec/ter and spill over - _hashArea = new int[hashSize << 3]; - - _secondaryStart = hashSize << 2; // right after primary area (at 50%) - _tertiaryStart = _secondaryStart + (_secondaryStart >> 1); // right after secondary - _tertiaryShift = _calcTertiaryShift(hashSize); - _spilloverEnd = _hashArea.length - hashSize; // start AND end the same, at 7/8, initially - _longNameOffset = _hashArea.length; // and start of long name area is at end of initial area (to be expanded) - } - - static int _calcTertiaryShift(int primarySlots) - { - // first: we only get 1/4 of slots of primary, to divide - int tertSlots = (primarySlots) >> 2; - // default is for buckets of 4 slots (each 4 ints, i.e. 1 << 4) - if (tertSlots < 64) return 4; - // buckets of 8 slots (up to 256 == 32 x 8) - if (tertSlots <= 256) return 5; - // buckets of 16 slots (up to 1024 == 64 x 16) - if (tertSlots <= 1024) return 6; - // and biggest buckets have 32 slots - return 7; - } - - /* - /********************************************************************** - /* Life-cycle: factory methods - /********************************************************************** - */ - - public static BinaryNameMatcher constructFrom(List propertyNames, boolean alreadyInterned) - { - return construct(stringsFromNames(propertyNames, alreadyInterned)); - } - - public static BinaryNameMatcher construct(List symbols) - { - // Two-step process: since we need backup string-based lookup (when matching - // current name, buffered etc etc), start with that - return _construct(symbols, SimpleNameMatcher.construct(null, symbols)); - } - - public static BinaryNameMatcher constructCaseInsensitive(Locale locale, - List propertyNames, boolean alreadyInterned) - { - final List names = PropertyNameMatcher.stringsFromNames(propertyNames, alreadyInterned); - return _construct(names, SimpleNameMatcher.constructCaseInsensitive(locale, names)); - } - - private static BinaryNameMatcher _construct(List symbols, - SimpleNameMatcher base) - { - int sz = _findSize(symbols.size()); - String[] lookup = symbols.toArray(new String[0]); - BinaryNameMatcher matcher = new BinaryNameMatcher(base, lookup, sz); - for (String name : symbols) { - matcher.addName(name); - } - return matcher; - } - - /* - /********************************************************************** - /* API, mutators - /********************************************************************** - */ - - public int addName(String name) { - byte[] ch = name.getBytes(StandardCharsets.UTF_8); - int len = ch.length; - - if (len <= 12) { - if (len <= 4) { - return addName(name, _decodeLast(ch, 0, len)); - } - int q1 = _decodeFull(ch, 0); - if (len <= 8) { - return addName(name, q1, _decodeLast(ch, 4, len-4)); - } - return addName(name, q1, _decodeFull(ch, 4), _decodeLast(ch, 8, len-8)); - } - int[] quads = _quads(name); - return addName(name, quads, quads.length); - } - - private int addName(String name, int q1) { - final int index = _count; - int offset = _findOffsetForAdd(calcHash(q1)); - _hashArea[offset] = q1; - _hashArea[offset+3] = _lengthAndIndex(1); // increases _count - return index; - } - - private int addName(String name, int q1, int q2) { - final int index = _count; - int offset = _findOffsetForAdd(calcHash(q1, q2)); - _hashArea[offset] = q1; - _hashArea[offset+1] = q2; - _hashArea[offset+3] = _lengthAndIndex(2); // increases _count - return index; - } - - private int addName(String name, int q1, int q2, int q3) { - final int index = _count; - int offset = _findOffsetForAdd(calcHash(q1, q2, q3)); - _hashArea[offset] = q1; - _hashArea[offset+1] = q2; - _hashArea[offset+2] = q3; - _hashArea[offset+3] = _lengthAndIndex(3); // increases _count - return index; - } - - private int addName(String name, int[] q, int qlen) - { - switch (qlen) { - case 1: - return addName(name, q[0]); - case 2: - return addName(name, q[0], q[1]); - case 3: - return addName(name, q[0], q[1], q[2]); - } - final int index = _count; - final int hash = calcHash(q, qlen); - int offset = _findOffsetForAdd(hash); - _hashArea[offset] = hash; - int longStart = _appendLongName(q, qlen); - _hashArea[offset+1] = longStart; - _hashArea[offset+3] = _lengthAndIndex(qlen); // increases _count - return index; - } - - /** - * Method called to find the location within hash table to add a new symbol in. - */ - private int _findOffsetForAdd(int hash) - { - // first, check the primary: - int offset = _calcOffset(hash); - final int[] hashArea = _hashArea; - if (hashArea[offset+3] == 0) { - return offset; - } - // then secondary - int offset2 = _secondaryStart + ((offset >> 3) << 2); - if (hashArea[offset2+3] == 0) { - return offset2; - } - // if not, tertiary? - offset2 = _tertiaryStart + ((offset >> (_tertiaryShift + 2)) << _tertiaryShift); - final int bucketSize = (1 << _tertiaryShift); - for (int end = offset2 + bucketSize; offset2 < end; offset2 += 4) { - if (hashArea[offset2+3] == 0) { - return offset2; - } - } - - // and if even tertiary full, append at the end of spill area - offset = _spilloverEnd; - - // 25-Nov-2017, tatu: One potential problem: we may even fill the overflow area. - // Seems very unlikely as instances are created for bounded name sets, but - // for correctness need to catch. If we must, we can handle this by resizing - // hash areas etc, but let's cross that bridge if we ever get there - final int end = (_hashSize << 3); - if (_spilloverEnd >= end) { - throw new IllegalStateException("Internal error: Overflow with "+_count+" entries (hash size of "+_hashSize+")"); - } - _spilloverEnd += 4; - return offset; - } - - private int _appendLongName(int[] quads, int qlen) - { - int start = _longNameOffset; - // note: at this point we must already be shared. But may not have enough space - if ((start + qlen) > _hashArea.length) { - // try to increment in reasonable chunks; at least space that we need - int toAdd = (start + qlen) - _hashArea.length; - // but at least 1/8 of regular hash area size or 16kB (whichever smaller) - int minAdd = Math.min(4096, _hashSize); - - int newSize = _hashArea.length + Math.max(toAdd, minAdd); - _hashArea = Arrays.copyOf(_hashArea, newSize); - } - System.arraycopy(quads, 0, _hashArea, start, qlen); - _longNameOffset += qlen; - return start; - } - - /* - /********************************************************************** - /* API, accessors, mostly for Unit Tests - /********************************************************************** - */ - - public int size() { return _count; } - - public int bucketCount() { return _hashSize; } - - // For tests - public int primaryQuadCount() - { - int count = 0; - for (int offset = 3, end = _secondaryStart; offset < end; offset += 4) { - if (_hashArea[offset] != 0) { - ++count; - } - } - return count; - } - - // For tests - public int secondaryQuadCount() { - int count = 0; - int offset = _secondaryStart + 3; - for (int end = _tertiaryStart; offset < end; offset += 4) { - if (_hashArea[offset] != 0) { - ++count; - } - } - return count; - } - - // For tests - public int tertiaryQuadCount() { - int count = 0; - int offset = _tertiaryStart + 3; // to 1.5x, starting point of tertiary - for (int end = offset + _hashSize; offset < end; offset += 4) { - if (_hashArea[offset] != 0) { - ++count; - } - } - return count; - } - - // For tests - public int spilloverQuadCount() { - // difference between spillover end, start, divided by 4 (four ints per slot) - return (_spilloverEnd - _spilloverStart()) >> 2; - } - - // For tests - public int totalCount() { - int count = 0; - for (int offset = 3, end = (_hashSize << 3); offset < end; offset += 4) { - if (_hashArea[offset] != 0) { - ++count; - } - } - return count; - } - - /* - /********************************************************************** - /* Public API, accessing symbols - /********************************************************************** - */ - - @Override - public int matchByQuad(int q1) - { - int offset = _calcOffset(calcHash(q1)); - - // first: primary match? - final int[] hashArea = _hashArea; - - int lenAndIndex = hashArea[offset+3]; - if ((lenAndIndex & 0xFFFF) == 1) { - if (hashArea[offset] == q1) { - return lenAndIndex >> 16; - } - } else if (lenAndIndex == 0) { // empty slot; unlikely but avoid further lookups if so - return -1; - } - // secondary? single slot shared by N/2 primaries - int offset2 = _secondaryStart + ((offset >> 3) << 2); - lenAndIndex = hashArea[offset2+3]; - if ((lenAndIndex & 0xFFFF) == 1) { - if (hashArea[offset2] == q1) { - return lenAndIndex >> 16; - } - } else if (lenAndIndex == 0) { // empty slot; unlikely but avoid further lookups if so - return -1; - } - // tertiary lookup & spillovers best to offline - return _findTertiary(offset, q1); - } - - @Override - public int matchByQuad(int q1, int q2) - { - int offset = _calcOffset(calcHash(q1, q2)); - - final int[] hashArea = _hashArea; - int lenAndIndex = hashArea[offset+3]; - - if ((lenAndIndex & 0xFFFF) == 2) { - if ((q1 == hashArea[offset]) && (q2 == hashArea[offset+1])) { - return lenAndIndex >> 16; - } - } else if (lenAndIndex == 0) { // empty slot; unlikely but avoid further lookups if so - return -1; - } - // secondary? - int offset2 = _secondaryStart + ((offset >> 3) << 2); - int lenAndIndex2 = hashArea[offset2+3]; - if ((lenAndIndex2 & 0xFFFF) == 2) { - if ((q1 == hashArea[offset2]) && (q2 == hashArea[offset2+1])) { - return lenAndIndex2 >> 16; - } - } else if (lenAndIndex2 == 0) { // empty slot? Short-circuit if no more spillovers - return -1; - } - return _findTertiary(offset, q1, q2); - } - - @Override - public int matchByQuad(int q1, int q2, int q3) - { - int offset = _calcOffset(calcHash(q1, q2, q3)); - final int[] hashArea = _hashArea; - final int lenAndIndex = hashArea[offset+3]; - if ((lenAndIndex & 0xFFFF) == 3) { - if ((q1 == hashArea[offset]) && (hashArea[offset+1] == q2) && (hashArea[offset+2] == q3)) { - return lenAndIndex >> 16; - } - } else if (lenAndIndex == 0) { // empty slot; unlikely but avoid further lookups if so - return -1; - } - - // secondary? - int offset2 = _secondaryStart + ((offset >> 3) << 2); - final int lenAndIndex2 = hashArea[offset2+3]; - if ((lenAndIndex2 & 0xFFFF) == 3) { - if ((q1 == hashArea[offset2]) && (hashArea[offset2+1] == q2) && (hashArea[offset2+2] == q3)) { - return lenAndIndex2 >> 16; - } - } else if (lenAndIndex2 == 0) { // empty slot? Short-circuit if no more spillovers - return -1; - } - return _findTertiary(offset, q1, q2, q3); - } - - @Override - public int matchByQuad(int[] q, int qlen) - { - // This version differs significantly, because longer names do not fit within cell. - // Rather, they contain hash in main slot, and offset+length to extension area - // that contains actual quads. - if (qlen < 4) { // another sanity check - switch (qlen) { - case 3: - return matchByQuad(q[0], q[1], q[2]); - case 2: - return matchByQuad(q[0], q[1]); - case 1: - return matchByQuad(q[0]); - default: // if 0 ever passed - return -1; - } - } - final int hash = calcHash(q, qlen); - int offset = _calcOffset(hash); - - final int[] hashArea = _hashArea; - final int lenAndIndex = hashArea[offset+3]; - - if ((hash == hashArea[offset]) && ((lenAndIndex & 0xFFFF) == qlen)) { - // probable but not guaranteed: verify - if (_verifyLongName(q, qlen, hashArea[offset+1])) { - return lenAndIndex >> 16; - } - } - if (lenAndIndex == 0) { // empty slot; unlikely but avoid further lookups if so - return -1; - } - // secondary? - int offset2 = _secondaryStart + ((offset >> 3) << 2); - - final int lenAndIndex2 = hashArea[offset2+3]; - if ((hash == hashArea[offset2]) && ((lenAndIndex2 & 0xFFFF) == qlen)) { - if (_verifyLongName(q, qlen, hashArea[offset2+1])) { - return lenAndIndex2 >> 16; - } - } - return _findTertiary(offset, hash, q, qlen); - } - - private final int _calcOffset(int hash) - { - int ix = hash & (_hashSize-1); - // keeping in mind we have 4 ints per entry - return (ix << 2); - } - - /* - /********************************************************************** - /* Access from spill-over areas - /********************************************************************** - */ - - private int _findTertiary(int origOffset, int q1) - { - // tertiary area division is dynamic. First; its size is N/4 compared to - // primary hash size; and offsets are for 4 int slots. So to get to logical - // index would shift by 4. But! Tertiary area is further split into buckets, - // determined by shift value. And finally, from bucket back into physical offsets - int offset = _tertiaryStart + ((origOffset >> (_tertiaryShift + 2)) << _tertiaryShift); - final int[] hashArea = _hashArea; - final int bucketSize = (1 << _tertiaryShift); - for (int end = offset + bucketSize; offset < end; offset += 4) { - int lenAndIndex = hashArea[offset+3]; - if ((q1 == hashArea[offset]) && (1 == (lenAndIndex & 0xFFFF))) { - return lenAndIndex >> 16; - } - if (lenAndIndex == 0) { - return -1; - } - } - // but if tertiary full, check out spill-over area as last resort - // shared spillover starts at 7/8 of the main hash area - // (which is sized at 2 * _hashSize), so: - for (offset = _spilloverStart(); offset < _spilloverEnd; offset += 4) { - if (q1 == hashArea[offset]) { - int lenAndIndex = hashArea[offset+3]; - if (1 == (lenAndIndex & 0xFFFF)) { - return lenAndIndex >> 16; - } - } - } - return -1; - } - - private int _findTertiary(int origOffset, int q1, int q2) - { - int offset = _tertiaryStart + ((origOffset >> (_tertiaryShift + 2)) << _tertiaryShift); - final int[] hashArea = _hashArea; - - final int bucketSize = (1 << _tertiaryShift); - for (int end = offset + bucketSize; offset < end; offset += 4) { - int lenAndIndex = hashArea[offset+3]; - if ((q1 == hashArea[offset]) && (q2 == hashArea[offset+1]) && (2 == (lenAndIndex & 0xFFFF))) { - return lenAndIndex >> 16; - } - if (lenAndIndex == 0) { - return -1; - } - } - for (offset = _spilloverStart(); offset < _spilloverEnd; offset += 4) { - if ((q1 == hashArea[offset]) && (q2 == hashArea[offset+1])) { - int lenAndIndex = hashArea[offset+3]; - if (2 == (lenAndIndex & 0xFFFF)) { - return lenAndIndex >> 16; - } - } - } - return -1; - } - - private int _findTertiary(int origOffset, int q1, int q2, int q3) - { - int offset = _tertiaryStart + ((origOffset >> (_tertiaryShift + 2)) << _tertiaryShift); - final int[] hashArea = _hashArea; - final int bucketSize = (1 << _tertiaryShift); - for (int end = offset + bucketSize; offset < end; offset += 4) { - int lenAndIndex = hashArea[offset+3]; - if ((q1 == hashArea[offset]) && (q2 == hashArea[offset+1]) && (q3 == hashArea[offset+2]) - && (3 == (lenAndIndex & 0xFFFF))) { - return lenAndIndex >> 16; - } - if (lenAndIndex == 0) { - return -1; - } - } - for (offset = _spilloverStart(); offset < _spilloverEnd; offset += 4) { - if ((q1 == hashArea[offset]) && (q2 == hashArea[offset+1]) && (q3 == hashArea[offset+2])) { - int lenAndIndex = hashArea[offset+3]; - if (3 == (lenAndIndex & 0xFFFF)) { - return lenAndIndex >> 16; - } - } - } - return -1; - } - - private int _findTertiary(int origOffset, int hash, int[] q, int qlen) - { - int offset = _tertiaryStart + ((origOffset >> (_tertiaryShift + 2)) << _tertiaryShift); - final int[] hashArea = _hashArea; - - final int bucketSize = (1 << _tertiaryShift); - for (int end = offset + bucketSize; offset < end; offset += 4) { - int lenAndIndex = hashArea[offset+3]; - if ((hash == hashArea[offset]) && (qlen == (lenAndIndex & 0xFFFF))) { - if (_verifyLongName(q, qlen, hashArea[offset+1])) { - return lenAndIndex >> 16; - } - } - if (lenAndIndex == 0) { - return -1; - } - } - for (offset = _spilloverStart(); offset < _spilloverEnd; offset += 4) { - if (hash == hashArea[offset]) { - int lenAndIndex = hashArea[offset+3]; - if ((qlen == (lenAndIndex & 0xFFFF)) - && _verifyLongName(q, qlen, hashArea[offset+1])) { - return lenAndIndex >> 16; - } - } - } - return -1; - } - - private boolean _verifyLongName(int[] q, int qlen, int spillOffset) - { - final int[] hashArea = _hashArea; - // spillOffset assumed to be physical index right into quad string - int ix = 0; - - switch (qlen) { - default: - return _verifyLongName2(q, qlen, spillOffset); - case 8: - if (q[ix++] != hashArea[spillOffset++]) return false; - case 7: - if (q[ix++] != hashArea[spillOffset++]) return false; - case 6: - if (q[ix++] != hashArea[spillOffset++]) return false; - case 5: - if (q[ix++] != hashArea[spillOffset++]) return false; - case 4: // always at least 4 - if (q[ix++] != hashArea[spillOffset++]) return false; - if (q[ix++] != hashArea[spillOffset++]) return false; - if (q[ix++] != hashArea[spillOffset++]) return false; - if (q[ix++] != hashArea[spillOffset++]) return false; - } - return true; - } - - private boolean _verifyLongName2(int[] q, int qlen, int spillOffset) - { - int ix = 0; - do { - if (q[ix++] != _hashArea[spillOffset++]) { - return false; - } - } while (ix < qlen); - return true; - } - - /* - /********************************************************************** - /* Hash calculation - /********************************************************************** - */ - - // // Copied straight frmo big quads canonicalizer: look comments there - - private final static int MULT = 33; - private final static int MULT2 = 65599; - private final static int MULT3 = 31; - - public int calcHash(int q1) - { - int hash = q1 + (q1 >>> 16) ^ (q1 << 3); - return hash + (hash >>> 11); - } - - public int calcHash(int q1, int q2) - { - int hash = q1 + (q1 >>> 15) ^ (q1 >>> 9); - hash += (q2 * MULT) ^ (q2 >>> 15); - hash += (hash >>> 7) + (hash >>> 3); - return hash; - } - - public int calcHash(int q1, int q2, int q3) - { - int hash = q1 + (q1 >>> 15) ^ (q1 >>> 9); - hash = (hash * MULT) + q2 ^ (q2 >>> 15) + (q2 >> 7); - hash = (hash * MULT3) + q3 ^ (q3 >>> 13) + (q3 >> 9); - hash += (hash >>> 4); - return hash; - } - - public int calcHash(int[] q, int qlen) - { - if (qlen < 4) { - throw new IllegalArgumentException(); - } - // And then change handling again for "multi-quad" case - int hash = q[0]; - hash += (hash >>> 9); - hash += q[1]; - hash += (hash >>> 15); - hash *= MULT; - hash ^= q[2]; - hash += (hash >>> 4); - - for (int i = 3; i < qlen; ++i) { - int next = q[i]; - next = next ^ (next >> 21); - hash += next; - } - hash *= MULT2; - - // and finally shuffle some more once done - hash += (hash >>> 19); - hash ^= (hash << 5); - return hash; - } - - @Override - public String toString() { - int pri = primaryQuadCount(); - int sec = secondaryQuadCount(); - int tert = tertiaryQuadCount(); - int spill = spilloverQuadCount(); - int total = totalCount(); - return String.format("[%s: size=%d, hashSize=%d, %d/%d/%d/%d pri/sec/ter/spill (=%s), total:%d]", - getClass().getName(), _count, _hashSize, - pri, sec, tert, spill, (pri+sec+tert+spill), total); - } - - /* - /********************************************************************** - /* Helper methods - /********************************************************************** - */ - - public static int[] _quads(String name) { - final byte[] b = name.getBytes(StandardCharsets.UTF_8); - final int len = b.length; - int[] buf = new int[(len + 3) >> 2]; - - int in = 0; - int out = 0; - int left = len; - - for (; left > 4; left -= 4) { - buf[out++] = _decodeFull(b, in); - in += 4; - } - buf[out++] = _decodeLast(b, in, left); - return buf; - } - - private static int _decodeFull(byte[] b, int offset) { - return (b[offset] << 24) + ((b[offset+1] & 0xFF) << 16) - + ((b[offset+2] & 0xFF) << 8) + (b[offset+3] & 0xFF); - } - - private static int _decodeLast(byte[] b, int offset, int bytes) { - // 22-Nov-2017, tatu: Padding apparently not used with fully binary property names, - // unlike with JSON. May or may not want to change this in future. - int value = b[offset++] & 0xFF; - switch (bytes) { - case 4: - value = (value << 8) | (b[offset++] & 0xFF); - case 3: - value = (value << 8) | (b[offset++] & 0xFF); - case 2: - value = (value << 8) | (b[offset++] & 0xFF); - } - return value; - } - - private int _lengthAndIndex(int qlen) { - if (qlen > MAX_LENGTH_IN_QUADS) { - throw new IllegalArgumentException("Maximum name length in quads ("+MAX_LENGTH_IN_QUADS+") exceeded: "+qlen); - } - // count as Most-Significant-Word (16-bits); length LSB - if (_count == MAX_ENTRIES) { - throw new IllegalArgumentException("Maximum entry count ("+MAX_ENTRIES+") reached, can not add more entries"); - } - int enc = (_count << 16) | qlen; - ++_count; - return enc; - } - - /** - * Helper method that calculates start of the spillover area - */ - private int _spilloverStart() { - // we'll need slot at 1.75x of hashSize, but with 4-ints per slot. - // So basically multiply by 7 (i.e. shift to multiply by 8 subtract 1) - int offset = _hashSize; - return (offset << 3) - offset; - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/sym/ByteQuadsCanonicalizer.java b/src/main/java/com/fasterxml/jackson/core/sym/ByteQuadsCanonicalizer.java index 7ef836b073..249206d64b 100644 --- a/src/main/java/com/fasterxml/jackson/core/sym/ByteQuadsCanonicalizer.java +++ b/src/main/java/com/fasterxml/jackson/core/sym/ByteQuadsCanonicalizer.java @@ -3,8 +3,7 @@ import java.util.Arrays; import java.util.concurrent.atomic.AtomicReference; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.util.InternCache; /** @@ -24,6 +23,8 @@ * and within every area, entries are 4 {@code int}s, where 1 - 3 ints contain 1 - 12 * UTF-8 encoded bytes of name (null-padded), and last int is offset in * {@code _names} that contains actual name Strings. + * + * @since 2.6 */ public final class ByteQuadsCanonicalizer { @@ -103,6 +104,8 @@ public final class ByteQuadsCanonicalizer /** * Flag that indicates whether we should throw an exception if enough * hash collisions are detected (true); or just worked around (false). + * + * @since 2.4 */ protected final boolean _failOnDoS; @@ -351,33 +354,35 @@ protected static ByteQuadsCanonicalizer createRoot(int seed) { * Factory method used to create actual symbol table instance to * use for parsing. * - * @param flags Bit flags of active {@link com.fasterxml.jackson.core.TokenStreamFactory.Feature}s enabled. + * @param flags Bit flags of active {@link com.fasterxml.jackson.core.JsonFactory.Feature}s enabled. * * @return Actual canonicalizer instance that can be used by a parser */ public ByteQuadsCanonicalizer makeChild(int flags) { return new ByteQuadsCanonicalizer(this, _seed, _tableInfo.get(), - JsonFactory.Feature.INTERN_PROPERTY_NAMES.enabledIn(flags), + JsonFactory.Feature.INTERN_FIELD_NAMES.enabledIn(flags), JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW.enabledIn(flags)); } /** * Method similar to {@link #makeChild} but one that only creates real - * instance of {@link com.fasterxml.jackson.core.TokenStreamFactory.Feature#CANONICALIZE_PROPERTY_NAMES} is + * instance of {@link com.fasterxml.jackson.core.JsonFactory.Feature#CANONICALIZE_FIELD_NAMES} is * enabled: otherwise a "bogus" instance is created. * - * @param flags Bit flags of active {@link com.fasterxml.jackson.core.TokenStreamFactory.Feature}s enabled. + * @param flags Bit flags of active {@link com.fasterxml.jackson.core.JsonFactory.Feature}s enabled. * * @return Actual canonicalizer instance that can be used by a parser if (and only if) * canonicalization is enabled; otherwise a non-null "placeholder" instance. + * + * @since 2.13 */ public ByteQuadsCanonicalizer makeChildOrPlaceholder(int flags) { - if (JsonFactory.Feature.CANONICALIZE_PROPERTY_NAMES.enabledIn(flags)) { + if (JsonFactory.Feature.CANONICALIZE_FIELD_NAMES.enabledIn(flags)) { // inlined "makeChild()" return new ByteQuadsCanonicalizer(this, _seed, _tableInfo.get(), - JsonFactory.Feature.INTERN_PROPERTY_NAMES.enabledIn(flags), + JsonFactory.Feature.INTERN_FIELD_NAMES.enabledIn(flags), JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW.enabledIn(flags)); } return new ByteQuadsCanonicalizer(_tableInfo.get()); @@ -915,13 +920,15 @@ public String addName(String name, int[] q, int qlen) int offset; switch (qlen) { - case 1: { + case 1: + { offset = _findOffsetForAdd(calcHash(q[0])); _hashArea[offset] = q[0]; _hashArea[offset+3] = 1; } break; - case 2: { + case 2: + { offset = _findOffsetForAdd(calcHash(q[0], q[1])); _hashArea[offset] = q[0]; _hashArea[offset+1] = q[1]; @@ -1314,13 +1321,10 @@ protected void _reportTooManyCollisions() if (_hashSize <= 1024) { // would have spill-over area of 128 entries return; } - // 20-Mar-2021, tatu: [core#686]: should use Jackson-specific exception - // (to use new "processing limit" exception when available) - throw new StreamReadException(null, -"Spill-over slots in symbol table with "+_count -+" entries, hash area of "+_hashSize+" slots is now full (all " -+(_hashSize >> 3)+" slots -- suspect a DoS attack based on hash collisions." -+" You can disable the check via `TokenStreamFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW`"); + throw new IllegalStateException("Spill-over slots in symbol table with "+_count + +" entries, hash area of "+_hashSize+" slots is now full (all " + +(_hashSize >> 3)+" slots -- suspect a DoS attack based on hash collisions." + +" You can disable the check via `JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW`"); } static int _calcTertiaryShift(int primarySlots) diff --git a/src/main/java/com/fasterxml/jackson/core/sym/CharsToNameCanonicalizer.java b/src/main/java/com/fasterxml/jackson/core/sym/CharsToNameCanonicalizer.java index 1ac2917abb..3fdc26db8f 100644 --- a/src/main/java/com/fasterxml/jackson/core/sym/CharsToNameCanonicalizer.java +++ b/src/main/java/com/fasterxml/jackson/core/sym/CharsToNameCanonicalizer.java @@ -4,8 +4,7 @@ import java.util.BitSet; import java.util.concurrent.atomic.AtomicReference; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.util.InternCache; /** @@ -119,6 +118,8 @@ public final class CharsToNameCanonicalizer * instance. * This is done for security reasons, to avoid potential DoS attack via * hash collisions. + * + * @since 2.1 */ final protected int _seed; @@ -177,6 +178,8 @@ public final class CharsToNameCanonicalizer * We need to keep track of the longest collision list; this is needed * both to indicate problems with attacks and to allow flushing for * other cases. + * + * @since 2.1 */ protected int _longestCollisionList; @@ -210,6 +213,8 @@ public final class CharsToNameCanonicalizer * collision buckets that have overflowed once: this is used * to detect likely attempts at denial-of-service attacks that * uses hash collisions. + * + * @since 2.4 */ protected BitSet _overflows; @@ -249,7 +254,7 @@ private CharsToNameCanonicalizer(CharsToNameCanonicalizer parent, int flags, int _seed = seed; _tableInfo = null; // not used by child tables _flags = flags; - _canonicalize = JsonFactory.Feature.CANONICALIZE_PROPERTY_NAMES.enabledIn(flags); + _canonicalize = JsonFactory.Feature.CANONICALIZE_FIELD_NAMES.enabledIn(flags); // Then copy shared state _symbols = parentState.symbols; @@ -276,7 +281,7 @@ private CharsToNameCanonicalizer(CharsToNameCanonicalizer parent, int flags, int */ /** - * Method called to create root canonicalizer for a {@link com.fasterxml.jackson.core.json.JsonFactory} + * Method called to create root canonicalizer for a {@link com.fasterxml.jackson.core.JsonFactory} * instance. Root instance is never used directly; its main use is for * storing and sharing underlying symbol arrays as needed. * @@ -307,7 +312,7 @@ protected static CharsToNameCanonicalizer createRoot(int seed) { * on which only makeChild/mergeChild are called, but instance itself * is not used as a symbol table. * - * @param flags Bit flags of active {@link com.fasterxml.jackson.core.TokenStreamFactory.Feature}s enabled. + * @param flags Bit flags of active {@link com.fasterxml.jackson.core.JsonFactory.Feature}s enabled. * * @return Actual canonicalizer instance that can be used by a parser */ @@ -494,7 +499,7 @@ private String _addSymbol(char[] buffer, int start, int len, int h, int index) } String newSymbol = new String(buffer, start, len); - if (JsonFactory.Feature.INTERN_PROPERTY_NAMES.enabledIn(_flags)) { + if (JsonFactory.Feature.INTERN_FIELD_NAMES.enabledIn(_flags)) { newSymbol = InternCache.instance.intern(newSymbol); } ++_size; @@ -629,9 +634,10 @@ private void rehash() { final int size = _symbols.length; int newSize = size + size; - // 12-Mar-2010, tatu: Let's actually limit maximum size we are - // prepared to use, to guard against OOME in case of unbounded - // name sets (unique [non-repeating] names) + /* 12-Mar-2010, tatu: Let's actually limit maximum size we are + * prepared to use, to guard against OOME in case of unbounded + * name sets (unique [non-repeating] names) + */ if (newSize > MAX_T_SIZE) { // If this happens, there's no point in either growing or shrinking hash areas. // Rather, let's just cut our losses and stop canonicalizing. @@ -702,17 +708,23 @@ private void rehash() { } } - // 20-Mar-2021, tatu: [core#686]: should use Jackson-specific exception - // (to use new "processing limit" exception when available) + /** + * @param maxLen Maximum allowed length of collision chain + * + * @since 2.1 + */ protected void _reportTooManyCollisions(int maxLen) { - throw new StreamReadException(null, -"Longest collision chain in symbol table (of size "+_size -+") now exceeds maximum, "+maxLen+" -- suspect a DoS attack based on hash collisions." -+" You can disable the check via `TokenStreamFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW`"); + throw new IllegalStateException("Longest collision chain in symbol table (of size "+_size + +") now exceeds maximum, "+maxLen+" -- suspect a DoS attack based on hash collisions"); } - // Diagnostics method that will verify that internal data structures are consistent; - // not meant as user-facing method but only for test suites and possible troubleshooting. + // since 2.10, for tests only + /** + * Diagnostics method that will verify that internal data structures are consistent; + * not meant as user-facing method but only for test suites and possible troubleshooting. + * + * @since 2.10 + */ protected void verifyInternalConsistency() { int count = 0; final int size = _symbols.length; @@ -825,6 +837,8 @@ public String has(char[] buf, int start, int len) { * Immutable value class used for sharing information as efficiently * as possible, by only require synchronization of reference manipulation * but not access to contents. + * + * @since 2.8.7 */ private final static class TableInfo { diff --git a/src/main/java/com/fasterxml/jackson/core/sym/HashedMatcherBase.java b/src/main/java/com/fasterxml/jackson/core/sym/HashedMatcherBase.java deleted file mode 100644 index dadd309330..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/sym/HashedMatcherBase.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.fasterxml.jackson.core.sym; - -import java.util.Locale; - -/** - * Intermediate base class for matchers that use hash-array based approach - * with Strings. - */ -public abstract class HashedMatcherBase - extends PropertyNameMatcher -{ - private static final long serialVersionUID = 1L; - - /** - * Mask used to get index from raw hash code, within hash area. - */ - protected final int _mask; - - // // // Main hash area (ints) along with Strings it maps (sparse) - - protected final int[] _offsets; - protected final String[] _names; - - /* - /********************************************************************** - /* Construction - /********************************************************************** - */ - - protected HashedMatcherBase(Locale locale, String[] names, int[] offsets, int mask, - PropertyNameMatcher backup, String[] nameLookup) - { - super(locale, backup, nameLookup); - _names = names; - _offsets = offsets; - _mask = mask; - } - - protected HashedMatcherBase(HashedMatcherBase base, String[] nameLookup) { - this(base._locale, base._names, base._offsets, base._mask, base._backupMatcher, nameLookup); - } - - protected HashedMatcherBase(HashedMatcherBase base, PropertyNameMatcher fallback) { - this(base._locale, base._names, base._offsets, base._mask, fallback, base._nameLookup); - } - - /* - /********************************************************************** - /* API: lookup by String - /********************************************************************** - */ - - @Override - public final int matchName(String toMatch) - { - // Logic here is that it is expected most names to match are intern()ed - // anyway; as are (typically) contents. So identity check is likely to - // work, just not guaranteed. So do fast checks for primary, secondary here - - int ix = _hash(toMatch.hashCode(), _mask); - if (_names[ix] == toMatch) { - return _offsets[ix]; - } - // check secondary slot - int ix2 = (_mask + 1) + (ix >> 1); - if (_names[ix2] == toMatch) { - return _offsets[ix2]; - } - return _matchName2(toMatch, ix, ix2); - } - - private final int _matchName2(String toMatch, int ix, int ix2) - { - String name = _names[ix]; - if (toMatch.equals(name)) { - return _offsets[ix]; - } - if (name != null) { - name = _names[ix2]; - if (toMatch.equals(name)) { - return _offsets[ix2]; - } - if (name != null) { - return _matchSpill(toMatch); - } - } - return matchSecondary(toMatch); - } - - protected int _matchSpill(String toMatch) { - int ix = (_mask+1); - ix += (ix>>1); - - for (int end = _names.length; ix < end; ++ix) { - String name = _names[ix]; - - if (toMatch.equals(name)) { - return _offsets[ix]; - } - if (name == null) { - break; - } - } - return matchSecondary(toMatch); - } - - /* - /********************************************************************** - /* Test methods - /********************************************************************** - */ - - public int spillCount() { - int spillStart = (_mask+1) + ((_mask+1) >> 1); - int count = 0; - for (int i = spillStart; i < _names.length; ++i) { - if (_names[i] != null) { - ++count; - } - } - return count; - } - - public int secondaryCount() { - int spillStart = (_mask+1) + ((_mask+1) >> 1); - int count = 0; - for (int i = _mask+1; i < spillStart; ++i) { - if (_names[i] != null) { - ++count; - } - } - return count; - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/sym/Name.java b/src/main/java/com/fasterxml/jackson/core/sym/Name.java new file mode 100644 index 0000000000..0160e9d125 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/sym/Name.java @@ -0,0 +1,51 @@ +package com.fasterxml.jackson.core.sym; + +/** + * Base class for tokenized names (key strings in objects) that have + * been tokenized from byte-based input sources (like + * {@link java.io.InputStream}. + * + * @author Tatu Saloranta + */ +public abstract class Name +{ + protected final String _name; + + protected final int _hashCode; + + protected Name(String name, int hashCode) { + _name = name; + _hashCode = hashCode; + } + + public String getName() { return _name; } + + /* + /********************************************************** + /* Methods for package/core parser + /********************************************************** + */ + + public abstract boolean equals(int q1); + + public abstract boolean equals(int q1, int q2); + + public abstract boolean equals(int q1, int q2, int q3); + + public abstract boolean equals(int[] quads, int qlen); + + /* + /********************************************************** + /* Overridden standard methods + /********************************************************** + */ + + @Override public String toString() { return _name; } + + @Override public final int hashCode() { return _hashCode; } + + @Override public boolean equals(Object o) { + // Canonical instances, can usually just do identity comparison + return (o == this); + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/sym/Name1.java b/src/main/java/com/fasterxml/jackson/core/sym/Name1.java new file mode 100644 index 0000000000..fee42553a1 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/sym/Name1.java @@ -0,0 +1,29 @@ +package com.fasterxml.jackson.core.sym; + +/** + * Specialized implementation of PName: can be used for short Strings + * that consists of at most 4 bytes. Usually this means short + * ascii-only names. + *

    + * The reason for such specialized classes is mostly space efficiency; + * and to a lesser degree performance. Both are achieved for short + * Strings by avoiding another level of indirection (via quad arrays) + */ +public final class Name1 extends Name +{ + private final static Name1 EMPTY = new Name1("", 0, 0); + private final int q; + + Name1(String name, int hash, int quad) { + super(name, hash); + q = quad; + } + + public static Name1 getEmptyName() { return EMPTY; } + + @Override public boolean equals(int quad) { return (quad == q); } + @Override public boolean equals(int quad1, int quad2) { return (quad1 == q) && (quad2 == 0); } + @Override public boolean equals(int q1, int q2, int q3) { return false; } + + @Override public boolean equals(int[] quads, int qlen) { return (qlen == 1 && quads[0] == q); } +} diff --git a/src/main/java/com/fasterxml/jackson/core/sym/Name2.java b/src/main/java/com/fasterxml/jackson/core/sym/Name2.java new file mode 100644 index 0000000000..e60fbd4a0a --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/sym/Name2.java @@ -0,0 +1,32 @@ +package com.fasterxml.jackson.core.sym; + +/** + * Specialized implementation of PName: can be used for short Strings + * that consists of 5 to 8 bytes. Usually this means relatively short + * ascii-only names. + *

    + * The reason for such specialized classes is mostly space efficiency; + * and to a lesser degree performance. Both are achieved for short + * Strings by avoiding another level of indirection (via quad arrays) + */ +public final class Name2 extends Name +{ + private final int q1, q2; + + Name2(String name, int hash, int quad1, int quad2) { + super(name, hash); + q1 = quad1; + q2 = quad2; + } + + @Override + public boolean equals(int quad) { return false; } + + @Override + public boolean equals(int quad1, int quad2) { return (quad1 == q1) && (quad2 == q2); } + + @Override public boolean equals(int quad1, int quad2, int q3) { return false; } + + @Override + public boolean equals(int[] quads, int qlen) { return (qlen == 2 && quads[0] == q1 && quads[1] == q2); } +} diff --git a/src/main/java/com/fasterxml/jackson/core/sym/Name3.java b/src/main/java/com/fasterxml/jackson/core/sym/Name3.java new file mode 100644 index 0000000000..2da81e9f12 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/sym/Name3.java @@ -0,0 +1,36 @@ +package com.fasterxml.jackson.core.sym; + +/** + * Specialized implementation of PName: can be used for short Strings + * that consists of 9 to 12 bytes. It's the longest special purpose + * implementaion; longer ones are expressed using {@link NameN}. + */ +public final class Name3 extends Name +{ + private final int q1, q2, q3; + + Name3(String name, int hash, int i1, int i2, int i3) { + super(name, hash); + q1 = i1; + q2 = i2; + q3 = i3; + } + + // Implies quad length == 1, never matches + @Override + public boolean equals(int quad) { return false; } + + // Implies quad length == 2, never matches + @Override + public boolean equals(int quad1, int quad2) { return false; } + + @Override + public boolean equals(int quad1, int quad2, int quad3) { + return (q1 == quad1) && (q2 == quad2) && (q3 == quad3); + } + + @Override + public boolean equals(int[] quads, int qlen) { + return (qlen == 3) && (quads[0] == q1) && (quads[1] == q2) && (quads[2] == q3); + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/sym/NameN.java b/src/main/java/com/fasterxml/jackson/core/sym/NameN.java new file mode 100644 index 0000000000..2d51df73e4 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/sym/NameN.java @@ -0,0 +1,100 @@ +package com.fasterxml.jackson.core.sym; + +import java.util.Arrays; + +/** + * Generic implementation of PName used for "long" names, where long + * means that its byte (UTF-8) representation is 13 bytes or more. + */ +public final class NameN extends Name +{ + private final int q1, q2, q3, q4; // first four quads + private final int qlen; // total number of quads (4 + q.length) + private final int[] q; + + NameN(String name, int hash, int q1, int q2, int q3, int q4, + int[] quads, int quadLen) { + super(name, hash); + this.q1 = q1; + this.q2 = q2; + this.q3 = q3; + this.q4 = q4; + q = quads; + qlen = quadLen; + } + + public static NameN construct(String name, int hash, int[] q, int qlen) + { + /* We have specialized implementations for shorter + * names, so let's not allow runt instances here + */ + if (qlen < 4) { + throw new IllegalArgumentException(); + } + int q1 = q[0]; + int q2 = q[1]; + int q3 = q[2]; + int q4 = q[3]; + + int rem = qlen - 4; + + int[] buf; + + if (rem > 0) { + buf = Arrays.copyOfRange(q, 4, qlen); + } else { + buf = null; + } + return new NameN(name, hash, q1, q2, q3, q4, buf, qlen); + + } + + // Implies quad length == 1, never matches + @Override + public boolean equals(int quad) { return false; } + + // Implies quad length == 2, never matches + @Override + public boolean equals(int quad1, int quad2) { return false; } + + // Implies quad length == 3, never matches + @Override + public boolean equals(int quad1, int quad2, int quad3) { return false; } + + @Override + public boolean equals(int[] quads, int len) { + if (len != qlen) { return false; } + + // Will always have >= 4 quads, can unroll + if (quads[0] != q1) return false; + if (quads[1] != q2) return false; + if (quads[2] != q3) return false; + if (quads[3] != q4) return false; + + switch (len) { + default: + return _equals2(quads); + case 8: + if (quads[7] != q[3]) return false; + case 7: + if (quads[6] != q[2]) return false; + case 6: + if (quads[5] != q[1]) return false; + case 5: + if (quads[4] != q[0]) return false; + case 4: + } + return true; + } + + private final boolean _equals2(int[] quads) + { + final int end = qlen-4; + for (int i = 0; i < end; ++i) { + if (quads[i+4] != q[i]) { + return false; + } + } + return true; + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/sym/PropertyNameMatcher.java b/src/main/java/com/fasterxml/jackson/core/sym/PropertyNameMatcher.java deleted file mode 100644 index 811d191855..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/sym/PropertyNameMatcher.java +++ /dev/null @@ -1,197 +0,0 @@ -package com.fasterxml.jackson.core.sym; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -import com.fasterxml.jackson.core.util.InternCache; -import com.fasterxml.jackson.core.util.Named; - -/** - * Interface for implementations used for efficient matching of Object property names from - * input stream (via parser) to higher-level abstractions like properties that - * databind uses. Used to avoid two-phase lookups -- first from input stream to - * strings; then from strings to entities -- but details may heavily depend on - * format parser (some formats can optimize better than others). - * - * @since 3.0 - */ -public abstract class PropertyNameMatcher - implements java.io.Serializable -{ - private static final long serialVersionUID = 1L; - - private final static InternCache INTERNER = InternCache.instance; - - /** - * Marker for case where JsonToken.END_OBJECT encountered. - */ - public final static int MATCH_END_OBJECT = -1; - - /** - * Marker for case where property name encountered but not one of matches. - */ - public final static int MATCH_UNKNOWN_NAME = -2; - - /** - * Marker for case where token encountered is neither PROPERTY_NAME - * nor END_OBJECT. - */ - public final static int MATCH_ODD_TOKEN = -3; - - // // // Original indexed Strings (dense) iff preserved - - protected final String[] _nameLookup; - - // // // Backup index, mostly for case-insensitive lookups - - protected final PropertyNameMatcher _backupMatcher; - - /** - * Since case-handling is Locale-specific in some (rare) cases, need to hold - * on to configured Locale. - */ - protected final Locale _locale; - - /* - /********************************************************************** - /* Construction - /********************************************************************** - */ - - protected PropertyNameMatcher(Locale locale, - PropertyNameMatcher backup, String[] nameLookup) - { - _locale = locale; - _backupMatcher = backup; - _nameLookup = nameLookup; - } - - /* - /********************************************************************** - /* API: lookup by String - /********************************************************************** - */ - - /** - * Lookup method that does not assume name to be matched to be - * {@link String#intern}ed (although passing interned String is likely - * to result in more efficient matching). - * - * @param toMatch Name to match - * - * @return Index of the name matched, if any (non-negative number); or an - * error code (negative constant {@code MATCH_xxx}) if none - */ - public abstract int matchName(String toMatch); - - /* - /********************************************************************** - /* API: lookup by quad-bytes - /********************************************************************** - */ - - public abstract int matchByQuad(int q1); - - public abstract int matchByQuad(int q1, int q2); - - public abstract int matchByQuad(int q1, int q2, int q3); - - public abstract int matchByQuad(int[] q, int qlen); - - /* - /********************************************************************** - /* API: optional access to indexed Strings - /********************************************************************** - */ - - /** - * Accessor to names matching indexes, iff passed during construction. - * - * @return Array of names that this matcher may match (with indices that - * match non-negative values by {@code matchXxx} methods) - */ - public final String[] nameLookup() { - return _nameLookup; - } - - /* - /********************************************************************** - /* Methods for sub-classes to implement - /********************************************************************** - */ - - /** - * Secondary lookup method used for matchers that operate with more complex - * matching rules, such as case-insensitive matchers. - * - * @param toMatch Name to match - * - * @return Index for the match, if any (non-negative); or error code if no match - */ - protected int matchSecondary(String toMatch) { - if (_backupMatcher == null) { - return MATCH_UNKNOWN_NAME; - } - // 04-Dec-2017, tatu: Note that we absolutely MUST do another lookup even if - // key does not change; thing being that we are now using secondary index, - // contents of which MAY be different from primary one. Specifically, if original - // keys are not all lower-case, we would induce a miss if skipping lookup here. - return _backupMatcher.matchName(toMatch.toLowerCase(_locale)); - } - - /* - /********************************************************************** - /* Helper methods for sub-classes - /********************************************************************** - */ - - protected final static int _hash(int h, int mask) { - // for some reason, slight shuffle with add (not xor!) works quite well - return (h + (h >> 3)) & mask; - } - - protected static int _findSize(int size) { - if (size <= 5) return 8; - if (size <= 11) return 16; - if (size <= 23) return 32; - int needed = size + (size >> 2) + (size >> 4); // at most 75% full - int result = 64; - while (result < needed) { - result += result; - } - return result; - } - - public static List stringsFromNames(List properties, - final boolean alreadyInterned) - { - // 29-Jan-2018, tatu: With seemingly simple definition (commented out) getting - // strange "java.lang.NoClassDefFoundError: Could not initialize class java.util.stream.StreamOpFlag" - // so having to replace with bit different - /* - return properties.stream() - .map(n -> _fromName(n, alreadyInterned)) - .collect(Collectors.toList()); - */ - ArrayList result = new ArrayList(properties.size()); - for (Named n : properties) { - result.add(_fromName(n, alreadyInterned)); - } - return result; - } - - protected static String _fromName(Named n, boolean alreadyInterned) { - if (n == null) return null; - String name = n.getName(); - return alreadyInterned ? name : INTERNER.intern(name); - } - - protected static List _lc(Locale locale, List src) { - List lcd = new ArrayList<>(src.size()); - for (String n : src) { - lcd.add((n == null) ? null : n.toLowerCase(locale)); - } - return lcd; - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/sym/SimpleNameMatcher.java b/src/main/java/com/fasterxml/jackson/core/sym/SimpleNameMatcher.java deleted file mode 100644 index f6cf547ee5..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/sym/SimpleNameMatcher.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.fasterxml.jackson.core.sym; - -import java.util.*; - -import com.fasterxml.jackson.core.util.Named; - -/** - * Basic {@link PropertyNameMatcher} that uses case-sensitive match and does - * not require (or expect) that names passed as arguments have been - * {@link String#intern}ed. - */ -public class SimpleNameMatcher - extends HashedMatcherBase - implements java.io.Serializable -{ - private static final long serialVersionUID = 1L; - - private SimpleNameMatcher(Locale locale, String[] names, int[] offsets, int mask) { - super(locale, names, offsets, mask, null, null); - } - - protected SimpleNameMatcher(SimpleNameMatcher base, String[] nameLookup) { - super(base, nameLookup); - } - - protected SimpleNameMatcher(SimpleNameMatcher primary, SimpleNameMatcher secondary) { - super(primary, secondary); - } - - /** - * Factory method for constructing case-sensitive matcher that only supports - * matching from `String`. - * - * @param locale Locale to use (relevant for case-insensitive matchers) - * @param propertyNames Names to match - * @param alreadyInterned Whether underlying Strings have been {@code String.intern()}ed or not - * - * @return Matcher constructed - */ - public static SimpleNameMatcher constructFrom(Locale locale, - List propertyNames, boolean alreadyInterned) { - return construct(locale, stringsFromNames(propertyNames, alreadyInterned)); - } - - /** - * Factory method for constructing case-sensitive matcher that only supports - * matching from `String`. - * - * @param locale Locale to use (relevant for case-insensitive matchers) - * @param propertyNames Names to match - * - * @return Matcher constructed - */ - public static SimpleNameMatcher construct(Locale locale, List propertyNames) - { - final int nameCount = propertyNames.size(); - final int hashSize = _findSize(nameCount); - final int allocSize = hashSize + (hashSize>>1); - - String[] names = new String[allocSize]; - int[] offsets = new int[allocSize]; - // 20-Dec-2017, tatu: Let's initialize to value "not found" just in case, since `0` would - // be valid value, indicating first entry - Arrays.fill(offsets, PropertyNameMatcher.MATCH_UNKNOWN_NAME); // since we are never called if there's no name involved - - // Alas: can not easily extract out without tuples or such since names/offsets need resizing... - final int mask = hashSize-1; - int spillPtr = names.length; - - for (int i = 0, fcount = propertyNames.size(); i < fcount; ++i) { - String name = propertyNames.get(i); - if (name == null) { - continue; - } - int ix = _hash(name.hashCode(), mask); - if (names[ix] == null) { - names[ix] = name; - offsets[ix] = i; - continue; - } - ix = (mask+1) + (ix >> 1); - if (names[ix] == null) { - names[ix] = name; - offsets[ix] = i; - continue; - } - if (names.length == spillPtr) { - int newLength = names.length + 4; - names = Arrays.copyOf(names, newLength); - offsets = Arrays.copyOf(offsets, newLength); - } - names[spillPtr] = name; - offsets[spillPtr] = i; - ++spillPtr; - } - return new SimpleNameMatcher(locale, names, offsets, mask); - } - - public static SimpleNameMatcher constructCaseInsensitive(Locale locale, - List propertyNames, boolean alreadyInterned) { - return constructCaseInsensitive(locale, stringsFromNames(propertyNames, alreadyInterned)); - } - - public static SimpleNameMatcher constructCaseInsensitive(Locale locale, - List names) - { - return new SimpleNameMatcher(SimpleNameMatcher.construct(locale, names), - SimpleNameMatcher.construct(locale, _lc(locale, names))); - } - - // // // Not implemented by this matcher, but not an error to call (caller won't know) - - @Override - public int matchByQuad(int q1) { return MATCH_UNKNOWN_NAME; } - - @Override - public int matchByQuad(int q1, int q2) { return MATCH_UNKNOWN_NAME; } - - @Override - public int matchByQuad(int q1, int q2, int q3) { return MATCH_UNKNOWN_NAME; } - - @Override - public int matchByQuad(int[] q, int qlen) { return MATCH_UNKNOWN_NAME; } -} diff --git a/src/main/java/com/fasterxml/jackson/core/sym/package-info.java b/src/main/java/com/fasterxml/jackson/core/sym/package-info.java index 9301a2e5bc..b0ae032806 100644 --- a/src/main/java/com/fasterxml/jackson/core/sym/package-info.java +++ b/src/main/java/com/fasterxml/jackson/core/sym/package-info.java @@ -1,5 +1,5 @@ /** * Internal implementation classes for efficient handling of - * of symbols in JSON (Object property names) + * of symbols in JSON (field names in Objects) */ package com.fasterxml.jackson.core.sym; diff --git a/src/main/java/com/fasterxml/jackson/core/tree/ArrayTreeNode.java b/src/main/java/com/fasterxml/jackson/core/tree/ArrayTreeNode.java deleted file mode 100644 index 3964c6af1a..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/tree/ArrayTreeNode.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fasterxml.jackson.core.tree; - -import com.fasterxml.jackson.core.TreeNode; - -/** - * Tag interface (for now) for Array nodes - * - * @since 3.0 - */ -public interface ArrayTreeNode - extends TreeNode -{ - -} diff --git a/src/main/java/com/fasterxml/jackson/core/tree/ObjectTreeNode.java b/src/main/java/com/fasterxml/jackson/core/tree/ObjectTreeNode.java deleted file mode 100644 index 37b6991ad4..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/tree/ObjectTreeNode.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fasterxml.jackson.core.tree; - -import com.fasterxml.jackson.core.TreeNode; - -/** - * Tag interface (for now) for Object nodes - * - * @since 3.0 - */ -public interface ObjectTreeNode - extends TreeNode -{ - -} diff --git a/src/main/java/com/fasterxml/jackson/core/tree/package-info.java b/src/main/java/com/fasterxml/jackson/core/tree/package-info.java deleted file mode 100644 index a511a0f971..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/tree/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Package that contains abstractions that are used dealing - * with Tree Models (other than - * {@link com.fasterxml.jackson.core.TreeNode}). - * - * @since 3.0 - */ - -package com.fasterxml.jackson.core.tree; diff --git a/src/main/java/com/fasterxml/jackson/core/type/ResolvedType.java b/src/main/java/com/fasterxml/jackson/core/type/ResolvedType.java index dbbead88bc..b2bbab52eb 100644 --- a/src/main/java/com/fasterxml/jackson/core/type/ResolvedType.java +++ b/src/main/java/com/fasterxml/jackson/core/type/ResolvedType.java @@ -8,13 +8,15 @@ * MUST be of type JavaType from "databind" bundle -- this * abstraction is only needed so that types can be passed through * {@link com.fasterxml.jackson.core.JsonParser#readValueAs} methods. + * + * @since 2.0 */ public abstract class ResolvedType { /* - /********************************************************************** + /********************************************************** /* Public API, simple property accessors - /********************************************************************** + /********************************************************** */ /** @@ -52,6 +54,8 @@ public abstract class ResolvedType * Optional types (in JDK8, Guava). * * @return {@code True} if this is a "referential" type, {@code false} if not + * + * @since 2.6 */ public boolean isReferenceType() { return getReferencedType() != null; @@ -60,9 +64,9 @@ public boolean isReferenceType() { public abstract boolean isMapLikeType(); /* - /********************************************************************** + /********************************************************** /* Public API, type parameter access - /********************************************************************** + /********************************************************** */ /** @@ -73,6 +77,17 @@ public boolean isReferenceType() { */ public abstract boolean hasGenericTypes(); + /** + * @deprecated Since 2.7: does not have meaning as parameters depend on type + * resolved. + * + * @return Type-erased class of something not usable at this point + */ + @Deprecated // since 2.7 + public Class getParameterSource() { + return null; + } + /** * Method for accessing key type for this type, assuming type * has such a concept (only Map types do) @@ -95,6 +110,8 @@ public boolean isReferenceType() { * type references, if any. * * @return Referenced type, if any; {@code null} if not. + * + * @since 2.6 */ public abstract ResolvedType getReferencedType(); @@ -117,11 +134,24 @@ public boolean isReferenceType() { * exists (no exception thrown) */ public abstract ResolvedType containedType(int index); + + /** + * Method for accessing name of type variable in indicated + * position. If no name is bound, will use placeholders (derived + * from 0-based index); if no type variable or argument exists + * with given index, null is returned. + * + * @param index Index of contained type to return + * + * @return Contained type at index, or null if no such type + * exists (no exception thrown) + */ + public abstract String containedTypeName(int index); /* - /********************************************************************** + /********************************************************** /* Public API, other - /********************************************************************** + /********************************************************** */ /** diff --git a/src/main/java/com/fasterxml/jackson/core/util/BufferRecycler.java b/src/main/java/com/fasterxml/jackson/core/util/BufferRecycler.java index 3ec1528a3b..10b81486cb 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/BufferRecycler.java +++ b/src/main/java/com/fasterxml/jackson/core/util/BufferRecycler.java @@ -35,6 +35,8 @@ public class BufferRecycler /** * Buffer used for concatenating binary data that is either being * encoded as base64 output, or decoded from base64 input. + * + * @since 2.1 */ public final static int BYTE_BASE64_CODEC_BUFFER = 3; @@ -100,6 +102,8 @@ public BufferRecycler() { * * @param bbCount Number of {@code byte[]} buffers to allocate * @param cbCount Number of {@code char[]} buffers to allocate + * + * @since 2.4 */ protected BufferRecycler(int bbCount, int cbCount) { _byteBuffers = new AtomicReferenceArray(bbCount); diff --git a/src/main/java/com/fasterxml/jackson/core/util/BufferRecyclers.java b/src/main/java/com/fasterxml/jackson/core/util/BufferRecyclers.java index 7591a83702..6b8ffa24bc 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/BufferRecyclers.java +++ b/src/main/java/com/fasterxml/jackson/core/util/BufferRecyclers.java @@ -2,11 +2,15 @@ import java.lang.ref.SoftReference; +import com.fasterxml.jackson.core.io.JsonStringEncoder; + /** * Helper entity used to control access to simple buffer recyling scheme used for * some encoding, decoding tasks. * * @see BufferRecycler + * + * @since 2.9.2 */ public class BufferRecyclers { @@ -94,4 +98,86 @@ public static int releaseBuffers() { } return -1; } + + /* + /********************************************************************** + /* Obsolete things re-introduced in 2.12.5 after accidental direct + /* removal from 2.10.0 + /********************************************************************** + */ + + /** + * Not to be used any more: call {@link JsonStringEncoder#getInstance()} instead. + * + * @return {@code JsonStringEncoder} instance to use. + * + * @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated + * in 2.12.5, to be removed from 3.0) + */ + @Deprecated + public static JsonStringEncoder getJsonStringEncoder() { + return JsonStringEncoder.getInstance(); + } + + /** + * Not to be used any more: call {@link JsonStringEncoder#getInstance()} (and then + * {@code encodeAsUTF8()}) instead. + * + * @param text String to encode + * @return String encoded as UTF-8 bytes. + * + * @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated + * in 2.12.5, to be removed from 3.0) + */ + @Deprecated + public static byte[] encodeAsUTF8(String text) { + return JsonStringEncoder.getInstance().encodeAsUTF8(text); + } + + /** + * Not to be used any more: call {@link JsonStringEncoder#getInstance()} (and then + * {@code quoteAsString()}) instead. + * + * @param rawText String to quote + * + * @return Quoted text as {@code char[]} + * + * @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated + * in 2.12.5, to be removed from 3.0) + */ + @Deprecated + public static char[] quoteAsJsonText(String rawText) { + return JsonStringEncoder.getInstance().quoteAsString(rawText); + } + + /** + * Not to be used any more: call {@link JsonStringEncoder#getInstance()} (and then + * {@code quoteAsString()}) instead. + * + * @param input Textual content to quote + * @param output Builder to append quoted content + * + * @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated + * in 2.12.5, to be removed from 3.0) + */ + @Deprecated + public static void quoteAsJsonText(CharSequence input, StringBuilder output) { + JsonStringEncoder.getInstance().quoteAsString(input, output); + } + + /** + * Not to be used any more: call {@link JsonStringEncoder#getInstance()} (and then + * {@code quoteAsUTF8()}) instead. + * + * @param rawText String to quote + * + * @return Quoted text as {@code byte[]} + * + * @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated + * in 2.12.5, to be removed from 3.0) + */ + @Deprecated + public static byte[] quoteAsJsonUTF8(String rawText) { + return JsonStringEncoder.getInstance().quoteAsUTF8(rawText); + } } diff --git a/src/main/java/com/fasterxml/jackson/core/util/ByteArrayBuilder.java b/src/main/java/com/fasterxml/jackson/core/util/ByteArrayBuilder.java index ba77720145..336301f435 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/ByteArrayBuilder.java +++ b/src/main/java/com/fasterxml/jackson/core/util/ByteArrayBuilder.java @@ -41,7 +41,7 @@ public final class ByteArrayBuilder extends OutputStream // Optional buffer recycler instance that we can use for allocating the first block. private final BufferRecycler _bufferRecycler; - private final List _pastBlocks = new ArrayList(); + private final LinkedList _pastBlocks = new LinkedList(); // Number of bytes within byte arrays in {@link _pastBlocks}. private int _pastLen; @@ -76,7 +76,9 @@ public void reset() { _pastLen = 0; _currBlockPtr = 0; - _pastBlocks.clear(); + if (!_pastBlocks.isEmpty()) { + _pastBlocks.clear(); + } } /** @@ -179,9 +181,9 @@ public byte[] toByteArray() } /* - /********************************************************************** + /********************************************************** /* Non-stream API (similar to TextBuffer) - /********************************************************************** + /********************************************************** */ /** @@ -226,9 +228,9 @@ public byte[] completeAndCoalesce(int lastBlockLength) { public int getCurrentSegmentLength() { return _currBlockPtr; } /* - /********************************************************************** + /********************************************************** /* OutputStream implementation - /********************************************************************** + /********************************************************** */ @Override @@ -262,9 +264,9 @@ public void write(int b) { @Override public void flush() { /* NOP */ } /* - /********************************************************************** + /********************************************************** /* Internal methods - /********************************************************************** + /********************************************************** */ private void _allocMore() diff --git a/src/main/java/com/fasterxml/jackson/core/util/DefaultIndenter.java b/src/main/java/com/fasterxml/jackson/core/util/DefaultIndenter.java index 8c7e8b14a8..1e9dcdb362 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/DefaultIndenter.java +++ b/src/main/java/com/fasterxml/jackson/core/util/DefaultIndenter.java @@ -1,6 +1,7 @@ package com.fasterxml.jackson.core.util; -import com.fasterxml.jackson.core.JacksonException; +import java.io.IOException; + import com.fasterxml.jackson.core.JsonGenerator; /** @@ -84,7 +85,7 @@ public DefaultIndenter withIndent(String indent) public boolean isInline() { return false; } @Override - public void writeIndentation(JsonGenerator jg, int level) throws JacksonException + public void writeIndentation(JsonGenerator jg, int level) throws IOException { jg.writeRaw(eol); if (level > 0) { // should we err on negative values (as there's some flaw?) diff --git a/src/main/java/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.java b/src/main/java/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.java index fb52e52556..627aed02b0 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.java +++ b/src/main/java/com/fasterxml/jackson/core/util/DefaultPrettyPrinter.java @@ -1,5 +1,7 @@ package com.fasterxml.jackson.core.util; +import java.io.*; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.SerializedString; @@ -7,8 +9,9 @@ * Default {@link PrettyPrinter} implementation that uses 2-space * indentation with platform-default linefeeds. * Usually this class is not instantiated directly, but instead - * instantiated by {@code JsonFactory} or databind level mapper. - *

    + * method {@link JsonGenerator#useDefaultPrettyPrinter} is + * used, which will use an instance of this class for operation. + * * If you override this class, take note of {@link Instantiatable}, * as subclasses will still create an instance of DefaultPrettyPrinter. */ @@ -22,6 +25,8 @@ public class DefaultPrettyPrinter /** * Constant that specifies default "root-level" separator to use between * root values: a single space character. + * + * @since 2.1 */ public final static SerializedString DEFAULT_ROOT_VALUE_SEPARATOR = new SerializedString(" "); @@ -33,7 +38,7 @@ public class DefaultPrettyPrinter */ public interface Indenter { - void writeIndentation(JsonGenerator g, int level) throws JacksonException; + void writeIndentation(JsonGenerator g, int level) throws IOException; /** * @return True if indenter is considered inline (does not add linefeeds), @@ -47,7 +52,7 @@ public interface Indenter /** * By default, let's use only spaces to separate array values. */ - protected Indenter _arrayIndenter = FixedSpaceIndenter.instance(); + protected Indenter _arrayIndenter = FixedSpaceIndenter.instance; /** * By default, let's use linefeed-adding indenter for separate @@ -66,7 +71,7 @@ public interface Indenter /** * By default we will add spaces around colons used to - * separate Object property names and values. + * separate object fields and values. * If disabled, will not use spaces around colon. */ protected boolean _spacesInObjectEntries = true; @@ -79,15 +84,21 @@ public interface Indenter */ protected transient int _nesting; + /** + * @since 2.9 + */ protected Separators _separators; + /** + * @since 2.9 + */ protected String _objectFieldValueSeparatorWithSpaces; /* - /********************************************************************** + /********************************************************** /* Life-cycle (construct, configure) - /********************************************************************** - */ + /********************************************************** + */ public DefaultPrettyPrinter() { this(DEFAULT_ROOT_VALUE_SEPARATOR); @@ -148,22 +159,25 @@ public DefaultPrettyPrinter withRootSeparator(SerializableString rootSeparator) * @param rootSeparator Root-level value separator to use * * @return This pretty-printer instance (for call chaining) + * + * @since 2.6 */ public DefaultPrettyPrinter withRootSeparator(String rootSeparator) { return withRootSeparator((rootSeparator == null) ? null : new SerializedString(rootSeparator)); } public void indentArraysWith(Indenter i) { - _arrayIndenter = (i == null) ? NopIndenter.instance() : i; + _arrayIndenter = (i == null) ? NopIndenter.instance : i; } public void indentObjectsWith(Indenter i) { - _objectIndenter = (i == null) ? NopIndenter.instance() : i; + _objectIndenter = (i == null) ? NopIndenter.instance : i; } + // @since 2.3 public DefaultPrettyPrinter withArrayIndenter(Indenter i) { if (i == null) { - i = NopIndenter.instance(); + i = NopIndenter.instance; } if (_arrayIndenter == i) { return this; @@ -173,9 +187,10 @@ public DefaultPrettyPrinter withArrayIndenter(Indenter i) { return pp; } + // @since 2.3 public DefaultPrettyPrinter withObjectIndenter(Indenter i) { if (i == null) { - i = NopIndenter.instance(); + i = NopIndenter.instance; } if (_objectIndenter == i) { return this; @@ -192,6 +207,8 @@ public DefaultPrettyPrinter withObjectIndenter(Indenter i) { * and returned. * * @return This pretty-printer instance (for call chaining) + * + * @since 2.3 */ public DefaultPrettyPrinter withSpacesInObjectEntries() { return _withSpaces(true); @@ -204,6 +221,8 @@ public DefaultPrettyPrinter withSpacesInObjectEntries() { * and returned. * * @return This pretty-printer instance (for call chaining) + * + * @since 2.3 */ public DefaultPrettyPrinter withoutSpacesInObjectEntries() { return _withSpaces(false); @@ -225,22 +244,24 @@ protected DefaultPrettyPrinter _withSpaces(boolean state) * @param separators Separator definitions to use * * @return This pretty-printer instance (for call chaining) + * + * @since 2.9 */ public DefaultPrettyPrinter withSeparators(Separators separators) { _separators = separators; - _objectFieldValueSeparatorWithSpaces = " " + separators.getObjectNameValueSeparator() + " "; + _objectFieldValueSeparatorWithSpaces = " " + separators.getObjectFieldValueSeparator() + " "; return this; } /* - /********************************************************************** + /********************************************************** /* Instantiatable impl - /********************************************************************** + /********************************************************** */ @Override public DefaultPrettyPrinter createInstance() { - if (getClass() != DefaultPrettyPrinter.class) { + if (getClass() != DefaultPrettyPrinter.class) { // since 2.10 throw new IllegalStateException("Failed `createInstance()`: "+getClass().getName() +" does not override method; it has to"); } @@ -248,13 +269,13 @@ public DefaultPrettyPrinter createInstance() { } /* - /********************************************************************** + /********************************************************** /* PrettyPrinter impl - /********************************************************************** + /********************************************************** */ @Override - public void writeRootValueSeparator(JsonGenerator g) throws JacksonException + public void writeRootValueSeparator(JsonGenerator g) throws IOException { if (_rootSeparator != null) { g.writeRaw(_rootSeparator); @@ -262,7 +283,7 @@ public void writeRootValueSeparator(JsonGenerator g) throws JacksonException } @Override - public void writeStartObject(JsonGenerator g) throws JacksonException + public void writeStartObject(JsonGenerator g) throws IOException { g.writeRaw('{'); if (!_objectIndenter.isInline()) { @@ -271,13 +292,13 @@ public void writeStartObject(JsonGenerator g) throws JacksonException } @Override - public void beforeObjectEntries(JsonGenerator g) throws JacksonException + public void beforeObjectEntries(JsonGenerator g) throws IOException { _objectIndenter.writeIndentation(g, _nesting); } /** - * Method called after the object property name has been output, but + * Method called after an object field has been output, but * before the value is output. *

    * Default handling (without pretty-printing) will output a single @@ -286,12 +307,12 @@ public void beforeObjectEntries(JsonGenerator g) throws JacksonException * (white-space) decoration. */ @Override - public void writeObjectFieldValueSeparator(JsonGenerator g) throws JacksonException + public void writeObjectFieldValueSeparator(JsonGenerator g) throws IOException { if (_spacesInObjectEntries) { g.writeRaw(_objectFieldValueSeparatorWithSpaces); } else { - g.writeRaw(_separators.getObjectNameValueSeparator()); + g.writeRaw(_separators.getObjectFieldValueSeparator()); } } @@ -305,14 +326,14 @@ public void writeObjectFieldValueSeparator(JsonGenerator g) throws JacksonExcept * (white-space) decoration. */ @Override - public void writeObjectEntrySeparator(JsonGenerator g) throws JacksonException + public void writeObjectEntrySeparator(JsonGenerator g) throws IOException { g.writeRaw(_separators.getObjectEntrySeparator()); _objectIndenter.writeIndentation(g, _nesting); } @Override - public void writeEndObject(JsonGenerator g, int nrOfEntries) throws JacksonException + public void writeEndObject(JsonGenerator g, int nrOfEntries) throws IOException { if (!_objectIndenter.isInline()) { --_nesting; @@ -326,7 +347,7 @@ public void writeEndObject(JsonGenerator g, int nrOfEntries) throws JacksonExcep } @Override - public void writeStartArray(JsonGenerator g) throws JacksonException + public void writeStartArray(JsonGenerator g) throws IOException { if (!_arrayIndenter.isInline()) { ++_nesting; @@ -335,7 +356,7 @@ public void writeStartArray(JsonGenerator g) throws JacksonException } @Override - public void beforeArrayValues(JsonGenerator g) throws JacksonException { + public void beforeArrayValues(JsonGenerator g) throws IOException { _arrayIndenter.writeIndentation(g, _nesting); } @@ -349,14 +370,14 @@ public void beforeArrayValues(JsonGenerator g) throws JacksonException { * (white-space) decoration. */ @Override - public void writeArrayValueSeparator(JsonGenerator g) throws JacksonException + public void writeArrayValueSeparator(JsonGenerator g) throws IOException { g.writeRaw(_separators.getArrayValueSeparator()); _arrayIndenter.writeIndentation(g, _nesting); } @Override - public void writeEndArray(JsonGenerator g, int nrOfValues) throws JacksonException + public void writeEndArray(JsonGenerator g, int nrOfValues) throws IOException { if (!_arrayIndenter.isInline()) { --_nesting; @@ -370,9 +391,9 @@ public void writeEndArray(JsonGenerator g, int nrOfValues) throws JacksonExcepti } /* - /********************************************************************** + /********************************************************** /* Helper classes - /********************************************************************** + /********************************************************** */ /** @@ -381,12 +402,10 @@ public void writeEndArray(JsonGenerator g, int nrOfValues) throws JacksonExcepti public static class NopIndenter implements Indenter, java.io.Serializable { - private static final NopIndenter _nopInstance = new NopIndenter(); - - public static NopIndenter instance() { return _nopInstance; } + public static final NopIndenter instance = new NopIndenter(); @Override - public void writeIndentation(JsonGenerator g, int level) { } + public void writeIndentation(JsonGenerator g, int level) throws IOException { } @Override public boolean isInline() { return true; } @@ -399,12 +418,10 @@ public void writeIndentation(JsonGenerator g, int level) { } */ public static class FixedSpaceIndenter extends NopIndenter { - private static final FixedSpaceIndenter _fixedInstance = new FixedSpaceIndenter(); - - public static FixedSpaceIndenter instance() { return _fixedInstance; } + public static final FixedSpaceIndenter instance = new FixedSpaceIndenter(); @Override - public void writeIndentation(JsonGenerator g, int level) throws JacksonException + public void writeIndentation(JsonGenerator g, int level) throws IOException { g.writeRaw(' '); } diff --git a/src/main/java/com/fasterxml/jackson/core/util/Instantiatable.java b/src/main/java/com/fasterxml/jackson/core/util/Instantiatable.java index 053c461ee9..a05871d8ce 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/Instantiatable.java +++ b/src/main/java/com/fasterxml/jackson/core/util/Instantiatable.java @@ -10,6 +10,8 @@ * by simply returning 'this': this is acceptable if instances are stateless. * * @see DefaultPrettyPrinter + * + * @since 2.1 */ public interface Instantiatable { diff --git a/src/main/java/com/fasterxml/jackson/core/util/JacksonFeature.java b/src/main/java/com/fasterxml/jackson/core/util/JacksonFeature.java index 55ff9d5e08..ac89fa7ace 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/JacksonFeature.java +++ b/src/main/java/com/fasterxml/jackson/core/util/JacksonFeature.java @@ -5,6 +5,8 @@ * settings and capabilities exposed as something that can be internally * represented as bit sets. * Designed to be used with {@link JacksonFeatureSet}. + * + * @since 2.12 */ public interface JacksonFeature { @@ -26,7 +28,7 @@ public interface JacksonFeature /** * Convenience method for checking whether feature is enabled in given bitmask. * - * @param flags Bitfield that contains a set of enabled features of this type + * @param flags Bit field that contains a set of enabled features of this type * * @return True if this feature is enabled in passed bit field */ diff --git a/src/main/java/com/fasterxml/jackson/core/util/JacksonFeatureSet.java b/src/main/java/com/fasterxml/jackson/core/util/JacksonFeatureSet.java index 1d5dbb9001..8af982b59b 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/JacksonFeatureSet.java +++ b/src/main/java/com/fasterxml/jackson/core/util/JacksonFeatureSet.java @@ -39,7 +39,7 @@ public static JacksonFeatureSet fromDefaults(F[] a if (allFeatures.length > 31) { final String desc = allFeatures[0].getClass().getName(); throw new IllegalArgumentException(String.format( -"Cannot use type `%s` with JacksonFeatureSet: too many entries (%d > 31)", +"Can not use type `%s` with JacksonFeatureSet: too many entries (%d > 31)", desc, allFeatures.length)); } diff --git a/src/main/java/com/fasterxml/jackson/core/util/JsonGeneratorDelegate.java b/src/main/java/com/fasterxml/jackson/core/util/JsonGeneratorDelegate.java index dcc4060c26..8fb3abb4d0 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/JsonGeneratorDelegate.java +++ b/src/main/java/com/fasterxml/jackson/core/util/JsonGeneratorDelegate.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.CharacterEscapes; +import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; @@ -17,8 +18,7 @@ public class JsonGeneratorDelegate extends JsonGenerator /** * Whether copy methods - * ({@link #copyCurrentEvent}, {@link #copyCurrentStructure}, - * {@link #writeTree} and {@link #writePOJO}) + * ({@link #copyCurrentEvent}, {@link #copyCurrentStructure}, {@link #writeTree} and {@link #writeObject}) * are to be called (true), or handled by this object (false). */ protected boolean delegateCopyMethods; @@ -44,26 +44,35 @@ public JsonGeneratorDelegate(JsonGenerator d, boolean delegateCopyMethods) { this.delegateCopyMethods = delegateCopyMethods; } - @Override - public Object currentValue() { - return delegate.currentValue(); - } - - @Override - public void assignCurrentValue(Object v) { - delegate.assignCurrentValue(v); - } - /* /********************************************************************** - /* Public API, metadata + /* Public API, metadata/state access /********************************************************************** */ + + @Override public ObjectCodec getCodec() { return delegate.getCodec(); } + @Override public JsonGenerator setCodec(ObjectCodec oc) { + delegate.setCodec(oc); + return this; + } + + @Override public void setSchema(FormatSchema schema) { delegate.setSchema(schema); } @Override public FormatSchema getSchema() { return delegate.getSchema(); } @Override public Version version() { return delegate.version(); } - @Override public Object streamWriteOutputTarget() { return delegate.streamWriteOutputTarget(); } - @Override public int streamWriteOutputBuffered() { return delegate.streamWriteOutputBuffered(); } + @Override public Object getOutputTarget() { return delegate.getOutputTarget(); } + @Override public int getOutputBuffered() { return delegate.getOutputBuffered(); } + + @Override public void assignCurrentValue(Object v) { delegate.assignCurrentValue(v); } + @Override public Object currentValue() { return delegate.currentValue(); } + + // TODO: deprecate in 2.14 or later + @Override + public void setCurrentValue(Object v) { delegate.setCurrentValue(v); } + + // TODO: deprecate in 2.14 or later + @Override + public Object getCurrentValue() { return delegate.getCurrentValue(); } /* /********************************************************************** @@ -71,6 +80,9 @@ public void assignCurrentValue(Object v) { /********************************************************************** */ + @Override + public boolean canUseSchema(FormatSchema schema) { return delegate.canUseSchema(schema); } + @Override public boolean canWriteTypeId() { return delegate.canWriteTypeId(); } @@ -78,11 +90,17 @@ public void assignCurrentValue(Object v) { public boolean canWriteObjectId() { return delegate.canWriteObjectId(); } @Override - public boolean canOmitProperties() { return delegate.canOmitProperties(); } + public boolean canWriteBinaryNatively() { return delegate.canWriteBinaryNatively(); } + + @Override + public boolean canOmitFields() { return delegate.canOmitFields(); } + + @Override + public boolean canWriteFormattedNumbers() { return delegate.canWriteFormattedNumbers(); } @Override - public JacksonFeatureSet streamWriteCapabilities() { - return delegate.streamWriteCapabilities(); + public JacksonFeatureSet getWriteCapabilities() { + return delegate.getWriteCapabilities(); } /* @@ -92,14 +110,42 @@ public JacksonFeatureSet streamWriteCapabilities() { */ @Override - public boolean isEnabled(StreamWriteFeature f) { return delegate.isEnabled(f); } + public JsonGenerator enable(Feature f) { + delegate.enable(f); + return this; + } + + @Override + public JsonGenerator disable(Feature f) { + delegate.disable(f); + return this; + } + + @Override + public boolean isEnabled(Feature f) { return delegate.isEnabled(f); } + + // final, can't override (and no need to) + //public final JsonGenerator configure(Feature f, boolean state) + + @Override + public int getFeatureMask() { return delegate.getFeatureMask(); } @Override - public int streamWriteFeatures() { return delegate.streamWriteFeatures(); } + @Deprecated + public JsonGenerator setFeatureMask(int mask) { + delegate.setFeatureMask(mask); + return this; + } + + @Override + public JsonGenerator overrideStdFeatures(int values, int mask) { + delegate.overrideStdFeatures(values, mask); + return this; + } @Override - public JsonGenerator configure(StreamWriteFeature f, boolean state) { - delegate.configure(f, state); + public JsonGenerator overrideFormatFeatures(int values, int mask) { + delegate.overrideFormatFeatures(values, mask); return this; } @@ -110,11 +156,36 @@ public JsonGenerator configure(StreamWriteFeature f, boolean state) { */ @Override - public int getHighestNonEscapedChar() { return delegate.getHighestNonEscapedChar(); } + public JsonGenerator setPrettyPrinter(PrettyPrinter pp) { + delegate.setPrettyPrinter(pp); + return this; + } + + @Override + public PrettyPrinter getPrettyPrinter() { return delegate.getPrettyPrinter(); } + + @Override + public JsonGenerator useDefaultPrettyPrinter() { delegate.useDefaultPrettyPrinter(); + return this; } + + @Override + public JsonGenerator setHighestNonEscapedChar(int charCode) { delegate.setHighestNonEscapedChar(charCode); + return this; } + + @Override + public int getHighestEscapedChar() { return delegate.getHighestEscapedChar(); } @Override public CharacterEscapes getCharacterEscapes() { return delegate.getCharacterEscapes(); } + @Override + public JsonGenerator setCharacterEscapes(CharacterEscapes esc) { delegate.setCharacterEscapes(esc); + return this; } + + @Override + public JsonGenerator setRootValueSeparator(SerializableString sep) { delegate.setRootValueSeparator(sep); + return this; } + /* /********************************************************************** /* Public API, write methods, structural @@ -122,63 +193,67 @@ public JsonGenerator configure(StreamWriteFeature f, boolean state) { */ @Override - public void writeStartArray() throws JacksonException { delegate.writeStartArray(); } + public void writeStartArray() throws IOException { delegate.writeStartArray(); } + @SuppressWarnings("deprecation") @Override - public void writeStartArray(Object forValue) throws JacksonException { delegate.writeStartArray(forValue); } + public void writeStartArray(int size) throws IOException { delegate.writeStartArray(size); } @Override - public void writeStartArray(Object forValue, int size) throws JacksonException { delegate.writeStartArray(forValue, size); } + public void writeStartArray(Object forValue) throws IOException { delegate.writeStartArray(forValue); } @Override - public void writeEndArray() throws JacksonException { delegate.writeEndArray(); } + public void writeStartArray(Object forValue, int size) throws IOException { delegate.writeStartArray(forValue, size); } @Override - public void writeStartObject() throws JacksonException { delegate.writeStartObject(); } + public void writeEndArray() throws IOException { delegate.writeEndArray(); } @Override - public void writeStartObject(Object forValue) throws JacksonException { delegate.writeStartObject(forValue); } + public void writeStartObject() throws IOException { delegate.writeStartObject(); } @Override - public void writeStartObject(Object forValue, int size) throws JacksonException { + public void writeStartObject(Object forValue) throws IOException { delegate.writeStartObject(forValue); } + + @Override + public void writeStartObject(Object forValue, int size) throws IOException { delegate.writeStartObject(forValue, size); } @Override - public void writeEndObject() throws JacksonException { delegate.writeEndObject(); } + public void writeEndObject() throws IOException { delegate.writeEndObject(); } @Override - public void writeName(String name) throws JacksonException { - delegate.writeName(name); + public void writeFieldName(String name) throws IOException { + delegate.writeFieldName(name); } @Override - public void writeName(SerializableString name) throws JacksonException { - delegate.writeName(name); + public void writeFieldName(SerializableString name) throws IOException { + delegate.writeFieldName(name); } @Override - public void writePropertyId(long id) throws JacksonException { - delegate.writePropertyId(id); + public void writeFieldId(long id) throws IOException { + delegate.writeFieldId(id); } @Override - public void writeArray(int[] array, int offset, int length) throws JacksonException { + public void writeArray(int[] array, int offset, int length) throws IOException { delegate.writeArray(array, offset, length); } @Override - public void writeArray(long[] array, int offset, int length) throws JacksonException { + public void writeArray(long[] array, int offset, int length) throws IOException { delegate.writeArray(array, offset, length); } @Override - public void writeArray(double[] array, int offset, int length) throws JacksonException { + public void writeArray(double[] array, int offset, int length) throws IOException { delegate.writeArray(array, offset, length); } @Override - public void writeArray(String[] array, int offset, int length) throws JacksonException { + public void writeArray(String[] array, int offset, int length) throws IOException { delegate.writeArray(array, offset, length); } @@ -189,24 +264,24 @@ public void writeArray(String[] array, int offset, int length) throws JacksonExc */ @Override - public void writeString(String text) throws JacksonException { delegate.writeString(text); } + public void writeString(String text) throws IOException { delegate.writeString(text); } @Override - public void writeString(Reader reader, int len) throws JacksonException { + public void writeString(Reader reader, int len) throws IOException { delegate.writeString(reader, len); } @Override - public void writeString(char[] text, int offset, int len) throws JacksonException { delegate.writeString(text, offset, len); } + public void writeString(char[] text, int offset, int len) throws IOException { delegate.writeString(text, offset, len); } @Override - public void writeString(SerializableString text) throws JacksonException { delegate.writeString(text); } + public void writeString(SerializableString text) throws IOException { delegate.writeString(text); } @Override - public void writeRawUTF8String(byte[] text, int offset, int length) throws JacksonException { delegate.writeRawUTF8String(text, offset, length); } + public void writeRawUTF8String(byte[] text, int offset, int length) throws IOException { delegate.writeRawUTF8String(text, offset, length); } @Override - public void writeUTF8String(byte[] text, int offset, int length) throws JacksonException { delegate.writeUTF8String(text, offset, length); } + public void writeUTF8String(byte[] text, int offset, int length) throws IOException { delegate.writeUTF8String(text, offset, length); } /* /********************************************************************** @@ -215,34 +290,34 @@ public void writeString(Reader reader, int len) throws JacksonException { */ @Override - public void writeRaw(String text) throws JacksonException { delegate.writeRaw(text); } + public void writeRaw(String text) throws IOException { delegate.writeRaw(text); } @Override - public void writeRaw(String text, int offset, int len) throws JacksonException { delegate.writeRaw(text, offset, len); } + public void writeRaw(String text, int offset, int len) throws IOException { delegate.writeRaw(text, offset, len); } @Override - public void writeRaw(SerializableString raw) throws JacksonException { delegate.writeRaw(raw); } + public void writeRaw(SerializableString raw) throws IOException { delegate.writeRaw(raw); } @Override - public void writeRaw(char[] text, int offset, int len) throws JacksonException { delegate.writeRaw(text, offset, len); } + public void writeRaw(char[] text, int offset, int len) throws IOException { delegate.writeRaw(text, offset, len); } @Override - public void writeRaw(char c) throws JacksonException { delegate.writeRaw(c); } + public void writeRaw(char c) throws IOException { delegate.writeRaw(c); } @Override - public void writeRawValue(String text) throws JacksonException { delegate.writeRawValue(text); } + public void writeRawValue(String text) throws IOException { delegate.writeRawValue(text); } @Override - public void writeRawValue(String text, int offset, int len) throws JacksonException { delegate.writeRawValue(text, offset, len); } + public void writeRawValue(String text, int offset, int len) throws IOException { delegate.writeRawValue(text, offset, len); } @Override - public void writeRawValue(char[] text, int offset, int len) throws JacksonException { delegate.writeRawValue(text, offset, len); } + public void writeRawValue(char[] text, int offset, int len) throws IOException { delegate.writeRawValue(text, offset, len); } @Override - public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len) throws JacksonException { delegate.writeBinary(b64variant, data, offset, len); } + public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len) throws IOException { delegate.writeBinary(b64variant, data, offset, len); } @Override - public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) throws JacksonException { return delegate.writeBinary(b64variant, data, dataLength); } + public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) throws IOException { return delegate.writeBinary(b64variant, data, dataLength); } /* /********************************************************************** @@ -251,62 +326,63 @@ public void writeString(Reader reader, int len) throws JacksonException { */ @Override - public void writeNumber(short v) throws JacksonException { delegate.writeNumber(v); } + public void writeNumber(short v) throws IOException { delegate.writeNumber(v); } @Override - public void writeNumber(int v) throws JacksonException { delegate.writeNumber(v); } + public void writeNumber(int v) throws IOException { delegate.writeNumber(v); } @Override - public void writeNumber(long v) throws JacksonException { delegate.writeNumber(v); } + public void writeNumber(long v) throws IOException { delegate.writeNumber(v); } @Override - public void writeNumber(BigInteger v) throws JacksonException { delegate.writeNumber(v); } + public void writeNumber(BigInteger v) throws IOException { delegate.writeNumber(v); } @Override - public void writeNumber(double v) throws JacksonException { delegate.writeNumber(v); } + public void writeNumber(double v) throws IOException { delegate.writeNumber(v); } @Override - public void writeNumber(float v) throws JacksonException { delegate.writeNumber(v); } + public void writeNumber(float v) throws IOException { delegate.writeNumber(v); } @Override - public void writeNumber(BigDecimal v) throws JacksonException { delegate.writeNumber(v); } + public void writeNumber(BigDecimal v) throws IOException { delegate.writeNumber(v); } @Override - public void writeNumber(String encodedValue) throws JacksonException, UnsupportedOperationException { delegate.writeNumber(encodedValue); } + public void writeNumber(String encodedValue) throws IOException, UnsupportedOperationException { delegate.writeNumber(encodedValue); } @Override - public void writeNumber(char[] encodedValueBuffer, int offset, int length) throws JacksonException, UnsupportedOperationException { delegate.writeNumber(encodedValueBuffer, offset, length); } + public void writeNumber(char[] encodedValueBuffer, int offset, int length) throws IOException, UnsupportedOperationException { delegate.writeNumber(encodedValueBuffer, offset, length); } @Override - public void writeBoolean(boolean state) throws JacksonException { delegate.writeBoolean(state); } + public void writeBoolean(boolean state) throws IOException { delegate.writeBoolean(state); } @Override - public void writeNull() throws JacksonException { delegate.writeNull(); } + public void writeNull() throws IOException { delegate.writeNull(); } /* /********************************************************************** - /* Public API, convenience property-write methods + /* Public API, convenience field-write methods /********************************************************************** */ // 04-Oct-2019, tatu: Reminder: these should NOT be delegated, unless matching // methods in `FilteringGeneratorDelegate` are re-defined to "split" calls again -// public void writeBinaryProperty(String propName, byte[] data) throws JacksonException { -// public void writeBooleanProperty(String propName, boolean value) throws JacksonException { -// public void writeNullProperty(String propName) throws JacksonException { -// public void writeStringProperty(String propName, String value) throws JacksonException { -// public void writeNumberProperty(String propName, short value) throws JacksonException { +// public void writeBinaryField(String fieldName, byte[] data) throws IOException { +// public void writeBooleanField(String fieldName, boolean value) throws IOException { +// public void writeNullField(String fieldName) throws IOException { +// public void writeStringField(String fieldName, String value) throws IOException { +// public void writeNumberField(String fieldName, short value) throws IOException { -// public void writeArrayPropertyStart(String propName) throws JacksonException { -// public void writeObjectPropertyStart(String propName) throws JacksonException { -// public void writePOJOProperty(String propName, Object pojo) throws JacksonException { +// public void writeArrayFieldStart(String fieldName) throws IOException { +// public void writeObjectFieldStart(String fieldName) throws IOException { +// public void writeObjectField(String fieldName, Object pojo) throws IOException { +// public void writePOJOField(String fieldName, Object pojo) throws IOException { // Sole exception being this method as it is not a "combo" method @Override - public void writeOmittedProperty(String propName) throws JacksonException { - delegate.writeOmittedProperty(propName); + public void writeOmittedField(String fieldName) throws IOException { + delegate.writeOmittedField(fieldName); } /* @@ -316,38 +392,48 @@ public void writeOmittedProperty(String propName) throws JacksonException { */ @Override - public void writeObjectId(Object id) throws JacksonException { delegate.writeObjectId(id); } + public void writeObjectId(Object id) throws IOException { delegate.writeObjectId(id); } @Override - public void writeObjectRef(Object id) throws JacksonException { delegate.writeObjectRef(id); } + public void writeObjectRef(Object id) throws IOException { delegate.writeObjectRef(id); } @Override - public void writeTypeId(Object id) throws JacksonException { delegate.writeTypeId(id); } + public void writeTypeId(Object id) throws IOException { delegate.writeTypeId(id); } @Override - public void writeEmbeddedObject(Object object) throws JacksonException { delegate.writeEmbeddedObject(object); } + public void writeEmbeddedObject(Object object) throws IOException { delegate.writeEmbeddedObject(object); } /* /********************************************************************** /* Public API, write methods, serializing Java objects /********************************************************************** */ - + + @Override // since 2.13 + public void writePOJO(Object pojo) throws IOException { + writeObject(pojo); + } + @Override - public void writePOJO(Object pojo) throws JacksonException { + public void writeObject(Object pojo) throws IOException { if (delegateCopyMethods) { - delegate.writePOJO(pojo); + delegate.writeObject(pojo); return; } if (pojo == null) { writeNull(); } else { - objectWriteContext().writeValue(this, pojo); + ObjectCodec c = getCodec(); + if (c != null) { + c.writeValue(this, pojo); + return; + } + _writeSimpleObject(pojo); } } @Override - public void writeTree(TreeNode tree) throws JacksonException { + public void writeTree(TreeNode tree) throws IOException { if (delegateCopyMethods) { delegate.writeTree(tree); return; @@ -356,13 +442,17 @@ public void writeTree(TreeNode tree) throws JacksonException { if (tree == null) { writeNull(); } else { - objectWriteContext().writeTree(this, tree); + ObjectCodec c = getCodec(); + if (c == null) { + throw new IllegalStateException("No ObjectCodec defined"); + } + c.writeTree(this, tree); } } /* /********************************************************************** - /* Public API, convenience property write methods + /* Public API, convenience field write methods /********************************************************************** */ @@ -375,13 +465,13 @@ public void writeTree(TreeNode tree) throws JacksonException { */ @Override - public void copyCurrentEvent(JsonParser p) throws JacksonException { + public void copyCurrentEvent(JsonParser p) throws IOException { if (delegateCopyMethods) delegate.copyCurrentEvent(p); else super.copyCurrentEvent(p); } @Override - public void copyCurrentStructure(JsonParser p) throws JacksonException { + public void copyCurrentStructure(JsonParser p) throws IOException { if (delegateCopyMethods) delegate.copyCurrentStructure(p); else super.copyCurrentStructure(p); } @@ -392,8 +482,7 @@ public void copyCurrentStructure(JsonParser p) throws JacksonException { /********************************************************************** */ - @Override public TokenStreamContext streamWriteContext() { return delegate.streamWriteContext(); } - @Override public ObjectWriteContext objectWriteContext() { return delegate.objectWriteContext(); } + @Override public JsonStreamContext getOutputContext() { return delegate.getOutputContext(); } /* /********************************************************************** @@ -401,15 +490,9 @@ public void copyCurrentStructure(JsonParser p) throws JacksonException { /********************************************************************** */ - @Override public void flush() { delegate.flush(); } - @Override public void close() { delegate.close(); } + @Override public void flush() throws IOException { delegate.flush(); } + @Override public void close() throws IOException { delegate.close(); } - /* - /********************************************************************** - /* Closeable implementation - /********************************************************************** - */ - @Override public boolean isClosed() { return delegate.isClosed(); } /* @@ -418,8 +501,13 @@ public void copyCurrentStructure(JsonParser p) throws JacksonException { /********************************************************************** */ + @Deprecated // since 2.11 + public JsonGenerator getDelegate() { return delegate; } + /** * @return Underlying generator that calls are delegated to + * + * @since 2.11 */ public JsonGenerator delegate() { return delegate; } } diff --git a/src/main/java/com/fasterxml/jackson/core/util/JsonParserDelegate.java b/src/main/java/com/fasterxml/jackson/core/util/JsonParserDelegate.java index 9de92148af..8ca5074007 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/JsonParserDelegate.java +++ b/src/main/java/com/fasterxml/jackson/core/util/JsonParserDelegate.java @@ -1,16 +1,12 @@ package com.fasterxml.jackson.core.util; +import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.async.NonBlockingInputFeeder; -import com.fasterxml.jackson.core.exc.InputCoercionException; -import com.fasterxml.jackson.core.sym.PropertyNameMatcher; -import com.fasterxml.jackson.core.type.ResolvedType; -import com.fasterxml.jackson.core.type.TypeReference; /** * Helper class that implements @@ -30,56 +26,54 @@ public JsonParserDelegate(JsonParser d) { delegate = d; } - @Override public Version version() { return delegate.version(); } + /* + /********************************************************************** + /* Public API, configuration + /********************************************************************** + */ - // // // Public API: basic context access + @Override public void setCodec(ObjectCodec c) { delegate.setCodec(c); } + @Override public ObjectCodec getCodec() { return delegate.getCodec(); } @Override - public TokenStreamContext streamReadContext() { return delegate.streamReadContext(); } - - @Override - public ObjectReadContext objectReadContext() { return delegate.objectReadContext(); } - - // // // Public API, input source, location access - - @Override public JsonLocation currentTokenLocation() { return delegate.currentTokenLocation(); } - @Override public JsonLocation currentLocation() { return delegate.currentLocation(); } - @Override public Object streamReadInputSource() { return delegate.streamReadInputSource(); } + public JsonParser enable(Feature f) { + delegate.enable(f); + return this; + } @Override - public Object currentValue() { - return delegate.currentValue(); + public JsonParser disable(Feature f) { + delegate.disable(f); + return this; } + + @Override public boolean isEnabled(Feature f) { return delegate.isEnabled(f); } + @Override public int getFeatureMask() { return delegate.getFeatureMask(); } @Override - public void assignCurrentValue(Object v) { - delegate.assignCurrentValue(v); + @Deprecated // since 2.7 + public JsonParser setFeatureMask(int mask) { + delegate.setFeatureMask(mask); + return this; } - /* - /********************************************************************** - /* Public API, configuration - /********************************************************************** - */ - - /* @Override - public JsonParser enable(StreamReadFeature f) { - delegate.enable(f); + public JsonParser overrideStdFeatures(int values, int mask) { + delegate.overrideStdFeatures(values, mask); return this; } @Override - public JsonParser disable(StreamReadFeature f) { - delegate.disable(f); + public JsonParser overrideFormatFeatures(int values, int mask) { + delegate.overrideFormatFeatures(values, mask); return this; } - */ - - @Override public boolean isEnabled(StreamReadFeature f) { return delegate.isEnabled(f); } - @Override public int streamReadFeatures() { return delegate.streamReadFeatures(); } @Override public FormatSchema getSchema() { return delegate.getSchema(); } + @Override public void setSchema(FormatSchema schema) { delegate.setSchema(schema); } + @Override public boolean canUseSchema(FormatSchema schema) { return delegate.canUseSchema(schema); } + @Override public Version version() { return delegate.version(); } + @Override public Object getInputSource() { return delegate.getInputSource(); } /* /********************************************************************** @@ -87,11 +81,9 @@ public JsonParser disable(StreamReadFeature f) { /********************************************************************** */ - @Override public boolean canParseAsync() { return delegate.canParseAsync(); } - - @Override public NonBlockingInputFeeder nonBlockingInputFeeder() { return delegate.nonBlockingInputFeeder(); } + @Override public boolean requiresCustomCodec() { return delegate.requiresCustomCodec(); } - @Override public JacksonFeatureSet streamReadCapabilities() { return delegate.streamReadCapabilities(); } + @Override public JacksonFeatureSet getReadCapabilities() { return delegate.getReadCapabilities(); } /* /********************************************************************** @@ -99,124 +91,129 @@ public JsonParser disable(StreamReadFeature f) { /********************************************************************** */ - @Override public void close() { delegate.close(); } + @Override public void close() throws IOException { delegate.close(); } @Override public boolean isClosed() { return delegate.isClosed(); } /* /********************************************************************** - /* Public API, token accessors + /* Public API, state change/override methods /********************************************************************** */ - @Override public JsonToken currentToken() { return delegate.currentToken(); } - @Override public int currentTokenId() { return delegate.currentTokenId(); } - @Override public String currentName() { return delegate.currentName(); } - - @Override public boolean hasCurrentToken() { return delegate.hasCurrentToken(); } - @Override public boolean hasTokenId(int id) { return delegate.hasTokenId(id); } - @Override public boolean hasToken(JsonToken t) { return delegate.hasToken(t); } + @Override public void clearCurrentToken() { delegate.clearCurrentToken(); } + @Override public JsonToken getLastClearedToken() { return delegate.getLastClearedToken(); } + @Override public void overrideCurrentName(String name) { delegate.overrideCurrentName(name); } - @Override public boolean isExpectedStartArrayToken() { return delegate.isExpectedStartArrayToken(); } - @Override public boolean isExpectedStartObjectToken() { return delegate.isExpectedStartObjectToken(); } - @Override public boolean isExpectedNumberIntToken() { return delegate.isExpectedNumberIntToken(); } + @Override // since 2.13 + public void assignCurrentValue(Object v) { delegate.assignCurrentValue(v); } - @Override public boolean isNaN() { return delegate.isNaN(); } + // TODO: deprecate in 2.14 or later + @Override + public void setCurrentValue(Object v) { delegate.setCurrentValue(v); } /* /********************************************************************** - /* Public API, token state overrides + /* Public API, state/location accessors /********************************************************************** */ - @Override public void clearCurrentToken() { delegate.clearCurrentToken(); } - @Override public JsonToken getLastClearedToken() { return delegate.getLastClearedToken(); } - /* - @Override public void overrideCurrentName(String name) { - delegate.overrideCurrentName(name); - } - */ + @Override public JsonStreamContext getParsingContext() { return delegate.getParsingContext(); } + + @Override public JsonToken currentToken() { return delegate.currentToken(); } + @Override public int currentTokenId() { return delegate.currentTokenId(); } + @Override public String currentName() throws IOException { return delegate.currentName(); } + @Override // since 2.13 + public Object currentValue() { return delegate.currentValue(); } + + @Override // since 2.13 + public JsonLocation currentLocation() { return delegate.getCurrentLocation(); } + @Override // since 2.13 + public JsonLocation currentTokenLocation() { return delegate.getTokenLocation(); } + + // TODO: deprecate in 2.14 or later + @Override public JsonToken getCurrentToken() { return delegate.getCurrentToken(); } + @Deprecated // since 2.12 + @Override public int getCurrentTokenId() { return delegate.getCurrentTokenId(); } + // TODO: deprecate in 2.14 or later + @Override public String getCurrentName() throws IOException { return delegate.getCurrentName(); } + // TODO: deprecate in 2.14 or later + @Override public Object getCurrentValue() { return delegate.getCurrentValue(); } + + // TODO: deprecate in 2.14 or later + @Override public JsonLocation getCurrentLocation() { return delegate.getCurrentLocation(); } + // TODO: deprecate in 2.14 or later + @Override public JsonLocation getTokenLocation() { return delegate.getTokenLocation(); } /* /********************************************************************** - /* Public API, iteration over token stream + /* Public API, token accessors /********************************************************************** */ - @Override public JsonToken nextToken() throws JacksonException { return delegate.nextToken(); } - @Override public JsonToken nextValue() throws JacksonException { return delegate.nextValue(); } - @Override public void finishToken() throws JacksonException { delegate.finishToken(); } - - @Override - public JsonParser skipChildren() throws JacksonException { - delegate.skipChildren(); - // NOTE: must NOT delegate this method to delegate, needs to be self-reference for chaining - return this; - } - - // 12-Nov-2017, tatu: These DO work as long as `JsonParserSequence` further overrides - // handling + @Override public boolean hasCurrentToken() { return delegate.hasCurrentToken(); } + @Override public boolean hasTokenId(int id) { return delegate.hasTokenId(id); } + @Override public boolean hasToken(JsonToken t) { return delegate.hasToken(t); } - @Override public String nextName() throws JacksonException { return delegate.nextName(); } - @Override public boolean nextName(SerializableString str) throws JacksonException { return delegate.nextName(str); } - @Override public int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException { return delegate.nextNameMatch(matcher); } + @Override public boolean isExpectedStartArrayToken() { return delegate.isExpectedStartArrayToken(); } + @Override public boolean isExpectedStartObjectToken() { return delegate.isExpectedStartObjectToken(); } + @Override public boolean isExpectedNumberIntToken() { return delegate.isExpectedNumberIntToken(); } - // NOTE: fine without overrides since it does NOT change state - @Override public int currentNameMatch(PropertyNameMatcher matcher) { return delegate.currentNameMatch(matcher); } + @Override public boolean isNaN() throws IOException { return delegate.isNaN(); } /* /********************************************************************** - /* Public API, access to token information, text + /* Public API, access to token textual content /********************************************************************** */ - @Override public String getText() throws JacksonException { return delegate.getText(); } + @Override public String getText() throws IOException { return delegate.getText(); } @Override public boolean hasTextCharacters() { return delegate.hasTextCharacters(); } - @Override public char[] getTextCharacters() throws JacksonException { return delegate.getTextCharacters(); } - @Override public int getTextLength() throws JacksonException { return delegate.getTextLength(); } - @Override public int getTextOffset() throws JacksonException { return delegate.getTextOffset(); } - @Override public int getText(Writer writer) throws JacksonException { return delegate.getText(writer); } + @Override public char[] getTextCharacters() throws IOException { return delegate.getTextCharacters(); } + @Override public int getTextLength() throws IOException { return delegate.getTextLength(); } + @Override public int getTextOffset() throws IOException { return delegate.getTextOffset(); } + @Override public int getText(Writer writer) throws IOException, UnsupportedOperationException { return delegate.getText(writer); } /* /********************************************************************** - /* Public API, access to token information, numeric + /* Public API, access to token numeric values /********************************************************************** */ - + @Override - public BigInteger getBigIntegerValue() { return delegate.getBigIntegerValue(); } + public BigInteger getBigIntegerValue() throws IOException { return delegate.getBigIntegerValue(); } @Override - public boolean getBooleanValue() throws InputCoercionException { return delegate.getBooleanValue(); } + public boolean getBooleanValue() throws IOException { return delegate.getBooleanValue(); } @Override - public byte getByteValue() throws InputCoercionException { return delegate.getByteValue(); } + public byte getByteValue() throws IOException { return delegate.getByteValue(); } @Override - public short getShortValue() throws InputCoercionException { return delegate.getShortValue(); } + public short getShortValue() throws IOException { return delegate.getShortValue(); } @Override - public BigDecimal getDecimalValue() throws InputCoercionException { return delegate.getDecimalValue(); } + public BigDecimal getDecimalValue() throws IOException { return delegate.getDecimalValue(); } @Override - public double getDoubleValue() throws InputCoercionException { return delegate.getDoubleValue(); } + public double getDoubleValue() throws IOException { return delegate.getDoubleValue(); } @Override - public float getFloatValue() throws InputCoercionException { return delegate.getFloatValue(); } + public float getFloatValue() throws IOException { return delegate.getFloatValue(); } @Override - public int getIntValue() throws InputCoercionException { return delegate.getIntValue(); } + public int getIntValue() throws IOException { return delegate.getIntValue(); } @Override - public long getLongValue() throws InputCoercionException { return delegate.getLongValue(); } + public long getLongValue() throws IOException { return delegate.getLongValue(); } @Override - public NumberType getNumberType() { return delegate.getNumberType(); } + public NumberType getNumberType() throws IOException { return delegate.getNumberType(); } @Override - public Number getNumberValue() throws InputCoercionException { return delegate.getNumberValue(); } + public Number getNumberValue() throws IOException { return delegate.getNumberValue(); } @Override - public Number getNumberValueExact() throws InputCoercionException { return delegate.getNumberValueExact(); } + public Number getNumberValueExact() throws IOException { return delegate.getNumberValueExact(); } /* /********************************************************************** @@ -224,16 +221,16 @@ public JsonParser skipChildren() throws JacksonException { /********************************************************************** */ - @Override public int getValueAsInt() throws InputCoercionException { return delegate.getValueAsInt(); } - @Override public int getValueAsInt(int defaultValue) throws InputCoercionException { return delegate.getValueAsInt(defaultValue); } - @Override public long getValueAsLong() throws InputCoercionException { return delegate.getValueAsLong(); } - @Override public long getValueAsLong(long defaultValue) throws InputCoercionException { return delegate.getValueAsLong(defaultValue); } - @Override public double getValueAsDouble() throws InputCoercionException { return delegate.getValueAsDouble(); } - @Override public double getValueAsDouble(double defaultValue) throws InputCoercionException { return delegate.getValueAsDouble(defaultValue); } - @Override public boolean getValueAsBoolean() { return delegate.getValueAsBoolean(); } - @Override public boolean getValueAsBoolean(boolean defaultValue) { return delegate.getValueAsBoolean(defaultValue); } - @Override public String getValueAsString(){ return delegate.getValueAsString(); } - @Override public String getValueAsString(String defaultValue) { return delegate.getValueAsString(defaultValue); } + @Override public int getValueAsInt() throws IOException { return delegate.getValueAsInt(); } + @Override public int getValueAsInt(int defaultValue) throws IOException { return delegate.getValueAsInt(defaultValue); } + @Override public long getValueAsLong() throws IOException { return delegate.getValueAsLong(); } + @Override public long getValueAsLong(long defaultValue) throws IOException { return delegate.getValueAsLong(defaultValue); } + @Override public double getValueAsDouble() throws IOException { return delegate.getValueAsDouble(); } + @Override public double getValueAsDouble(double defaultValue) throws IOException { return delegate.getValueAsDouble(defaultValue); } + @Override public boolean getValueAsBoolean() throws IOException { return delegate.getValueAsBoolean(); } + @Override public boolean getValueAsBoolean(boolean defaultValue) throws IOException { return delegate.getValueAsBoolean(defaultValue); } + @Override public String getValueAsString() throws IOException { return delegate.getValueAsString(); } + @Override public String getValueAsString(String defaultValue) throws IOException { return delegate.getValueAsString(defaultValue); } /* /********************************************************************** @@ -241,34 +238,21 @@ public JsonParser skipChildren() throws JacksonException { /********************************************************************** */ - @Override public Object getEmbeddedObject() { return delegate.getEmbeddedObject(); } - @Override public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException { return delegate.getBinaryValue(b64variant); } - @Override public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws JacksonException { return delegate.readBinaryValue(b64variant, out); } - - /* - /********************************************************************** - /* Public API, databind callbacks via `ObjectReadContext` - /********************************************************************** - */ - - @Override - public T readValueAs(Class valueType) throws JacksonException { - return delegate.readValueAs(valueType); - } + @Override public Object getEmbeddedObject() throws IOException { return delegate.getEmbeddedObject(); } + @Override public byte[] getBinaryValue(Base64Variant b64variant) throws IOException { return delegate.getBinaryValue(b64variant); } + @Override public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException { return delegate.readBinaryValue(b64variant, out); } - @Override - public T readValueAs(TypeReference valueTypeRef) throws JacksonException { - return delegate.readValueAs(valueTypeRef); - } + @Override public JsonToken nextToken() throws IOException { return delegate.nextToken(); } - @Override - public T readValueAs(ResolvedType type) throws JacksonException { - return delegate.readValueAs(type); - } + @Override public JsonToken nextValue() throws IOException { return delegate.nextValue(); } + @Override public void finishToken() throws IOException { delegate.finishToken(); } + @Override - public T readValueAsTree() throws JacksonException { - return delegate.readValueAsTree(); + public JsonParser skipChildren() throws IOException { + delegate.skipChildren(); + // NOTE: must NOT delegate this method to delegate, needs to be self-reference for chaining + return this; } /* @@ -279,8 +263,8 @@ public T readValueAsTree() throws JacksonException { @Override public boolean canReadObjectId() { return delegate.canReadObjectId(); } @Override public boolean canReadTypeId() { return delegate.canReadTypeId(); } - @Override public Object getObjectId() { return delegate.getObjectId(); } - @Override public Object getTypeId() { return delegate.getTypeId(); } + @Override public Object getObjectId() throws IOException { return delegate.getObjectId(); } + @Override public Object getTypeId() throws IOException { return delegate.getTypeId(); } /* /********************************************************************** @@ -292,6 +276,8 @@ public T readValueAsTree() throws JacksonException { * Accessor for getting the immediate {@link JsonParser} this parser delegates calls to. * * @return Underlying parser calls are delegated to + * + * @since 2.10 */ public JsonParser delegate() { return delegate; } } diff --git a/src/main/java/com/fasterxml/jackson/core/util/JsonParserSequence.java b/src/main/java/com/fasterxml/jackson/core/util/JsonParserSequence.java index bc9347b433..bed1ae4dde 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/JsonParserSequence.java +++ b/src/main/java/com/fasterxml/jackson/core/util/JsonParserSequence.java @@ -1,9 +1,9 @@ package com.fasterxml.jackson.core.util; +import java.io.IOException; import java.util.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.sym.PropertyNameMatcher; /** * Helper class that can be used to sequence multiple physical @@ -31,6 +31,8 @@ public class JsonParserSequence extends JsonParserDelegate *

    * Default setting is false (for backwards-compatibility) * so that possible existing token is not considered for parsers. + * + * @since 2.8 */ protected final boolean _checkForExistingToken; @@ -42,6 +44,8 @@ public class JsonParserSequence extends JsonParserDelegate /** * Flag used to indicate that `JsonParser.nextToken()` should not be called, * due to parser already pointing to a token. + * + * @since 2.8 */ protected boolean _hasToken; @@ -51,6 +55,12 @@ public class JsonParserSequence extends JsonParserDelegate ******************************************************* */ + @Deprecated // since 2.8 + protected JsonParserSequence(JsonParser[] parsers) { + this(false, parsers); + } + + // @since 2.8 protected JsonParserSequence(boolean checkForExistingToken, JsonParser[] parsers) { super(parsers[0]); @@ -83,7 +93,7 @@ public static JsonParserSequence createFlattened(boolean checkForExistingToken, return new JsonParserSequence(checkForExistingToken, new JsonParser[] { first, second }); } - ArrayList p = new ArrayList(10); + ArrayList p = new ArrayList(); if (first instanceof JsonParserSequence) { ((JsonParserSequence) first).addFlattenedActiveParsers(p); } else { @@ -95,9 +105,14 @@ public static JsonParserSequence createFlattened(boolean checkForExistingToken, p.add(second); } return new JsonParserSequence(checkForExistingToken, - p.toArray(new JsonParser[0])); + p.toArray(new JsonParser[p.size()])); } + @Deprecated // since 2.8 + public static JsonParserSequence createFlattened(JsonParser first, JsonParser second) { + return createFlattened(false, first, second); + } + @SuppressWarnings("resource") protected void addFlattenedActiveParsers(List listToAddIn) { @@ -119,12 +134,12 @@ protected void addFlattenedActiveParsers(List listToAddIn) */ @Override - public void close() throws JacksonException { + public void close() throws IOException { do { delegate.close(); } while (switchToNext()); } @Override - public JsonToken nextToken() throws JacksonException + public JsonToken nextToken() throws IOException { if (delegate == null) { return null; @@ -146,7 +161,7 @@ public JsonToken nextToken() throws JacksonException * state correct here. */ @Override - public JsonParser skipChildren() throws JacksonException + public JsonParser skipChildren() throws IOException { if ((delegate.currentToken() != JsonToken.START_OBJECT) && (delegate.currentToken() != JsonToken.START_ARRAY)) { @@ -171,40 +186,6 @@ public JsonParser skipChildren() throws JacksonException } } - /* - /******************************************************* - /* And some more methods where default delegation would - /* cause problems with state handling here - /******************************************************* - */ - - @Override - public String nextName() throws JacksonException { - // NOTE: call `nextToken()` to handle delegation - return (nextToken() == JsonToken.PROPERTY_NAME) ? currentName() : null; - } - - @Override - public boolean nextName(SerializableString str) throws JacksonException { - // NOTE: call `nextToken()` to handle delegation - return (nextToken() == JsonToken.PROPERTY_NAME) - && str.getValue().equals(currentName()); - } - - @Override - public int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException { - // NOTE: call `nextToken()` to handle delegation - String str = nextName(); - if (str != null) { - // 15-Nov-2017, tatu: Can not assume intern()ing aspects when delegating... - return matcher.matchName(str); - } - if (hasToken(JsonToken.END_OBJECT)) { - return PropertyNameMatcher.MATCH_END_OBJECT; - } - return PropertyNameMatcher.MATCH_ODD_TOKEN; - } - /* /******************************************************* /* Additional extended API @@ -234,6 +215,8 @@ public int containedParsersCount() { * if so, the next parser will become the active delegate parser. * * @return True if switch succeeded; false otherwise + * + * @since 2.8 */ protected boolean switchToNext() { @@ -244,12 +227,12 @@ protected boolean switchToNext() return false; } - protected JsonToken switchAndReturnNext() throws JacksonException + protected JsonToken switchAndReturnNext() throws IOException { while (_nextParserIndex < _parsers.length) { delegate = _parsers[_nextParserIndex++]; if (_checkForExistingToken && delegate.hasCurrentToken()) { - return delegate.currentToken(); + return delegate.getCurrentToken(); } JsonToken t = delegate.nextToken(); if (t != null) { diff --git a/src/main/java/com/fasterxml/jackson/core/util/MinimalPrettyPrinter.java b/src/main/java/com/fasterxml/jackson/core/util/MinimalPrettyPrinter.java index e372ccb492..c6d74ab2f5 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/MinimalPrettyPrinter.java +++ b/src/main/java/com/fasterxml/jackson/core/util/MinimalPrettyPrinter.java @@ -1,6 +1,7 @@ package com.fasterxml.jackson.core.util; -import com.fasterxml.jackson.core.JacksonException; +import java.io.IOException; + import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.PrettyPrinter; @@ -28,12 +29,15 @@ public class MinimalPrettyPrinter protected String _rootValueSeparator; + /** + * @since 2.9 + */ protected Separators _separators; /* - /********************************************************************** + /********************************************************** /* Life-cycle, construction, configuration - /********************************************************************** + /********************************************************** */ public MinimalPrettyPrinter() { @@ -53,6 +57,8 @@ public void setRootValueSeparator(String sep) { * @param separators Separator definitions * * @return This pretty-printer instance to allow call chaining + * + * @since 2.9 */ public MinimalPrettyPrinter setSeparators(Separators separators) { _separators = separators; @@ -60,13 +66,13 @@ public MinimalPrettyPrinter setSeparators(Separators separators) { } /* - /********************************************************************** + /********************************************************** /* PrettyPrinter impl - /********************************************************************** + /********************************************************** */ @Override - public void writeRootValueSeparator(JsonGenerator g) throws JacksonException + public void writeRootValueSeparator(JsonGenerator g) throws IOException { if (_rootValueSeparator != null) { g.writeRaw(_rootValueSeparator); @@ -74,28 +80,28 @@ public void writeRootValueSeparator(JsonGenerator g) throws JacksonException } @Override - public void writeStartObject(JsonGenerator g) throws JacksonException + public void writeStartObject(JsonGenerator g) throws IOException { g.writeRaw('{'); } @Override - public void beforeObjectEntries(JsonGenerator g) throws JacksonException + public void beforeObjectEntries(JsonGenerator g) throws IOException { // nothing special, since no indentation is added } /** - * Method called after the Object property name has been output, but + * Method called after an object field has been output, but * before the value is output. *

    * Default handling will just output a single * colon to separate the two, without additional spaces. */ @Override - public void writeObjectFieldValueSeparator(JsonGenerator g) throws JacksonException + public void writeObjectFieldValueSeparator(JsonGenerator g) throws IOException { - g.writeRaw(_separators.getObjectNameValueSeparator()); + g.writeRaw(_separators.getObjectFieldValueSeparator()); } /** @@ -106,25 +112,25 @@ public void writeObjectFieldValueSeparator(JsonGenerator g) throws JacksonExcept * comma to separate the two. */ @Override - public void writeObjectEntrySeparator(JsonGenerator g) throws JacksonException + public void writeObjectEntrySeparator(JsonGenerator g) throws IOException { g.writeRaw(_separators.getObjectEntrySeparator()); } @Override - public void writeEndObject(JsonGenerator g, int nrOfEntries) throws JacksonException + public void writeEndObject(JsonGenerator g, int nrOfEntries) throws IOException { g.writeRaw('}'); } @Override - public void writeStartArray(JsonGenerator g) throws JacksonException + public void writeStartArray(JsonGenerator g) throws IOException { g.writeRaw('['); } @Override - public void beforeArrayValues(JsonGenerator g) throws JacksonException + public void beforeArrayValues(JsonGenerator g) throws IOException { // nothing special, since no indentation is added } @@ -137,13 +143,13 @@ public void beforeArrayValues(JsonGenerator g) throws JacksonException * comma to separate values. */ @Override - public void writeArrayValueSeparator(JsonGenerator g) throws JacksonException + public void writeArrayValueSeparator(JsonGenerator g) throws IOException { g.writeRaw(_separators.getArrayValueSeparator()); } @Override - public void writeEndArray(JsonGenerator g, int nrOfValues) throws JacksonException + public void writeEndArray(JsonGenerator g, int nrOfValues) throws IOException { g.writeRaw(']'); } diff --git a/src/main/java/com/fasterxml/jackson/core/util/Named.java b/src/main/java/com/fasterxml/jackson/core/util/Named.java deleted file mode 100644 index 6497ccf847..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/util/Named.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.fasterxml.jackson.core.util; - -/** - * Simple tag interface used primarily to allow databind to pass entities with - * name without needing to expose more details of implementation. - *

    - * NOTE: in Jackson 2.x, was part of `jackson-databind`: demoted here for 3.0. - * - * @since 3.0 - */ -public interface Named { - public String getName(); - - public static Named fromString(String n) { - if (n == null) return null; - return new StringAsNamed(n); - } - - public static class StringAsNamed - implements Named, java.io.Serializable - { - private static final long serialVersionUID = 1L; - - protected final String _name; - - public StringAsNamed(String n) { _name = n; } - - @Override - public String getName() { return _name; } - - @Override - public String toString() { return _name; } - - @Override - public int hashCode() { return _name.hashCode(); } - - @Override - public boolean equals(Object o) { - if (o == this) return true; - if (!(o instanceof StringAsNamed)) return false; - return _name.equals(((StringAsNamed) o)._name); - } - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/util/RequestPayload.java b/src/main/java/com/fasterxml/jackson/core/util/RequestPayload.java new file mode 100644 index 0000000000..a7e7e858fb --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/core/util/RequestPayload.java @@ -0,0 +1,67 @@ +package com.fasterxml.jackson.core.util; + +import java.io.IOException; + +/** + * Container object used to contain optional information on content + * being parsed, passed to {@link com.fasterxml.jackson.core.JsonParseException} in case of + * exception being thrown; this may be useful for caller to display + * information on failure. + * + * @since 2.8 + */ +public class RequestPayload + implements java.io.Serializable // just in case, even though likely included as transient +{ + private static final long serialVersionUID = 1L; + + // request payload as byte[] + protected byte[] _payloadAsBytes; + + // request payload as String + protected CharSequence _payloadAsText; + + // Charset if the request payload is set in bytes + protected String _charset; + + public RequestPayload(byte[] bytes, String charset) { + if (bytes == null) { + throw new IllegalArgumentException(); + } + _payloadAsBytes = bytes; + _charset = (charset == null || charset.isEmpty()) ? "UTF-8" : charset; + } + + public RequestPayload(CharSequence str) { + if (str == null) { + throw new IllegalArgumentException(); + } + _payloadAsText = str; + } + + /** + * Returns the raw request payload object i.e, either byte[] or String + * + * @return Object which is a raw request payload i.e, either byte[] or + * String + */ + public Object getRawPayload() { + if (_payloadAsBytes != null) { + return _payloadAsBytes; + } + + return _payloadAsText; + } + + @Override + public String toString() { + if (_payloadAsBytes != null) { + try { + return new String(_payloadAsBytes, _charset); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + return _payloadAsText.toString(); + } +} diff --git a/src/main/java/com/fasterxml/jackson/core/util/Separators.java b/src/main/java/com/fasterxml/jackson/core/util/Separators.java index 343061d75b..54b7c54b76 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/Separators.java +++ b/src/main/java/com/fasterxml/jackson/core/util/Separators.java @@ -8,14 +8,16 @@ * * @see com.fasterxml.jackson.core.util.DefaultPrettyPrinter * @see com.fasterxml.jackson.core.util.MinimalPrettyPrinter + * + * @since 2.9 */ public class Separators implements Serializable { private static final long serialVersionUID = 1; - private final char _objectNameValueSeparator; - private final char _objectEntrySeparator; - private final char _arrayElementSeparator; + private final char objectFieldValueSeparator; + private final char objectEntrySeparator; + private final char arrayValueSeparator; public static Separators createDefaultInstance() { return new Separators(); @@ -27,35 +29,35 @@ public Separators() { public Separators(char objectFieldValueSeparator, char objectEntrySeparator, char arrayValueSeparator) { - _objectNameValueSeparator = objectFieldValueSeparator; - _objectEntrySeparator = objectEntrySeparator; - _arrayElementSeparator = arrayValueSeparator; + this.objectFieldValueSeparator = objectFieldValueSeparator; + this.objectEntrySeparator = objectEntrySeparator; + this.arrayValueSeparator = arrayValueSeparator; } public Separators withObjectFieldValueSeparator(char sep) { - return (_objectNameValueSeparator == sep) ? this - : new Separators(sep, _objectEntrySeparator, _arrayElementSeparator); + return (objectFieldValueSeparator == sep) ? this + : new Separators(sep, objectEntrySeparator, arrayValueSeparator); } public Separators withObjectEntrySeparator(char sep) { - return (_objectEntrySeparator == sep) ? this - : new Separators(_objectNameValueSeparator, sep, _arrayElementSeparator); + return (objectEntrySeparator == sep) ? this + : new Separators(objectFieldValueSeparator, sep, arrayValueSeparator); } public Separators withArrayValueSeparator(char sep) { - return (_arrayElementSeparator == sep) ? this - : new Separators(_objectNameValueSeparator, _objectEntrySeparator, sep); + return (arrayValueSeparator == sep) ? this + : new Separators(objectFieldValueSeparator, objectEntrySeparator, sep); } - public char getObjectNameValueSeparator() { - return _objectNameValueSeparator; + public char getObjectFieldValueSeparator() { + return objectFieldValueSeparator; } public char getObjectEntrySeparator() { - return _objectEntrySeparator; + return objectEntrySeparator; } public char getArrayValueSeparator() { - return _arrayElementSeparator; + return arrayValueSeparator; } } diff --git a/src/main/java/com/fasterxml/jackson/core/util/SimpleStreamReadContext.java b/src/main/java/com/fasterxml/jackson/core/util/SimpleStreamReadContext.java deleted file mode 100644 index 080569becd..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/util/SimpleStreamReadContext.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.fasterxml.jackson.core.util; - -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.io.ContentReference; -import com.fasterxml.jackson.core.json.DupDetector; - -/** - * Basic implementation of {@link TokenStreamContext} useful for most - * format backend {@link JsonParser} implementations - * (with notable exception of JSON that needs bit more advanced state). - * - * @since 3.0 - */ -public class SimpleStreamReadContext extends TokenStreamContext -{ - /** - * Parent context for this context; null for root context. - */ - protected final SimpleStreamReadContext _parent; - - // // // Optional duplicate detection - - protected DupDetector _dups; - - /* - /********************************************************************** - /* Simple instance reuse slots; speed up things a bit (10-15%) - /* for docs with lots of small arrays/objects - /********************************************************************** - */ - - protected SimpleStreamReadContext _childToRecycle; - - /* - /********************************************************************** - /* Location/state information (minus source reference) - /********************************************************************** - */ - - protected String _currentName; - - protected Object _currentValue; - - protected int _lineNr; - protected int _columnNr; - - /* - /********************************************************************** - /* Instance construction, config, reuse - /********************************************************************** - */ - - public SimpleStreamReadContext(int type, SimpleStreamReadContext parent, DupDetector dups, - int lineNr, int colNr) { - super(); - _parent = parent; - _dups = dups; - _type = type; - _lineNr = lineNr; - _columnNr = colNr; - _index = -1; - } - - protected void reset(int type, int lineNr, int colNr) { - _type = type; - _currentValue = null; - _lineNr = lineNr; - _columnNr = colNr; - _index = -1; - _currentName = null; - if (_dups != null) { - _dups.reset(); - } - } - - @Override - public Object currentValue() { - return _currentValue; - } - - @Override - public void assignCurrentValue(Object v) { - _currentValue = v; - } - - /* - /********************************************************************** - /* Factory methods - /********************************************************************** - */ - - public static SimpleStreamReadContext createRootContext(int lineNr, int colNr, DupDetector dups) { - return new SimpleStreamReadContext(TYPE_ROOT, null, dups, lineNr, colNr); - } - - public static SimpleStreamReadContext createRootContext(DupDetector dups) { - return createRootContext(1, 0, dups); - } - - public SimpleStreamReadContext createChildArrayContext(int lineNr, int colNr) { - SimpleStreamReadContext ctxt = _childToRecycle; - if (ctxt == null) { - _childToRecycle = ctxt = new SimpleStreamReadContext(TYPE_ARRAY, this, - (_dups == null) ? null : _dups.child(), lineNr, colNr); - } else { - ctxt.reset(TYPE_ARRAY, lineNr, colNr); - } - return ctxt; - } - - public SimpleStreamReadContext createChildObjectContext(int lineNr, int colNr) { - SimpleStreamReadContext ctxt = _childToRecycle; - if (ctxt == null) { - _childToRecycle = ctxt = new SimpleStreamReadContext(TYPE_OBJECT, this, - (_dups == null) ? null : _dups.child(), lineNr, colNr); - return ctxt; - } - ctxt.reset(TYPE_OBJECT, lineNr, colNr); - return ctxt; - } - - /* - /********************************************************************** - /* Abstract method implementations, overrides - /********************************************************************** - */ - - /** - * @since 3.0 - */ - @Override public String currentName() { return _currentName; } - - @Override public boolean hasCurrentName() { return _currentName != null; } - - @Override public SimpleStreamReadContext getParent() { return _parent; } - - @Override - public JsonLocation startLocation(ContentReference srcRef) { - // We don't keep track of offsets at this level (only reader does) - long totalChars = -1L; - return new JsonLocation(srcRef, - totalChars, _lineNr, _columnNr); - } - - /* - /********************************************************************** - /* Extended API - /********************************************************************** - */ - - /** - * Method that can be used to both clear the accumulated references - * (specifically value set with {@link #assignCurrentValue(Object)}) - * that should not be retained, and returns parent (as would - * {@link #getParent()} do). Typically called when closing the active - * context when encountering {@link JsonToken#END_ARRAY} or - * {@link JsonToken#END_OBJECT}. - * - * @return Parent context of this context node, if any; {@code null} for root context - */ - public SimpleStreamReadContext clearAndGetParent() { - _currentValue = null; - // could also clear the current name, but seems cheap enough to leave? - return _parent; - } - - public DupDetector getDupDetector() { - return _dups; - } - - /* - /********************************************************************** - /* State changes - /********************************************************************** - */ - - /** - * Method to call to advance index within current context: to be called - * when a new token found within current context (property name for objects, - * value for root and array contexts) - * - * @return Index after increment - */ - public int valueRead() { - return ++_index; // starts from -1 - } - - /** - * Method called to indicate what the "current" name (Object property name - * just decoded) is: may also trigger duplicate detection. - * - * @param name Name of Object property encountered - * - * @throws StreamReadException If there is a duplicate name violation - */ - public void setCurrentName(String name) - throws StreamReadException - { - _currentName = name; - if (_dups != null) { _checkDup(_dups, name); } - } - - protected void _checkDup(DupDetector dd, String name) - throws StreamReadException - { - if (dd.isDup(name)) { - Object src = dd.getSource(); - throw new StreamReadException(((src instanceof JsonParser) ? ((JsonParser) src) : null), - "Duplicate Object property \""+name+"\""); - } - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/util/SimpleStreamWriteContext.java b/src/main/java/com/fasterxml/jackson/core/util/SimpleStreamWriteContext.java deleted file mode 100644 index af3f14b095..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/util/SimpleStreamWriteContext.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.fasterxml.jackson.core.util; - -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamWriteException; -import com.fasterxml.jackson.core.json.DupDetector; - -/** - * Basic implementation of {@link TokenStreamContext} useful for most - * format backend {@link JsonGenerator} implementations - * (with notable exception of JSON that needs bit more advanced state). - * - * @since 3.0 - */ -public final class SimpleStreamWriteContext extends TokenStreamContext -{ - /** - * Parent context for this context; null for root context. - */ - protected final SimpleStreamWriteContext _parent; - - // // // Optional duplicate detection - - protected DupDetector _dups; - - /* - /********************************************************************** - /* Simple instance reuse slots; speed up things a bit (10-15%) - /* for docs with lots of small arrays/objects - /********************************************************************** - */ - - protected SimpleStreamWriteContext _childToRecycle; - - /* - /********************************************************************** - /* Location/state information (minus source reference) - /********************************************************************** - */ - - /** - * Name of the property of which value is to be written; only - * used for OBJECT contexts. - */ - protected String _currentName; - - protected Object _currentValue; - - /** - * Marker used to indicate that we just wrote a property name (or possibly - * property id for some backends) and now expect a value to write. - */ - protected boolean _gotPropertyId; - - /* - /********************************************************************** - /* Life-cycle - /********************************************************************** - */ - - protected SimpleStreamWriteContext(int type, SimpleStreamWriteContext parent, - DupDetector dups, Object currentValue) { - super(); - _type = type; - _parent = parent; - _dups = dups; - _index = -1; - _currentValue = currentValue; - } - - private SimpleStreamWriteContext reset(int type, Object currentValue) { - _type = type; - _index = -1; - _currentName = null; - _gotPropertyId = false; - _currentValue = currentValue; - if (_dups != null) { _dups.reset(); } - return this; - } - - public SimpleStreamWriteContext withDupDetector(DupDetector dups) { - _dups = dups; - return this; - } - - @Override - public Object currentValue() { - return _currentValue; - } - - @Override - public void assignCurrentValue(Object v) { - _currentValue = v; - } - - /* - /********************************************************************** - /* Factory methods - /********************************************************************** - */ - - public static SimpleStreamWriteContext createRootContext(DupDetector dd) { - return new SimpleStreamWriteContext(TYPE_ROOT, null, dd, null); - } - - public SimpleStreamWriteContext createChildArrayContext(Object currentValue) { - SimpleStreamWriteContext ctxt = _childToRecycle; - if (ctxt == null) { - _childToRecycle = ctxt = new SimpleStreamWriteContext(TYPE_ARRAY, this, - (_dups == null) ? null : _dups.child(), currentValue); - return ctxt; - } - return ctxt.reset(TYPE_ARRAY, currentValue); - } - - public SimpleStreamWriteContext createChildObjectContext(Object currentValue) { - SimpleStreamWriteContext ctxt = _childToRecycle; - if (ctxt == null) { - _childToRecycle = ctxt = new SimpleStreamWriteContext(TYPE_OBJECT, this, - (_dups == null) ? null : _dups.child(), currentValue); - return ctxt; - } - return ctxt.reset(TYPE_OBJECT, currentValue); - } - - /* - /********************************************************************** - /* Accessors - /********************************************************************** - */ - - @Override public final SimpleStreamWriteContext getParent() { return _parent; } - @Override public final String currentName() { - // 15-Aug-2019, tatu: Should NOT check this status because otherwise name - // in parent context is not accessible after new structured scope started -// if (_gotPropertyId) { ... } - return _currentName; - } - - @Override public boolean hasCurrentName() { return _gotPropertyId; } - - /** - * Method that can be used to both clear the accumulated references - * (specifically value set with {@link #assignCurrentValue(Object)}) - * that should not be retained, and returns parent (as would - * {@link #getParent()} do). Typically called when closing the active - * context when encountering {@link JsonToken#END_ARRAY} or - * {@link JsonToken#END_OBJECT}. - * - * @return Parent context of this context node, if any; {@code null} for root context - */ - public SimpleStreamWriteContext clearAndGetParent() { - _currentValue = null; - // could also clear the current name, but seems cheap enough to leave? - return _parent; - } - - public DupDetector getDupDetector() { - return _dups; - } - - /* - /********************************************************************** - /* State changing - /********************************************************************** - */ - - /** - * Method that writer is to call before it writes an Object Property name. - * - * @param name Name of Object property name being written - * - * @return {@code True} if name writing should proceed; {@code false} if not - * - * @throws StreamWriteException If write fails due to duplicate check - */ - public boolean writeName(String name) throws StreamWriteException { - if ((_type != TYPE_OBJECT) || _gotPropertyId) { - return false; - } - _gotPropertyId = true; - _currentName = name; - if (_dups != null) { _checkDup(_dups, name); } - return true; - } - - private final void _checkDup(DupDetector dd, String name) throws StreamWriteException { - if (dd.isDup(name)) { - Object src = dd.getSource(); - throw new StreamWriteException(((src instanceof JsonGenerator) ? ((JsonGenerator) src) : null), - "Duplicate Object property \""+name+"\""); - } - } - - public boolean writeValue() { - // Only limitation is with OBJECTs: - if (_type == TYPE_OBJECT) { - if (!_gotPropertyId) { - return false; - } - _gotPropertyId = false; - } - ++_index; - return true; - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/util/Snapshottable.java b/src/main/java/com/fasterxml/jackson/core/util/Snapshottable.java deleted file mode 100644 index f832abafa4..0000000000 --- a/src/main/java/com/fasterxml/jackson/core/util/Snapshottable.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fasterxml.jackson.core.util; - -/** - * Interface that defines one method (see {@link #snapshot}) for ensuring that we get - * an instance that does not allow modifying state of `this` instance. Instance returned - * may be `this` if (and only if) it is immutable through its API (or, for some limited - * circumstances, if usage is guaranteed not to modify it after this point -- such usage - * is discouraged however); or, if that can not be guaranteed, a newly created copy - * with same configuration and state as `this`. - *

    - * Interface is intended to be used for persisting state for serialization, or to support - * "re-build" of otherwise immutable objects like factories. Some of the helper objects - * factories use and rely on have mutable state which can not be shared: instead, to support - * re-building, a state object may be created to contain copies (snapshots). - * Intent, therefore, is that caller does not need to know about immutability (or lack thereof) - * of an entity but can simply call {@link #snapshot}. - * - * @since 3.0 - */ -public interface Snapshottable { - /** - * Method to call to get an instance that may not be modified through any other object, - * including `this`. That instance may be `this` if (and only if) this instance is effectively - * immutable (unmodifiable) through its API: if this is not the case, a new copy with same - * configuration must be created and returned. - * - * @return Snapshot instance - */ - public T snapshot(); - - public static T takeSnapshot(Snapshottable src) { - if (src == null) { - return null; - } - return src.snapshot(); - } -} diff --git a/src/main/java/com/fasterxml/jackson/core/util/TextBuffer.java b/src/main/java/com/fasterxml/jackson/core/util/TextBuffer.java index 56c6397727..e63ecee6b3 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/TextBuffer.java +++ b/src/main/java/com/fasterxml/jackson/core/util/TextBuffer.java @@ -26,43 +26,44 @@ */ public final class TextBuffer { - private final static char[] NO_CHARS = new char[0]; + final static char[] NO_CHARS = new char[0]; - /* + /** * Let's start with sizable but not huge buffer, will grow as necessary *

    * Reduced from 1000 down to 500 in 2.10. */ - private final static int MIN_SEGMENT_LEN = 500; + final static int MIN_SEGMENT_LEN = 500; - // Non-private to access from a test - /* + /** * Let's limit maximum segment length to something sensible. * For 2.10, let's limit to using 64kc chunks (128 kB) -- was 256kC/512kB up to 2.9 */ final static int MAX_SEGMENT_LEN = 0x10000; - + /* - /********************************************************************** - /* Configuration - /********************************************************************** + /********************************************************** + /* Configuration: + /********************************************************** */ private final BufferRecycler _allocator; /* - /********************************************************************** + /********************************************************** /* Shared input buffers - /********************************************************************** + /********************************************************** */ - /* Shared input buffer; stored here in case some input can be returned + /** + * Shared input buffer; stored here in case some input can be returned * as is, without being copied to collector's own buffers. Note that * this is read-only for this Object. */ private char[] _inputBuffer; - /* Character offset of first char in input buffer; -1 to indicate + /** + * Character offset of first char in input buffer; -1 to indicate * that input buffer currently does not contain any useful char data */ private int _inputStart; @@ -70,9 +71,9 @@ public final class TextBuffer private int _inputLen; /* - /********************************************************************** + /********************************************************** /* Aggregation segments (when not using input buf) - /********************************************************************** + /********************************************************** */ /** @@ -100,9 +101,9 @@ public final class TextBuffer private int _currentSize; /* - /********************************************************************** + /********************************************************** /* Caching of results - /********************************************************************** + /********************************************************** */ /** @@ -114,15 +115,16 @@ public final class TextBuffer private char[] _resultArray; /* - /********************************************************************** + /********************************************************** /* Life-cycle - /********************************************************************** + /********************************************************** */ public TextBuffer(BufferRecycler allocator) { _allocator = allocator; } + // @since 2.10 protected TextBuffer(BufferRecycler allocator, char[] initialSegment) { _allocator = allocator; _currentSegment = initialSegment; @@ -138,6 +140,8 @@ protected TextBuffer(BufferRecycler allocator, char[] initialSegment) { * {@link #size()} would return length of {@code initialSegment}) * * @return TextBuffer constructed + * + * @since 2.10 */ public static TextBuffer fromInitial(char[] initialSegment) { return new TextBuffer(null, initialSegment); @@ -207,6 +211,8 @@ public void resetWithEmpty() * a single-character content (so {@link #size()} would return {@code 1}) * * @param ch Character to set as the buffer contents + * + * @since 2.9 */ public void resetWith(char ch) { @@ -271,6 +277,7 @@ public void resetWithCopy(char[] buf, int offset, int len) append(buf, offset, len); } + // @since 2.9 public void resetWithCopy(String text, int start, int len) { _inputBuffer = null; @@ -333,17 +340,18 @@ private void clearSegments() /* Let's start using _last_ segment from list; for one, it's * the biggest one, and it's also most likely to be cached */ - // 28-Aug-2009, tatu: Actually, the current segment should - // be the biggest one, already + /* 28-Aug-2009, tatu: Actually, the current segment should + * be the biggest one, already + */ //_currentSegment = _segments.get(_segments.size() - 1); _segments.clear(); _currentSize = _segmentSize = 0; } /* - /********************************************************************** + /********************************************************** /* Accessors for implementing public interface - /********************************************************************** + /********************************************************** */ /** @@ -411,9 +419,9 @@ public char[] getTextBuffer() } /* - /********************************************************************** - /* Other accessors - /********************************************************************** + /********************************************************** + /* Other accessors: + /********************************************************** */ /** @@ -573,6 +581,8 @@ public long contentsAsLong(boolean neg) { * @return Number of characters written (same as {@link #size()}) * * @throws IOException If write using {@link Writer} parameter fails + * + * @since 2.8 */ public int contentsToWriter(Writer w) throws IOException { @@ -611,9 +621,9 @@ public int contentsToWriter(Writer w) throws IOException } /* - /********************************************************************** - /* Public mutators - /********************************************************************** + /********************************************************** + /* Public mutators: + /********************************************************** */ /** @@ -714,9 +724,9 @@ public void append(String str, int offset, int len) } /* - /********************************************************************** - /* Raw access, for high-performance use - /********************************************************************** + /********************************************************** + /* Raw access, for high-performance use: + /********************************************************** */ public char[] getCurrentSegment() @@ -773,6 +783,8 @@ public char[] emptyAndGetCurrentSegment() * @param len Length of content (in characters) of the current active segment * * @return String that contains all buffered content + * + * @since 2.6 */ public String setCurrentAndReturn(int len) { _currentSize = len; @@ -789,7 +801,7 @@ public String setCurrentAndReturn(int len) { public char[] finishCurrentSegment() { if (_segments == null) { - _segments = new ArrayList<>(4); + _segments = new ArrayList(); } _hasSegments = true; _segments.add(_currentSegment); @@ -838,6 +850,8 @@ public char[] expandCurrentSegment() * @param minSize Required minimum strength of the current segment * * @return Expanded current segment + * + * @since 2.4 */ public char[] expandCurrentSegment(int minSize) { char[] curr = _currentSegment; @@ -847,9 +861,9 @@ public char[] expandCurrentSegment(int minSize) { } /* - /********************************************************************** - /* Standard method overrides - /********************************************************************** + /********************************************************** + /* Standard methods: + /********************************************************** */ /** @@ -860,9 +874,9 @@ public char[] expandCurrentSegment(int minSize) { @Override public String toString() { return contentsAsString(); } /* - /********************************************************************** + /********************************************************** /* Internal methods: - /********************************************************************** + /********************************************************** */ /** @@ -895,7 +909,7 @@ private void expand(int minNewSegmentSize) { // First, let's move current segment to segment list: if (_segments == null) { - _segments = new ArrayList<>(4); + _segments = new ArrayList(); } char[] curr = _currentSegment; _hasSegments = true; diff --git a/src/main/java/com/fasterxml/jackson/core/util/VersionUtil.java b/src/main/java/com/fasterxml/jackson/core/util/VersionUtil.java index 6c0154bb4d..d09abb3b47 100644 --- a/src/main/java/com/fasterxml/jackson/core/util/VersionUtil.java +++ b/src/main/java/com/fasterxml/jackson/core/util/VersionUtil.java @@ -1,5 +1,7 @@ package com.fasterxml.jackson.core.util; +import java.io.*; +import java.util.Properties; import java.util.regex.Pattern; import com.fasterxml.jackson.core.Version; @@ -12,6 +14,14 @@ * Note that this class can be used in two roles: first, as a static * utility class for loading purposes, and second, as a singleton * loader of per-module version information. + *

    + * Note that method for accessing version information changed between versions + * 2.1 and 2.2; earlier code used file named "VERSION.txt"; but this has serious + * performance issues on some platforms (Android), so a replacement system + * was implemented to use class generation and dynamic class loading. + *

    + * Note that functionality for reading "VERSION.txt" was removed completely + * from Jackson 2.6. */ public class VersionUtil { @@ -25,12 +35,15 @@ public class VersionUtil protected VersionUtil() { } + @Deprecated // since 2.9 + public Version version() { return Version.unknownVersion(); } + /* /********************************************************************** /* Static load methods /********************************************************************** */ - + /** * Loads version information by introspecting a class named * "PackageVersion" in the same package as the given class. @@ -62,6 +75,58 @@ public static Version versionFor(Class cls) return (v == null) ? Version.unknownVersion() : v; } + /** + * Alias of {@link #versionFor(Class)}. + * + * @param cls Class for which to look version information + * + * @return Version information discovered if any; + * {@link Version#unknownVersion()} if none + * + * @deprecated Since 2.12 simply use {@link #versionFor(Class)} instead + */ + @Deprecated + public static Version packageVersionFor(Class cls) { + return versionFor(cls); + } + + /** + * Will attempt to load the maven version for the given groupId and + * artifactId. Maven puts a pom.properties file in + * META-INF/maven/groupId/artifactId, containing the groupId, + * artifactId and version of the library. + * + * @param cl the ClassLoader to load the pom.properties file from + * @param groupId the groupId of the library + * @param artifactId the artifactId of the library + * @return The version + * + * @deprecated Since 2.6: functionality not used by any official Jackson component, should be + * moved out if anyone needs it + */ + @SuppressWarnings("resource") + @Deprecated // since 2.6 + public static Version mavenVersionFor(ClassLoader cl, String groupId, String artifactId) + { + InputStream pomProperties = cl.getResourceAsStream("META-INF/maven/" + + groupId.replaceAll("\\.", "/")+ "/" + artifactId + "/pom.properties"); + if (pomProperties != null) { + try { + Properties props = new Properties(); + props.load(pomProperties); + String versionStr = props.getProperty("version"); + String pomPropertiesArtifactId = props.getProperty("artifactId"); + String pomPropertiesGroupId = props.getProperty("groupId"); + return parseVersion(versionStr, pomPropertiesGroupId, pomPropertiesArtifactId); + } catch (IOException e) { + // Ignore + } finally { + _close(pomProperties); + } + } + return Version.unknownVersion(); + } + /** * Method used by PackageVersion classes to decode version injected by Maven build. * @@ -95,6 +160,12 @@ protected static int parseVersionPart(String s) { return number; } + private final static void _close(Closeable c) { + try { + c.close(); + } catch (IOException e) { } + } + /* /********************************************************************** /* Orphan utility methods diff --git a/src/main/resources/META-INF/NOTICE b/src/main/resources/META-INF/NOTICE index 1fb62eabd3..d226e890da 100644 --- a/src/main/resources/META-INF/NOTICE +++ b/src/main/resources/META-INF/NOTICE @@ -7,11 +7,11 @@ It is currently developed by a community of developers. ## Licensing -Jackson 3.x core and extension components are licensed under Apache License 2.0 +Jackson 2.x core and extension components are licensed under Apache License 2.0 To find the details that apply to this artifact see the accompanying LICENSE file. ## Credits -A list of contributors may be found from CREDITS file, which is included +A list of contributors may be found from CREDITS(-2.x) file, which is included in some artifacts (usually source distributions); but is always available from the source code management (SCM) system project uses. diff --git a/src/main/resources/META-INF/services/com.fasterxml.jackson.core.JsonFactory b/src/main/resources/META-INF/services/com.fasterxml.jackson.core.JsonFactory new file mode 100644 index 0000000000..239a78a0a8 --- /dev/null +++ b/src/main/resources/META-INF/services/com.fasterxml.jackson.core.JsonFactory @@ -0,0 +1 @@ +com.fasterxml.jackson.core.JsonFactory diff --git a/src/main/resources/META-INF/services/com.fasterxml.jackson.core.TokenStreamFactory b/src/main/resources/META-INF/services/com.fasterxml.jackson.core.TokenStreamFactory deleted file mode 100644 index 32105da159..0000000000 --- a/src/main/resources/META-INF/services/com.fasterxml.jackson.core.TokenStreamFactory +++ /dev/null @@ -1 +0,0 @@ -com.fasterxml.jackson.core.json.JsonFactory diff --git a/src/moditect/module-info.java b/src/moditect/module-info.java index d6aeca8b31..8d928d192b 100644 --- a/src/moditect/module-info.java +++ b/src/moditect/module-info.java @@ -1,18 +1,23 @@ -// Generated 14-Mar-2019 using Moditect maven plugin +// Generated 08-Mar-2019 using Moditect maven plugin module com.fasterxml.jackson.core { + // 08-Mar-2019, tatu: Ugh. Can not use wildcards, stupid ass JDK 9+ module system... + // So, for 2.x core need to make sure we manually include everything. + // Worse, there is only syntactic validation, not contents, so we can both miss + // AND add bogus packages. + // However: at least syntax is verified; and this works with JKD8 exports com.fasterxml.jackson.core; exports com.fasterxml.jackson.core.async; exports com.fasterxml.jackson.core.base; exports com.fasterxml.jackson.core.exc; exports com.fasterxml.jackson.core.filter; + exports com.fasterxml.jackson.core.format; exports com.fasterxml.jackson.core.io; exports com.fasterxml.jackson.core.json; exports com.fasterxml.jackson.core.json.async; exports com.fasterxml.jackson.core.sym; - exports com.fasterxml.jackson.core.tree; exports com.fasterxml.jackson.core.type; exports com.fasterxml.jackson.core.util; - provides com.fasterxml.jackson.core.TokenStreamFactory with - com.fasterxml.jackson.core.json.JsonFactory; + // 03-Oct-2019, tatu: [core#567] Add self-use to avoid warnings + uses com.fasterxml.jackson.core.ObjectCodec; } diff --git a/src/test/java/com/fasterxml/jackson/core/Base64VariantTest.java b/src/test/java/com/fasterxml/jackson/core/Base64VariantTest.java deleted file mode 100644 index cd5ae2fb74..0000000000 --- a/src/test/java/com/fasterxml/jackson/core/Base64VariantTest.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.fasterxml.jackson.core; - -import com.fasterxml.jackson.core.util.BufferRecycler; -import com.fasterxml.jackson.core.util.ByteArrayBuilder; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; - -/** - * Unit tests for class {@link Base64Variant}. - * - * @date 2017-09-18 - * @see Base64Variant - **/ -@SuppressWarnings("resource") -public class Base64VariantTest extends BaseTest { - @Test - public void testDecodeTaking2ArgumentsThrowsIllegalArgumentException() { - Base64Variant base64Variant = new Base64Variant("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - false, - 'x', - 'x'); - - assertEquals(120, base64Variant.getMaxLineLength()); - assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", base64Variant.toString()); - assertFalse(base64Variant.usesPadding()); - assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", base64Variant.getName()); - assertEquals((byte) 120, base64Variant.getPaddingByte()); - assertEquals('x', base64Variant.getPaddingChar()); - - ByteArrayBuilder byteArrayBuilder = new ByteArrayBuilder(); - - try { - base64Variant.decode("-%8en$9m=>$m", byteArrayBuilder); - fail("Expecting exception: IllegalArgumentException"); - } catch (IllegalArgumentException e) { - assertEquals(Base64Variant.class.getName(), e.getStackTrace()[0].getClassName()); - } - } - - @Test - public void test_reportInvalidBase64ThrowsIllegalArgumentException() { - Base64Variant base64Variant = new Base64Variant("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - false, - 'L', - 3); - - assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", base64Variant.getName()); - assertFalse(base64Variant.usesPadding()); - assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", base64Variant.toString()); - assertEquals((byte) 76, base64Variant.getPaddingByte()); - assertEquals(3, base64Variant.getMaxLineLength()); - assertEquals('L', base64Variant.getPaddingChar()); - - try { - base64Variant._reportInvalidBase64('L', 2274, "r68;3&@B"); - fail("Expecting exception: IllegalArgumentException"); - } catch (IllegalArgumentException e) { - assertEquals(Base64Variant.class.getName(), e.getStackTrace()[0].getClassName()); - } - } - - @Test - public void testEquals() { - Base64Variant base64Variant = new Base64Variant("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - true, - ':', - ':'); - - Object bogus = new BufferRecycler(); - assertFalse(base64Variant.equals(bogus)); - assertTrue(base64Variant.equals(base64Variant)); - - } - - @Test - public void testDecodeTaking2ArgumentsOne() { - Base64Variant base64Variant = new Base64Variant("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - false, - 'R', - 4); - BufferRecycler bufferRecycler = new BufferRecycler(); - ByteArrayBuilder byteArrayBuilder = new ByteArrayBuilder(bufferRecycler); - - base64Variant.decode("PEM", byteArrayBuilder); - - assertFalse(base64Variant.usesPadding()); - assertEquals('R', base64Variant.getPaddingChar()); - assertEquals(4, base64Variant.getMaxLineLength()); - assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", base64Variant.toString()); - assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", base64Variant.getName()); - assertEquals((byte) 82, base64Variant.getPaddingByte()); - } - - @Test - public void testEncodeTaking2ArgumentsWithTrue() { - Base64Variant base64Variant = new Base64Variant("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - false, - 'L', - 3); - byte[] byteArray = new byte[9]; - String encoded = base64Variant.encode(byteArray, true); - - assertArrayEquals(new byte[]{(byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0}, byteArray); - assertEquals("\"AAAA\\nAAAA\\nAAAA\\n\"", encoded); - } -} \ No newline at end of file diff --git a/src/test/java/com/fasterxml/jackson/core/BaseTest.java b/src/test/java/com/fasterxml/jackson/core/BaseTest.java index 37324181cd..0a94de643e 100644 --- a/src/test/java/com/fasterxml/jackson/core/BaseTest.java +++ b/src/test/java/com/fasterxml/jackson/core/BaseTest.java @@ -1,14 +1,10 @@ package com.fasterxml.jackson.core; import java.io.*; -import java.nio.charset.StandardCharsets; -import java.util.*; +import java.util.Arrays; -import com.fasterxml.jackson.core.json.JsonFactory; -import com.fasterxml.jackson.core.json.JsonFactoryBuilder; import com.fasterxml.jackson.core.testsupport.MockDataInput; import com.fasterxml.jackson.core.testsupport.ThrottledInputStream; -import com.fasterxml.jackson.core.util.Named; import junit.framework.TestCase; @@ -46,11 +42,11 @@ public abstract class BaseTest MODE_INPUT_STREAM_THROTTLED, MODE_READER }; - + /* - /********************************************************************** - /* Some sample documents - /********************************************************************** + /********************************************************** + /* Some sample documents: + /********************************************************** */ protected final static int SAMPLE_SPEC_VALUE_WIDTH = 800; @@ -81,11 +77,11 @@ public abstract class BaseTest ; /* - /********************************************************************** + /********************************************************** /* Helper classes (beans) - /********************************************************************** + /********************************************************** */ - + /** * Sample class from Jackson tutorial ("JacksonInFiveMinutes") */ @@ -166,18 +162,20 @@ public boolean equals(Object o) protected final JsonFactory JSON_FACTORY = new JsonFactory(); /* - /********************************************************************** + /********************************************************** /* High-level helpers - /********************************************************************** + /********************************************************** */ protected void verifyJsonSpecSampleDoc(JsonParser p, boolean verifyContents) + throws IOException { verifyJsonSpecSampleDoc(p, verifyContents, true); } protected void verifyJsonSpecSampleDoc(JsonParser p, boolean verifyContents, boolean requireNumbers) + throws IOException { if (!p.hasCurrentToken()) { p.nextToken(); @@ -188,14 +186,14 @@ protected void verifyJsonSpecSampleDoc(JsonParser p, boolean verifyContents, assertToken(JsonToken.START_OBJECT, p.currentToken()); // main object - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // 'Image' + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // 'Image' if (verifyContents) { verifyFieldName(p, "Image"); } assertToken(JsonToken.START_OBJECT, p.nextToken()); // 'image' object - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // 'Width' + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // 'Width' if (verifyContents) { verifyFieldName(p, "Width"); } @@ -205,7 +203,7 @@ protected void verifyJsonSpecSampleDoc(JsonParser p, boolean verifyContents, verifyIntValue(p, SAMPLE_SPEC_VALUE_WIDTH); } - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // 'Height' + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // 'Height' if (verifyContents) { verifyFieldName(p, "Height"); } @@ -214,19 +212,19 @@ protected void verifyJsonSpecSampleDoc(JsonParser p, boolean verifyContents, if (verifyContents) { verifyIntValue(p, SAMPLE_SPEC_VALUE_HEIGHT); } - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // 'Title' + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // 'Title' if (verifyContents) { verifyFieldName(p, "Title"); } assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(SAMPLE_SPEC_VALUE_TITLE, getAndVerifyText(p)); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // 'Thumbnail' + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // 'Thumbnail' if (verifyContents) { verifyFieldName(p, "Thumbnail"); } assertToken(JsonToken.START_OBJECT, p.nextToken()); // 'thumbnail' object - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // 'Url' + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // 'Url' if (verifyContents) { verifyFieldName(p, "Url"); } @@ -234,7 +232,7 @@ protected void verifyJsonSpecSampleDoc(JsonParser p, boolean verifyContents, if (verifyContents) { assertEquals(SAMPLE_SPEC_VALUE_TN_URL, getAndVerifyText(p)); } - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // 'Height' + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // 'Height' if (verifyContents) { verifyFieldName(p, "Height"); } @@ -242,7 +240,7 @@ protected void verifyJsonSpecSampleDoc(JsonParser p, boolean verifyContents, if (verifyContents) { verifyIntValue(p, SAMPLE_SPEC_VALUE_TN_HEIGHT); } - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // 'Width' + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // 'Width' if (verifyContents) { verifyFieldName(p, "Width"); } @@ -253,7 +251,7 @@ protected void verifyJsonSpecSampleDoc(JsonParser p, boolean verifyContents, } assertToken(JsonToken.END_OBJECT, p.nextToken()); // 'thumbnail' object - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // 'IDs' + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // 'IDs' assertToken(JsonToken.START_ARRAY, p.nextToken()); // 'ids' array verifyIntToken(p.nextToken(), requireNumbers); // ids[0] if (verifyContents) { @@ -293,40 +291,42 @@ private void verifyIntToken(JsonToken t, boolean requireNumbers) } protected void verifyFieldName(JsonParser p, String expName) + throws IOException { assertEquals(expName, p.getText()); - assertEquals(expName, p.currentName()); + assertEquals(expName, p.getCurrentName()); } protected void verifyIntValue(JsonParser p, long expValue) + throws IOException { // First, via textual assertEquals(String.valueOf(expValue), p.getText()); } - + /* - /********************************************************************** + /********************************************************** /* Parser construction - /********************************************************************** + /********************************************************** */ - protected JsonParser createParser(int mode, String doc) { + protected JsonParser createParser(int mode, String doc) throws IOException { return createParser(JSON_FACTORY, mode, doc); } - protected JsonParser createParser(int mode, byte[] doc) { + protected JsonParser createParser(int mode, byte[] doc) throws IOException { return createParser(JSON_FACTORY, mode, doc); } - protected JsonParser createParser(JsonFactory f, int mode, String doc) + protected JsonParser createParser(JsonFactory f, int mode, String doc) throws IOException { switch (mode) { case MODE_INPUT_STREAM: return createParserUsingStream(f, doc, "UTF-8"); case MODE_INPUT_STREAM_THROTTLED: { - InputStream in = new ThrottledInputStream(doc.getBytes(StandardCharsets.UTF_8), 1); - return f.createParser(ObjectReadContext.empty(), in); + InputStream in = new ThrottledInputStream(doc.getBytes("UTF-8"), 1); + return f.createParser(in); } case MODE_READER: return createParserUsingReader(f, doc); @@ -337,19 +337,18 @@ protected JsonParser createParser(JsonFactory f, int mode, String doc) throw new RuntimeException("internal error"); } - protected JsonParser createParser(JsonFactory f, int mode, byte[] doc) + protected JsonParser createParser(JsonFactory f, int mode, byte[] doc) throws IOException { switch (mode) { case MODE_INPUT_STREAM: - return f.createParser(ObjectReadContext.empty(), new ByteArrayInputStream(doc)); + return f.createParser(new ByteArrayInputStream(doc)); case MODE_INPUT_STREAM_THROTTLED: { InputStream in = new ThrottledInputStream(doc, 1); - return f.createParser(ObjectReadContext.empty(), in); + return f.createParser(in); } case MODE_READER: - return f.createParser(ObjectReadContext.empty(), new StringReader( - new String(doc, StandardCharsets.UTF_8))); + return f.createParser(new StringReader(new String(doc, "UTF-8"))); case MODE_DATA_INPUT: return createParserForDataInput(f, new MockDataInput(doc)); default: @@ -357,23 +356,26 @@ protected JsonParser createParser(JsonFactory f, int mode, byte[] doc) throw new RuntimeException("internal error"); } - protected JsonParser createParserUsingReader(String input) + protected JsonParser createParserUsingReader(String input) throws IOException { return createParserUsingReader(new JsonFactory(), input); } protected JsonParser createParserUsingReader(JsonFactory f, String input) + throws IOException { - return f.createParser(ObjectReadContext.empty(), new StringReader(input)); + return f.createParser(new StringReader(input)); } protected JsonParser createParserUsingStream(String input, String encoding) + throws IOException { return createParserUsingStream(new JsonFactory(), input, encoding); } protected JsonParser createParserUsingStream(JsonFactory f, String input, String encoding) + throws IOException { /* 23-Apr-2008, tatus: UTF-32 is not supported by JDK, have to @@ -385,58 +387,55 @@ protected JsonParser createParserUsingStream(JsonFactory f, if (encoding.equalsIgnoreCase("UTF-32")) { data = encodeInUTF32BE(input); } else { - try { - data = input.getBytes(encoding); - } catch (IOException e) { - throw new RuntimeException(e); - } + data = input.getBytes(encoding); } InputStream is = new ByteArrayInputStream(data); - return f.createParser(ObjectReadContext.empty(), is); + return f.createParser(is); } protected JsonParser createParserForDataInput(JsonFactory f, DataInput input) + throws IOException { - return f.createParser(ObjectReadContext.empty(), input); + return f.createParser(input); } /* - /********************************************************************** + /********************************************************** /* Generator construction - /********************************************************************** + /********************************************************** */ - protected JsonGenerator createGenerator(OutputStream out) { + protected JsonGenerator createGenerator(OutputStream out) throws IOException { return createGenerator(JSON_FACTORY, out); } - protected JsonGenerator createGenerator(TokenStreamFactory f, OutputStream out) { - return f.createGenerator(ObjectWriteContext.empty(), out); + protected JsonGenerator createGenerator(TokenStreamFactory f, OutputStream out) throws IOException { + return f.createGenerator(out); } - protected JsonGenerator createGenerator(Writer w) { + protected JsonGenerator createGenerator(Writer w) throws IOException { return createGenerator(JSON_FACTORY, w); } - protected JsonGenerator createGenerator(TokenStreamFactory f, Writer w) { - return f.createGenerator(ObjectWriteContext.empty(), w); + protected JsonGenerator createGenerator(TokenStreamFactory f, Writer w) throws IOException { + return f.createGenerator(w); } /* - /********************************************************************** + /********************************************************** /* Helper read/write methods - /********************************************************************** + /********************************************************** */ - protected void writeJsonDoc(JsonFactory f, String doc, Writer w) + protected void writeJsonDoc(JsonFactory f, String doc, Writer w) throws IOException { - writeJsonDoc(f, doc, f.createGenerator(ObjectWriteContext.empty(), w)); + writeJsonDoc(f, doc, f.createGenerator(w)); } - protected void writeJsonDoc(JsonFactory f, String doc, JsonGenerator g) + protected void writeJsonDoc(JsonFactory f, String doc, JsonGenerator g) throws IOException { - JsonParser p = f.createParser(ObjectReadContext.empty(), aposToQuotes(doc)); + JsonParser p = f.createParser(aposToQuotes(doc)); while (p.nextToken() != null) { g.copyCurrentStructure(p); @@ -445,10 +444,28 @@ protected void writeJsonDoc(JsonFactory f, String doc, JsonGenerator g) g.close(); } + protected String readAndWrite(JsonFactory f, JsonParser p) throws IOException + { + StringWriter sw = new StringWriter(100); + JsonGenerator g = f.createGenerator(sw); + g.disable(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT); + try { + while (p.nextToken() != null) { + g.copyCurrentEvent(p); + } + } catch (IOException e) { + g.flush(); + fail("Unexpected problem during `readAndWrite`. Output so far: '"+sw+"'; problem: "+e); + } + p.close(); + g.close(); + return sw.toString(); + } + /* - /********************************************************************** + /********************************************************** /* Additional assertion methods - /********************************************************************** + /********************************************************** */ protected void assertToken(JsonToken expToken, JsonToken actToken) @@ -492,7 +509,7 @@ protected void verifyException(Throwable e, String... matches) * available methods, and ensures results are consistent, before * returning them */ - protected String getAndVerifyText(JsonParser p) + protected String getAndVerifyText(JsonParser p) throws IOException { // Ok, let's verify other accessors int actLen = p.getTextLength(); @@ -509,9 +526,9 @@ protected String getAndVerifyText(JsonParser p) } /* - /********************************************************************** + /********************************************************** /* And other helpers - /********************************************************************** + /********************************************************** */ protected static String quote(String str) { @@ -540,41 +557,15 @@ protected byte[] encodeInUTF32BE(String input) return result; } + // @since 2.9.7 protected static byte[] utf8Bytes(String str) { - return str.getBytes(StandardCharsets.UTF_8); - } - - protected static String utf8String(ByteArrayOutputStream bytes) { try { - return bytes.toString(StandardCharsets.UTF_8.name()); + return str.getBytes("UTF-8"); } catch (IOException e) { - throw new IllegalArgumentException(e); + throw new RuntimeException(e); } } - protected byte[] readResource(String ref) - { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - final byte[] buf = new byte[4000]; - - InputStream in = getClass().getResourceAsStream(ref); - if (in != null) { - try { - int len; - while ((len = in.read(buf)) > 0) { - bytes.write(buf, 0, len); - } - in.close(); - } catch (IOException e) { - throw new RuntimeException("Failed to read resource '"+ref+"': "+e); - } - } - if (bytes.size() == 0) { - throw new IllegalArgumentException("Failed to read resource '"+ref+"': empty resource?"); - } - return bytes.toByteArray(); - } - protected void fieldNameFor(StringBuilder sb, int index) { /* let's do something like "f1.1" to exercise different @@ -596,16 +587,19 @@ protected void fieldNameFor(StringBuilder sb, int index) } } + // @since 2.9.7 protected JsonFactory sharedStreamFactory() { return JSON_FACTORY; } + // @since 2.9.7 protected JsonFactory newStreamFactory() { return new JsonFactory(); } + // @since 2.9.8 protected JsonFactoryBuilder streamFactoryBuilder() { - return JsonFactory.builder(); + return (JsonFactoryBuilder) JsonFactory.builder(); } protected String fieldNameFor(int index) @@ -643,15 +637,26 @@ protected int[] calcQuads(byte[] wordBytes) { return result; } - public static List namedFromStrings(Collection input) { - ArrayList result = new ArrayList<>(input.size()); - for (String str : input) { - result.add(Named.fromString(str)); - } - return result; - } + protected byte[] readResource(String ref) + { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + final byte[] buf = new byte[4000]; - public static List namedFromStrings(String... input) { - return namedFromStrings(Arrays.asList(input)); + InputStream in = getClass().getResourceAsStream(ref); + if (in != null) { + try { + int len; + while ((len = in.read(buf)) > 0) { + bytes.write(buf, 0, len); + } + in.close(); + } catch (IOException e) { + throw new RuntimeException("Failed to read resource '"+ref+"': "+e); + } + } + if (bytes.size() == 0) { + throw new IllegalArgumentException("Failed to read resource '"+ref+"': empty resource?"); + } + return bytes.toByteArray(); } } diff --git a/src/test/java/com/fasterxml/jackson/core/JsonpCharacterEscapesTest.java b/src/test/java/com/fasterxml/jackson/core/JsonpCharacterEscapesTest.java index bd07859004..1e70fe41e5 100644 --- a/src/test/java/com/fasterxml/jackson/core/JsonpCharacterEscapesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/JsonpCharacterEscapesTest.java @@ -1,8 +1,6 @@ package com.fasterxml.jackson.core; import com.fasterxml.jackson.core.io.SerializedString; -import com.fasterxml.jackson.core.util.JsonpCharacterEscapes; - import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/com/fasterxml/jackson/core/PointerFromContextTest.java b/src/test/java/com/fasterxml/jackson/core/PointerFromContextTest.java index 33c078d86b..8e32cebd35 100644 --- a/src/test/java/com/fasterxml/jackson/core/PointerFromContextTest.java +++ b/src/test/java/com/fasterxml/jackson/core/PointerFromContextTest.java @@ -2,8 +2,6 @@ import java.io.StringWriter; -import com.fasterxml.jackson.core.json.JsonFactory; - public class PointerFromContextTest extends BaseTest { /* @@ -18,82 +16,82 @@ public void testViaParser() throws Exception { final String SIMPLE = aposToQuotes("{'a':123,'array':[1,2,[3],5,{'obInArray':4}]," +"'ob':{'first':[false,true],'second':{'sub':37}},'b':true}"); - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), SIMPLE); + JsonParser p = JSON_F.createParser(SIMPLE); // by default should just get "empty" - assertSame(JsonPointer.EMPTY, p.streamReadContext().pathAsPointer()); + assertSame(JsonPointer.EMPTY, p.getParsingContext().pathAsPointer()); // let's just traverse, then: assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertSame(JsonPointer.EMPTY, p.streamReadContext().pathAsPointer()); + assertSame(JsonPointer.EMPTY, p.getParsingContext().pathAsPointer()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // a - assertEquals("/a", p.streamReadContext().pathAsPointer().toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // a + assertEquals("/a", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals("/a", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/a", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // array - assertEquals("/array", p.streamReadContext().pathAsPointer().toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // array + assertEquals("/array", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertEquals("/array", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // 1 - assertEquals("/array/0", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array/0", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // 2 - assertEquals("/array/1", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array/1", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertEquals("/array/2", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array/2", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // 3 - assertEquals("/array/2/0", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array/2/0", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertEquals("/array/2", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array/2", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // 5 - assertEquals("/array/3", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array/3", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("/array/4", p.streamReadContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // obInArray - assertEquals("/array/4/obInArray", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array/4", p.getParsingContext().pathAsPointer().toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // obInArray + assertEquals("/array/4/obInArray", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // 4 - assertEquals("/array/4/obInArray", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array/4/obInArray", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertEquals("/array/4", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array/4", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.END_ARRAY, p.nextToken()); // /array - assertEquals("/array", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/array", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // ob - assertEquals("/ob", p.streamReadContext().pathAsPointer().toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // ob + assertEquals("/ob", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("/ob", p.streamReadContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // first - assertEquals("/ob/first", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/ob", p.getParsingContext().pathAsPointer().toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // first + assertEquals("/ob/first", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertEquals("/ob/first", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/ob/first", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); - assertEquals("/ob/first/0", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/ob/first/0", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertEquals("/ob/first/1", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/ob/first/1", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertEquals("/ob/first", p.streamReadContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // second - assertEquals("/ob/second", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/ob/first", p.getParsingContext().pathAsPointer().toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // second + assertEquals("/ob/second", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("/ob/second", p.streamReadContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // sub - assertEquals("/ob/second/sub", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/ob/second", p.getParsingContext().pathAsPointer().toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // sub + assertEquals("/ob/second/sub", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // 37 - assertEquals("/ob/second/sub", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/ob/second/sub", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertEquals("/ob/second", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/ob/second", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); // /ob - assertEquals("/ob", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/ob", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // b - assertEquals("/b", p.streamReadContext().pathAsPointer().toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // b + assertEquals("/b", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertEquals("/b", p.streamReadContext().pathAsPointer().toString()); + assertEquals("/b", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertSame(JsonPointer.EMPTY, p.streamReadContext().pathAsPointer()); + assertSame(JsonPointer.EMPTY, p.getParsingContext().pathAsPointer()); assertNull(p.nextToken()); p.close(); @@ -102,37 +100,37 @@ public void testViaParser() throws Exception public void testViaGenerator() throws Exception { StringWriter w = new StringWriter(); - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), w); - assertSame(JsonPointer.EMPTY, g.streamWriteContext().pathAsPointer()); + JsonGenerator g = JSON_F.createGenerator(w); + assertSame(JsonPointer.EMPTY, g.getOutputContext().pathAsPointer()); g.writeStartArray(); // no path yet - assertSame(JsonPointer.EMPTY, g.streamWriteContext().pathAsPointer()); + assertSame(JsonPointer.EMPTY, g.getOutputContext().pathAsPointer()); g.writeBoolean(true); - assertEquals("/0", g.streamWriteContext().pathAsPointer().toString()); + assertEquals("/0", g.getOutputContext().pathAsPointer().toString()); g.writeStartObject(); - assertEquals("/1", g.streamWriteContext().pathAsPointer().toString()); - g.writeName("x"); - assertEquals("/1/x", g.streamWriteContext().pathAsPointer().toString()); + assertEquals("/1", g.getOutputContext().pathAsPointer().toString()); + g.writeFieldName("x"); + assertEquals("/1/x", g.getOutputContext().pathAsPointer().toString()); g.writeString("foo"); - assertEquals("/1/x", g.streamWriteContext().pathAsPointer().toString()); - g.writeName("stats"); - assertEquals("/1/stats", g.streamWriteContext().pathAsPointer().toString()); + assertEquals("/1/x", g.getOutputContext().pathAsPointer().toString()); + g.writeFieldName("stats"); + assertEquals("/1/stats", g.getOutputContext().pathAsPointer().toString()); g.writeStartObject(); - assertEquals("/1/stats", g.streamWriteContext().pathAsPointer().toString()); - g.writeName("rate"); - assertEquals("/1/stats/rate", g.streamWriteContext().pathAsPointer().toString()); + assertEquals("/1/stats", g.getOutputContext().pathAsPointer().toString()); + g.writeFieldName("rate"); + assertEquals("/1/stats/rate", g.getOutputContext().pathAsPointer().toString()); g.writeNumber(13); - assertEquals("/1/stats/rate", g.streamWriteContext().pathAsPointer().toString()); + assertEquals("/1/stats/rate", g.getOutputContext().pathAsPointer().toString()); g.writeEndObject(); - assertEquals("/1/stats", g.streamWriteContext().pathAsPointer().toString()); + assertEquals("/1/stats", g.getOutputContext().pathAsPointer().toString()); g.writeEndObject(); - assertEquals("/1", g.streamWriteContext().pathAsPointer().toString()); + assertEquals("/1", g.getOutputContext().pathAsPointer().toString()); g.writeEndArray(); - assertSame(JsonPointer.EMPTY, g.streamWriteContext().pathAsPointer()); + assertSame(JsonPointer.EMPTY, g.getOutputContext().pathAsPointer()); g.close(); w.close(); } @@ -147,52 +145,52 @@ public void testParserWithRoot() throws Exception { final String JSON = aposToQuotes("{'a':1,'b':3}\n" +"{'a':5,'c':[1,2]}\n[1,2]\n"); - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), JSON); + JsonParser p = JSON_F.createParser(JSON); // before pointing to anything, we have no path to point to - assertSame(JsonPointer.EMPTY, p.streamReadContext().pathAsPointer(true)); + assertSame(JsonPointer.EMPTY, p.getParsingContext().pathAsPointer(true)); // but immediately after advancing we do assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("/0", p.streamReadContext().pathAsPointer(true).toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // a - assertEquals("/0/a", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/0", p.getParsingContext().pathAsPointer(true).toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // a + assertEquals("/0/a", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // a:1 - assertEquals("/0/a", p.streamReadContext().pathAsPointer(true).toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // b - assertEquals("/0/b", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/0/a", p.getParsingContext().pathAsPointer(true).toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // b + assertEquals("/0/b", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // a:1 - assertEquals("/0/b", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/0/b", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertEquals("/0", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/0", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("/1", p.streamReadContext().pathAsPointer(true).toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // a - assertEquals("/1/a", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/1", p.getParsingContext().pathAsPointer(true).toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // a + assertEquals("/1/a", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // a:1 - assertEquals("/1/a", p.streamReadContext().pathAsPointer(true).toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // c - assertEquals("/1/c", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/1/a", p.getParsingContext().pathAsPointer(true).toString()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // c + assertEquals("/1/c", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertEquals("/1/c", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/1/c", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals("/1/c/0", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/1/c/0", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals("/1/c/1", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/1/c/1", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertEquals("/1/c", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/1/c", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertEquals("/1", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/1", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertEquals("/2", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/2", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals("/2/0", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/2/0", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals("/2/1", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/2/1", p.getParsingContext().pathAsPointer(true).toString()); assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertEquals("/2", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/2", p.getParsingContext().pathAsPointer(true).toString()); assertNull(p.nextToken()); @@ -201,7 +199,7 @@ public void testParserWithRoot() throws Exception // and it's not 100% clear what is the best path forward. So, for now... // just verify current sub-optimal behavior - assertEquals("/2", p.streamReadContext().pathAsPointer(true).toString()); + assertEquals("/2", p.getParsingContext().pathAsPointer(true).toString()); p.close(); } @@ -209,39 +207,39 @@ public void testParserWithRoot() throws Exception public void testGeneratorWithRoot() throws Exception { StringWriter w = new StringWriter(); - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), w); - assertSame(JsonPointer.EMPTY, g.streamWriteContext().pathAsPointer(true)); + JsonGenerator g = JSON_F.createGenerator(w); + assertSame(JsonPointer.EMPTY, g.getOutputContext().pathAsPointer(true)); g.writeStartArray(); - assertEquals("/0", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/0", g.getOutputContext().pathAsPointer(true).toString()); g.writeBoolean(true); - assertEquals("/0/0", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/0/0", g.getOutputContext().pathAsPointer(true).toString()); g.writeStartObject(); - assertEquals("/0/1", g.streamWriteContext().pathAsPointer(true).toString()); - g.writeName("x"); - assertEquals("/0/1/x", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/0/1", g.getOutputContext().pathAsPointer(true).toString()); + g.writeFieldName("x"); + assertEquals("/0/1/x", g.getOutputContext().pathAsPointer(true).toString()); g.writeString("foo"); - assertEquals("/0/1/x", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/0/1/x", g.getOutputContext().pathAsPointer(true).toString()); g.writeEndObject(); - assertEquals("/0/1", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/0/1", g.getOutputContext().pathAsPointer(true).toString()); g.writeEndArray(); - assertEquals("/0", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/0", g.getOutputContext().pathAsPointer(true).toString()); g.writeBoolean(true); - assertEquals("/1", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/1", g.getOutputContext().pathAsPointer(true).toString()); g.writeStartArray(); - assertEquals("/2", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/2", g.getOutputContext().pathAsPointer(true).toString()); g.writeString("foo"); - assertEquals("/2/0", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/2/0", g.getOutputContext().pathAsPointer(true).toString()); g.writeString("bar"); - assertEquals("/2/1", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/2/1", g.getOutputContext().pathAsPointer(true).toString()); g.writeEndArray(); - assertEquals("/2", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/2", g.getOutputContext().pathAsPointer(true).toString()); // as earlier, not optimal result, but verify it's stable: - assertEquals("/2", g.streamWriteContext().pathAsPointer(true).toString()); + assertEquals("/2", g.getOutputContext().pathAsPointer(true).toString()); g.close(); } diff --git a/src/test/java/com/fasterxml/jackson/core/exc/TestExceptions.java b/src/test/java/com/fasterxml/jackson/core/TestExceptions.java similarity index 71% rename from src/test/java/com/fasterxml/jackson/core/exc/TestExceptions.java rename to src/test/java/com/fasterxml/jackson/core/TestExceptions.java index 50b5f877ef..5cd8d0a3bc 100644 --- a/src/test/java/com/fasterxml/jackson/core/exc/TestExceptions.java +++ b/src/test/java/com/fasterxml/jackson/core/TestExceptions.java @@ -1,45 +1,45 @@ -package com.fasterxml.jackson.core.exc; +package com.fasterxml.jackson.core; import java.io.StringWriter; -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; +import com.fasterxml.jackson.core.exc.StreamReadException; +import com.fasterxml.jackson.core.io.JsonEOFException; public class TestExceptions extends BaseTest { - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); // For [core#10] public void testOriginalMesssage() { - final JsonLocation loc = new JsonLocation(null, -1L, 1, 1); - StreamReadException exc = new StreamReadException(null, "Foobar", loc); + JsonProcessingException exc = new JsonParseException(null, "Foobar", JsonLocation.NA); String msg = exc.getMessage(); String orig = exc.getOriginalMessage(); assertEquals("Foobar", orig); assertTrue(msg.length() > orig.length()); // and another - StreamReadException exc2 = new StreamReadException((JsonParser) null, "Second", - loc, exc); + JsonProcessingException exc2 = new JsonProcessingException("Second", + JsonLocation.NA, exc); assertSame(exc, exc2.getCause()); exc2.clearLocation(); assertNull(exc2.getLocation()); // and yet with null - StreamReadException exc3 = new StreamReadException((JsonParser) null, null, exc); + JsonProcessingException exc3 = new JsonProcessingException(exc); assertNull(exc3.getOriginalMessage()); - assertEquals("N/A\n at [No location information]", exc3.getMessage()); - assertTrue(exc3.toString().startsWith(StreamReadException.class.getName()+": N/A")); + assertEquals("N/A", exc3.getMessage()); + + assertEquals("com.fasterxml.jackson.core.JsonProcessingException: N/A", exc3.toString()); } // [core#198] public void testAccessToParser() throws Exception { - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), "{}"); + JsonParser p = JSON_F.createParser("{}"); assertToken(JsonToken.START_OBJECT, p.nextToken()); - StreamReadException e = new StreamReadException(p, "Test!"); - assertSame(p, e.processor()); + JsonParseException e = new JsonParseException(p, "Test!"); + assertSame(p, e.getProcessor()); assertEquals("Test!", e.getOriginalMessage()); JsonLocation loc = e.getLocation(); assertNotNull(loc); @@ -52,10 +52,10 @@ public void testAccessToParser() throws Exception public void testAccessToGenerator() throws Exception { StringWriter w = new StringWriter(); - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), w); + JsonGenerator g = JSON_F.createGenerator(w); g.writeStartObject(); - StreamWriteException e = new StreamWriteException(g, "Test!"); - assertSame(g, e.processor()); + JsonGenerationException e = new JsonGenerationException("Test!", g); + assertSame(g, e.getProcessor()); assertEquals("Test!", e.getOriginalMessage()); g.close(); } @@ -77,20 +77,20 @@ private void _testEofExceptions(int mode) throws Exception try { p.nextToken(); fail("Should get exception"); - } catch (UnexpectedEndOfInputException e) { + } catch (JsonEOFException e) { verifyException(e, "close marker for Array"); } p.close(); p = createParser(mode, "{ \"foo\" : [ ] "); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.END_ARRAY, p.nextToken()); try { p.nextToken(); fail("Should get exception"); - } catch (UnexpectedEndOfInputException e) { + } catch (JsonEOFException e) { verifyException(e, "close marker for Object"); } p.close(); @@ -100,10 +100,10 @@ private void _testEofExceptions(int mode) throws Exception try { p.nextToken(); fail("Should get exception"); - } catch (UnexpectedEndOfInputException e) { + } catch (JsonEOFException e) { - verifyException(e, "in property name"); - assertEquals(JsonToken.PROPERTY_NAME, e.getTokenBeingDecoded()); + verifyException(e, "in field name"); + assertEquals(JsonToken.FIELD_NAME, e.getTokenBeingDecoded()); } p.close(); @@ -112,7 +112,7 @@ private void _testEofExceptions(int mode) throws Exception try { p.nextToken(); fail("Should get exception"); - } catch (UnexpectedEndOfInputException e) { + } catch (JsonEOFException e) { verifyException(e, "unexpected end-of-input"); verifyException(e, "Object entries"); } @@ -130,19 +130,19 @@ public void testContentSnippetWithOffset() throws Exception final int start = lfIndex+1; final int len = json.length() - start; - p = JSON_F.createParser(ObjectReadContext.empty(), jsonB, start, len); + p = JSON_F.createParser(jsonB, start, len); // for byte-based, will be after character that follows token: // (and alas cannot be easily fixed) _testContentSnippetWithOffset(p, 9, "(byte[])\"[broken]\n\""); p.close(); final char[] jsonC = json.toCharArray(); - p = JSON_F.createParser(ObjectReadContext.empty(), jsonC, start, len); + p = JSON_F.createParser(jsonC, start, len); // for char-based we get true offset at end of token _testContentSnippetWithOffset(p, 8, "(char[])\"[broken]\n\""); p.close(); - p = JSON_F.createParser(ObjectReadContext.empty(), json.substring(start)); + p = JSON_F.createParser(json.substring(start)); // for char-based we get true offset at end of token _testContentSnippetWithOffset(p, 8, "(String)\"[broken]\n\""); p.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/CoreJDKSerializabilityTest.java b/src/test/java/com/fasterxml/jackson/core/TestJDKSerializability.java similarity index 79% rename from src/test/java/com/fasterxml/jackson/core/CoreJDKSerializabilityTest.java rename to src/test/java/com/fasterxml/jackson/core/TestJDKSerializability.java index 0aca26fe5c..af3b88a4b9 100644 --- a/src/test/java/com/fasterxml/jackson/core/CoreJDKSerializabilityTest.java +++ b/src/test/java/com/fasterxml/jackson/core/TestJDKSerializability.java @@ -2,17 +2,13 @@ import java.io.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.exc.StreamWriteException; import com.fasterxml.jackson.core.io.ContentReference; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; /** - * Unit tests to verify that `JsonFactory` and abstractions it relies on - * may be JDK serialized/deserialized. + * Unit tests for [core#31] (https://github.com/FasterXML/jackson-core/issues/31) */ -public class CoreJDKSerializabilityTest extends BaseTest +public class TestJDKSerializability extends BaseTest { public void testJsonFactorySerializable() throws Exception { @@ -73,9 +69,9 @@ public void testPrettyPrinter() throws Exception public void testLocation() throws Exception { JsonFactory jf = new JsonFactory(); - JsonParser jp = jf.createParser(ObjectReadContext.empty(), " { }"); + JsonParser jp = jf.createParser(" { }"); assertToken(JsonToken.START_OBJECT, jp.nextToken()); - JsonLocation loc = jp.currentLocation(); + JsonLocation loc = jp.getCurrentLocation(); byte[] stuff = jdkSerialize(loc); JsonLocation loc2 = jdkDeserialize(stuff); @@ -99,43 +95,43 @@ public void testSourceReference() throws Exception public void testParseException() throws Exception { JsonFactory jf = new JsonFactory(); - JsonParser p = jf.createParser(ObjectReadContext.empty(), " { garbage! }"); - StreamReadException exc = null; + JsonParser p = jf.createParser(" { garbage! }"); + JsonParseException exc = null; try { p.nextToken(); p.nextToken(); fail("Should not get here"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { exc = e; } p.close(); byte[] stuff = jdkSerialize(exc); - StreamReadException result = jdkDeserialize(stuff); + JsonParseException result = jdkDeserialize(stuff); assertNotNull(result); } public void testGenerationException() throws Exception { JsonFactory jf = new JsonFactory(); - JsonGenerator g = jf.createGenerator(ObjectWriteContext.empty(), new ByteArrayOutputStream()); - StreamWriteException exc = null; + JsonGenerator g = jf.createGenerator(new ByteArrayOutputStream()); + JsonGenerationException exc = null; g.writeStartObject(); try { g.writeNumber(4); fail("Should not get here"); - } catch (StreamWriteException e) { + } catch (JsonGenerationException e) { exc = e; } g.close(); byte[] stuff = jdkSerialize(exc); - StreamWriteException result = jdkDeserialize(stuff); + JsonGenerationException result = jdkDeserialize(stuff); assertNotNull(result); } /* - /********************************************************************** + /********************************************************** /* Helper methods - /********************************************************************** + /********************************************************** */ protected byte[] jdkSerialize(Object o) throws IOException @@ -166,19 +162,19 @@ protected String _copyJson(JsonFactory f, String json, boolean useBytes) throws { if (useBytes) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator jg = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator jg = f.createGenerator(bytes); _copyJson(f, json, jg); return bytes.toString("UTF-8"); } StringWriter sw = new StringWriter(); - JsonGenerator jg = f.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator jg = f.createGenerator(sw); _copyJson(f, json, jg); return sw.toString(); } protected void _copyJson(JsonFactory f, String json, JsonGenerator g) throws IOException { - JsonParser p = f.createParser(ObjectReadContext.empty(), json); + JsonParser p = f.createParser(json); while (p.nextToken() != null) { g.copyCurrentEvent(p); } diff --git a/src/test/java/com/fasterxml/jackson/core/TestJsonPointer.java b/src/test/java/com/fasterxml/jackson/core/TestJsonPointer.java index af8bafeee1..54ddf82084 100644 --- a/src/test/java/com/fasterxml/jackson/core/TestJsonPointer.java +++ b/src/test/java/com/fasterxml/jackson/core/TestJsonPointer.java @@ -145,31 +145,6 @@ public void testAppendWithFinalSlash() assertEquals("extension", appended.last().getMatchingProperty()); } - public void testAppendProperty() - { - final String INPUT = "/Image/15/name"; - final String APPEND_WITH_SLASH = "/extension"; - final String APPEND_NO_SLASH = "extension"; - - JsonPointer ptr = JsonPointer.compile(INPUT); - JsonPointer appendedWithSlash = ptr.appendProperty(APPEND_WITH_SLASH); - JsonPointer appendedNoSlash = ptr.appendProperty(APPEND_NO_SLASH); - - assertEquals("extension", appendedWithSlash.last().getMatchingProperty()); - assertEquals("extension", appendedNoSlash.last().getMatchingProperty()); - } - - public void testAppendIndex() - { - final String INPUT = "/Image/15/name"; - final int INDEX = 12; - - JsonPointer ptr = JsonPointer.compile(INPUT); - JsonPointer appended = ptr.appendIndex(INDEX); - - assertEquals(12, appended.last().getMatchingIndex()); - } - public void testQuotedPath() throws Exception { final String INPUT = "/w~1out/til~0de/a~1b"; diff --git a/src/test/java/com/fasterxml/jackson/core/TestLocation.java b/src/test/java/com/fasterxml/jackson/core/TestLocation.java index 71c93bfcf4..b5cad2a719 100644 --- a/src/test/java/com/fasterxml/jackson/core/TestLocation.java +++ b/src/test/java/com/fasterxml/jackson/core/TestLocation.java @@ -3,9 +3,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; -import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.core.io.ContentReference; -import com.fasterxml.jackson.core.json.JsonFactory; public class TestLocation extends BaseTest { @@ -26,10 +24,10 @@ public void testBasics() assertTrue(loc2.hashCode() != 0); } - public void testBasicToString() + public void testBasicToString() throws Exception { // no location; presumed to be Binary due to defaulting - assertEquals("[Source: UNKNOWN; byte offset: #10]", + assertEquals("[Source: UNKNOWN; line: 3, column: 2]", new JsonLocation(null, 10L, 10L, 3, 2).toString()); // Short String @@ -42,7 +40,8 @@ public void testBasicToString() // Short byte[] assertEquals("[Source: (byte[])\"bytes-source\"; line: 1, column: 2]", - new JsonLocation(_sourceRef(utf8Bytes("bytes-source")), 10L, 10L, 1, 2).toString()); + new JsonLocation(_sourceRef("bytes-source".getBytes("UTF-8")), + 10L, 10L, 1, 2).toString()); // InputStream assertEquals("[Source: (ByteArrayInputStream); line: 1, column: 2]", @@ -59,7 +58,7 @@ public void testBasicToString() new JsonLocation(_rawSourceRef(true, srcRef), 10L, 10L, 1, 2).toString()); } - public void testTruncatedSource() + public void testTruncatedSource() throws Exception { StringBuilder sb = new StringBuilder(); for (int i = 0; i < ContentReference.DEFAULT_MAX_CONTENT_SNIPPET; ++i) { @@ -72,7 +71,7 @@ public void testTruncatedSource() assertEquals(String.format("(String)\"%s\"[truncated 3 chars]", main), desc); // and same with bytes - loc = new JsonLocation(_sourceRef(utf8Bytes(json)), 0L, 0L, 1, 1); + loc = new JsonLocation(_sourceRef(json.getBytes("UTF-8")), 0L, 0L, 1, 1); desc = loc.sourceDescription(); assertEquals(String.format("(byte[])\"%s\"[truncated 3 bytes]", main), desc); } @@ -88,17 +87,18 @@ public void testEscapeNonPrintable() throws Exception } // for [jackson-core#356] - public void testDisableSourceInclusion() + public void testDisableSourceInclusion() throws Exception { JsonFactory f = JsonFactory.builder() .disable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION) .build(); - JsonParser p = f.createParser(ObjectReadContext.empty(), "[ foobar ]"); + + JsonParser p = f.createParser("[ foobar ]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); try { p.nextToken(); fail("Shouldn't have passed"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "unrecognized token"); JsonLocation loc = e.getLocation(); assertNull(loc.contentReference().getRawContent()); @@ -107,12 +107,12 @@ public void testDisableSourceInclusion() p.close(); // and verify same works for byte-based too - p = f.createParser(ObjectReadContext.empty(), utf8Bytes("[ foobar ]")); + p = f.createParser("[ foobar ]".getBytes("UTF-8")); assertToken(JsonToken.START_ARRAY, p.nextToken()); try { p.nextToken(); fail("Shouldn't have passed"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "unrecognized token"); JsonLocation loc = e.getLocation(); assertNull(loc.contentReference().getRawContent()); diff --git a/src/test/java/com/fasterxml/jackson/core/TestVersions.java b/src/test/java/com/fasterxml/jackson/core/TestVersions.java index f9ba63bfb0..e20dea6d1b 100644 --- a/src/test/java/com/fasterxml/jackson/core/TestVersions.java +++ b/src/test/java/com/fasterxml/jackson/core/TestVersions.java @@ -1,8 +1,10 @@ package com.fasterxml.jackson.core; import com.fasterxml.jackson.core.json.*; - -import java.io.*; +import com.fasterxml.jackson.core.io.IOContext; +import com.fasterxml.jackson.core.io.ContentReference; +import com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer; +import com.fasterxml.jackson.core.util.BufferRecycler; /** * Tests to verify functioning of {@link Version} class. @@ -11,16 +13,14 @@ public class TestVersions extends com.fasterxml.jackson.core.BaseTest { public void testCoreVersions() throws Exception { - final JsonFactory f = new JsonFactory(); - assertVersion(f.version()); - JsonParser jp = f.createParser(ObjectReadContext.empty(), - new StringReader("true")); + assertVersion(new JsonFactory().version()); + ReaderBasedJsonParser jp = new ReaderBasedJsonParser(getIOContext(), 0, null, null, + CharsToNameCanonicalizer.createRoot()); assertVersion(jp.version()); jp.close(); - JsonGenerator jg = f.createGenerator(ObjectWriteContext.empty(), - new ByteArrayOutputStream()); - assertVersion(jg.version()); - jg.close(); + JsonGenerator jgen = new WriterBasedJsonGenerator(getIOContext(), 0, null, null, '"'); + assertVersion(jgen.version()); + jgen.close(); } public void testMisc() { @@ -45,4 +45,8 @@ private void assertVersion(Version v) { assertEquals(PackageVersion.VERSION, v); } + + private IOContext getIOContext() { + return new IOContext(new BufferRecycler(), ContentReference.unknown(), false); + } } diff --git a/src/test/java/com/fasterxml/jackson/core/VersionTest.java b/src/test/java/com/fasterxml/jackson/core/VersionTest.java index 1817c11d72..e7ba0eea2e 100644 --- a/src/test/java/com/fasterxml/jackson/core/VersionTest.java +++ b/src/test/java/com/fasterxml/jackson/core/VersionTest.java @@ -1,24 +1,33 @@ package com.fasterxml.jackson.core; +import org.junit.Test; +import static org.junit.Assert.*; + /** * Unit tests for class {@link Version}. - */ -public class VersionTest extends BaseTest -{ + * + **/ +public class VersionTest{ + + @Test public void testCompareToOne() { Version version = Version.unknownVersion(); - Version versionTwo = new Version(0, -263, -1820, "", "", ""); + Version versionTwo = new Version(0, (-263), (-1820), "", + "", ""); assertEquals(263, version.compareTo(versionTwo)); } + @Test public void testCompareToReturningZero() { Version version = Version.unknownVersion(); - Version versionTwo = new Version(0, 0, 0, "", "", ""); + Version versionTwo = new Version(0, 0, 0, "", + "", ""); assertEquals(0, version.compareTo(versionTwo)); } + @Test public void testCreatesVersionTaking6ArgumentsAndCallsCompareTo() { Version version = new Version(0, 0, 0, null, null, ""); Version versionTwo = new Version(0, 0, 0, "", "", "//0.0.0"); @@ -26,17 +35,19 @@ public void testCreatesVersionTaking6ArgumentsAndCallsCompareTo() { assertTrue(version.compareTo(versionTwo) < 0); } + @Test public void testCompareToTwo() { Version version = Version.unknownVersion(); - Version versionTwo = new Version(-1, 0, 0, "SNAPSHOT", "groupId", "artifactId"); + Version versionTwo = new Version((-1), 0, 0, "0.0.0", + "", ""); - int diff = version.compareTo(versionTwo); - assertTrue("Diff should be negative, was: "+diff, diff < 0); + assertTrue(version.compareTo(versionTwo) > 0); } + @Test public void testCompareToAndCreatesVersionTaking6ArgumentsAndUnknownVersion() { Version version = Version.unknownVersion(); - Version versionTwo = new Version(0, 0, 0, "SNAPSHOT", "groupId", "artifactId"); + Version versionTwo = new Version(0, 0, 0, "//0.0.0", "//0.0.0", ""); assertTrue(version.compareTo(versionTwo) < 0); } diff --git a/src/test/java/com/fasterxml/jackson/core/async/AsyncTestBase.java b/src/test/java/com/fasterxml/jackson/core/async/AsyncTestBase.java index f8a65a5138..f347740474 100644 --- a/src/test/java/com/fasterxml/jackson/core/async/AsyncTestBase.java +++ b/src/test/java/com/fasterxml/jackson/core/async/AsyncTestBase.java @@ -1,6 +1,6 @@ package com.fasterxml.jackson.core.async; -import java.nio.charset.StandardCharsets; +import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; @@ -15,11 +15,11 @@ public abstract class AsyncTestBase extends BaseTest protected final static String UNICODE_SEGMENT = "["+UNICODE_2BYTES+"/"+UNICODE_3BYTES+"]"; - public static AsyncReaderWrapper asyncForBytes(TokenStreamFactory f, + public static AsyncReaderWrapper asyncForBytes(JsonFactory f, int bytesPerRead, - byte[] bytes, int padding) + byte[] bytes, int padding) throws IOException { - return new AsyncReaderWrapperForByteArray(f.createNonBlockingByteArrayParser(ObjectReadContext.empty()), + return new AsyncReaderWrapperForByteArray(f.createNonBlockingByteArrayParser(), bytesPerRead, bytes, padding); } @@ -28,13 +28,13 @@ protected static String spaces(int count) return SPACES.substring(0, Math.min(SPACES.length(), count)); } - protected final JsonToken verifyStart(AsyncReaderWrapper reader) + protected final JsonToken verifyStart(AsyncReaderWrapper reader) throws Exception { assertToken(JsonToken.NOT_AVAILABLE, reader.currentToken()); return reader.nextToken(); } - protected final byte[] _jsonDoc(String doc) { - return doc.getBytes(StandardCharsets.UTF_8); + protected final byte[] _jsonDoc(String doc) throws IOException { + return doc.getBytes("UTF-8"); } } diff --git a/src/test/java/com/fasterxml/jackson/core/base/FactoryBaseImplsTest.java b/src/test/java/com/fasterxml/jackson/core/base/FactoryBaseImplsTest.java deleted file mode 100644 index dae9187997..0000000000 --- a/src/test/java/com/fasterxml/jackson/core/base/FactoryBaseImplsTest.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.fasterxml.jackson.core.base; - -import java.io.DataInput; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; - -import com.fasterxml.jackson.core.BaseTest; -import com.fasterxml.jackson.core.FormatSchema; -import com.fasterxml.jackson.core.JacksonException; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.ObjectReadContext; -import com.fasterxml.jackson.core.ObjectWriteContext; -import com.fasterxml.jackson.core.TokenStreamFactory; -import com.fasterxml.jackson.core.Version; -import com.fasterxml.jackson.core.io.IOContext; - -// Bit different "test" class, used to check that intermediate base types -// (textual, binary format bases) are complete enough. This is not done -// via test methods but just by having minimal definitions present. -// -// In future might add some actual tests too -@SuppressWarnings("serial") -public class FactoryBaseImplsTest extends BaseTest -{ - static class ToyBinaryFormatFactory - extends BinaryTSFactory - { - public ToyBinaryFormatFactory() { super(0, 0); } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ioCtxt, InputStream in) throws JacksonException { - return null; - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ioCtxt, byte[] data, int offset, int len) throws JacksonException { - return null; - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ioCtxt, DataInput input) throws JacksonException { - return null; - } - - @Override - protected JsonGenerator _createGenerator(ObjectWriteContext writeCtxt, - IOContext ioCtxt, OutputStream out) throws JacksonException { - return null; - } - - @Override - public TokenStreamFactory copy() { return this; } - @Override - public TokenStreamFactory snapshot() { return this; } - @Override - public TSFBuilder rebuild() { return null; } - - @Override - public boolean canParseAsync() { return false; } - @Override - public boolean canUseSchema(FormatSchema schema) { return false; } - - @Override - public String getFormatName() { return null; } - - @Override - public Version version() { return Version.unknownVersion(); } - } - - static class ToyTextualFormatFactory - extends TextualTSFactory - { - public ToyTextualFormatFactory() { super(0, 0); } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, InputStream in) throws JacksonException { - return null; - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, Reader r) throws JacksonException { - return null; - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, - byte[] data, int offset, int len) throws JacksonException { - return null; - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, char[] data, int offset, int len, boolean recyclable) - throws JacksonException { - return null; - } - - @Override - protected JsonParser _createParser(ObjectReadContext readCtxt, - IOContext ctxt, DataInput input) throws JacksonException { - return null; - } - - @Override - protected JsonGenerator _createGenerator(ObjectWriteContext writeCtxt, - IOContext ioCtxt, Writer out) throws JacksonException { - return null; - } - - @Override - protected JsonGenerator _createUTF8Generator(ObjectWriteContext writeCtxt, - IOContext ioCtxt, OutputStream out) throws JacksonException { - return null; - } - - @Override - public TokenStreamFactory copy() { return this; } - @Override - public TokenStreamFactory snapshot() { return this; } - @Override - public TSFBuilder rebuild() { return null; } - - @Override - public boolean canParseAsync() { return false; } - @Override - public boolean canUseSchema(FormatSchema schema) { return false; } - - @Override - public String getFormatName() { return null; } - - @Override - public Version version() { return Version.unknownVersion(); } -} - - public void testBogus() { - // no real tests but need one "test" method to avoid junit fail - - assertNotNull(new ToyBinaryFormatFactory()); - assertNotNull(new ToyTextualFormatFactory()); - } -} diff --git a/src/test/java/com/fasterxml/jackson/core/base64/Base64BinaryParsingTest.java b/src/test/java/com/fasterxml/jackson/core/base64/Base64BinaryParsingTest.java index ced1e54d78..4ae115f546 100644 --- a/src/test/java/com/fasterxml/jackson/core/base64/Base64BinaryParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/base64/Base64BinaryParsingTest.java @@ -3,30 +3,27 @@ import static org.junit.Assert.assertArrayEquals; import java.io.*; -import java.nio.charset.StandardCharsets; import org.junit.Assert; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; public class Base64BinaryParsingTest extends com.fasterxml.jackson.core.BaseTest { - public void testBase64UsingInputStream() + public void testBase64UsingInputStream() throws Exception { _testBase64Text(MODE_INPUT_STREAM); _testBase64Text(MODE_INPUT_STREAM_THROTTLED); _testBase64Text(MODE_DATA_INPUT); } - public void testBase64UsingReader() + public void testBase64UsingReader() throws Exception { _testBase64Text(MODE_READER); } - public void testStreaming() + public void testStreaming() throws IOException { _testStreaming(MODE_INPUT_STREAM); _testStreaming(MODE_INPUT_STREAM_THROTTLED); @@ -34,7 +31,7 @@ public void testStreaming() _testStreaming(MODE_READER); } - public void testSimple() + public void testSimple() throws IOException { for (int mode : ALL_MODES) { // [core#414]: Allow leading/trailign white-space, ensure it is accepted @@ -45,7 +42,7 @@ public void testSimple() } } - public void testInArray() + public void testInArray() throws IOException { for (int mode : ALL_MODES) { _testInArray(mode); @@ -64,7 +61,7 @@ public void testWithEscapedPadding() throws IOException { } } - public void testInvalidTokenForBase64() + public void testInvalidTokenForBase64() throws IOException { for (int mode : ALL_MODES) { @@ -74,7 +71,7 @@ public void testInvalidTokenForBase64() try { p.getBinaryValue(); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "current token"); verifyException(e, "can not access as binary"); } @@ -82,7 +79,7 @@ public void testInvalidTokenForBase64() } } - public void testInvalidChar() + public void testInvalidChar() throws IOException { for (int mode : ALL_MODES) { @@ -92,7 +89,7 @@ public void testInvalidChar() try { p.getBinaryValue(Base64Variants.MIME); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "padding only legal"); } p.close(); @@ -103,7 +100,7 @@ public void testInvalidChar() try { p.getBinaryValue(Base64Variants.MIME); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "illegal white space"); } p.close(); @@ -114,14 +111,14 @@ public void testInvalidChar() try { p.getBinaryValue(Base64Variants.MIME); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "illegal character '#'"); } p.close(); } } - public void testOkMissingPadding() { + public void testOkMissingPadding() throws IOException { final byte[] DOC1 = new byte[] { (byte) 0xAD }; _testOkMissingPadding(DOC1, MODE_INPUT_STREAM); _testOkMissingPadding(DOC1, MODE_INPUT_STREAM_THROTTLED); @@ -135,7 +132,7 @@ public void testOkMissingPadding() { _testOkMissingPadding(DOC2, MODE_DATA_INPUT); } - private void _testOkMissingPadding(byte[] input, int mode) + private void _testOkMissingPadding(byte[] input, int mode) throws IOException { final Base64Variant b64 = Base64Variants.MODIFIED_FOR_URL; final String encoded = b64.encode(input, false); @@ -148,7 +145,7 @@ private void _testOkMissingPadding(byte[] input, int mode) p.close(); } - public void testFailDueToMissingPadding() { + public void testFailDueToMissingPadding() throws IOException { final String DOC1 = quote("fQ"); // 1 bytes, no padding _testFailDueToMissingPadding(DOC1, MODE_INPUT_STREAM); _testFailDueToMissingPadding(DOC1, MODE_INPUT_STREAM_THROTTLED); @@ -162,7 +159,7 @@ public void testFailDueToMissingPadding() { _testFailDueToMissingPadding(DOC2, MODE_DATA_INPUT); } - private void _testFailDueToMissingPadding(String doc, int mode) { + private void _testFailDueToMissingPadding(String doc, int mode) throws IOException { final String EXP_EXCEPTION_MATCH = "Unexpected end of base64-encoded String: base64 variant 'MIME' expects padding"; // First, without getting text value first: @@ -171,7 +168,7 @@ private void _testFailDueToMissingPadding(String doc, int mode) { try { /*byte[] b =*/ p.getBinaryValue(Base64Variants.MIME); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, EXP_EXCEPTION_MATCH); } p.close(); @@ -183,7 +180,7 @@ private void _testFailDueToMissingPadding(String doc, int mode) { try { /*byte[] b =*/ p.getBinaryValue(Base64Variants.MIME); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, EXP_EXCEPTION_MATCH); } p.close(); @@ -196,7 +193,7 @@ private void _testFailDueToMissingPadding(String doc, int mode) { */ @SuppressWarnings("resource") - public void _testBase64Text(int mode) + public void _testBase64Text(int mode) throws Exception { // let's actually iterate over sets of encoding modes, lengths @@ -221,16 +218,16 @@ public void _testBase64Text(int mode) if (mode == MODE_READER) { chars = new StringWriter(); - g = jsonFactory.createGenerator(ObjectWriteContext.empty(), chars); + g = jsonFactory.createGenerator(chars); } else { bytes.reset(); - g = jsonFactory.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); + g = jsonFactory.createGenerator(bytes, JsonEncoding.UTF8); } g.writeBinary(variant, input, 0, input.length); g.close(); JsonParser p; if (mode == MODE_READER) { - p = jsonFactory.createParser(ObjectReadContext.empty(), chars.toString()); + p = jsonFactory.createParser(chars.toString()); } else { p = createParser(jsonFactory, mode, bytes.toByteArray()); } @@ -245,7 +242,7 @@ public void _testBase64Text(int mode) try { data = p.getBinaryValue(variant); } catch (Exception e) { - RuntimeException ioException = new RuntimeException("Failed (variant "+variant+", data length "+len+"): "+e.getMessage()); + IOException ioException = new IOException("Failed (variant "+variant+", data length "+len+"): "+e.getMessage()); ioException.initCause(e); throw ioException; } @@ -268,7 +265,7 @@ private byte[] _generateData(int size) return result; } - private void _testStreaming(int mode) + private void _testStreaming(int mode) throws IOException { final int[] SIZES = new int[] { 1, 2, 3, 4, 5, 6, @@ -286,14 +283,14 @@ private void _testStreaming(int mode) JsonGenerator g; if (mode == MODE_READER) { chars = new StringWriter(); - g = jsonFactory.createGenerator(ObjectWriteContext.empty(), chars); + g = jsonFactory.createGenerator(chars); } else { bytes.reset(); - g = jsonFactory.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); + g = jsonFactory.createGenerator(bytes, JsonEncoding.UTF8); } g.writeStartObject(); - g.writeName("b"); + g.writeFieldName("b"); g.writeBinary(data); g.writeEndObject(); g.close(); @@ -301,14 +298,14 @@ private void _testStreaming(int mode) // and verify JsonParser p; if (mode == MODE_READER) { - p = jsonFactory.createParser(ObjectReadContext.empty(), chars.toString()); + p = jsonFactory.createParser(chars.toString()); } else { p = createParser(jsonFactory, mode, bytes.toByteArray()); } assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("b", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("b", p.getCurrentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); ByteArrayOutputStream result = new ByteArrayOutputStream(size); int gotten = p.readBinaryValue(result); @@ -322,12 +319,12 @@ private void _testStreaming(int mode) } } - private void _testSimple(int mode, boolean leadingWS, boolean trailingWS) + private void _testSimple(int mode, boolean leadingWS, boolean trailingWS) throws IOException { // The usual sample input string, from Thomas Hobbes's "Leviathan" // (via Wikipedia) final String RESULT = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure."; - final byte[] RESULT_BYTES = RESULT.getBytes(StandardCharsets.US_ASCII); + final byte[] RESULT_BYTES = RESULT.getBytes("US-ASCII"); // And here's what should produce it... String INPUT_STR = @@ -354,14 +351,14 @@ private void _testSimple(int mode, boolean leadingWS, boolean trailingWS) p.close(); } - private void _testInArray(int mode) + private void _testInArray(int mode) throws IOException { JsonFactory f = sharedStreamFactory(); final int entryCount = 7; StringWriter sw = new StringWriter(); - JsonGenerator jg = f.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator jg = f.createGenerator(sw); jg.writeStartArray(); byte[][] entries = new byte[entryCount][]; @@ -461,7 +458,7 @@ private void _testEscapedPadding(int mode) throws IOException p.close(); } - private byte[] _readBinary(JsonParser p) + private byte[] _readBinary(JsonParser p) throws IOException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); p.readBinaryValue(bytes); diff --git a/src/test/java/com/fasterxml/jackson/core/base64/Base64GenerationTest.java b/src/test/java/com/fasterxml/jackson/core/base64/Base64GenerationTest.java index 466b1b632c..f3b064f5a3 100644 --- a/src/test/java/com/fasterxml/jackson/core/base64/Base64GenerationTest.java +++ b/src/test/java/com/fasterxml/jackson/core/base64/Base64GenerationTest.java @@ -3,7 +3,6 @@ import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.ThrottledInputStream; public class Base64GenerationTest @@ -60,7 +59,7 @@ public void testIssue55() throws Exception // First, byte-backed: ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator gen = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator gen = f.createGenerator(bytes); ByteArrayInputStream data = new ByteArrayInputStream(new byte[2000]); gen.writeBinary(data, 1999); gen.close(); @@ -72,7 +71,7 @@ public void testIssue55() throws Exception // Then char-backed StringWriter sw = new StringWriter(); - gen = f.createGenerator(ObjectWriteContext.empty(), sw); + gen = f.createGenerator(sw); data = new ByteArrayInputStream(new byte[2000]); gen.writeBinary(data, 1999); gen.close(); @@ -97,13 +96,13 @@ public void testBinaryAsEmbeddedObject() throws Exception JsonGenerator g; StringWriter sw = new StringWriter(); - g = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + g = JSON_F.createGenerator(sw); g.writeEmbeddedObject(WIKIPEDIA_BASE64_AS_BYTES); g.close(); assertEquals(quote(WIKIPEDIA_BASE64_ENCODED), sw.toString()); ByteArrayOutputStream bytes = new ByteArrayOutputStream(100); - g = JSON_F.createGenerator(ObjectWriteContext.empty(), bytes); + g = JSON_F.createGenerator(bytes); g.writeEmbeddedObject(WIKIPEDIA_BASE64_AS_BYTES); g.close(); assertEquals(quote(WIKIPEDIA_BASE64_ENCODED), bytes.toString("UTF-8")); @@ -127,9 +126,9 @@ private void _testSimpleBinaryWrite(boolean useCharBased) throws Exception JsonGenerator gen; ByteArrayOutputStream bout = new ByteArrayOutputStream(200); if (useCharBased) { - gen = jf.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bout, "UTF-8")); + gen = jf.createGenerator(new OutputStreamWriter(bout, "UTF-8")); } else { - gen = jf.createGenerator(ObjectWriteContext.empty(), bout, JsonEncoding.UTF8); + gen = jf.createGenerator(bout, JsonEncoding.UTF8); } switch (i) { @@ -143,14 +142,14 @@ private void _testSimpleBinaryWrite(boolean useCharBased) throws Exception break; default: // object gen.writeStartObject(); - gen.writeName("field"); + gen.writeFieldName("field"); gen.writeBinary(b64v, WIKIPEDIA_BASE64_AS_BYTES, 0, WIKIPEDIA_BASE64_AS_BYTES.length); gen.writeEndObject(); break; } gen.close(); - JsonParser jp = jf.createParser(ObjectReadContext.empty(), new ByteArrayInputStream(bout.toByteArray())); + JsonParser jp = jf.createParser(new ByteArrayInputStream(bout.toByteArray())); // Need to skip other events before binary data: switch (i) { @@ -161,7 +160,7 @@ private void _testSimpleBinaryWrite(boolean useCharBased) throws Exception break; default: assertEquals(JsonToken.START_OBJECT, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, jp.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); break; } assertEquals(JsonToken.VALUE_STRING, jp.nextToken()); @@ -189,9 +188,9 @@ private void _testStreamingWrites(JsonFactory jf, boolean useBytes) throws Excep final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); if (useBytes) { - jgen = jf.createGenerator(ObjectWriteContext.empty(), bytes); + jgen = jf.createGenerator(bytes); } else { - jgen = jf.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bytes, "UTF-8")); + jgen = jf.createGenerator(new OutputStreamWriter(bytes, "UTF-8")); } jgen.writeStartArray(); int length = passLength ? INPUT.length : -1; diff --git a/src/test/java/com/fasterxml/jackson/core/filter/BasicGeneratorFilteringTest.java b/src/test/java/com/fasterxml/jackson/core/filter/BasicGeneratorFilteringTest.java index fb2d6696cb..5908aa56f8 100644 --- a/src/test/java/com/fasterxml/jackson/core/filter/BasicGeneratorFilteringTest.java +++ b/src/test/java/com/fasterxml/jackson/core/filter/BasicGeneratorFilteringTest.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; import com.fasterxml.jackson.core.io.SerializedString; -import com.fasterxml.jackson.core.json.JsonFactory; /** * Low-level tests for explicit, hand-written tests for generator-side @@ -172,8 +171,8 @@ public void testSingleMatchFilteringWithoutPath() throws Exception public void testSingleMatchFilteringWithPath() throws Exception { StringWriter w = new StringWriter(); - JsonGenerator origGen = JSON_F.createGenerator(ObjectWriteContext.empty(), w); - NameMatchFilter filter = new NameMatchFilter("value"); + JsonGenerator origGen = _createGenerator(w); + NameMatchFilter filter = new NameMatchFilter("value"); FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(origGen, filter, Inclusion.INCLUDE_ALL_AND_PATH, @@ -181,7 +180,7 @@ public void testSingleMatchFilteringWithPath() throws Exception ); // Hmmh. Should we get access to eventual target? - assertSame(w, gen.streamWriteOutputTarget()); + assertSame(w, gen.getOutputTarget()); assertNotNull(gen.getFilterContext()); assertSame(filter, gen.getFilter()); @@ -203,7 +202,7 @@ public void testSingleMatchFilteringWithPathSkippedArray() throws Exception ); // Hmmh. Should we get access to eventual target? - assertSame(w, gen.streamWriteOutputTarget()); + assertSame(w, gen.getOutputTarget()); assertNotNull(gen.getFilterContext()); assertSame(filter, gen.getFilter()); @@ -233,27 +232,27 @@ private void _testSingleMatchFilteringWithPathAlternate1(boolean exclude) throws //final String JSON = "{'a':123,'array':[1,2],'ob':{'value0':2,'value':[3],'value2':'foo'},'b':true}"; gen.writeStartObject(); - gen.writeName(new SerializedString("a")); + gen.writeFieldName(new SerializedString("a")); gen.writeNumber(123); - gen.writeName("array"); + gen.writeFieldName("array"); gen.writeStartArray(2); gen.writeNumber("1"); gen.writeNumber((short) 2); gen.writeEndArray(); - gen.writeName(new SerializedString("ob")); + gen.writeFieldName(new SerializedString("ob")); gen.writeStartObject(); - gen.writeNumberProperty("value0", 2); - gen.writeName(new SerializedString("value")); + gen.writeNumberField("value0", 2); + gen.writeFieldName(new SerializedString("value")); gen.writeStartArray(1); gen.writeString(new SerializedString("x")); // just to vary generation method gen.writeEndArray(); - gen.writeStringProperty("value2", "foo"); + gen.writeStringField("value2", "foo"); gen.writeEndObject(); - gen.writeBooleanProperty("b", true); + gen.writeBooleanField("b", true); gen.writeEndObject(); gen.close(); @@ -281,14 +280,14 @@ public void testSingleMatchFilteringWithPathRawBinary() throws Exception gen.writeStartObject(); - gen.writeName("header"); + gen.writeFieldName("header"); gen.writeStartArray(); gen.writeBinary(new byte[] { 1 }); gen.writeRawValue(new SerializedString("1")); gen.writeRawValue("2"); gen.writeEndArray(); - - gen.writeName("array"); + + gen.writeFieldName("array"); gen.writeStartArray(); gen.writeBinary(new byte[] { 1 }); @@ -303,7 +302,7 @@ public void testSingleMatchFilteringWithPathRawBinary() throws Exception gen.writeNumber(7.5); gen.writeEndArray(); - gen.writeArrayPropertyStart("extra"); + gen.writeArrayFieldStart("extra"); gen.writeNumber((short) 1); gen.writeNumber((int) 2); gen.writeNumber((long) 3); @@ -350,6 +349,7 @@ public void testMultipleMatchFilteringWithPath1() throws Exception public void testMultipleMatchFilteringWithPath2() throws Exception { StringWriter w = new StringWriter(); + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), new NameMatchFilter("array", "b", "value"), Inclusion.INCLUDE_ALL_AND_PATH, true); @@ -362,6 +362,7 @@ public void testMultipleMatchFilteringWithPath2() throws Exception public void testMultipleMatchFilteringWithPath3() throws Exception { StringWriter w = new StringWriter(); + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), new NameMatchFilter("value"), Inclusion.INCLUDE_ALL_AND_PATH, true); @@ -375,7 +376,7 @@ public void testNoMatchFiltering1() throws Exception { StringWriter w = new StringWriter(); - FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(JSON_F.createGenerator(w), new NameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, true); final String JSON = "{'root':{'a0':true,'b':{'value':4}},'b0':false}"; @@ -388,7 +389,7 @@ public void testNoMatchFiltering2() throws Exception { StringWriter w = new StringWriter(); - FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(JSON_F.createGenerator(w), new NameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, true); final String object = "{'root':{'a0':true,'b':{'value':4}},'b0':false}"; @@ -402,7 +403,7 @@ public void testNoMatchFiltering3() throws Exception { StringWriter w = new StringWriter(); - FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(JSON_F.createGenerator(w), new NameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, true); final String object = "{'root':{'a0':true,'b':{'value':4}},'b0':false}"; @@ -416,7 +417,7 @@ public void testNoMatchFiltering4() throws Exception { StringWriter w = new StringWriter(); - FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(JSON_F.createGenerator(w), new StrictNameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, true); final String JSON = "{'root':{'a0':true,'a':{'value':3},'b':{'value':4}},'b0':false}"; @@ -429,7 +430,7 @@ public void testNoMatchFiltering5() throws Exception { StringWriter w = new StringWriter(); - FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(JSON_F.createGenerator(w), new StrictNameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, true); final String object = "{'root':{'a0':true,'b':{'value':4}},'b0':false}"; @@ -443,7 +444,7 @@ public void testNoMatchFiltering6() throws Exception { StringWriter w = new StringWriter(); - FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(JSON_F.createGenerator(w), new StrictNameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, true); final String object = "{'root':{'a0':true,'b':{'value':4}},'b0':false}"; @@ -457,7 +458,7 @@ public void testValueOmitsFieldName1() throws Exception { StringWriter w = new StringWriter(); - FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(JSON_F.createGenerator(w), new NoArraysFilter(), Inclusion.INCLUDE_NON_NULL, true); final String JSON = "{'root':['a'],'b0':false}"; @@ -482,7 +483,7 @@ public void testValueOmitsFieldName2() throws Exception { StringWriter w = new StringWriter(); - FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(JSON_F.createGenerator(w), new NoObjectsFilter(), Inclusion.INCLUDE_NON_NULL, true); final String JSON = "['a',{'root':{'b':{'value':4}},'b0':false}]"; @@ -553,6 +554,7 @@ public void testIndexMatchWithPath2() throws Exception public void testWriteStartObjectWithObject() throws Exception { StringWriter w = new StringWriter(); + FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(_createGenerator(w), TokenFilter.INCLUDE_ALL, Inclusion.INCLUDE_ALL_AND_PATH, true); @@ -560,13 +562,13 @@ public void testWriteStartObjectWithObject() throws Exception String value = "val"; gen.writeStartObject(new Object(), 2); - gen.writeName("field1"); + gen.writeFieldName("field1"); { gen.writeStartObject(value); gen.writeEndObject(); } - gen.writeName("field2"); + gen.writeFieldName("field2"); gen.writeNumber(new BigDecimal("1.0")); gen.writeEndObject(); @@ -602,10 +604,10 @@ public void testRawValueDelegationWithObject() throws Exception TokenFilter.INCLUDE_ALL, Inclusion.INCLUDE_ALL_AND_PATH, true); gen.writeStartObject(); - gen.writeNumberProperty("f1", 1); - gen.writeName("f2"); + gen.writeNumberField("f1", 1); + gen.writeFieldName("f2"); gen.writeRawValue(new char[]{'1', '2', '.', '3', '-'}, 0, 4); - gen.writeNumberProperty("f3", 3); + gen.writeNumberField("f3", 3); gen.writeEndObject(); gen.close(); @@ -613,6 +615,6 @@ public void testRawValueDelegationWithObject() throws Exception } private JsonGenerator _createGenerator(Writer w) throws IOException { - return JSON_F.createGenerator(ObjectWriteContext.empty(), w); + return JSON_F.createGenerator(w); } } diff --git a/src/test/java/com/fasterxml/jackson/core/filter/BasicParserFilteringTest.java b/src/test/java/com/fasterxml/jackson/core/filter/BasicParserFilteringTest.java index 2636bd1c48..ebb5abe4d0 100644 --- a/src/test/java/com/fasterxml/jackson/core/filter/BasicParserFilteringTest.java +++ b/src/test/java/com/fasterxml/jackson/core/filter/BasicParserFilteringTest.java @@ -1,12 +1,9 @@ package com.fasterxml.jackson.core.filter; -import java.io.IOException; -import java.io.StringWriter; import java.math.BigInteger; import java.util.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; @SuppressWarnings("resource") @@ -96,21 +93,21 @@ public TokenFilter filterStartObject() { /********************************************************** */ - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); private final String SIMPLE = aposToQuotes( "{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':0.25},'b':true}"); public void testNonFiltering() throws Exception { - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), SIMPLE); + JsonParser p = JSON_F.createParser(SIMPLE); String result = readAndWrite(JSON_F, p); assertEquals(SIMPLE, result); } public void testSingleMatchFilteringWithoutPath() throws Exception { - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), SIMPLE); + JsonParser p0 = JSON_F.createParser(SIMPLE); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.ONLY_INCLUDE_ALL, @@ -124,7 +121,7 @@ public void testSingleMatchFilteringWithoutPath() throws Exception public void testSingleMatchFilteringWithPath1() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4},'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("a"), Inclusion.INCLUDE_ALL_AND_PATH, @@ -138,7 +135,7 @@ public void testSingleMatchFilteringWithPath1() throws Exception public void testSingleMatchFilteringWithPath2() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4},'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.INCLUDE_ALL_AND_PATH, @@ -152,7 +149,7 @@ public void testSingleMatchFilteringWithPath2() throws Exception public void testSingleMatchFilteringWithPath3() throws Exception { String jsonString = aposToQuotes("{'a':123,'ob':{'value0':2,'value':3,'value2':4},'array':[1,2],'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("ob"), Inclusion.INCLUDE_ALL_AND_PATH, @@ -166,7 +163,7 @@ public void testSingleMatchFilteringWithPath3() throws Exception public void testNotAllowMultipleMatchesWithoutPath1() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4,'value':{'value0':2}},'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.ONLY_INCLUDE_ALL, @@ -180,7 +177,7 @@ public void testNotAllowMultipleMatchesWithoutPath1() throws Exception public void testNotAllowMultipleMatchesWithoutPath2() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'array':[3,4],'ob':{'value0':2,'value':3,'value2':4,'value':{'value0':2}},'value':\"val\",'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new IndexMatchFilter(1), Inclusion.ONLY_INCLUDE_ALL, @@ -194,7 +191,7 @@ public void testNotAllowMultipleMatchesWithoutPath2() throws Exception public void testNotAllowMultipleMatchesWithPath1() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'array':[3,4],'ob':{'value':3,'array':[5,6],'value':{'value0':2}},'value':\"val\",'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new IndexMatchFilter(1), Inclusion.INCLUDE_ALL_AND_PATH, @@ -209,7 +206,7 @@ public void testNotAllowMultipleMatchesWithPath1() throws Exception public void testNotAllowMultipleMatchesWithPath2() throws Exception { String jsonString = aposToQuotes("{'a':123,'ob':{'value':3,'array':[1,2],'value':{'value0':2}},'array':[3,4]}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new IndexMatchFilter(1), Inclusion.INCLUDE_ALL_AND_PATH, @@ -223,7 +220,7 @@ public void testNotAllowMultipleMatchesWithPath2() throws Exception public void testNotAllowMultipleMatchesWithPath3() throws Exception { String jsonString = aposToQuotes("{'ob':{'value':3,'ob':{'value':2}},'value':\"val\"}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.INCLUDE_ALL_AND_PATH, @@ -237,7 +234,7 @@ public void testNotAllowMultipleMatchesWithPath3() throws Exception public void testNotAllowMultipleMatchesWithPath4() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value1':1},'ob2':{'ob':{'value2':2}},'value':\"val\",'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("ob"), Inclusion.INCLUDE_ALL_AND_PATH, @@ -251,7 +248,7 @@ public void testNotAllowMultipleMatchesWithPath4() throws Exception public void testAllowMultipleMatchesWithoutPath() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4,'value':{'value0':2}},'value':\"val\",'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.ONLY_INCLUDE_ALL, @@ -265,7 +262,7 @@ public void testAllowMultipleMatchesWithoutPath() throws Exception public void testAllowMultipleMatchesWithPath1() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4,'value':{'value0':2}},'value':\"val\",'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.INCLUDE_ALL_AND_PATH, @@ -279,7 +276,7 @@ public void testAllowMultipleMatchesWithPath1() throws Exception public void testAllowMultipleMatchesWithPath2() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'array':[3,4],'value':{'value0':2}},'value':\"val\",'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new IndexMatchFilter(1), Inclusion.INCLUDE_ALL_AND_PATH, @@ -292,7 +289,7 @@ public void testAllowMultipleMatchesWithPath2() throws Exception public void testMultipleMatchFilteringWithPath1() throws Exception { - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), SIMPLE); + JsonParser p0 = JSON_F.createParser(SIMPLE); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("value0", "value2"), Inclusion.INCLUDE_ALL_AND_PATH, true /* multipleMatches */ ); @@ -305,7 +302,7 @@ public void testMultipleMatchFilteringWithPath1() throws Exception public void testMultipleMatchFilteringWithPath2() throws Exception { String INPUT = aposToQuotes("{'a':123,'ob':{'value0':2,'value':3,'value2':4},'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), INPUT); + JsonParser p0 = JSON_F.createParser(INPUT); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("b", "value"), Inclusion.INCLUDE_ALL_AND_PATH, true); @@ -318,7 +315,7 @@ public void testMultipleMatchFilteringWithPath2() throws Exception public void testMultipleMatchFilteringWithPath3() throws Exception { final String JSON = aposToQuotes("{'root':{'a0':true,'a':{'value':3},'b':{'value':\"foo\"}},'b0':false}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), JSON); + JsonParser p0 = JSON_F.createParser(JSON); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.INCLUDE_ALL_AND_PATH, true); @@ -330,7 +327,7 @@ public void testMultipleMatchFilteringWithPath3() throws Exception public void testNoMatchFiltering1() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4},'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, @@ -345,7 +342,7 @@ public void testNoMatchFiltering2() throws Exception { String object = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4},'b':true}"); String jsonString = String.format("[%s,%s,%s]", object, object, object); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, @@ -360,7 +357,7 @@ public void testNoMatchFiltering3() throws Exception { String object = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4},'b':true}"); String jsonString = String.format("[[%s],[%s],[%s]]", object, object, object); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, @@ -374,7 +371,7 @@ public void testNoMatchFiltering3() throws Exception public void testNoMatchFiltering4() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4},'b':true}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new StrictNameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, @@ -389,7 +386,7 @@ public void testNoMatchFiltering5() throws Exception { String object = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4},'b':true}"); String jsonString = String.format("[%s,%s,%s]", object, object, object); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new StrictNameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, @@ -404,7 +401,7 @@ public void testNoMatchFiltering6() throws Exception { String object = aposToQuotes("{'a':123,'array':[1,2],'ob':{'value0':2,'value':3,'value2':4},'b':true}"); String jsonString = String.format("[[%s],[%s],[%s]]", object, object, object); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new StrictNameMatchFilter("invalid"), Inclusion.INCLUDE_NON_NULL, @@ -418,7 +415,7 @@ public void testNoMatchFiltering6() throws Exception public void testValueOmitsFieldName2() throws Exception { String jsonString = aposToQuotes("['a',{'value0':3,'b':{'value':4}},123]"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NoObjectsFilter(), Inclusion.INCLUDE_NON_NULL, @@ -431,13 +428,13 @@ public void testValueOmitsFieldName2() throws Exception public void testIndexMatchWithPath1() throws Exception { - FilteringParserDelegate p = new FilteringParserDelegate(JSON_F.createParser(ObjectReadContext.empty(), SIMPLE), + FilteringParserDelegate p = new FilteringParserDelegate(JSON_F.createParser(SIMPLE), new IndexMatchFilter(1), Inclusion.INCLUDE_ALL_AND_PATH, true); String result = readAndWrite(JSON_F, p); assertEquals(aposToQuotes("{'array':[2]}"), result); assertEquals(1, p.getMatchCount()); - p = new FilteringParserDelegate(JSON_F.createParser(ObjectReadContext.empty(), SIMPLE), + p = new FilteringParserDelegate(JSON_F.createParser(SIMPLE), new IndexMatchFilter(0), Inclusion.INCLUDE_ALL_AND_PATH, true); result = readAndWrite(JSON_F, p); assertEquals(aposToQuotes("{'array':[1]}"), result); @@ -446,13 +443,13 @@ public void testIndexMatchWithPath1() throws Exception public void testIndexMatchWithPath2() throws Exception { - FilteringParserDelegate p = new FilteringParserDelegate(JSON_F.createParser(ObjectReadContext.empty(), SIMPLE), + FilteringParserDelegate p = new FilteringParserDelegate(JSON_F.createParser(SIMPLE), new IndexMatchFilter(0, 1), Inclusion.INCLUDE_ALL_AND_PATH, true); assertEquals(aposToQuotes("{'array':[1,2]}"), readAndWrite(JSON_F, p)); assertEquals(2, p.getMatchCount()); String JSON = aposToQuotes("{'a':123,'array':[1,2,3,4,5],'b':[1,2,3]}"); - p = new FilteringParserDelegate(JSON_F.createParser(ObjectReadContext.empty(), JSON), + p = new FilteringParserDelegate(JSON_F.createParser(JSON), new IndexMatchFilter(1, 3), Inclusion.INCLUDE_ALL_AND_PATH, true); assertEquals(aposToQuotes("{'array':[2,4],'b':[2]}"), readAndWrite(JSON_F, p)); assertEquals(3, p.getMatchCount()); @@ -460,7 +457,7 @@ public void testIndexMatchWithPath2() throws Exception public void testBasicSingleMatchFilteringWithPath() throws Exception { - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), SIMPLE); + JsonParser p0 = JSON_F.createParser(SIMPLE); JsonParser p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.INCLUDE_ALL_AND_PATH, @@ -474,7 +471,7 @@ public void testBasicSingleMatchFilteringWithPath() throws Exception public void testTokensSingleMatchWithPath() throws Exception { - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), SIMPLE); + JsonParser p0 = JSON_F.createParser(SIMPLE); JsonParser p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.INCLUDE_ALL_AND_PATH, @@ -482,7 +479,7 @@ public void testTokensSingleMatchWithPath() throws Exception ); assertFalse(p.hasCurrentToken()); - assertNull(p.currentToken()); + assertNull(p.getCurrentToken()); assertEquals(JsonTokenId.ID_NO_TOKEN, p.currentTokenId()); assertFalse(p.isExpectedStartObjectToken()); assertFalse(p.isExpectedStartArrayToken()); @@ -492,29 +489,31 @@ public void testTokensSingleMatchWithPath() throws Exception // assertEquals(aposToQuotes("{'ob':{'value':3}}"), result); assertToken(JsonToken.START_OBJECT, p.nextToken()); + assertEquals(JsonToken.START_OBJECT, p.getCurrentToken()); assertEquals(JsonToken.START_OBJECT, p.currentToken()); assertEquals(JsonTokenId.ID_START_OBJECT, p.currentTokenId()); + assertEquals(JsonTokenId.ID_START_OBJECT, p.currentTokenId()); assertTrue(p.isExpectedStartObjectToken()); assertFalse(p.isExpectedStartArrayToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.currentToken()); - assertTrue(p.hasToken(JsonToken.PROPERTY_NAME)); - assertTrue(p.hasTokenId(JsonTokenId.ID_PROPERTY_NAME)); - assertEquals("ob", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, p.getCurrentToken()); + assertTrue(p.hasToken(JsonToken.FIELD_NAME)); + assertTrue(p.hasTokenId(JsonTokenId.ID_FIELD_NAME)); + assertEquals("ob", p.getCurrentName()); // assertEquals("ob", p.getText()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("ob", p.currentName()); + assertEquals("ob", p.getCurrentName()); - assertEquals(p0.currentLocation(), p.currentLocation()); + assertEquals(p0.getCurrentLocation(), p.getCurrentLocation()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("value", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("value", p.getCurrentName()); assertEquals("value", p.getText()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.currentToken()); + assertEquals(JsonToken.VALUE_NUMBER_INT, p.getCurrentToken()); assertEquals(JsonParser.NumberType.INT, p.getNumberType()); assertEquals(3, p.getIntValue()); assertEquals(3, p.getValueAsInt()); @@ -536,20 +535,20 @@ public void testTokensSingleMatchWithPath() throws Exception assertEquals("value", p.currentName()); assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertEquals(JsonToken.END_OBJECT, p.currentToken()); + assertEquals(JsonToken.END_OBJECT, p.getCurrentToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertEquals(JsonToken.END_OBJECT, p.currentToken()); + assertEquals(JsonToken.END_OBJECT, p.getCurrentToken()); p.clearCurrentToken(); - assertNull(p.currentToken()); + assertNull(p.getCurrentToken()); p.close(); } public void testSkippingForSingleWithPath() throws Exception { - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), SIMPLE); + JsonParser p0 = JSON_F.createParser(SIMPLE); JsonParser p = new FilteringParserDelegate(p0, new NameMatchFilter("value"), Inclusion.INCLUDE_ALL_AND_PATH, @@ -558,25 +557,7 @@ public void testSkippingForSingleWithPath() throws Exception assertToken(JsonToken.START_OBJECT, p.nextToken()); p.skipChildren(); - assertEquals(JsonToken.END_OBJECT, p.currentToken()); + assertEquals(JsonToken.END_OBJECT, p.getCurrentToken()); assertNull(p.nextToken()); } - - private String readAndWrite(JsonFactory f, JsonParser p) throws IOException - { - StringWriter sw = new StringWriter(100); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), sw); - //g.disable(StreamWriteFeature.AUTO_CLOSE_CONTENT); - try { - while (p.nextToken() != null) { - g.copyCurrentEvent(p); - } - } catch (Exception e) { - g.flush(); - fail("Unexpected problem during `readAndWrite`. Output so far: '"+sw+"'; problem: "+e); - } - p.close(); - g.close(); - return sw.toString(); - } } diff --git a/src/test/java/com/fasterxml/jackson/core/filter/GeneratorFiltering609Test.java b/src/test/java/com/fasterxml/jackson/core/filter/GeneratorFiltering609Test.java index a02a10f901..52373253a4 100644 --- a/src/test/java/com/fasterxml/jackson/core/filter/GeneratorFiltering609Test.java +++ b/src/test/java/com/fasterxml/jackson/core/filter/GeneratorFiltering609Test.java @@ -3,6 +3,7 @@ import java.io.*; import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; import com.fasterxml.jackson.core.util.JsonGeneratorDelegate; // for [core#609] @@ -33,7 +34,7 @@ static class StringTruncatingGeneratorDelegate } @Override - public void writeString(String text) { + public void writeString(String text) throws IOException { if (text == null) { writeNull(); } else if (maxStringLength <= 0 || maxStringLength >= text.length()) { @@ -45,34 +46,33 @@ public void writeString(String text) { } @Override - public void writeName(String name) { + public void writeFieldName(String name) throws IOException { if (maxStringLength <= 0 || maxStringLength >= name.length()) { - super.writeName(name); + super.writeFieldName(name); } else { String truncatedName = name.substring(0, maxStringLength); - super.writeName(truncatedName); + super.writeFieldName(truncatedName); } } } // for [core#609]: will pass in 2.10 for some cases - @SuppressWarnings("resource") public void testIssue609() throws Exception { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); JsonGenerator g = createGenerator(outputStream); g = new FilteringGeneratorDelegate( - g, NullExcludingTokenFilter.INSTANCE, - TokenFilter.Inclusion.INCLUDE_ALL_AND_PATH, true); + g, NullExcludingTokenFilter.INSTANCE, Inclusion.INCLUDE_ALL_AND_PATH, true); int maxStringLength = 10; g = new StringTruncatingGeneratorDelegate( g, maxStringLength); g.writeStartObject(); - g.writeName("message"); + g.writeFieldName("message"); g.writeString("1234567890!"); g.writeEndObject(); g.close(); + outputStream.close(); String json = outputStream.toString("US-ASCII"); assertEquals("{\"message\":\"1234567890\"}", json); diff --git a/src/test/java/com/fasterxml/jackson/core/filter/JsonPointerGeneratorFilteringTest.java b/src/test/java/com/fasterxml/jackson/core/filter/JsonPointerGeneratorFilteringTest.java index 37cb020422..4097e162e8 100644 --- a/src/test/java/com/fasterxml/jackson/core/filter/JsonPointerGeneratorFilteringTest.java +++ b/src/test/java/com/fasterxml/jackson/core/filter/JsonPointerGeneratorFilteringTest.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; -import com.fasterxml.jackson.core.json.JsonFactory; @SuppressWarnings("resource") public class JsonPointerGeneratorFilteringTest extends com.fasterxml.jackson.core.BaseTest @@ -95,7 +94,7 @@ private void _assert(String input, String pathExpr, Inclusion tokenFilterInclusi { StringWriter w = new StringWriter(); - JsonGenerator g0 = JSON_F.createGenerator(ObjectWriteContext.empty(), w); + JsonGenerator g0 = JSON_F.createGenerator(w); FilteringGeneratorDelegate g = new FilteringGeneratorDelegate(g0, new JsonPointerBasedFilter(pathExpr), tokenFilterInclusion, false); @@ -129,10 +128,10 @@ public void testArrayFiltering582WithSize() throws IOException { private void _testArrayFiltering582(int mode) throws IOException { StringWriter output = new StringWriter(); - JsonGenerator jg = JSON_F.createGenerator(ObjectWriteContext.empty(), output); + JsonGenerator jg = JSON_F.createGenerator(output); FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(jg, - new JsonPointerBasedFilter("/noMatch"), Inclusion.ONLY_INCLUDE_ALL, true); + new JsonPointerBasedFilter("/noMatch"), Inclusion.INCLUDE_ALL_AND_PATH, true); final String[] stuff = new String[] { "foo", "bar" }; switch (mode) { diff --git a/src/test/java/com/fasterxml/jackson/core/filter/JsonPointerParserFilteringTest.java b/src/test/java/com/fasterxml/jackson/core/filter/JsonPointerParserFilteringTest.java index f5af207d13..86fa975902 100644 --- a/src/test/java/com/fasterxml/jackson/core/filter/JsonPointerParserFilteringTest.java +++ b/src/test/java/com/fasterxml/jackson/core/filter/JsonPointerParserFilteringTest.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; -import com.fasterxml.jackson.core.json.JsonFactory; public class JsonPointerParserFilteringTest extends com.fasterxml.jackson.core.BaseTest { @@ -61,12 +60,12 @@ public void testSimpleNoPath() throws Exception void _assert(String input, String pathExpr, TokenFilter.Inclusion inclusion, String exp) throws Exception { - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), input); + JsonParser p0 = JSON_F.createParser(input); FilteringParserDelegate p = new FilteringParserDelegate(p0, new JsonPointerBasedFilter(pathExpr), inclusion, false); StringWriter w = new StringWriter(); - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), w); + JsonGenerator g = JSON_F.createGenerator(w); try { while (p.nextToken() != null) { diff --git a/src/test/java/com/fasterxml/jackson/core/filter/ParserFiltering700Test.java b/src/test/java/com/fasterxml/jackson/core/filter/ParserFiltering700Test.java index 91a287cfb6..9831b2a229 100644 --- a/src/test/java/com/fasterxml/jackson/core/filter/ParserFiltering700Test.java +++ b/src/test/java/com/fasterxml/jackson/core/filter/ParserFiltering700Test.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; -import com.fasterxml.jackson.core.json.JsonFactory; @SuppressWarnings("resource") public class ParserFiltering700Test extends BaseTest @@ -39,7 +38,7 @@ public void testSkippingRootLevel() throws Exception assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("value", p.currentName()); // 19-Jul-2021, tatu: while not ideal, existing contract is that "getText()" // ought to return property name as well... @@ -68,13 +67,13 @@ public void testSkippingOneNested() throws Exception assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("value", p.currentName()); // as earlier, this needs to hold true too assertEquals("value", p.getText()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentName()); assertEquals("a", p.getText()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); @@ -110,24 +109,24 @@ private void _testSkippingForSingleWithPath(boolean useNextName) throws Exceptio assertTrue(p.isExpectedStartObjectToken()); if (useNextName) { - assertEquals("value", p.nextName()); + assertEquals("value", p.nextFieldName()); // as earlier, this needs to hold true too assertEquals("value", p.getText()); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertTrue(p.isExpectedStartObjectToken()); - assertEquals("a", p.nextName()); + assertEquals("a", p.nextFieldName()); assertEquals("a", p.getText()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(99, p.getIntValue()); - assertNull(p.nextName()); + assertNull(p.nextFieldName()); assertEquals(JsonToken.END_OBJECT, p.currentToken()); } else { - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("value", p.currentName()); assertEquals("value", p.getText()); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertTrue(p.isExpectedStartObjectToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentName()); assertEquals("a", p.getText()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); @@ -148,6 +147,6 @@ private void _testSkippingForSingleWithPath(boolean useNextName) throws Exceptio */ private JsonParser _createParser(TokenStreamFactory f, String json) throws Exception { - return f.createParser(ObjectReadContext.empty(), json); + return f.createParser(json); } } diff --git a/src/test/java/com/fasterxml/jackson/core/format/DataFormatMatcherTest.java b/src/test/java/com/fasterxml/jackson/core/format/DataFormatMatcherTest.java new file mode 100644 index 0000000000..817fccac2a --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/core/format/DataFormatMatcherTest.java @@ -0,0 +1,66 @@ +package com.fasterxml.jackson.core.format; + +import java.io.IOException; +import java.io.InputStream; + +import com.fasterxml.jackson.core.JsonFactory; + +/** + * Unit tests for class {@link DataFormatMatcher}. + */ +public class DataFormatMatcherTest extends com.fasterxml.jackson.core.BaseTest +{ + private final JsonFactory JSON_F = new JsonFactory(); + + public void testGetDataStream() throws IOException { + byte[] byteArray = new byte[2]; + MatchStrength matchStrength = MatchStrength.WEAK_MATCH; + DataFormatMatcher dataFormatMatcher = new DataFormatMatcher(null, + byteArray, + 1, + 0, + null, + matchStrength); + InputStream inputStream = dataFormatMatcher.getDataStream(); + assertEquals(0, inputStream.available()); + inputStream.close(); + } + + public void testCreatesDataFormatMatcherTwo() throws IOException { + try { + @SuppressWarnings("unused") + DataFormatMatcher dataFormatMatcher = new DataFormatMatcher(null, + new byte[0], 2, 1, + JSON_F, MatchStrength.NO_MATCH); + } catch (IllegalArgumentException e) { + verifyException(e, "Illegal start/length"); + } + } + + public void testGetMatchedFormatNameReturnsNameWhenMatches() { + DataFormatMatcher dataFormatMatcher = new DataFormatMatcher(null, + new byte[2], + 1, + 0, + JSON_F, + MatchStrength.SOLID_MATCH); + assertEquals(JsonFactory.FORMAT_NAME_JSON, dataFormatMatcher.getMatchedFormatName()); + } + + public void testDetectorConfiguration() { + DataFormatDetector df0 = new DataFormatDetector(JSON_F); + + // Defaults are: SOLID for optimal, WEAK for minimum, so: + assertSame(df0, df0.withOptimalMatch(MatchStrength.SOLID_MATCH)); + assertSame(df0, df0.withMinimalMatch(MatchStrength.WEAK_MATCH)); + assertSame(df0, df0.withMaxInputLookahead(DataFormatDetector.DEFAULT_MAX_INPUT_LOOKAHEAD)); + + // but will change + assertNotSame(df0, df0.withOptimalMatch(MatchStrength.FULL_MATCH)); + assertNotSame(df0, df0.withMinimalMatch(MatchStrength.SOLID_MATCH)); + assertNotSame(df0, df0.withMaxInputLookahead(DataFormatDetector.DEFAULT_MAX_INPUT_LOOKAHEAD + 5)); + + // regardless, we should be able to use `toString()` + assertNotNull(df0.toString()); + } +} diff --git a/src/test/java/com/fasterxml/jackson/core/format/TestJsonFormatDetection.java b/src/test/java/com/fasterxml/jackson/core/format/TestJsonFormatDetection.java new file mode 100644 index 0000000000..6596bb8a54 --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/core/format/TestJsonFormatDetection.java @@ -0,0 +1,97 @@ +package com.fasterxml.jackson.core.format; + +import java.io.*; + +import com.fasterxml.jackson.core.*; + +public class TestJsonFormatDetection extends com.fasterxml.jackson.core.BaseTest +{ + public void testSimpleValidArray() throws Exception + { + JsonFactory jsonF = new JsonFactory(); + DataFormatDetector detector = new DataFormatDetector(jsonF); + final String ARRAY_JSON = "[ 1, 2 ]"; + DataFormatMatcher matcher = detector.findFormat(new ByteArrayInputStream(ARRAY_JSON.getBytes("UTF-8"))); + // should have match + assertTrue(matcher.hasMatch()); + assertEquals("JSON", matcher.getMatchedFormatName()); + assertSame(jsonF, matcher.getMatch()); + // no "certain" match with JSON, but solid: + assertEquals(MatchStrength.SOLID_MATCH, matcher.getMatchStrength()); + // and thus: + JsonParser jp = matcher.createParserWithMatch(); + assertToken(JsonToken.START_ARRAY, jp.nextToken()); + assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertToken(JsonToken.END_ARRAY, jp.nextToken()); + assertNull(jp.nextToken()); + jp.close(); + } + + public void testSimpleValidObject() throws Exception + { + JsonFactory jsonF = new JsonFactory(); + DataFormatDetector detector = new DataFormatDetector(jsonF); + final String JSON = "{ \"field\" : true }"; + DataFormatMatcher matcher = detector.findFormat(new ByteArrayInputStream(JSON.getBytes("UTF-8"))); + // should have match + assertTrue(matcher.hasMatch()); + assertEquals("JSON", matcher.getMatchedFormatName()); + assertSame(jsonF, matcher.getMatch()); + // no "certain" match with JSON, but solid: + assertEquals(MatchStrength.SOLID_MATCH, matcher.getMatchStrength()); + // and thus: + JsonParser jp = matcher.createParserWithMatch(); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + assertToken(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("field", jp.getCurrentName()); + assertToken(JsonToken.VALUE_TRUE, jp.nextToken()); + assertToken(JsonToken.END_OBJECT, jp.nextToken()); + assertNull(jp.nextToken()); + jp.close(); + } + + /** + * While JSON String is not a strong match alone, it should + * be detected unless some better match is available + */ + public void testSimpleValidString() throws Exception + { + JsonFactory jsonF = new JsonFactory(); + DataFormatDetector detector = new DataFormatDetector(jsonF); + final String JSON = "\"JSON!\""; + final byte[] bytes = JSON.getBytes("UTF-8"); + + _testSimpleValidString(jsonF, detector.findFormat(bytes)); + _testSimpleValidString(jsonF, detector.findFormat(new ByteArrayInputStream(bytes))); + } + + private void _testSimpleValidString(JsonFactory jsonF, DataFormatMatcher matcher) throws Exception + { + // should have match + assertTrue(matcher.hasMatch()); + assertEquals("JSON", matcher.getMatchedFormatName()); + assertSame(jsonF, matcher.getMatch()); + assertEquals(MatchStrength.WEAK_MATCH, matcher.getMatchStrength()); + JsonParser jp = matcher.createParserWithMatch(); + assertToken(JsonToken.VALUE_STRING, jp.nextToken()); + assertEquals("JSON!", jp.getText()); + assertNull(jp.nextToken()); + jp.close(); + } + + public void testSimpleInvalid() throws Exception + { + DataFormatDetector detector = new DataFormatDetector(new JsonFactory()); + final String NON_JSON = ""; + DataFormatMatcher matcher = detector.findFormat(new ByteArrayInputStream(NON_JSON.getBytes("UTF-8"))); + // should not have match + assertFalse(matcher.hasMatch()); + assertNull(matcher.getMatchedFormatName()); + // and thus: + assertEquals(MatchStrength.INCONCLUSIVE, matcher.getMatchStrength()); + // also: + assertNull(matcher.createParserWithMatch()); + } + +} diff --git a/src/test/java/com/fasterxml/jackson/core/fuzz/Fuzz32208UTF32ParseTest.java b/src/test/java/com/fasterxml/jackson/core/fuzz/Fuzz32208UTF32ParseTest.java index b63910b372..8e16d388c3 100644 --- a/src/test/java/com/fasterxml/jackson/core/fuzz/Fuzz32208UTF32ParseTest.java +++ b/src/test/java/com/fasterxml/jackson/core/fuzz/Fuzz32208UTF32ParseTest.java @@ -5,9 +5,7 @@ import java.io.InputStream; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.WrappedIOException; import com.fasterxml.jackson.core.io.UTF32Reader; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.ThrottledInputStream; // Trying to repro: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32216 @@ -18,14 +16,14 @@ public class Fuzz32208UTF32ParseTest extends BaseTest public void testFuzz32208ViaParser() throws Exception { - final JsonFactory f = newStreamFactory(); + final JsonFactory f = new JsonFactory(); - JsonParser p = f.createParser(ObjectReadContext.empty(), DOC); + JsonParser p = f.createParser(/*ObjectReadContext.empty(), */ DOC); try { assertToken(JsonToken.VALUE_STRING, p.nextToken()); String text = p.getText(); fail("Should not have passed; got text with length of: "+text.length()); - } catch (WrappedIOException e) { + } catch (CharConversionException e) { verifyException(e, "Invalid UTF-32 character "); } p.close(); @@ -47,7 +45,7 @@ public void testFuzz32208Direct() throws Exception public void testFuzz32208DirectSingleByte() throws Exception { - UTF32Reader r = new UTF32Reader(null, new ByteArrayInputStream(DOC), true, + UTF32Reader r = new UTF32Reader(null, new ByteArrayInputStream(DOC), new byte[500], 0, 0, false); int count = 0; @@ -67,8 +65,7 @@ private void _testFuzz32208Direct(int readSize) throws Exception { InputStream in = new ThrottledInputStream(DOC, readSize); // apparently input is NOT big-endian so: - UTF32Reader r = new UTF32Reader(null, in, true, - new byte[500], 0, 0, false); + UTF32Reader r = new UTF32Reader(null, in, new byte[500], 0, 0, false); int count = 0; int ch; diff --git a/src/test/java/com/fasterxml/jackson/core/fuzz/Fuzz34435ParseTest.java b/src/test/java/com/fasterxml/jackson/core/fuzz/Fuzz34435ParseTest.java index c3d772b2b5..e83cf3dc4c 100644 --- a/src/test/java/com/fasterxml/jackson/core/fuzz/Fuzz34435ParseTest.java +++ b/src/test/java/com/fasterxml/jackson/core/fuzz/Fuzz34435ParseTest.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; // Trying to repro: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34435 @@ -17,15 +16,15 @@ public void testFuzz34435ViaParser() throws Exception .enable(JsonReadFeature.ALLOW_JAVA_COMMENTS) .enable(JsonReadFeature.ALLOW_YAML_COMMENTS) .enable(JsonReadFeature.ALLOW_SINGLE_QUOTES) - .enable(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES) + .enable(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES) .build(); - JsonParser p = f.createParser(ObjectReadContext.empty(), DOC); + JsonParser p = f.createParser(/*ObjectReadContext.empty(), */ DOC); // Long doc so only check a few initial entries first: for (int i = 0; i < 10; ++i) { assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); } // Beyond that, simply read through to catch expected issue @@ -33,7 +32,7 @@ public void testFuzz34435ViaParser() throws Exception while (p.nextToken() != null) { // but force decoding of Strings switch (p.currentToken()) { - case PROPERTY_NAME: + case FIELD_NAME: p.currentName(); break; case VALUE_STRING: diff --git a/src/test/java/com/fasterxml/jackson/core/io/TestJsonStringEncoder.java b/src/test/java/com/fasterxml/jackson/core/io/TestJsonStringEncoder.java index 7bcb23320a..c916dfb1e9 100644 --- a/src/test/java/com/fasterxml/jackson/core/io/TestJsonStringEncoder.java +++ b/src/test/java/com/fasterxml/jackson/core/io/TestJsonStringEncoder.java @@ -6,7 +6,6 @@ import static org.junit.Assert.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; public class TestJsonStringEncoder extends com.fasterxml.jackson.core.BaseTest @@ -14,9 +13,15 @@ public class TestJsonStringEncoder public void testQuoteAsString() throws Exception { JsonStringEncoder encoder = new JsonStringEncoder(); - char[] result = encoder.quoteAsCharArray("foobar"); + char[] result = encoder.quoteAsString("foobar"); assertArrayEquals("foobar".toCharArray(), result); - result = encoder.quoteAsCharArray("\"x\""); + result = encoder.quoteAsString("\"x\""); + assertArrayEquals("\\\"x\\\"".toCharArray(), result); + + // and simply for sake of code coverage + result = encoder.quoteAsString(new StringBuilder("foobar")); + assertArrayEquals("foobar".toCharArray(), result); + result = encoder.quoteAsString(new StringBuilder("\"x\"")); assertArrayEquals("\\\"x\\\"".toCharArray(), result); } @@ -46,10 +51,9 @@ public void testQuoteLongAsString() throws Exception } String input = sb.toString(); String exp = sb2.toString(); - char[] result = encoder.quoteAsCharArray(input); + char[] result = encoder.quoteAsString(input); assertEquals(2*input.length(), result.length); assertEquals(exp, new String(result)); - } public void testQuoteLongCharSequenceAsString() throws Exception @@ -79,7 +83,7 @@ public void testQuoteAsUTF8() throws Exception for (int length : lengths) { String str = generateRandom(length); StringWriter sw = new StringWriter(length*2); - JsonGenerator jgen = f.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator jgen = f.createGenerator(sw); jgen.writeString(str); jgen.close(); String encoded = sw.toString(); @@ -101,14 +105,17 @@ public void testEncodeAsUTF8() throws Exception generateRandom(39000) }; for (String str : strings) { - assertArrayEquals(str.getBytes("UTF-8"), encoder.encodeAsUTF8(str)); + final byte[] exp = str.getBytes("UTF-8"); + assertArrayEquals(exp, encoder.encodeAsUTF8(str)); + // and for 2.x code coverage (only + assertArrayEquals(exp, encoder.encodeAsUTF8((CharSequence)str)); } } public void testCtrlChars() throws Exception { char[] input = new char[] { 0, 1, 2, 3, 4 }; - char[] quoted = JsonStringEncoder.getInstance().quoteAsCharArray(new String(input)); + char[] quoted = JsonStringEncoder.getInstance().quoteAsString(new String(input)); assertEquals("\\u0000\\u0001\\u0002\\u0003\\u0004", new String(quoted)); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/CustomQuoteCharTest.java b/src/test/java/com/fasterxml/jackson/core/json/CustomQuoteCharTest.java index 128653ed90..148ef58219 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/CustomQuoteCharTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/CustomQuoteCharTest.java @@ -108,7 +108,7 @@ public void testAposQuotingWithByteBased() throws Exception private void _writeObject(JsonGenerator g, String key, String value) throws Exception { g.writeStartObject(); - g.writeStringProperty(key, value); + g.writeStringField(key, value); g.writeEndObject(); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/GeneratorFailFromReaderTest.java b/src/test/java/com/fasterxml/jackson/core/json/GeneratorFailFromReaderTest.java index e2b5d5cf1b..0f5120af23 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/GeneratorFailFromReaderTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/GeneratorFailFromReaderTest.java @@ -1,38 +1,37 @@ package com.fasterxml.jackson.core.json; +import com.fasterxml.jackson.core.JsonEncoding; +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; + import java.io.ByteArrayOutputStream; -import java.io.IOException; import java.io.OutputStreamWriter; import java.io.StringReader; -import com.fasterxml.jackson.core.JsonEncoding; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.ObjectWriteContext; -import com.fasterxml.jackson.core.exc.StreamWriteException; - public class GeneratorFailFromReaderTest extends com.fasterxml.jackson.core.BaseTest { - private final JsonFactory F = newStreamFactory(); + private final JsonFactory F = new JsonFactory(); // [core#177] // Also: should not try writing JSON String if field name expected // (in future maybe take one as alias... but not yet) - public void testFailOnWritingStringNotFieldNameBytes() throws IOException { + public void testFailOnWritingStringNotFieldNameBytes() throws Exception { _testFailOnWritingStringNotFieldName(F, false); } // [core#177] - public void testFailOnWritingStringNotFieldNameChars() throws IOException { + public void testFailOnWritingStringNotFieldNameChars() throws Exception { _testFailOnWritingStringNotFieldName(F, true); } - public void testFailOnWritingStringFromReaderWithTooFewCharacters() throws IOException { + public void testFailOnWritingStringFromReaderWithTooFewCharacters() throws Exception { _testFailOnWritingStringFromReaderWithTooFewCharacters(F, true); _testFailOnWritingStringFromReaderWithTooFewCharacters(F, false); } - public void testFailOnWritingStringFromNullReader() throws IOException { + public void testFailOnWritingStringFromNullReader() throws Exception { _testFailOnWritingStringFromNullReader(F, true); _testFailOnWritingStringFromNullReader(F, false); } @@ -44,15 +43,14 @@ public void testFailOnWritingStringFromNullReader() throws IOException { */ - private void _testFailOnWritingStringNotFieldName(JsonFactory f, boolean useReader) - throws IOException + private void _testFailOnWritingStringNotFieldName(JsonFactory f, boolean useReader) throws Exception { JsonGenerator gen; ByteArrayOutputStream bout = new ByteArrayOutputStream(); if (useReader) { - gen = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bout, "UTF-8")); + gen = f.createGenerator(new OutputStreamWriter(bout, "UTF-8")); } else { - gen = f.createGenerator(ObjectWriteContext.empty(), bout, JsonEncoding.UTF8); + gen = f.createGenerator(bout, JsonEncoding.UTF8); } gen.writeStartObject(); @@ -61,58 +59,54 @@ private void _testFailOnWritingStringNotFieldName(JsonFactory f, boolean useRead gen.writeString(reader, -1); gen.flush(); String json = bout.toString("UTF-8"); - fail("Should not have let "+gen.getClass().getName()+".writeString() be used in place of 'writeName()': output = "+json); - } catch (StreamWriteException e) { - verifyException(e, "cannot write a String"); + fail("Should not have let "+gen.getClass().getName()+".writeString() be used in place of 'writeFieldName()': output = "+json); + } catch (JsonProcessingException e) { + verifyException(e, "can not write a String"); } gen.close(); } - private void _testFailOnWritingStringFromReaderWithTooFewCharacters(JsonFactory f, boolean useReader) - throws IOException - { + private void _testFailOnWritingStringFromReaderWithTooFewCharacters(JsonFactory f, boolean useReader) throws Exception{ JsonGenerator gen; ByteArrayOutputStream bout = new ByteArrayOutputStream(); if (useReader) { - gen = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bout, "UTF-8")); + gen = f.createGenerator(new OutputStreamWriter(bout, "UTF-8")); } else { - gen = f.createGenerator(ObjectWriteContext.empty(), bout, JsonEncoding.UTF8); + gen = f.createGenerator(bout, JsonEncoding.UTF8); } gen.writeStartObject(); try { String testStr = "aaaaaaaaa"; StringReader reader = new StringReader(testStr); - gen.writeName("a"); + gen.writeFieldName("a"); gen.writeString(reader, testStr.length() + 1); gen.flush(); String json = bout.toString("UTF-8"); fail("Should not have let "+gen.getClass().getName()+".writeString() ': output = "+json); - } catch (StreamWriteException e) { + } catch (JsonProcessingException e) { verifyException(e, "Didn't read enough from reader"); } gen.close(); } - private void _testFailOnWritingStringFromNullReader(JsonFactory f, boolean useReader) - throws IOException - { + private void _testFailOnWritingStringFromNullReader(JsonFactory f, boolean useReader) throws Exception{ JsonGenerator gen; ByteArrayOutputStream bout = new ByteArrayOutputStream(); if (useReader) { - gen = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bout, "UTF-8")); + gen = f.createGenerator(new OutputStreamWriter(bout, "UTF-8")); } else { - gen = f.createGenerator(ObjectWriteContext.empty(), bout, JsonEncoding.UTF8); + gen = f.createGenerator(bout, JsonEncoding.UTF8); } gen.writeStartObject(); try { - gen.writeName("a"); + gen.writeFieldName("a"); gen.writeString(null, -1); gen.flush(); String json = bout.toString("UTF-8"); fail("Should not have let "+gen.getClass().getName()+".writeString() ': output = "+json); - } catch (StreamWriteException e) { + } catch (JsonProcessingException e) { verifyException(e, "null reader"); } gen.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/GeneratorFailTest.java b/src/test/java/com/fasterxml/jackson/core/json/GeneratorFailTest.java index d3f116ee74..67ebb2509d 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/GeneratorFailTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/GeneratorFailTest.java @@ -1,21 +1,20 @@ package com.fasterxml.jackson.core.json; import java.io.ByteArrayOutputStream; -import java.io.IOException; import java.io.OutputStreamWriter; import com.fasterxml.jackson.core.JsonEncoding; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.ObjectWriteContext; -import com.fasterxml.jackson.core.exc.StreamWriteException; +import com.fasterxml.jackson.core.JsonProcessingException; public class GeneratorFailTest extends com.fasterxml.jackson.core.BaseTest { - private final JsonFactory F = newStreamFactory(); + private final JsonFactory F = new JsonFactory(); // [core#167]: no error for writing field name twice - public void testDupFieldNameWrites() throws IOException + public void testDupFieldNameWrites() throws Exception { _testDupFieldNameWrites(F, false); _testDupFieldNameWrites(F, true); @@ -24,17 +23,17 @@ public void testDupFieldNameWrites() throws IOException // [core#177] // Also: should not try writing JSON String if field name expected // (in future maybe take one as alias... but not yet) - public void testFailOnWritingStringNotFieldNameBytes() throws IOException { + public void testFailOnWritingStringNotFieldNameBytes() throws Exception { _testFailOnWritingStringNotFieldName(F, false); } // [core#177] - public void testFailOnWritingStringNotFieldNameChars() throws IOException { + public void testFailOnWritingStringNotFieldNameChars() throws Exception { _testFailOnWritingStringNotFieldName(F, true); } // for [core#282] - public void testFailOnWritingFieldNameInRoot() throws IOException { + public void testFailOnWritingFieldNameInRoot() throws Exception { _testFailOnWritingFieldNameInRoot(F, false); _testFailOnWritingFieldNameInRoot(F, true); } @@ -45,68 +44,68 @@ public void testFailOnWritingFieldNameInRoot() throws IOException { /********************************************************** */ - private void _testDupFieldNameWrites(JsonFactory f, boolean useReader) throws IOException + private void _testDupFieldNameWrites(JsonFactory f, boolean useReader) throws Exception { JsonGenerator gen; ByteArrayOutputStream bout = new ByteArrayOutputStream(); if (useReader) { - gen = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bout, "UTF-8")); + gen = f.createGenerator(new OutputStreamWriter(bout, "UTF-8")); } else { - gen = f.createGenerator(ObjectWriteContext.empty(), bout, JsonEncoding.UTF8); + gen = f.createGenerator(bout, JsonEncoding.UTF8); } gen.writeStartObject(); - gen.writeName("a"); + gen.writeFieldName("a"); try { - gen.writeName("b"); + gen.writeFieldName("b"); gen.flush(); - String json = utf8String(bout); - fail("Should not have let two consecutive property name writes succeed: output = "+json); - } catch (StreamWriteException e) { - verifyException(e, "Cannot write a property name, expecting a value"); + String json = bout.toString("UTF-8"); + fail("Should not have let two consecutive field name writes succeed: output = "+json); + } catch (JsonProcessingException e) { + verifyException(e, "can not write a field name, expecting a value"); } gen.close(); } - private void _testFailOnWritingStringNotFieldName(JsonFactory f, boolean useReader) throws IOException + private void _testFailOnWritingStringNotFieldName(JsonFactory f, boolean useReader) throws Exception { JsonGenerator gen; ByteArrayOutputStream bout = new ByteArrayOutputStream(); if (useReader) { - gen = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bout, "UTF-8")); + gen = f.createGenerator(new OutputStreamWriter(bout, "UTF-8")); } else { - gen = f.createGenerator(ObjectWriteContext.empty(), bout, JsonEncoding.UTF8); + gen = f.createGenerator(bout, JsonEncoding.UTF8); } gen.writeStartObject(); try { gen.writeString("a"); gen.flush(); - String json = utf8String(bout); - fail("Should not have let "+gen.getClass().getName()+".writeString() be used in place of 'writeName()': output = "+json); - } catch (StreamWriteException e) { - verifyException(e, "Cannot write a String"); + String json = bout.toString("UTF-8"); + fail("Should not have let "+gen.getClass().getName()+".writeString() be used in place of 'writeFieldName()': output = "+json); + } catch (JsonProcessingException e) { + verifyException(e, "can not write a String"); } gen.close(); } // for [core#282] - private void _testFailOnWritingFieldNameInRoot(JsonFactory f, boolean useReader) throws IOException + private void _testFailOnWritingFieldNameInRoot(JsonFactory f, boolean useReader) throws Exception { JsonGenerator gen; ByteArrayOutputStream bout = new ByteArrayOutputStream(); if (useReader) { - gen = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bout, "UTF-8")); + gen = f.createGenerator(new OutputStreamWriter(bout, "UTF-8")); } else { - gen = f.createGenerator(ObjectWriteContext.empty(), bout, JsonEncoding.UTF8); + gen = f.createGenerator(bout, JsonEncoding.UTF8); } try { - gen.writeName("a"); + gen.writeFieldName("a"); gen.flush(); - String json = utf8String(bout); - fail("Should not have let "+gen.getClass().getName()+".writeName() be used in root context: output = "+json); - } catch (StreamWriteException e) { - verifyException(e, "Cannot write a property name"); + String json = bout.toString("UTF-8"); + fail("Should not have let "+gen.getClass().getName()+".writeFieldName() be used in root context: output = "+json); + } catch (JsonProcessingException e) { + verifyException(e, "can not write a field name"); } gen.close(); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/StreamWriteFeaturesTest.java b/src/test/java/com/fasterxml/jackson/core/json/GeneratorFeaturesTest.java similarity index 59% rename from src/test/java/com/fasterxml/jackson/core/json/StreamWriteFeaturesTest.java rename to src/test/java/com/fasterxml/jackson/core/json/GeneratorFeaturesTest.java index ba48ec90d8..77eaaf9633 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/StreamWriteFeaturesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/GeneratorFeaturesTest.java @@ -5,58 +5,83 @@ import java.math.BigInteger; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamWriteException; /** * Set of basic unit tests for verifying that the basic generator * functionality works as expected. */ -public class StreamWriteFeaturesTest +public class GeneratorFeaturesTest extends com.fasterxml.jackson.core.BaseTest { private final JsonFactory JSON_F = new JsonFactory(); - public void testConfigDefaults() + @SuppressWarnings("deprecation") + public void testConfigDefaults() throws IOException { - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), new StringWriter()); - assertFalse(((JsonGeneratorBase) g).isEnabled(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS)); + JsonGenerator g = JSON_F.createGenerator(new StringWriter()); + assertFalse(g.isEnabled(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS)); + + assertFalse(g.isEnabled(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN)); assertFalse(g.isEnabled(StreamWriteFeature.WRITE_BIGDECIMAL_AS_PLAIN)); - assertTrue(g.canOmitProperties()); + assertTrue(g.canOmitFields()); + assertFalse(g.canWriteBinaryNatively()); + assertTrue(g.canWriteFormattedNumbers()); assertFalse(g.canWriteObjectId()); assertFalse(g.canWriteTypeId()); g.close(); } - public void testFieldNameQuoting() + @SuppressWarnings("deprecation") + public void testConfigOverrides() throws IOException + { + // but also allow overide + JsonGenerator g = JSON_F.createGenerator(new StringWriter()); + int mask = JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS.getMask() + | JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN.getMask(); + g.overrideStdFeatures(mask, mask); + assertTrue(g.isEnabled(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS)); + assertTrue(g.isEnabled(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN)); + assertTrue(g.isEnabled(StreamWriteFeature.WRITE_BIGDECIMAL_AS_PLAIN)); + + // and for now, also test straight override + g.setFeatureMask(0); + assertFalse(g.isEnabled(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS)); + assertFalse(g.isEnabled(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN)); + assertFalse(g.isEnabled(StreamWriteFeature.WRITE_BIGDECIMAL_AS_PLAIN)); + g.close(); + } + + public void testFieldNameQuoting() throws IOException { JsonFactory f = new JsonFactory(); // by default, quoting should be enabled _testFieldNameQuoting(f, true); // can disable it - f = f.rebuild().disable(JsonWriteFeature.QUOTE_PROPERTY_NAMES) + f = JsonFactory.builder() + .disable(JsonWriteFeature.QUOTE_FIELD_NAMES) .build(); _testFieldNameQuoting(f, false); // and (re)enable: - f = f.rebuild() - .enable(JsonWriteFeature.QUOTE_PROPERTY_NAMES) + f = JsonFactory.builder() + .enable(JsonWriteFeature.QUOTE_FIELD_NAMES) .build(); _testFieldNameQuoting(f, true); } - public void testNonNumericQuoting() + public void testNonNumericQuoting() throws IOException { JsonFactory f = new JsonFactory(); // by default, quoting should be enabled - assertTrue(f.isEnabled(JsonWriteFeature.WRITE_NAN_AS_STRINGS)); _testNonNumericQuoting(f, true); // can disable it - f = f.rebuild().disable(JsonWriteFeature.WRITE_NAN_AS_STRINGS) + f = JsonFactory.builder() + .disable(JsonWriteFeature.WRITE_NAN_AS_STRINGS) .build(); _testNonNumericQuoting(f, false); // and (re)enable: - f = f.rebuild() + f = JsonFactory.builder() .enable(JsonWriteFeature.WRITE_NAN_AS_STRINGS) .build(); _testNonNumericQuoting(f, true); @@ -66,7 +91,7 @@ public void testNonNumericQuoting() * Testing for [JACKSON-176], ability to force serializing numbers * as JSON Strings. */ - public void testNumbersAsJSONStrings() + public void testNumbersAsJSONStrings() throws IOException { JsonFactory f = new JsonFactory(); // by default should output numbers as-is: @@ -74,79 +99,82 @@ public void testNumbersAsJSONStrings() assertEquals("[1,2,3,1.25,2.25,3001,0.5,-1,12.3,null,null,null]", _writeNumbers(f, true)); // but if overridden, quotes as Strings - f = f.rebuild().configure(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS, true) + f = JsonFactory.builder() + .enable(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS) .build(); assertEquals("[\"1\",\"2\",\"3\",\"1.25\",\"2.25\",\"3001\",\"0.5\",\"-1\",\"12.3\",null,null,null]", _writeNumbers(f, false)); assertEquals("[\"1\",\"2\",\"3\",\"1.25\",\"2.25\",\"3001\",\"0.5\",\"-1\",\"12.3\",null,null,null]", _writeNumbers(f, true)); + + } - public void testBigDecimalAsPlain() + public void testBigDecimalAsPlain() throws IOException { JsonFactory f = new JsonFactory(); BigDecimal ENG = new BigDecimal("1E+2"); StringWriter sw = new StringWriter(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator g = f.createGenerator(sw); g.writeNumber(ENG); g.close(); assertEquals("1E+2", sw.toString()); - f = f.rebuild().enable(StreamWriteFeature.WRITE_BIGDECIMAL_AS_PLAIN) - .build(); + f.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true); sw = new StringWriter(); - g = f.createGenerator(ObjectWriteContext.empty(), sw); + g = f.createGenerator(sw); g.writeNumber(ENG); g.close(); assertEquals("100", sw.toString()); } - public void testBigDecimalAsPlainString() + public void testBigDecimalAsPlainString() throws Exception { - JsonFactory f = new JsonFactory(); BigDecimal ENG = new BigDecimal("1E+2"); - f = f.rebuild().enable(StreamWriteFeature.WRITE_BIGDECIMAL_AS_PLAIN) + JsonFactory f = JsonFactory.builder() + .enable(StreamWriteFeature.WRITE_BIGDECIMAL_AS_PLAIN) .enable(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS) .build(); + StringWriter sw = new StringWriter(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator g = f.createGenerator(sw); g.writeNumber(ENG); g.close(); assertEquals(quote("100"), sw.toString()); // also, as bytes ByteArrayOutputStream bos = new ByteArrayOutputStream(); - g = f.createGenerator(ObjectWriteContext.empty(), bos); + g = f.createGenerator(bos); g.writeNumber(ENG); g.close(); - try { - assertEquals(quote("100"), bos.toString("UTF-8")); - } catch (IOException e) { - throw new RuntimeException(e); - } + assertEquals(quote("100"), bos.toString("UTF-8")); } // [core#315] - public void testTooBigBigDecimal() + @SuppressWarnings("deprecation") + public void testTooBigBigDecimal() throws Exception { + JsonFactory f = new JsonFactory(); + f.enable(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN); + // 24-Aug-2016, tatu: Initial check limits scale to [-9999,+9999] BigDecimal BIG = new BigDecimal("1E+9999"); BigDecimal TOO_BIG = new BigDecimal("1E+10000"); BigDecimal SMALL = new BigDecimal("1E-9999"); BigDecimal TOO_SMALL = new BigDecimal("1E-10000"); - for (boolean asString : new boolean[] { false, true } ) { - for (boolean useBytes : new boolean[] { false, true } ) { - JsonFactory f = JsonFactory.builder() - .enable(StreamWriteFeature.WRITE_BIGDECIMAL_AS_PLAIN) - .configure(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS, asString) - .build(); + for (boolean useBytes : new boolean[] { false, true } ) { + for (boolean asString : new boolean[] { false, true } ) { JsonGenerator g; + if (useBytes) { - g = f.createGenerator(ObjectWriteContext.empty(), new ByteArrayOutputStream()); + g = f.createGenerator(new ByteArrayOutputStream()); } else { - g = f.createGenerator(ObjectWriteContext.empty(), new StringWriter()); + g = f.createGenerator(new StringWriter()); + } + if (asString) { + g.enable(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS); } // first, ok cases: @@ -159,14 +187,17 @@ public void testTooBigBigDecimal() // then invalid for (BigDecimal input : new BigDecimal[] { TOO_BIG, TOO_SMALL }) { if (useBytes) { - g = f.createGenerator(ObjectWriteContext.empty(), new ByteArrayOutputStream()); + g = f.createGenerator(new ByteArrayOutputStream()); } else { - g = f.createGenerator(ObjectWriteContext.empty(), new StringWriter()); + g = f.createGenerator(new StringWriter()); + } + if (asString) { + g.enable(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS); } try { g.writeNumber(input); fail("Should not have written without exception: "+input); - } catch (StreamWriteException e) { + } catch (JsonGenerationException e) { verifyException(e, "Attempt to write plain `java.math.BigDecimal`"); verifyException(e, "illegal scale"); } @@ -176,15 +207,15 @@ public void testTooBigBigDecimal() } } - private String _writeNumbers(JsonFactory f, boolean useBytes) + private String _writeNumbers(JsonFactory f, boolean useBytes) throws IOException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); StringWriter sw = new StringWriter(); JsonGenerator g; if (useBytes) { - g = f.createGenerator(ObjectWriteContext.empty(), bytes); + g = f.createGenerator(bytes); } else { - g = f.createGenerator(ObjectWriteContext.empty(), sw); + g = f.createGenerator(sw); } g.writeStartArray(); @@ -203,11 +234,11 @@ private String _writeNumbers(JsonFactory f, boolean useBytes) g.writeEndArray(); g.close(); - return useBytes ? utf8String(bytes) : sw.toString(); + return useBytes ? bytes.toString("UTF-8") : sw.toString(); } // for [core#246] - public void testFieldNameQuotingEnabled() + public void testFieldNameQuotingEnabled() throws IOException { // // First, test with default factory, with quoting enabled by default @@ -222,7 +253,7 @@ public void testFieldNameQuotingEnabled() // // Then with alternatively configured factory JsonFactory f2 = JsonFactory.builder() - .disable(JsonWriteFeature.QUOTE_PROPERTY_NAMES) + .disable(JsonWriteFeature.QUOTE_FIELD_NAMES) .build(); _testFieldNameQuotingEnabled(f2, true, true, "{\"foo\":1}"); @@ -233,34 +264,50 @@ public void testFieldNameQuotingEnabled() _testFieldNameQuotingEnabled(f2, false, false, "{foo:1}"); } + @SuppressWarnings("deprecation") private void _testFieldNameQuotingEnabled(JsonFactory f, boolean useBytes, - boolean useQuotes, String exp) + boolean useQuotes, String exp) throws IOException { + ByteArrayOutputStream bytes = useBytes ? new ByteArrayOutputStream() : null; + StringWriter sw = useBytes ? null : new StringWriter(); + JsonGenerator gen = useBytes ? f.createGenerator(bytes) : f.createGenerator(sw); if (useQuotes) { - f = f.rebuild() - .enable(JsonWriteFeature.QUOTE_PROPERTY_NAMES) - .build(); + gen.enable(JsonGenerator.Feature.QUOTE_FIELD_NAMES); } else { - f = f.rebuild() - .disable(JsonWriteFeature.QUOTE_PROPERTY_NAMES) - .build(); + gen.disable(JsonGenerator.Feature.QUOTE_FIELD_NAMES); } - ByteArrayOutputStream bytes = useBytes ? new ByteArrayOutputStream() : null; - StringWriter sw = useBytes ? null : new StringWriter(); - JsonGenerator gen = useBytes ? f.createGenerator(ObjectWriteContext.empty(),bytes) - : f.createGenerator(ObjectWriteContext.empty(), sw); - gen.writeStartObject(); - gen.writeName("foo"); + gen.writeFieldName("foo"); gen.writeNumber(1); gen.writeEndObject(); gen.close(); - String json = useBytes ? utf8String(bytes) : sw.toString(); + String json = useBytes ? bytes.toString("UTF-8") : sw.toString(); assertEquals(exp, json); } + @SuppressWarnings("deprecation") + public void testChangeOnGenerator() throws IOException + { + StringWriter w = new StringWriter(); + + JsonGenerator g = JSON_F.createGenerator(w); + g.enable(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS); + g.writeNumber(123); + g.close(); + assertEquals(quote("123"), w.toString()); + + // but also the opposite + w = new StringWriter(); + g = JSON_F.createGenerator(w); + g.enable(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS); + g.disable(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS); + g.writeNumber(123); + g.close(); + assertEquals("123", w.toString()); + } + /* /********************************************************** /* Helper methods @@ -268,11 +315,12 @@ private void _testFieldNameQuotingEnabled(JsonFactory f, boolean useBytes, */ private void _testFieldNameQuoting(JsonFactory f, boolean quoted) + throws IOException { StringWriter sw = new StringWriter(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator g = f.createGenerator(sw); g.writeStartObject(); - g.writeName("foo"); + g.writeFieldName("foo"); g.writeNumber(1); g.writeEndObject(); g.close(); @@ -285,15 +333,16 @@ private void _testFieldNameQuoting(JsonFactory f, boolean quoted) } } private void _testNonNumericQuoting(JsonFactory f, boolean quoted) + throws IOException { StringWriter sw = new StringWriter(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator g = f.createGenerator(sw); g.writeStartObject(); - g.writeName("double"); + g.writeFieldName("double"); g.writeNumber(Double.NaN); g.writeEndObject(); g.writeStartObject(); - g.writeName("float"); + g.writeFieldName("float"); g.writeNumber(Float.NaN); g.writeEndObject(); g.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/JsonFactoryTest.java b/src/test/java/com/fasterxml/jackson/core/json/JsonFactoryTest.java index 1b201c88a6..e33e0204e7 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/JsonFactoryTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/JsonFactoryTest.java @@ -1,15 +1,101 @@ package com.fasterxml.jackson.core.json; import java.io.*; -import java.nio.charset.StandardCharsets; -import java.nio.file.*; +import java.util.Iterator; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.io.SerializedString; +import com.fasterxml.jackson.core.type.ResolvedType; +import com.fasterxml.jackson.core.type.TypeReference; public class JsonFactoryTest extends com.fasterxml.jackson.core.BaseTest { + static class BogusCodec extends ObjectCodec { + @Override + public Version version() { return null; } + + @Override + public T readValue(JsonParser p, Class valueType) throws IOException { + return null; + } + + @Override + public T readValue(JsonParser p, TypeReference valueTypeRef) throws IOException { + return null; + } + + @Override + public T readValue(JsonParser p, ResolvedType valueType) throws IOException { + return null; + } + + @Override + public Iterator readValues(JsonParser p, Class valueType) throws IOException { + return null; + } + + @Override + public Iterator readValues(JsonParser p, TypeReference valueTypeRef) throws IOException { + return null; + } + + @Override + public Iterator readValues(JsonParser p, ResolvedType valueType) throws IOException { + return null; + } + + @Override + public void writeValue(JsonGenerator gen, Object value) throws IOException { + } + + @Override + public T readTree(JsonParser p) throws IOException { + return null; + } + + @Override + public void writeTree(JsonGenerator gen, TreeNode tree) throws IOException { + } + + @Override + public TreeNode createObjectNode() { + return null; + } + + @Override + public TreeNode createArrayNode() { + return null; + } + + @Override + public JsonParser treeAsTokens(TreeNode n) { + return null; + } + + @Override + public T treeToValue(TreeNode n, Class valueType) throws JsonProcessingException { + return null; + } + + @Override + public TreeNode missingNode() { + return null; + } + + @Override + public TreeNode nullNode() { + return null; + } + } + + // for testing [core#460] + @SuppressWarnings("serial") + static class CustomFactory extends JsonFactory { + public CustomFactory(JsonFactory f, ObjectCodec codec) { + super(f, codec); + } + } + static class BogusSchema implements FormatSchema { @Override @@ -24,49 +110,36 @@ public String getSchemaType() { /********************************************************************** */ - final JsonFactory JSON_F = newStreamFactory(); - - public void testStreamWriteFeatures() throws Exception + final JsonFactory JSON_F = sharedStreamFactory(); + + @SuppressWarnings("deprecation") + public void testGeneratorFeatures() throws Exception { - JsonFactory f = JsonFactory.builder() - .enable(StreamWriteFeature.IGNORE_UNKNOWN) - .build(); - assertTrue(f.isEnabled(StreamWriteFeature.IGNORE_UNKNOWN)); - f = f.rebuild().configure(StreamWriteFeature.IGNORE_UNKNOWN, false) - .build(); - assertFalse(f.isEnabled(StreamWriteFeature.IGNORE_UNKNOWN)); - } + assertNull(JSON_F.getCodec()); - public void testJsonWriteFeatures() throws Exception - { JsonFactory f = JsonFactory.builder() - .enable(JsonWriteFeature.QUOTE_PROPERTY_NAMES) + .configure(JsonWriteFeature.QUOTE_FIELD_NAMES, true) .build(); - assertTrue(f.isEnabled(JsonWriteFeature.QUOTE_PROPERTY_NAMES)); - f = f.rebuild().configure(JsonWriteFeature.QUOTE_PROPERTY_NAMES, false) + // 24-Oct-2018, tatu: Until 3.x, we'll only have backwards compatible + assertTrue(f.isEnabled(JsonGenerator.Feature.QUOTE_FIELD_NAMES)); + f = JsonFactory.builder() + .configure(JsonWriteFeature.QUOTE_FIELD_NAMES, false) .build(); - assertFalse(f.isEnabled(JsonWriteFeature.QUOTE_PROPERTY_NAMES)); + assertFalse(f.isEnabled(JsonGenerator.Feature.QUOTE_FIELD_NAMES)); } - + public void testFactoryFeatures() throws Exception { JsonFactory f = JsonFactory.builder() - .enable(TokenStreamFactory.Feature.INTERN_PROPERTY_NAMES) + .configure(JsonFactory.Feature.INTERN_FIELD_NAMES, false) .build(); - assertTrue(f.isEnabled(JsonFactory.Feature.INTERN_PROPERTY_NAMES)); - - f = f.rebuild() - .disable(JsonFactory.Feature.INTERN_PROPERTY_NAMES) - .build(); - assertFalse(f.isEnabled(JsonFactory.Feature.INTERN_PROPERTY_NAMES)); + assertFalse(f.isEnabled(JsonFactory.Feature.INTERN_FIELD_NAMES)); // by default, should be enabled assertTrue(f.isEnabled(JsonFactory.Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING)); - f = f.rebuild().disable(JsonFactory.Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING) - .build(); - assertFalse(f.isEnabled(JsonFactory.Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING)); - assertFalse(f.canHandleBinaryNatively()); + assertFalse(JSON_F.requiresCustomCodec()); + assertFalse(JSON_F.canHandleBinaryNatively()); } public void testFactoryMisc() throws Exception @@ -77,8 +150,11 @@ public void testFactoryMisc() throws Exception assertFalse(JSON_F.canUseSchema(null)); assertFalse(JSON_F.canUseSchema(new BogusSchema())); - assertEquals(JsonReadFeature.class, JSON_F.getFormatReadFeatureType()); - assertEquals(JsonWriteFeature.class, JSON_F.getFormatWriteFeatureType()); + assertNull(JSON_F.getFormatReadFeatureType()); + assertNull(JSON_F.getFormatWriteFeatureType()); + + assertEquals(0, JSON_F.getFormatParserFeatures()); + assertEquals(0, JSON_F.getFormatGeneratorFeatures()); } // for [core#189]: verify that it's ok to disable recycling @@ -90,11 +166,12 @@ public void testDisablingBufferRecycling() throws Exception JsonFactory f = JsonFactory.builder() .disable(JsonFactory.Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING) .build(); + assertFalse(f.isEnabled(JsonFactory.Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING)); // First, generation for (int i = 0; i < 3; ++i) { StringWriter w = new StringWriter(); - JsonGenerator gen = f.createGenerator(ObjectWriteContext.empty(), w); + JsonGenerator gen = f.createGenerator(w); gen.writeStartObject(); gen.writeEndObject(); gen.close(); @@ -103,7 +180,7 @@ public void testDisablingBufferRecycling() throws Exception for (int i = 0; i < 3; ++i) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator gen = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator gen = f.createGenerator(bytes); gen.writeStartArray(); gen.writeEndArray(); gen.close(); @@ -112,13 +189,13 @@ public void testDisablingBufferRecycling() throws Exception // Then parsing: for (int i = 0; i < 3; ++i) { - JsonParser p = f.createParser(ObjectReadContext.empty(), "{}"); + JsonParser p = f.createParser("{}"); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertNull(p.nextToken()); p.close(); - p = f.createParser(ObjectReadContext.empty(), "{}".getBytes("UTF-8")); + p = f.createParser("{}".getBytes("UTF-8")); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertNull(p.nextToken()); @@ -134,227 +211,81 @@ public void testJsonWithFiles() throws Exception JsonFactory f = new JsonFactory(); // First: create file via generator.. and use an odd encoding - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), file, JsonEncoding.UTF16_LE); - g.writeStartObject(); - g.writeRaw(" "); - g.writeEndObject(); - g.close(); + JsonGenerator jg = f.createGenerator(file, JsonEncoding.UTF16_LE); + jg.writeStartObject(); + jg.writeRaw(" "); + jg.writeEndObject(); + jg.close(); // Ok: first read file directly - JsonParser p = f.createParser(ObjectReadContext.empty(), file); - assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertNull(p.nextToken()); - p.close(); + JsonParser jp = f.createParser(file); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + assertToken(JsonToken.END_OBJECT, jp.nextToken()); + assertNull(jp.nextToken()); + jp.close(); // Then via URL: - p = f.createParser(ObjectReadContext.empty(), file.toURI().toURL()); - assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertNull(p.nextToken()); - p.close(); + jp = f.createParser(file.toURI().toURL()); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + assertToken(JsonToken.END_OBJECT, jp.nextToken()); + assertNull(jp.nextToken()); + jp.close(); // ok, delete once we are done file.delete(); } + // #72 + @SuppressWarnings("deprecation") public void testCopy() throws Exception { - JsonFactory f = new JsonFactory(); + JsonFactory jf = new JsonFactory(); // first, verify defaults + assertNull(jf.getCodec()); + assertTrue(jf.isEnabled(JsonFactory.Feature.INTERN_FIELD_NAMES)); + assertFalse(jf.isEnabled(JsonParser.Feature.ALLOW_COMMENTS)); + assertFalse(jf.isEnabled(JsonGenerator.Feature.ESCAPE_NON_ASCII)); - // since 3.0: - assertFalse(f.isEnabled(JsonFactory.Feature.INTERN_PROPERTY_NAMES)); - assertFalse(f.isEnabled(JsonReadFeature.ALLOW_JAVA_COMMENTS)); - assertFalse(f.isEnabled(JsonWriteFeature.ESCAPE_NON_ASCII)); - - f = f.rebuild() - .enable(JsonFactory.Feature.INTERN_PROPERTY_NAMES) + // then change, verify that changes "stick" + jf = JsonFactory.builder() + .disable(JsonFactory.Feature.INTERN_FIELD_NAMES) .enable(JsonReadFeature.ALLOW_JAVA_COMMENTS) .enable(JsonWriteFeature.ESCAPE_NON_ASCII) .build(); - // then change, verify that changes "stick" - assertTrue(f.isEnabled(JsonFactory.Feature.INTERN_PROPERTY_NAMES)); - assertTrue(f.isEnabled(JsonReadFeature.ALLOW_JAVA_COMMENTS)); - assertTrue(f.isEnabled(JsonWriteFeature.ESCAPE_NON_ASCII)); - - JsonFactory jf2 = f.copy(); - assertTrue(jf2.isEnabled(JsonFactory.Feature.INTERN_PROPERTY_NAMES)); - assertTrue(f.isEnabled(JsonReadFeature.ALLOW_JAVA_COMMENTS)); - assertTrue(f.isEnabled(JsonWriteFeature.ESCAPE_NON_ASCII)); + ObjectCodec codec = new BogusCodec(); + jf.setCodec(codec); + + assertFalse(jf.isEnabled(JsonFactory.Feature.INTERN_FIELD_NAMES)); + assertTrue(jf.isEnabled(JsonParser.Feature.ALLOW_COMMENTS)); + assertTrue(jf.isEnabled(JsonGenerator.Feature.ESCAPE_NON_ASCII)); + assertSame(codec, jf.getCodec()); + + JsonFactory jf2 = jf.copy(); + assertFalse(jf2.isEnabled(JsonFactory.Feature.INTERN_FIELD_NAMES)); + assertTrue(jf2.isEnabled(JsonParser.Feature.ALLOW_COMMENTS)); + assertTrue(jf2.isEnabled(JsonGenerator.Feature.ESCAPE_NON_ASCII)); + // 16-May-2018, tatu: But! Note that despited [core#460], this should NOT copy it back + assertNull(jf2.getCodec()); + + // However: real copy constructor SHOULD copy it + JsonFactory jf3 = new CustomFactory(jf, codec); + assertSame(codec, jf3.getCodec()); } public void testRootValues() throws Exception { - assertEquals(" ", JSON_F.getRootValueSeparator()); - JsonFactoryBuilder b = JsonFactory.builder() - .rootValueSeparator("/"); - assertEquals(new SerializedString("/"), b.rootValueSeparator()); - JsonFactory f = b.build(); + JsonFactory f = new JsonFactory(); + assertEquals(" ", f.getRootValueSeparator()); + f.setRootValueSeparator("/"); assertEquals("/", f.getRootValueSeparator()); // but also test it is used StringWriter w = new StringWriter(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), w); + JsonGenerator g = f.createGenerator(w); g.writeNumber(1); g.writeNumber(2); g.writeNumber(3); g.close(); assertEquals("1/2/3", w.toString()); } - - public void test_createGenerator_OutputStream() throws Exception - { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - JsonGenerator jsonGenerator = new JsonFactory() - .createGenerator(ObjectWriteContext.empty(), outputStream); - - jsonGenerator.writeString("value"); - jsonGenerator.close(); - - assertEquals(new String(outputStream.toByteArray(), StandardCharsets.UTF_8), "\"value\""); - - // the stream has not been closed by close - outputStream.write(1); - } - - public void test_createGenerator_File() throws Exception - { - Path path = Files.createTempFile("", ""); - JsonGenerator jsonGenerator = new JsonFactory() - .createGenerator(ObjectWriteContext.empty(), path.toFile(), JsonEncoding.UTF8); - - jsonGenerator.writeString("value"); - jsonGenerator.close(); - - assertEquals(new String(Files.readAllBytes(path), StandardCharsets.UTF_8), "\"value\""); - } - - public void test_createGenerator_Path() throws Exception - { - Path path = Files.createTempFile("", ""); - JsonGenerator jsonGenerator = new JsonFactory() - .createGenerator(ObjectWriteContext.empty(), path, JsonEncoding.UTF8); - - jsonGenerator.writeString("value"); - jsonGenerator.close(); - - assertEquals(new String(Files.readAllBytes(path), StandardCharsets.UTF_8), "\"value\""); - } - - public void test_createGenerator_Writer() throws Exception - { - Writer writer = new StringWriter(); - JsonGenerator jsonGenerator = new JsonFactory() - .createGenerator(ObjectWriteContext.empty(), writer); - - jsonGenerator.writeString("value"); - jsonGenerator.close(); - - assertEquals(writer.toString(), "\"value\""); - - // the writer has not been closed by close - writer.append('1'); - } - - public void test_createGenerator_DataOutput() throws Exception - { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - DataOutput dataOutput = new DataOutputStream(outputStream); - JsonGenerator jsonGenerator = new JsonFactory() - .createGenerator(ObjectWriteContext.empty(), dataOutput); - - jsonGenerator.writeString("value"); - jsonGenerator.close(); - - assertEquals(new String(outputStream.toByteArray(), StandardCharsets.UTF_8), "\"value\""); - - // the data output has not been closed by close - dataOutput.write(1); - } - - public void test_createParser_InputStream() throws Exception - { - InputStream inputStream = new ByteArrayInputStream("\"value\"".getBytes(StandardCharsets.UTF_8)); - JsonParser jsonParser = new JsonFactory() - .createParser(ObjectReadContext.empty(), inputStream); - - assertEquals(jsonParser.nextTextValue(), "value"); - } - - public void test_createParser_File() throws Exception - { - Path path = Files.createTempFile("", ""); - Files.write(path, "\"value\"".getBytes(StandardCharsets.UTF_8)); - JsonParser jsonParser = new JsonFactory() - .createParser(ObjectReadContext.empty(), path.toFile()); - - assertEquals(jsonParser.nextTextValue(), "value"); - } - - public void test_createParser_Path() throws Exception - { - Path path = Files.createTempFile("", ""); - Files.write(path, "\"value\"".getBytes(StandardCharsets.UTF_8)); - JsonParser jsonParser = new JsonFactory() - .createParser(ObjectReadContext.empty(), path); - - assertEquals(jsonParser.nextTextValue(), "value"); - } - - public void test_createParser_Url() throws Exception - { - Path path = Files.createTempFile("", ""); - Files.write(path, "\"value\"".getBytes(StandardCharsets.UTF_8)); - JsonParser jsonParser = new JsonFactory() - .createParser(ObjectReadContext.empty(), path.toUri().toURL()); - - assertEquals(jsonParser.nextTextValue(), "value"); - } - - public void test_createParser_Reader() throws Exception - { - Reader reader = new StringReader("\"value\""); - JsonParser jsonParser = new JsonFactory() - .createParser(ObjectReadContext.empty(), reader); - - assertEquals(jsonParser.nextTextValue(), "value"); - } - - public void test_createParser_ByteArray() throws Exception - { - byte[] bytes = "\"value\"".getBytes(StandardCharsets.UTF_8); - JsonParser jsonParser = new JsonFactory() - .createParser(ObjectReadContext.empty(), bytes); - - assertEquals(jsonParser.nextTextValue(), "value"); - } - - public void test_createParser_String() throws Exception - { - String string = "\"value\""; - JsonParser jsonParser = new JsonFactory() - .createParser(ObjectReadContext.empty(), string); - - assertEquals(jsonParser.nextTextValue(), "value"); - } - - public void test_createParser_CharArray() throws Exception - { - char[] chars = "\"value\"".toCharArray(); - JsonParser jsonParser = new JsonFactory() - .createParser(ObjectReadContext.empty(), chars); - - assertEquals(jsonParser.nextTextValue(), "value"); - } - - public void test_createParser_DataInput() throws Exception - { - InputStream inputStream = new ByteArrayInputStream("\"value\"".getBytes(StandardCharsets.UTF_8)); - DataInput dataInput = new DataInputStream(inputStream); - JsonParser jsonParser = new JsonFactory() - .createParser(ObjectReadContext.empty(), dataInput); - - assertEquals(jsonParser.nextTextValue(), "value"); - } } diff --git a/src/test/java/com/fasterxml/jackson/core/json/JsonParserClosedCaseTest.java b/src/test/java/com/fasterxml/jackson/core/json/JsonParserClosedCaseTest.java index 383947b8a8..06483ba4be 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/JsonParserClosedCaseTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/JsonParserClosedCaseTest.java @@ -5,8 +5,8 @@ import java.util.Collection; import java.util.List; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.ObjectReadContext; import com.fasterxml.jackson.core.io.SerializedString; import com.fasterxml.jackson.core.testsupport.MockDataInput; @@ -35,11 +35,11 @@ public class JsonParserClosedCaseTest { @Parameters(name = "{0}") public static Collection parsers() throws IOException { ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] { '{', '}' }); - ObjectReadContext ctxt = ObjectReadContext.empty(); + return closeParsers( - JSON_F.createParser(ctxt, new InputStreamReader(inputStream)), - JSON_F.createParser(ctxt, inputStream), - JSON_F.createParser(ctxt, new MockDataInput("{}")) + (ReaderBasedJsonParser) JSON_F.createParser(new InputStreamReader(inputStream)), + (UTF8StreamJsonParser) JSON_F.createParser(inputStream), + (UTF8DataInputJsonParser) JSON_F.createParser(new MockDataInput("{}")) ); } @@ -49,12 +49,12 @@ public JsonParserClosedCaseTest(String parserName, JsonParser parser) { @Test public void testNullReturnedOnClosedParserOnNextFieldName() throws Exception { - Assert.assertNull(parser.nextName()); + Assert.assertNull(parser.nextFieldName()); } @Test public void testFalseReturnedOnClosedParserOnNextFieldNameSerializedString() throws Exception { - Assert.assertFalse(parser.nextName(new SerializedString(""))); + Assert.assertFalse(parser.nextFieldName(new SerializedString(""))); } @Test diff --git a/src/test/java/com/fasterxml/jackson/core/json/JsonReadContextTest.java b/src/test/java/com/fasterxml/jackson/core/json/JsonReadContextTest.java index c21aa3790b..122b911920 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/JsonReadContextTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/JsonReadContextTest.java @@ -1,36 +1,35 @@ package com.fasterxml.jackson.core.json; +import com.fasterxml.jackson.core.BaseTest; import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.exc.StreamReadException; +import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.io.ContentReference; /** * Unit tests for class {@link JsonReadContext}. */ -public class JsonReadContextTest - extends com.fasterxml.jackson.core.BaseTest +public class JsonReadContextTest extends BaseTest { - public void testSetCurrentNameTwiceWithSameName() + public void testSetCurrentNameTwiceWithSameNameRaisesJsonParseException() throws Exception { - final String PROP_NAME = "dupField"; DupDetector dupDetector = DupDetector.rootDetector((JsonGenerator) null); JsonReadContext jsonReadContext = new JsonReadContext((JsonReadContext) null, dupDetector, 2441, 2441, 2441); - jsonReadContext.setCurrentName(PROP_NAME); + jsonReadContext.setCurrentName("dupField"); try { - jsonReadContext.setCurrentName(PROP_NAME); - } catch (StreamReadException e) { - verifyException(e, "Duplicate Object property \""+PROP_NAME+"\""); - verifyException(e, PROP_NAME); + jsonReadContext.setCurrentName("dupField"); + fail("Should not pass"); + } catch (JsonParseException e) { + verifyException(e, "Duplicate field 'dupField'"); } } - public void testSetCurrentName() + public void testSetCurrentName() throws Exception { JsonReadContext jsonReadContext = JsonReadContext.createRootContext(0, 0, (DupDetector) null); jsonReadContext.setCurrentName("abc"); - assertEquals("abc", jsonReadContext.currentName()); + assertEquals("abc", jsonReadContext.getCurrentName()); jsonReadContext.setCurrentName(null); - assertNull(jsonReadContext.currentName()); + assertNull(jsonReadContext.getCurrentName()); } public void testReset() @@ -51,4 +50,5 @@ public void testReset() assertEquals(500, jsonReadContext.startLocation(bogusSrc).getLineNr()); assertEquals(200, jsonReadContext.startLocation(bogusSrc).getColumnNr()); } + } \ No newline at end of file diff --git a/src/test/java/com/fasterxml/jackson/core/json/RawValueWithSurrogatesTest.java b/src/test/java/com/fasterxml/jackson/core/json/RawValueWithSurrogatesTest.java index 5251522e28..e94e4edbc9 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/RawValueWithSurrogatesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/RawValueWithSurrogatesTest.java @@ -1,9 +1,8 @@ package com.fasterxml.jackson.core.json; import java.io.ByteArrayOutputStream; - +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.ObjectWriteContext; public class RawValueWithSurrogatesTest extends com.fasterxml.jackson.core.BaseTest @@ -75,7 +74,7 @@ private void _testRawWithSurrogatesString(boolean useCharArray) throws Exception sb.append(SURROGATES_307); final String text = sb.toString(); ByteArrayOutputStream out = new ByteArrayOutputStream(1000); - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), out); + JsonGenerator g = JSON_F.createGenerator(out); if (useCharArray) { char[] ch = text.toCharArray(); g.writeRawValue(ch, OFFSET, ch.length - OFFSET); diff --git a/src/test/java/com/fasterxml/jackson/core/json/RequestPayloadOnExceptionTest.java b/src/test/java/com/fasterxml/jackson/core/json/RequestPayloadOnExceptionTest.java new file mode 100644 index 0000000000..7fbc717eaf --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/core/json/RequestPayloadOnExceptionTest.java @@ -0,0 +1,144 @@ +package com.fasterxml.jackson.core.json; + +import com.fasterxml.jackson.core.*; + +public class RequestPayloadOnExceptionTest extends BaseTest +{ + /** + * Tests for Request payload data (bytes) on parsing error + */ + public void testRequestPayloadAsBytesOnParseException() throws Exception { + testRequestPayloadAsBytesOnParseExceptionInternal(true, "nul"); + testRequestPayloadAsBytesOnParseExceptionInternal(false, "nul"); + } + + /** + * Tests for Request payload data (String) on parsing error + */ + public void testRequestPayloadAsStringOnParseException() throws Exception { + testRequestPayloadAsStringOnParseExceptionInternal(true, "nul"); + testRequestPayloadAsStringOnParseExceptionInternal(false, "nul"); + } + + /** + * Tests for Raw Request payload data on parsing error + */ + public void testRawRequestPayloadOnParseException() throws Exception { + testRawRequestPayloadOnParseExceptionInternal(true, "nul"); + testRawRequestPayloadOnParseExceptionInternal(false, "nul"); + } + + /** + * Tests for no Request payload data on parsing error + */ + public void testNoRequestPayloadOnParseException() throws Exception { + testNoRequestPayloadOnParseExceptionInternal(true, "nul"); + testNoRequestPayloadOnParseExceptionInternal(false, "nul"); + } + + /** + * Tests for Request payload data which is null + */ + public void testNullRequestPayloadOnParseException() throws Exception { + testNullRequestPayloadOnParseExceptionInternal(true, "nul"); + testNullRequestPayloadOnParseExceptionInternal(false, "nul"); + } + + /** + * Tests for null Charset in Request payload data + */ + public void testNullCharsetOnParseException() throws Exception { + testNullCharsetOnParseExceptionInternal(true, "nul"); + testNullCharsetOnParseExceptionInternal(false, "nul"); + } + + /* + * *******************Private Methods************************* + */ + private void testRequestPayloadAsBytesOnParseExceptionInternal(boolean isStream, String value) throws Exception { + final String doc = "{ \"key1\" : " + value + " }"; + JsonParser jp = isStream ? createParserUsingStream(doc, "UTF-8") : createParserUsingReader(doc); + jp.setRequestPayloadOnError(doc.getBytes(), "UTF-8"); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + try { + jp.nextToken(); + fail("Expecting parsing exception"); + } catch (JsonParseException ex) { + assertEquals("Request payload data should match", doc, ex.getRequestPayloadAsString()); + assertTrue("Message contains request body", ex.getMessage().contains("Request payload : " + doc)); + } + jp.close(); + } + + private void testRequestPayloadAsStringOnParseExceptionInternal(boolean isStream, String value) throws Exception { + final String doc = "{ \"key1\" : " + value + " }"; + JsonParser jp = isStream ? createParserUsingStream(doc, "UTF-8") : createParserUsingReader(doc); + jp.setRequestPayloadOnError(doc); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + try { + jp.nextToken(); + fail("Expecting parsing exception"); + } catch (JsonParseException ex) { + assertEquals("Request payload data should match", doc, ex.getRequestPayloadAsString()); + assertTrue("Message contains request body", ex.getMessage().contains("Request payload : " + doc)); + } + jp.close(); + } + + private void testRawRequestPayloadOnParseExceptionInternal(boolean isStream, String value) throws Exception { + final String doc = "{ \"key1\" : " + value + " }"; + JsonParser jp = isStream ? createParserUsingStream(doc, "UTF-8") : createParserUsingReader(doc); + jp.setRequestPayloadOnError(doc.getBytes(), "UTF-8"); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + try { + jp.nextToken(); + fail("Expecting parsing exception"); + } catch (JsonParseException ex) { + assertTrue(((byte[]) ex.getRequestPayload().getRawPayload()).length > 0); + assertTrue("Message contains request body", ex.getMessage().contains("Request payload : " + doc)); + } + jp.close(); + } + + private void testNoRequestPayloadOnParseExceptionInternal(boolean isStream, String value) throws Exception { + final String doc = "{ \"key1\" : " + value + " }"; + JsonParser jp = isStream ? createParserUsingStream(doc, "UTF-8") : createParserUsingReader(doc); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + try { + jp.nextToken(); + fail("Expecting parsing exception"); + } catch (JsonParseException ex) { + assertEquals("Request payload data should be null", null, ex.getRequestPayload()); + } + jp.close(); + } + + private void testNullRequestPayloadOnParseExceptionInternal(boolean isStream, String value) throws Exception { + final String doc = "{ \"key1\" : " + value + " }"; + JsonParser jp = isStream ? createParserUsingStream(doc, "UTF-8") : createParserUsingReader(doc); + jp.setRequestPayloadOnError(null, "UTF-8"); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + try { + jp.nextToken(); + fail("Expecting parsing exception"); + } catch (JsonParseException ex) { + assertEquals("Request payload data should be null", null, ex.getRequestPayload()); + } + jp.close(); + } + + private void testNullCharsetOnParseExceptionInternal(boolean isStream, String value) throws Exception { + final String doc = "{ \"key1\" : " + value + " }"; + JsonParser jp = isStream ? createParserUsingStream(doc, "UTF-8") : createParserUsingReader(doc); + jp.setRequestPayloadOnError(doc.getBytes(), "UTF-8"); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + try { + jp.nextToken(); + fail("Expecting parsing exception"); + } catch (JsonParseException ex) { + assertEquals("Request payload data should match", doc, ex.getRequestPayloadAsString()); + assertTrue("Message contains request body", ex.getMessage().contains("Request payload : " + doc)); + } + jp.close(); + } +} diff --git a/src/test/java/com/fasterxml/jackson/core/json/StringGenerationFromReaderTest.java b/src/test/java/com/fasterxml/jackson/core/json/StringGenerationFromReaderTest.java index 4f694b0c7c..f21bda04c6 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/StringGenerationFromReaderTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/StringGenerationFromReaderTest.java @@ -20,8 +20,8 @@ public class StringGenerationFromReaderTest "Longer text & other stuff:\twith some\r\n\r\n random linefeeds etc added in to cause some \"special\" handling \\\\ to occur...\n" }; - private final JsonFactory FACTORY = newStreamFactory(); - + private final JsonFactory FACTORY = new JsonFactory(); + public void testBasicEscaping() throws Exception { doTestBasicEscaping(); @@ -74,9 +74,9 @@ public void testLongerRandomMultiChunk() throws Exception } /* - /********************************************************************** + /********************************************************** /* Internal methods - /********************************************************************** + /********************************************************** */ private String _generareMediumText(int minLen) @@ -84,7 +84,7 @@ private String _generareMediumText(int minLen) StringBuilder sb = new StringBuilder(minLen + 1000); Random rnd = new Random(minLen); do { - switch (rnd.nextInt(4)) { + switch (rnd.nextInt() % 4) { case 0: sb.append(" foo"); break; @@ -133,8 +133,8 @@ private void _testMediumStrings(JsonFactory jsonF, StringWriter sw = new StringWriter(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator gen = (readMode != MODE_READER) ? jsonF.createGenerator(ObjectWriteContext.empty(), bytes) - : jsonF.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = (readMode != MODE_READER) ? jsonF.createGenerator(bytes) + : jsonF.createGenerator(sw); gen.writeStartArray(); StringReader reader = new StringReader(text); @@ -144,7 +144,7 @@ private void _testMediumStrings(JsonFactory jsonF, JsonParser p; if (readMode == MODE_READER) { - p = jsonF.createParser(ObjectReadContext.empty(), sw.toString()); + p = jsonF.createParser(sw.toString()); } else { p = createParser(jsonF, readMode, bytes.toByteArray()); } @@ -160,7 +160,7 @@ private void doTestBasicEscaping() throws Exception for (int i = 0; i < SAMPLES.length; ++i) { String VALUE = SAMPLES[i]; StringWriter sw = new StringWriter(); - JsonGenerator gen = FACTORY.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = FACTORY.createGenerator(sw); gen.writeStartArray(); StringReader reader = new StringReader(VALUE); gen.writeString(reader, -1); @@ -182,7 +182,7 @@ private void _testLongerRandom(int readMode, String text) throws Exception { ByteArrayOutputStream bow = new ByteArrayOutputStream(text.length()); - JsonGenerator gen = FACTORY.createGenerator(ObjectWriteContext.empty(), bow, JsonEncoding.UTF8); + JsonGenerator gen = FACTORY.createGenerator(bow, JsonEncoding.UTF8); gen.writeStartArray(); StringReader reader = new StringReader(text); gen.writeString(reader, -1); @@ -214,14 +214,14 @@ private void _testLongerRandomMulti(int readMode, String text, int round) throws Exception { ByteArrayOutputStream bow = new ByteArrayOutputStream(text.length()); - JsonGenerator gen = FACTORY.createGenerator(ObjectWriteContext.empty(), bow, JsonEncoding.UTF8); + JsonGenerator gen = FACTORY.createGenerator(bow, JsonEncoding.UTF8); gen.writeStartArray(); StringReader reader = new StringReader(text); gen.writeString(reader, -1); gen.writeEndArray(); gen.close(); - gen = FACTORY.createGenerator(ObjectWriteContext.empty(), bow, JsonEncoding.UTF8); + gen = FACTORY.createGenerator(bow, JsonEncoding.UTF8); gen.writeStartArray(); gen.writeStartArray(); @@ -283,8 +283,7 @@ public void testIssue556() throws Exception sb.append("a"); } sb.append('"'); - JsonGenerator g = FACTORY.createGenerator(ObjectWriteContext.empty(), - new ByteArrayOutputStream()); + JsonGenerator g = FACTORY.createGenerator(new ByteArrayOutputStream()); g.writeStartArray(); _write556(g, sb.toString()); diff --git a/src/test/java/com/fasterxml/jackson/core/json/StringGenerationTest.java b/src/test/java/com/fasterxml/jackson/core/json/StringGenerationTest.java index e01aed0144..4fd67c1956 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/StringGenerationTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/StringGenerationTest.java @@ -88,7 +88,7 @@ private String _generareMediumText(int minLen) StringBuilder sb = new StringBuilder(minLen + 1000); Random rnd = new Random(minLen); do { - switch (rnd.nextInt(4)) { + switch (rnd.nextInt() % 4) { case 0: sb.append(" foo"); break; @@ -136,8 +136,8 @@ private void _testMediumStrings(int readMode, int length) throws Exception StringWriter sw = new StringWriter(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator gen = (readMode != MODE_READER) ? FACTORY.createGenerator(ObjectWriteContext.empty(), bytes) - : FACTORY.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = (readMode != MODE_READER) ? FACTORY.createGenerator(bytes) + : FACTORY.createGenerator(sw); gen.writeStartArray(); gen.writeString(text); gen.writeEndArray(); @@ -145,7 +145,7 @@ private void _testMediumStrings(int readMode, int length) throws Exception JsonParser p; if (readMode == MODE_READER) { - p = FACTORY.createParser(ObjectReadContext.empty(), sw.toString()); + p = FACTORY.createParser(sw.toString()); } else { p = createParser(FACTORY, readMode, bytes.toByteArray()); } @@ -161,7 +161,7 @@ private void doTestBasicEscaping(boolean charArray) throws Exception for (int i = 0; i < SAMPLES.length; ++i) { String VALUE = SAMPLES[i]; StringWriter sw = new StringWriter(); - JsonGenerator gen = FACTORY.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = FACTORY.createGenerator(sw); gen.writeStartArray(); if (charArray) { char[] buf = new char[VALUE.length() + i]; @@ -188,7 +188,7 @@ private void _testLongerRandom(int readMode, String text, boolean charArray) throws Exception { ByteArrayOutputStream bow = new ByteArrayOutputStream(text.length()); - JsonGenerator gen = FACTORY.createGenerator(ObjectWriteContext.empty(), bow, JsonEncoding.UTF8); + JsonGenerator gen = FACTORY.createGenerator(bow, JsonEncoding.UTF8); gen.writeStartArray(); if (charArray) { @@ -226,14 +226,14 @@ private void _testLongerRandomMulti(int readMode, String text, boolean charArray throws Exception { ByteArrayOutputStream bow = new ByteArrayOutputStream(text.length()); - JsonGenerator gen = FACTORY.createGenerator(ObjectWriteContext.empty(), bow, JsonEncoding.UTF8); + JsonGenerator gen = FACTORY.createGenerator(bow, JsonEncoding.UTF8); gen.writeStartArray(); gen.writeString(text); gen.writeEndArray(); gen.close(); - gen = FACTORY.createGenerator(ObjectWriteContext.empty(), bow, JsonEncoding.UTF8); + gen = FACTORY.createGenerator(bow, JsonEncoding.UTF8); gen.writeStartArray(); gen.writeStartArray(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/TestCharEscaping.java b/src/test/java/com/fasterxml/jackson/core/json/TestCharEscaping.java index 7480997933..c558f80810 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/TestCharEscaping.java +++ b/src/test/java/com/fasterxml/jackson/core/json/TestCharEscaping.java @@ -3,7 +3,6 @@ import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.core.io.CharacterEscapes; /** @@ -62,7 +61,7 @@ private void _testMissingEscaping(int readMode) throws Exception // and if not, should get it here: jp.getText(); fail("Expected an exception for un-escaped linefeed in string value"); - } catch (StreamReadException jex) { + } catch (JsonParseException jex) { verifyException(jex, "has to be escaped"); } jp.close(); @@ -125,7 +124,7 @@ private void _testSimpleNameEscaping(int readMode) throws Exception // note: append spaces so there's no buffer boundary issue JsonParser p = createParser(JSON_F, readMode, "{"+inputKey+" : 123456789} "); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(expKey, p.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(123456789, p.getIntValue()); @@ -151,7 +150,7 @@ private void _testInvalid(int readMode) throws Exception jp.nextToken(); jp.getText(); fail("Expected an exception for unclosed ARRAY"); - } catch (StreamReadException jpe) { + } catch (JsonParseException jpe) { verifyException(jpe, "for character escape"); } jp.close(); @@ -180,7 +179,7 @@ private void _test8DigitSequence(int readMode) throws Exception // [jackson-core#116] public void testEscapesForCharArrays() throws Exception { StringWriter writer = new StringWriter(); - JsonGenerator jgen = JSON_F.createGenerator(ObjectWriteContext.empty(), writer); + JsonGenerator jgen = JSON_F.createGenerator(writer); // must call #writeString(char[],int,int) and not #writeString(String) jgen.writeString(new char[] { '\0' }, 0, 1); jgen.close(); @@ -198,12 +197,13 @@ private void _testInvalidEscape(int readMode) throws Exception { String DOC = quote("\\u\u0080..."); JsonParser p = createParser(JSON_F, readMode, DOC); + assertToken(JsonToken.VALUE_STRING, p.nextToken()); // this is where we should get proper exception try { p.getText(); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected character"); } p.close(); @@ -240,8 +240,8 @@ private void _testEscapeNonLatin1(JsonFactory f, String valueIn, String expEncod { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); StringWriter sw = new StringWriter(); - final JsonGenerator g = useBytes ? f.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8) - : f.createGenerator(ObjectWriteContext.empty(), sw); + final JsonGenerator g = useBytes ? f.createGenerator(bytes, JsonEncoding.UTF8) + : f.createGenerator(sw); g.writeStartArray(); g.writeString(valueIn); g.writeEndArray(); @@ -261,18 +261,19 @@ private void _testEscapeNonLatin1(JsonFactory f, String valueIn, String expEncod public void testWriteLongCustomEscapes() throws Exception { + JsonFactory jf = ((JsonFactoryBuilder)JsonFactory.builder()) + .characterEscapes(ESC_627) + .build(); + StringBuilder longString = new StringBuilder(); while (longString.length() < 2000) { longString.append("\u65e5\u672c\u8a9e"); } - JsonFactory f = JsonFactory.builder() - .characterEscapes(ESC_627) - .highestNonEscapedChar(127) // must set to trigger bug - .build(); StringWriter writer = new StringWriter(); // must call #createGenerator(Writer), #createGenerator(OutputStream) doesn't trigger bug - JsonGenerator gen = f.createGenerator(ObjectWriteContext.empty(), writer); + JsonGenerator gen = jf.createGenerator(writer); + gen.setHighestNonEscapedChar(127); // must set to trigger bug gen.writeString(longString.toString()); gen.close(); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/TestCustomEscaping.java b/src/test/java/com/fasterxml/jackson/core/json/TestCustomEscaping.java index c29d88029e..974e31cc9c 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/TestCustomEscaping.java +++ b/src/test/java/com/fasterxml/jackson/core/json/TestCustomEscaping.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.CharacterEscapes; import com.fasterxml.jackson.core.io.SerializedString; -import com.fasterxml.jackson.core.util.JsonpCharacterEscapes; public class TestCustomEscaping extends com.fasterxml.jackson.core.BaseTest { @@ -118,17 +117,16 @@ public void testJsonpEscapes() throws Exception { @SuppressWarnings("resource") private void _testJsonpEscapes(boolean useStream, boolean stringAsChars) throws Exception { - JsonFactory f = JsonFactory.builder() - .characterEscapes(JsonpCharacterEscapes.instance()) - .build(); + JsonFactory f = new JsonFactory(); + f.setCharacterEscapes(JsonpCharacterEscapes.instance()); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); JsonGenerator g; // First: output normally; should not add escaping if (useStream) { - g = f.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); + g = f.createGenerator(bytes, JsonEncoding.UTF8); } else { - g = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bytes, "UTF-8")); + g = f.createGenerator(new OutputStreamWriter(bytes, "UTF-8")); } final String VALUE_TEMPLATE = "String with JS 'linefeeds': %s and %s..."; final String INPUT_VALUE = String.format(VALUE_TEMPLATE, "\u2028", "\u2029"); @@ -150,20 +148,20 @@ private void _testJsonpEscapes(boolean useStream, boolean stringAsChars) throws /******************************************************** */ - @SuppressWarnings({ "resource" }) + @SuppressWarnings({ "resource", "deprecation" }) private void _testEscapeAboveAscii(boolean useStream, boolean stringAsChars) throws Exception { JsonFactory f = new JsonFactory(); - final String VALUE = "chars: [\u00A0]-[\u1234]"; + final String VALUE = "chars: [\u00A0]/[\u1234]"; final String KEY = "fun:\u0088:\u3456"; ByteArrayOutputStream bytes = new ByteArrayOutputStream(); JsonGenerator g; // First: output normally; should not add escaping if (useStream) { - g = f.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); + g = f.createGenerator(bytes, JsonEncoding.UTF8); } else { - g = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bytes, "UTF-8")); + g = f.createGenerator(new OutputStreamWriter(bytes, "UTF-8")); } g.writeStartArray(); _writeString(g, VALUE, stringAsChars); @@ -174,35 +172,31 @@ private void _testEscapeAboveAscii(boolean useStream, boolean stringAsChars) thr assertEquals("["+quote(VALUE)+"]", json); // And then with forced ASCII; first, values - f = f.rebuild() - .enable(JsonWriteFeature.ESCAPE_NON_ASCII) - .build(); - + bytes = new ByteArrayOutputStream(); if (useStream) { - g = f.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); + g = f.createGenerator(bytes, JsonEncoding.UTF8); } else { - g = f.createGenerator(ObjectWriteContext.empty(),new OutputStreamWriter(bytes, "UTF-8")); + g = f.createGenerator(new OutputStreamWriter(bytes, "UTF-8")); } + g.enable(JsonGenerator.Feature.ESCAPE_NON_ASCII); g.writeStartArray(); _writeString(g, VALUE+"\\", stringAsChars); g.writeEndArray(); g.close(); json = bytes.toString("UTF-8"); - assertEquals("["+quote("chars: [\\u00A0]-[\\u1234]\\\\")+"]", json); + assertEquals("["+quote("chars: [\\u00A0]/[\\u1234]\\\\")+"]", json); // and then keys - f = f.rebuild() - .enable(JsonWriteFeature.ESCAPE_NON_ASCII) - .build(); bytes = new ByteArrayOutputStream(); if (useStream) { - g = f.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); + g = f.createGenerator(bytes, JsonEncoding.UTF8); } else { - g = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bytes, "UTF-8")); + g = f.createGenerator(new OutputStreamWriter(bytes, "UTF-8")); } + g.enable(JsonGenerator.Feature.ESCAPE_NON_ASCII); g.writeStartObject(); - g.writeName(KEY+"\\"); + g.writeFieldName(KEY+"\\"); g.writeBoolean(true); g.writeEndObject(); g.close(); @@ -214,9 +208,7 @@ private void _testEscapeAboveAscii(boolean useStream, boolean stringAsChars) thr private void _testEscapeCustom(boolean useStream, boolean stringAsChars, String customRepl) throws Exception { - JsonFactory f = JsonFactory.builder() - .characterEscapes(new MyEscapes(customRepl)) - .build(); + JsonFactory f = new JsonFactory().setCharacterEscapes(new MyEscapes(customRepl)); final String STR_IN = "[abcd/"+((char) TWO_BYTE_ESCAPED)+"/"+((char) THREE_BYTE_ESCAPED)+"]"; final String STR_OUT = "[\\A\\u0062c"+customRepl+"/"+TWO_BYTE_ESCAPED_STRING+"/"+THREE_BYTE_ESCAPED_STRING+"]"; ByteArrayOutputStream bytes = new ByteArrayOutputStream(); @@ -224,12 +216,12 @@ private void _testEscapeCustom(boolean useStream, boolean stringAsChars, // First: output normally; should not add escaping if (useStream) { - g = f.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); + g = f.createGenerator(bytes, JsonEncoding.UTF8); } else { - g = f.createGenerator(ObjectWriteContext.empty(), new OutputStreamWriter(bytes, "UTF-8")); + g = f.createGenerator(new OutputStreamWriter(bytes, "UTF-8")); } g.writeStartObject(); - g.writeName(STR_IN); + g.writeFieldName(STR_IN); _writeString(g, STR_IN, stringAsChars); g.writeEndObject(); g.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/TestDecorators.java b/src/test/java/com/fasterxml/jackson/core/json/TestDecorators.java index 8039218118..a04cbdbc86 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/TestDecorators.java +++ b/src/test/java/com/fasterxml/jackson/core/json/TestDecorators.java @@ -3,7 +3,6 @@ import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.WrappedIOException; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.core.io.InputDecorator; import com.fasterxml.jackson.core.io.OutputDecorator; @@ -27,24 +26,16 @@ static class SimpleInputDecorator extends InputDecorator { @Override public InputStream decorate(IOContext ctxt, InputStream in) - throws JacksonException + throws IOException { - try { - return new ByteArrayInputStream("123".getBytes("UTF-8")); - } catch (IOException e) { - throw WrappedIOException.construct(e, null); - } + return new ByteArrayInputStream("123".getBytes("UTF-8")); } @Override public InputStream decorate(IOContext ctxt, byte[] src, int offset, int length) - throws JacksonException + throws IOException { - try { - return new ByteArrayInputStream("456".getBytes("UTF-8")); - } catch (IOException e) { - throw WrappedIOException.construct(e, null); - } + return new ByteArrayInputStream("456".getBytes("UTF-8")); } @Override @@ -56,30 +47,22 @@ public Reader decorate(IOContext ctxt, Reader src) { static class SimpleOutputDecorator extends OutputDecorator { @Override - public OutputStream decorate(IOContext ctxt, OutputStream out) throws JacksonException + public OutputStream decorate(IOContext ctxt, OutputStream out) throws IOException { - try { - out.write("123".getBytes("UTF-8")); - out.flush(); - } catch (IOException e) { - throw WrappedIOException.construct(e, null); - } + out.write("123".getBytes("UTF-8")); + out.flush(); return new ByteArrayOutputStream(); } @Override - public Writer decorate(IOContext ctxt, Writer w) throws JacksonException + public Writer decorate(IOContext ctxt, Writer w) throws IOException { - try { - w.write("567"); - w.flush(); - } catch (IOException e) { - throw WrappedIOException.construct(e, null); - } + w.write("567"); + w.flush(); return new StringWriter(); } } - + /* /********************************************************** /* Unit tests @@ -93,14 +76,14 @@ public void testInputDecoration() throws IOException .build(); JsonParser p; // first test with Reader - p = f.createParser(ObjectReadContext.empty(), new StringReader("{ }")); + p = f.createParser(new StringReader("{ }")); // should be overridden; assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(789, p.getIntValue()); p.close(); // similarly with InputStream - p = f.createParser(ObjectReadContext.empty(), new ByteArrayInputStream("[ ]".getBytes("UTF-8"))); + p = f.createParser(new ByteArrayInputStream("[ ]".getBytes("UTF-8"))); // should be overridden; assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(123, p.getIntValue()); @@ -108,21 +91,21 @@ public void testInputDecoration() throws IOException // and with raw bytes final byte[] bytes = "[ ]".getBytes("UTF-8"); - p = f.createParser(ObjectReadContext.empty(), bytes); + p = f.createParser(bytes); // should be overridden; assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(456, p.getIntValue()); p.close(); // also diff method has diff code path so try both: - p = f.createParser(ObjectReadContext.empty(), bytes, 0, bytes.length); + p = f.createParser(bytes, 0, bytes.length); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(456, p.getIntValue()); p.close(); // and also char[] final char[] chars = " [ ]".toCharArray(); - p = f.createParser(ObjectReadContext.empty(), chars, 0, chars.length); + p = f.createParser(chars, 0, chars.length); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(789, p.getIntValue()); p.close(); @@ -133,16 +116,30 @@ public void testOutputDecoration() throws IOException JsonFactory f = JsonFactory.builder() .outputDecorator(new SimpleOutputDecorator()) .build(); - JsonGenerator jg; + JsonGenerator g; StringWriter sw = new StringWriter(); - jg = f.createGenerator(ObjectWriteContext.empty(), sw); - jg.close(); + g = f.createGenerator(sw); + g.close(); assertEquals("567", sw.toString()); ByteArrayOutputStream out = new ByteArrayOutputStream(); - jg = f.createGenerator(ObjectWriteContext.empty(), out, JsonEncoding.UTF8); - jg.close(); + g = f.createGenerator(out, JsonEncoding.UTF8); + g.close(); assertEquals("123", out.toString("UTF-8")); } + + @SuppressWarnings("deprecation") + public void testDeprecatedMethods() throws IOException + { + JsonFactory f = new JsonFactory(); + assertNull(f.getInputDecorator()); + assertNull(f.getOutputDecorator()); + final SimpleInputDecorator inDec = new SimpleInputDecorator(); + final SimpleOutputDecorator outDec = new SimpleOutputDecorator(); + f.setInputDecorator(inDec); + assertSame(inDec, f.getInputDecorator()); + f.setOutputDecorator(outDec); + assertSame(outDec, f.getOutputDecorator()); + } } diff --git a/src/test/java/com/fasterxml/jackson/core/json/TestMaxErrorSize.java b/src/test/java/com/fasterxml/jackson/core/json/TestMaxErrorSize.java index 0dad624345..8a63aa15fd 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/TestMaxErrorSize.java +++ b/src/test/java/com/fasterxml/jackson/core/json/TestMaxErrorSize.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.core.json; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; /** * Test size of parser error messages @@ -11,20 +10,20 @@ public class TestMaxErrorSize { private final static int EXPECTED_MAX_TOKEN_LEN = 256; // ParserBase.MAX_ERROR_TOKEN_LENGTH - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); - public void testLongErrorMessage() + public void testLongErrorMessage() throws Exception { _testLongErrorMessage(MODE_INPUT_STREAM); _testLongErrorMessage(MODE_INPUT_STREAM_THROTTLED); } - public void testLongErrorMessageReader() + public void testLongErrorMessageReader() throws Exception { _testLongErrorMessage(MODE_READER); } - private void _testLongErrorMessage(int mode) + private void _testLongErrorMessage(int mode) throws Exception { final String DOC = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" @@ -35,7 +34,7 @@ private void _testLongErrorMessage(int mode) try { jp.nextToken(); fail("Expected an exception for unrecognized token"); - } catch (StreamReadException jpe) { + } catch (JsonParseException jpe) { String msg = jpe.getMessage(); final String expectedPrefix = "Unrecognized token '"; final String expectedSuffix = "...': was expecting"; @@ -48,14 +47,14 @@ private void _testLongErrorMessage(int mode) jp.close(); } - public void testShortErrorMessage() + public void testShortErrorMessage() throws Exception { _testShortErrorMessage(MODE_INPUT_STREAM); _testShortErrorMessage(MODE_INPUT_STREAM_THROTTLED); _testShortErrorMessage(MODE_READER); } - public void _testShortErrorMessage(int mode) + public void _testShortErrorMessage(int mode) throws Exception { final String DOC = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; @@ -64,7 +63,7 @@ public void _testShortErrorMessage(int mode) try { jp.nextToken(); fail("Expected an exception for unrecognized token"); - } catch (StreamReadException jpe) { + } catch (JsonParseException jpe) { String msg = jpe.getMessage(); final String expectedPrefix = "Unrecognized token '"; final String expectedSuffix = "': was expecting"; diff --git a/src/test/java/com/fasterxml/jackson/core/json/TestParserOverrides.java b/src/test/java/com/fasterxml/jackson/core/json/TestParserOverrides.java index 2e8c66c50b..244effd753 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/TestParserOverrides.java +++ b/src/test/java/com/fasterxml/jackson/core/json/TestParserOverrides.java @@ -3,9 +3,9 @@ import java.io.ByteArrayInputStream; import java.io.StringReader; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.ObjectReadContext; public class TestParserOverrides extends com.fasterxml.jackson.core.BaseTest { @@ -25,7 +25,11 @@ public void testTokenAccess() throws Exception public void testCurrentName() throws Exception { JsonFactory jf = new JsonFactory(); + + _testCurrentName(jf, false); + + _testCurrentName(jf, true); } @@ -39,8 +43,8 @@ public void _testTokenAccess(JsonFactory jf, boolean useStream) throws Exception { final String DOC = "[ ]"; JsonParser jp = useStream ? - jf.createParser(ObjectReadContext.empty(), new ByteArrayInputStream(DOC.getBytes("UTF-8"))) - : jf.createParser(ObjectReadContext.empty(), DOC); + jf.createParser(new ByteArrayInputStream(DOC.getBytes("UTF-8"))) + : jf.createParser(DOC); assertNull(jp.currentToken()); jp.clearCurrentToken(); assertNull(jp.currentToken()); @@ -53,8 +57,8 @@ public void _testTokenAccess(JsonFactory jf, boolean useStream) throws Exception try { jp.readValueAsTree(); fail("Should get exception without codec"); - } catch (UnsupportedOperationException e) { - verifyException(e, "Operation not supported"); + } catch (IllegalStateException e) { + verifyException(e, "No ObjectCodec defined"); } jp.close(); } @@ -63,30 +67,30 @@ private void _testCurrentName(JsonFactory jf, boolean useStream) throws Exceptio { final String DOC = "{\"first\":{\"second\":3, \"third\":false}}"; JsonParser jp = useStream ? - jf.createParser(ObjectReadContext.empty(), new ByteArrayInputStream(DOC.getBytes("UTF-8"))) - : jf.createParser(ObjectReadContext.empty(), new StringReader(DOC)); + jf.createParser(new ByteArrayInputStream(DOC.getBytes("UTF-8"))) + : jf.createParser(new StringReader(DOC)); assertNull(jp.currentToken()); assertToken(JsonToken.START_OBJECT, jp.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, jp.nextToken()); - assertEquals("first", jp.currentName()); + assertToken(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("first", jp.getCurrentName()); assertToken(JsonToken.START_OBJECT, jp.nextToken()); - assertEquals("first", jp.currentName()); // still the same... -// jp.overrideCurrentName("foobar"); -// assertEquals("foobar", jp.currentName()); // but not any more! + assertEquals("first", jp.getCurrentName()); // still the same... + jp.overrideCurrentName("foobar"); + assertEquals("foobar", jp.getCurrentName()); // but not any more! - assertToken(JsonToken.PROPERTY_NAME, jp.nextToken()); - assertEquals("second", jp.currentName()); + assertToken(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("second", jp.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); - assertEquals("second", jp.currentName()); + assertEquals("second", jp.getCurrentName()); - assertToken(JsonToken.PROPERTY_NAME, jp.nextToken()); - assertEquals("third", jp.currentName()); + assertToken(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("third", jp.getCurrentName()); assertToken(JsonToken.VALUE_FALSE, jp.nextToken()); - assertEquals("third", jp.currentName()); + assertEquals("third", jp.getCurrentName()); assertToken(JsonToken.END_OBJECT, jp.nextToken()); // should retain overrides, too -// assertEquals("foobar", jp.currentName()); + assertEquals("foobar", jp.getCurrentName()); assertToken(JsonToken.END_OBJECT, jp.nextToken()); jp.clearCurrentToken(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/TestRootValues.java b/src/test/java/com/fasterxml/jackson/core/json/TestRootValues.java index d5aa9eec59..38794ff789 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/TestRootValues.java +++ b/src/test/java/com/fasterxml/jackson/core/json/TestRootValues.java @@ -1,10 +1,8 @@ package com.fasterxml.jackson.core.json; import java.io.*; -import java.nio.charset.StandardCharsets; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; public class TestRootValues extends com.fasterxml.jackson.core.BaseTest @@ -78,14 +76,14 @@ public int read(char[] b, int off, int len) throws IOException { private final JsonFactory JSON_F = sharedStreamFactory(); - public void testSimpleNumbers() { + public void testSimpleNumbers() throws Exception { // DataInput can not detect EOF so: _testSimpleNumbers(MODE_INPUT_STREAM); _testSimpleNumbers(MODE_INPUT_STREAM_THROTTLED); _testSimpleNumbers(MODE_READER); } - private void _testSimpleNumbers(int mode) + private void _testSimpleNumbers(int mode) throws Exception { final String DOC = "1 2\t3\r4\n5\r\n6\r\n 7"; JsonParser p = createParser(mode, DOC); @@ -97,7 +95,7 @@ private void _testSimpleNumbers(int mode) p.close(); } - public void testBrokenNumber() + public void testBrokenNumber() throws Exception { _testBrokenNumber(MODE_INPUT_STREAM); _testBrokenNumber(MODE_INPUT_STREAM_THROTTLED); @@ -106,7 +104,7 @@ public void testBrokenNumber() // _testBrokenNumber(MODE_DATA_INPUT); } - private void _testBrokenNumber(int mode) + private void _testBrokenNumber(int mode) throws Exception { final String DOC = "14:89:FD:D3:E7:8C"; JsonParser p = createParser(mode, DOC); @@ -114,20 +112,20 @@ private void _testBrokenNumber(int mode) try { p.nextToken(); fail("Ought to fail! Instead, got token: "+p.currentToken()); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "unexpected character"); } p.close(); } - public void testSimpleBooleans() { + public void testSimpleBooleans() throws Exception { // can't do DataInput so _testSimpleBooleans(MODE_INPUT_STREAM); _testSimpleBooleans(MODE_INPUT_STREAM_THROTTLED); _testSimpleBooleans(MODE_READER); } - private void _testSimpleBooleans(int mode) + private void _testSimpleBooleans(int mode) throws Exception { final String DOC = "true false\ttrue\rfalse\ntrue\r\nfalse\r\n true"; JsonParser p = createParser(mode, DOC); @@ -140,7 +138,7 @@ private void _testSimpleBooleans(int mode) p.close(); } - public void testInvalidToken() + public void testInvalidToken() throws Exception { _testInvalidToken(MODE_INPUT_STREAM, '\u00c4'); _testInvalidToken(MODE_INPUT_STREAM_THROTTLED, '\u00c4'); @@ -153,7 +151,7 @@ public void testInvalidToken() _testInvalidToken(MODE_DATA_INPUT, '\u3456'); } - private void _testInvalidToken(int mode, char weirdChar) + private void _testInvalidToken(int mode, char weirdChar) throws Exception { final String DOC = " A\u3456C "; JsonParser p = createParser(mode, DOC); @@ -161,7 +159,7 @@ private void _testInvalidToken(int mode, char weirdChar) try { p.nextToken(); fail("Ought to fail! Instead, got token: "+p.currentToken()); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unrecognized token"); } p.close(); @@ -173,22 +171,22 @@ private void _testInvalidToken(int mode, char weirdChar) /********************************************************** */ - public void testSimpleWrites() throws IOException + public void testSimpleWrites() throws Exception { _testSimpleWrites(false); _testSimpleWrites(true); } - private void _testSimpleWrites(boolean useStream) throws IOException + private void _testSimpleWrites(boolean useStream) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); StringWriter w = new StringWriter(); JsonGenerator gen; if (useStream) { - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), out, JsonEncoding.UTF8); + gen = JSON_F.createGenerator(out, JsonEncoding.UTF8); } else { - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), w); + gen = JSON_F.createGenerator(w); } gen.writeNumber(123); gen.writeString("abc"); @@ -199,7 +197,7 @@ private void _testSimpleWrites(boolean useStream) throws IOException w.close(); // and verify - String json = useStream ? utf8String(out) : w.toString(); + String json = useStream ? out.toString("UTF-8") : w.toString(); assertEquals("123 \"abc\" true", json); } @@ -210,18 +208,18 @@ private void _testSimpleWrites(boolean useStream) throws IOException */ // [core#516]: Off-by-one read problem - public void testRootOffsetIssue516Bytes() throws IOException + public void testRootOffsetIssue516Bytes() throws Exception { // InputStream that forces _parseNumber2 to be invoked. final InputStream in = new Issue516InputStream(new byte[][] { - "1234".getBytes(StandardCharsets.UTF_8), - "5 true".getBytes(StandardCharsets.UTF_8) + "1234".getBytes("UTF-8"), + "5 true".getBytes("UTF-8") }); - JsonParser parser = JSON_F.createParser(ObjectReadContext.empty(), in); + JsonParser parser = JSON_F.createParser(in); assertEquals(12345, parser.nextIntValue(0)); - // Fails with com.fasterxml.jackson.core.StreamReadException: Unrecognized token 'rue': was expecting ('true', 'false' or 'null') + // Fails with com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'rue': was expecting ('true', 'false' or 'null') assertTrue(parser.nextBooleanValue()); parser.close(); @@ -229,17 +227,17 @@ public void testRootOffsetIssue516Bytes() throws IOException } // [core#516]: Off-by-one read problem - public void testRootOffsetIssue516Chars() throws IOException + public void testRootOffsetIssue516Chars() throws Exception { // InputStream that forces _parseNumber2 to be invoked. final Reader in = new Issue516Reader(new char[][] { "1234".toCharArray(), "5 true".toCharArray() }); - JsonParser parser = JSON_F.createParser(ObjectReadContext.empty(), in); + JsonParser parser = JSON_F.createParser(in); assertEquals(12345, parser.nextIntValue(0)); - // Fails with com.fasterxml.jackson.core.StreamReadException: Unrecognized token 'rue': was expecting ('true', 'false' or 'null') + // Fails with com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'rue': was expecting ('true', 'false' or 'null') assertTrue(parser.nextBooleanValue()); parser.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/TestUnicode.java b/src/test/java/com/fasterxml/jackson/core/json/TestUnicode.java index b0914099bd..9f0e87e27e 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/TestUnicode.java +++ b/src/test/java/com/fasterxml/jackson/core/json/TestUnicode.java @@ -23,9 +23,9 @@ private void _testSurrogates(JsonFactory f, boolean checkText) throws IOExceptio { byte[] json = "{\"text\":\"\uD83D\uDE03\"}".getBytes("UTF-8"); // first - JsonParser jp = f.createParser(ObjectReadContext.empty(), json); + JsonParser jp = f.createParser(json); assertToken(JsonToken.START_OBJECT, jp.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, jp.nextToken()); + assertToken(JsonToken.FIELD_NAME, jp.nextToken()); if (checkText) { assertEquals("text", jp.getText()); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/TestWithTonsaSymbols.java b/src/test/java/com/fasterxml/jackson/core/json/TestWithTonsaSymbols.java index fdec3b4946..910962d7f6 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/TestWithTonsaSymbols.java +++ b/src/test/java/com/fasterxml/jackson/core/json/TestWithTonsaSymbols.java @@ -36,19 +36,20 @@ public void testReaderParser() throws Exception { private void _testWith(boolean useStream) throws Exception { - JsonFactory f = new JsonFactory(); + JsonFactory jf = new JsonFactory(); String doc = buildDoc(FIELD_COUNT); - // And let's do this multiple times: just so that symbol table - // state is different between runs. + /* And let's do this multiple times: just so that symbol table + * state is different between runs. + */ for (int x = 0; x < 3; ++x) { JsonParser p = useStream ? - f.createParser(ObjectReadContext.empty(), new ByteArrayInputStream(doc.getBytes("UTF-8"))) - : f.createParser(ObjectReadContext.empty(), new StringReader(doc)); + jf.createParser(new ByteArrayInputStream(doc.getBytes("UTF-8"))) + : jf.createParser(new StringReader(doc)); assertToken(JsonToken.START_OBJECT, p.nextToken()); for (int i = 0; i < FIELD_COUNT; ++i) { - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals(fieldNameFor(i), p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals(fieldNameFor(i), p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(i, p.getIntValue()); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncBinaryParseTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncBinaryParseTest.java index 400095f0ec..4ce01d282e 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncBinaryParseTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncBinaryParseTest.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncBinaryParseTest extends AsyncTestBase @@ -66,7 +65,7 @@ private void _testBinaryAsRoot2(JsonFactory f, int offset, int readSize) throws for (int size : SIZES) { byte[] binary = _generateData(size); ByteArrayOutputStream bo = new ByteArrayOutputStream(size+10); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bo); + JsonGenerator g = f.createGenerator(bo); g.writeBinary(binary); g.close(); byte[] smile = bo.toByteArray(); @@ -94,7 +93,7 @@ private void _testBinaryAsArray2(JsonFactory f, int offset, int readSize) throws for (int size : SIZES) { byte[] binary = _generateData(size); ByteArrayOutputStream bo = new ByteArrayOutputStream(size+10); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bo); + JsonGenerator g = f.createGenerator(bo); g.writeStartArray(); g.writeBinary(binary); g.writeNumber(1); // just to verify there's no overrun @@ -132,9 +131,9 @@ private void _testBinaryAsObject2(JsonFactory f, int offset, int readSize) throw for (int size : SIZES) { byte[] data = _generateData(size); ByteArrayOutputStream bo = new ByteArrayOutputStream(size+10); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bo); + JsonGenerator g = f.createGenerator(bo); g.writeStartObject(); - g.writeName("binary"); + g.writeFieldName("binary"); g.writeBinary(data); g.writeEndObject(); g.close(); @@ -143,7 +142,7 @@ private void _testBinaryAsObject2(JsonFactory f, int offset, int readSize) throw AsyncReaderWrapper p = asyncForBytes(f, readSize, smile, offset); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("binary", p.currentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); byte[] result = p.getBinaryValue(); @@ -161,7 +160,7 @@ private void _testBinaryAsObject2(JsonFactory f, int offset, int readSize) throw // and second time around, skipping p = asyncForBytes(f, readSize, smile, offset); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertNull(p.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncCharEscapingTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncCharEscapingTest.java index fb050dc2c8..9bb61a93a1 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncCharEscapingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncCharEscapingTest.java @@ -2,8 +2,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; /** @@ -38,7 +36,7 @@ private void _testMissingLinefeedEscaping(byte[] doc, int offset, int readSize) JsonToken t = r.nextToken(); assertToken(JsonToken.VALUE_STRING, t); fail("Expected an exception for un-escaped linefeed in string value"); - } catch (StreamReadException jex) { + } catch (JsonParseException jex) { verifyException(jex, "has to be escaped"); } r.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncCommentParsingTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncCommentParsingTest.java index 1eed95cdcc..614a76000e 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncCommentParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncCommentParsingTest.java @@ -4,8 +4,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; @@ -116,7 +114,7 @@ private void _testCommentsBeforePropValue(JsonFactory f, } catch (Exception e) { throw new RuntimeException("Failed on '"+DOC+"' due to "+e, e); } - assertEquals(JsonToken.PROPERTY_NAME, t); + assertEquals(JsonToken.FIELD_NAME, t); try { t = p.nextToken(); @@ -186,11 +184,11 @@ private void _testYAMLComments(JsonFactory f, int bytesPerRead) throws Exception AsyncReaderWrapper p = _createParser(f, DOC, bytesPerRead); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentName()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(1, p.getIntValue()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.currentName()); assertEquals(JsonToken.START_ARRAY, p.nextToken()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); @@ -225,7 +223,7 @@ private void _testDisabled(String doc) throws IOException try { p.nextToken(); fail("Expected exception for unrecognized comment"); - } catch (StreamReadException je) { + } catch (JsonParseException je) { // Should have something denoting that user may want to enable 'ALLOW_COMMENTS' verifyException(je, "ALLOW_COMMENTS"); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncConcurrencyTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncConcurrencyTest.java index 207d736408..ed7e9b4cc3 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncConcurrencyTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncConcurrencyTest.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncConcurrencyTest extends AsyncTestBase diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncFieldNamesTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncFieldNamesTest.java index a4685b2c7e..e25d7a0feb 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncFieldNamesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncFieldNamesTest.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; @@ -36,12 +35,12 @@ private void _testSimpleFieldName(String fieldName) throws IOException 0); assertNull(r.currentToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(fieldName, r.currentName()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); assertToken(JsonToken.END_OBJECT, r.nextToken()); assertNull(r.nextToken()); - JsonLocation loc = r.parser().currentLocation(); + JsonLocation loc = r.parser().getCurrentLocation(); assertEquals(2, loc.getLineNr()); assertEquals(1, loc.getColumnNr()); } @@ -104,7 +103,7 @@ private void _testEscapedFieldNames(byte[] doc, String expName, AsyncReaderWrapper r = asyncForBytes(JSON_F, readSize, doc, offset); assertNull(r.currentToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(expName, r.currentName()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); @@ -118,7 +117,7 @@ private void _testEscapedAposFieldNames(byte[] doc, String expName, AsyncReaderWrapper r = asyncForBytes(JSON_APOS_F, readSize, doc, offset); assertNull(r.currentToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(expName, r.currentName()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncInvalidCharsTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncInvalidCharsTest.java index 025ce9cf99..c52aa49121 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncInvalidCharsTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncInvalidCharsTest.java @@ -5,8 +5,7 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; + import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; // Tests for verifying things such as handling of invalid control characters; @@ -56,7 +55,7 @@ private void _testUTF8BomOk(int offset, int readSize) throws Exception * "out of stream" (not part of input). */ - JsonLocation loc = p.parser().currentTokenLocation(); + JsonLocation loc = p.parser().getTokenLocation(); // so if BOM was consider in-stream (part of input), this should expect 3: // (NOTE: this is location for START_ARRAY token, now) assertEquals(-1, loc.getCharOffset()); @@ -88,7 +87,7 @@ private void _testUTF8BomFail(int offset, int readSize, try { assertEquals(JsonToken.START_ARRAY, p.nextToken()); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, verify); } } @@ -113,7 +112,7 @@ private void _testHandlingOfInvalidSpace(int offset, int readSize) throws Except try { p.nextToken(); fail("Should have failed"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Illegal character"); // and correct error code verifyException(e, "code 8"); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncLocationTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncLocationTest.java index 69b95f07f8..d5035d1dc1 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncLocationTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncLocationTest.java @@ -3,7 +3,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; import com.fasterxml.jackson.core.async.ByteArrayFeeder; -import com.fasterxml.jackson.core.json.JsonFactory; public class AsyncLocationTest extends AsyncTestBase { @@ -12,28 +11,28 @@ public class AsyncLocationTest extends AsyncTestBase // for [core#531] public void testLocationOffsets() throws Exception { - JsonParser parser = DEFAULT_F.createNonBlockingByteArrayParser(ObjectReadContext.empty()); - ByteArrayFeeder feeder = (ByteArrayFeeder) parser.nonBlockingInputFeeder(); + JsonParser parser = DEFAULT_F.createNonBlockingByteArrayParser(); + ByteArrayFeeder feeder = (ByteArrayFeeder) parser.getNonBlockingInputFeeder(); byte[] input = utf8Bytes("[[["); feeder.feedInput(input, 2, 3); assertEquals(JsonToken.START_ARRAY, parser.nextToken()); assertEquals(1, parser.currentLocation().getByteOffset()); - assertEquals(1, parser.currentTokenLocation().getByteOffset()); - assertEquals(1, parser.currentLocation().getLineNr()); - assertEquals(1, parser.currentTokenLocation().getLineNr()); - assertEquals(2, parser.currentLocation().getColumnNr()); - assertEquals(1, parser.currentTokenLocation().getColumnNr()); + assertEquals(1, parser.getTokenLocation().getByteOffset()); + assertEquals(1, parser.getCurrentLocation().getLineNr()); + assertEquals(1, parser.getTokenLocation().getLineNr()); + assertEquals(2, parser.getCurrentLocation().getColumnNr()); + assertEquals(1, parser.getTokenLocation().getColumnNr()); feeder.feedInput(input, 0, 1); assertEquals(JsonToken.START_ARRAY, parser.nextToken()); - assertEquals(2, parser.currentLocation().getByteOffset()); - assertEquals(2, parser.currentTokenLocation().getByteOffset()); - assertEquals(1, parser.currentLocation().getLineNr()); - assertEquals(1, parser.currentTokenLocation().getLineNr()); - assertEquals(3, parser.currentLocation().getColumnNr()); - assertEquals(2, parser.currentTokenLocation().getColumnNr()); + assertEquals(2, parser.getCurrentLocation().getByteOffset()); + assertEquals(2, parser.getTokenLocation().getByteOffset()); + assertEquals(1, parser.getCurrentLocation().getLineNr()); + assertEquals(1, parser.getTokenLocation().getLineNr()); + assertEquals(3, parser.getCurrentLocation().getColumnNr()); + assertEquals(2, parser.getTokenLocation().getColumnNr()); parser.close(); } } diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncMissingValuesInArrayTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncMissingValuesInArrayTest.java index be08cfa016..608b91e813 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncMissingValuesInArrayTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncMissingValuesInArrayTest.java @@ -1,12 +1,10 @@ package com.fasterxml.jackson.core.json.async; +import java.io.IOException; import java.util.*; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; -import com.fasterxml.jackson.core.json.JsonFactoryBuilder; import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; @@ -22,7 +20,7 @@ public class AsyncMissingValuesInArrayTest extends AsyncTestBase public AsyncMissingValuesInArrayTest(Collection features) { this.features = new HashSet(features); - JsonFactoryBuilder b = JsonFactory.builder(); + JsonFactoryBuilder b = (JsonFactoryBuilder) JsonFactory.builder(); for (JsonReadFeature feature : features) { b = b.enable(feature); } @@ -204,21 +202,21 @@ public void testArrayTrailingCommasTriple() throws Exception { p.close(); } - private void assertEnd(AsyncReaderWrapper p) { + private void assertEnd(AsyncReaderWrapper p) throws IOException { JsonToken next = p.nextToken(); assertNull("expected end of stream but found " + next, next); } - private void assertUnexpected(AsyncReaderWrapper p, char c) { + private void assertUnexpected(AsyncReaderWrapper p, char c) throws IOException { try { p.nextToken(); fail("No exception thrown"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, String.format("Unexpected character ('%s' (code %d))", c, (int) c)); } } - private AsyncReaderWrapper createParser(JsonFactory f, String doc) + private AsyncReaderWrapper createParser(JsonFactory f, String doc) throws IOException { int bytesPerRead = 3; // should vary but... AsyncReaderWrapper p = asyncForBytes(f, bytesPerRead, _jsonDoc(doc), 0); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncMissingValuesInObjectTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncMissingValuesInObjectTest.java index 449f39c3d3..69ea742ff0 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncMissingValuesInObjectTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncMissingValuesInObjectTest.java @@ -1,5 +1,6 @@ package com.fasterxml.jackson.core.json.async; +import java.io.IOException; import java.util.*; import org.junit.Test; @@ -8,9 +9,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; -import com.fasterxml.jackson.core.json.JsonFactoryBuilder; import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; @@ -22,11 +20,11 @@ public class AsyncMissingValuesInObjectTest extends AsyncTestBase public AsyncMissingValuesInObjectTest(Collection features) { this.features = new HashSet(features); - JsonFactoryBuilder b = JsonFactory.builder(); + JsonFactoryBuilder b = (JsonFactoryBuilder) JsonFactory.builder(); for (JsonReadFeature feature : features) { b = b.enable(feature); } - this.factory = b.build(); + factory = b.build(); } @Parameterized.Parameters(name = "Features {0}") @@ -41,18 +39,18 @@ public static Collection> getTestCases() } @Test - public void testObjectBasic() { + public void testObjectBasic() throws Exception { String json = "{\"a\": true, \"b\": false}"; AsyncReaderWrapper p = createParser(factory, json); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.currentText()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); @@ -62,14 +60,14 @@ public void testObjectBasic() { } @Test - public void testObjectInnerComma() { + public void testObjectInnerComma() throws Exception { String json = "{\"a\": true,, \"b\": false}"; AsyncReaderWrapper p = createParser(factory, json); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); @@ -78,7 +76,7 @@ public void testObjectInnerComma() { } @Test - public void testObjectLeadingComma() { + public void testObjectLeadingComma() throws Exception { String json = "{,\"a\": true, \"b\": false}"; AsyncReaderWrapper p = createParser(factory, json); @@ -90,18 +88,18 @@ public void testObjectLeadingComma() { } @Test - public void testObjectTrailingComma() { + public void testObjectTrailingComma() throws Exception { String json = "{\"a\": true, \"b\": false,}"; AsyncReaderWrapper p = createParser(factory, json); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.currentText()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); @@ -115,18 +113,18 @@ public void testObjectTrailingComma() { } @Test - public void testObjectTrailingCommas() { + public void testObjectTrailingCommas() throws Exception { String json = "{\"a\": true, \"b\": false,,}"; AsyncReaderWrapper p = createParser(factory, json); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.currentText()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); @@ -134,21 +132,21 @@ public void testObjectTrailingCommas() { p.close(); } - private void assertEnd(AsyncReaderWrapper p) { + private void assertEnd(AsyncReaderWrapper p) throws IOException { JsonToken next = p.nextToken(); assertNull("expected end of stream but found " + next, next); } - private void assertUnexpected(AsyncReaderWrapper p, char c){ + private void assertUnexpected(AsyncReaderWrapper p, char c) throws IOException { try { p.nextToken(); fail("No exception thrown"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, String.format("Unexpected character ('%s' (code %d))", c, (int) c)); } } - private AsyncReaderWrapper createParser(JsonFactory f, String doc) + private AsyncReaderWrapper createParser(JsonFactory f, String doc) throws IOException { int bytesPerRead = 3; // should vary but... AsyncReaderWrapper p = asyncForBytes(f, bytesPerRead, _jsonDoc(doc), 0); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNaNHandlingTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNaNHandlingTest.java index c147229a76..58dcdf422d 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNaNHandlingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNaNHandlingTest.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; @@ -12,8 +11,9 @@ public class AsyncNaNHandlingTest extends AsyncTestBase { private final JsonFactory DEFAULT_F = new JsonFactory(); + @SuppressWarnings("deprecation") public void testDefaultsForAsync() throws Exception { - assertFalse(DEFAULT_F.isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)); + assertFalse(DEFAULT_F.isEnabled(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS)); } public void testDisallowNaN() throws Exception @@ -67,7 +67,8 @@ private void _testAllowNaN(JsonFactory f, String doc, int readBytes) throws Exce p.close(); // finally, should also work with skipping - f = f.rebuild().enable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS) + f = JsonFactory.builder() + .configure(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS, true) .build(); p = createParser(f, doc, readBytes); assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -111,7 +112,7 @@ private void _testDisallowInf(JsonFactory f, String token, int readBytes) throws p.close(); } } - + public void testAllowInf() throws Exception { JsonFactory f = JsonFactory.builder() @@ -165,7 +166,8 @@ private void _testAllowInf(JsonFactory f, String doc, int readBytes) throws Exce p.close(); // finally, should also work with skipping - f = f.rebuild().enable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS) + f = JsonFactory.builder() + .configure(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS, true) .build(); p = createParser(f, doc, readBytes); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNonStdNumberHandlingTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNonStdNumberHandlingTest.java index dbea06d5d2..65e949c14b 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNonStdNumberHandlingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNonStdNumberHandlingTest.java @@ -1,20 +1,21 @@ package com.fasterxml.jackson.core.json.async; +import java.io.IOException; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncNonStdNumberHandlingTest extends AsyncTestBase { - public void testDefaultsForAsync() { + @SuppressWarnings("deprecation") + public void testDefaultsForAsync() throws Exception { JsonFactory f = new JsonFactory(); - assertFalse(f.isEnabled(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS)); + assertFalse(f.isEnabled(JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS)); } - public void testLeadingZeroesInt() + public void testLeadingZeroesInt() throws Exception { _testLeadingZeroesInt("00003", 3); _testLeadingZeroesInt("00003 ", 3); @@ -37,7 +38,7 @@ public void testLeadingZeroesInt() _testLeadingZeroesInt("0"+Integer.MAX_VALUE+" ", Integer.MAX_VALUE); } - public void _testLeadingZeroesInt(String valueStr, int value) + public void _testLeadingZeroesInt(String valueStr, int value) throws Exception { // first: verify that we get an exception @@ -48,14 +49,16 @@ public void _testLeadingZeroesInt(String valueStr, int value) p.nextToken(); p.currentText(); fail("Should have thrown an exception for doc <"+JSON+">"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "invalid numeric value"); } finally { p.close(); } // and then verify it's ok when enabled - f = f.rebuild().enable(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS).build(); + f = JsonFactory.builder() + .enable(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS) + .build(); p = createParser(f, JSON); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(value, p.getIntValue()); @@ -63,7 +66,7 @@ public void _testLeadingZeroesInt(String valueStr, int value) p.close(); } - public void testLeadingZeroesFloat() + public void testLeadingZeroesFloat() throws Exception { _testLeadingZeroesFloat("00.25", 0.25); _testLeadingZeroesFloat(" 00.25", 0.25); @@ -74,7 +77,7 @@ public void testLeadingZeroesFloat() _testLeadingZeroesFloat("-000.5 ", -0.5); } - private void _testLeadingZeroesFloat(String valueStr, double value) + private void _testLeadingZeroesFloat(String valueStr, double value) throws Exception { // first: verify that we get an exception JsonFactory f = new JsonFactory(); @@ -84,14 +87,16 @@ private void _testLeadingZeroesFloat(String valueStr, double value) p.nextToken(); p.currentText(); fail("Should have thrown an exception for doc <"+JSON+">"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "invalid numeric value"); } finally { p.close(); } // and then verify it's ok when enabled - f = f.rebuild().enable(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS).build(); + f = JsonFactory.builder() + .enable(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS) + .build(); p = createParser(f, JSON); assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); assertEquals(String.valueOf(value), p.currentText()); @@ -99,7 +104,7 @@ private void _testLeadingZeroesFloat(String valueStr, double value) p.close(); } - public void testLeadingPeriodFloat() + public void testLeadingPeriodFloat() throws Exception { _testLeadingPeriodFloat(".25", 0.25, 1); _testLeadingPeriodFloat(".25", 0.25, 100); @@ -114,6 +119,7 @@ public void testLeadingPeriodFloat() } private void _testLeadingPeriodFloat(String valueStr, double value, int bytesPerRead) + throws Exception { // first: verify that we get an exception @@ -124,7 +130,7 @@ private void _testLeadingPeriodFloat(String valueStr, double value, int bytesPer p.nextToken(); p.currentText(); fail("Should have thrown an exception for doc <"+JSON+">"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected character ('.'"); verifyException(e, "expected a valid value"); } finally { @@ -142,12 +148,13 @@ private void _testLeadingPeriodFloat(String valueStr, double value, int bytesPer p.close(); } - private AsyncReaderWrapper createParser(JsonFactory f, String doc) + private AsyncReaderWrapper createParser(JsonFactory f, String doc) throws IOException { return createParser(f, doc, 1); } private AsyncReaderWrapper createParser(JsonFactory f, String doc, int bytesPerRead) + throws IOException { return asyncForBytes(f, bytesPerRead, _jsonDoc(doc), 1); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNonStdParsingTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNonStdParsingTest.java index 71bc42b2a4..93508235a1 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNonStdParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNonStdParsingTest.java @@ -1,18 +1,18 @@ package com.fasterxml.jackson.core.json.async; +import java.io.IOException; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncNonStdParsingTest extends AsyncTestBase { - public void testLargeUnquotedNames() + public void testLargeUnquotedNames() throws Exception { final JsonFactory f = JsonFactory.builder() - .enable(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES) + .enable(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES) .build(); StringBuilder sb = new StringBuilder(5000); sb.append("[\n"); @@ -43,13 +43,13 @@ public void testLargeUnquotedNames() } private void _testLargeUnquoted(JsonFactory f, int reps, String doc, - int offset, int readSize) + int offset, int readSize) throws Exception { AsyncReaderWrapper p = createParser(f, doc, offset, readSize); assertToken(JsonToken.START_ARRAY, p.nextToken()); for (int i = 0; i < reps; ++i) { assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("abc"+(i&127), p.currentName()); assertToken(((i&1) != 0) ? JsonToken.VALUE_TRUE : JsonToken.VALUE_FALSE, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); @@ -58,10 +58,10 @@ private void _testLargeUnquoted(JsonFactory f, int reps, String doc, p.close(); } - public void testSimpleUnquotedNames() + public void testSimpleUnquotedNames() throws Exception { final JsonFactory f = JsonFactory.builder() - .enable(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES) + .enable(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES) .build(); _testSimpleUnquoted(f, 0, 99); _testSimpleUnquoted(f, 0, 5); @@ -75,25 +75,25 @@ public void testSimpleUnquotedNames() } private void _testSimpleUnquoted(JsonFactory f, - int offset, int readSize) + int offset, int readSize) throws Exception { String doc = "{ a : 1, _foo:true, $:\"money!\", \" \":null }"; AsyncReaderWrapper p = createParser(f, doc, offset, readSize); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("_foo", p.currentName()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("$", p.currentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("money!", p.currentText()); // and then regular quoted one should still work too: - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(" ", p.currentName()); assertToken(JsonToken.VALUE_NULL, p.nextToken()); @@ -106,11 +106,11 @@ private void _testSimpleUnquoted(JsonFactory f, p = createParser(f, "{ 123:true,4:false }", offset, readSize); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("123", p.currentName()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("4", p.currentName()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); @@ -123,7 +123,7 @@ private void _testSimpleUnquoted(JsonFactory f, * accept single-quotes for String values (field names, * textual values) */ - public void testAposQuotingDisabled() + public void testAposQuotingDisabled() throws Exception { JsonFactory f = new JsonFactory(); _testSingleQuotesDefault(f, 0, 99); @@ -136,7 +136,7 @@ public void testAposQuotingDisabled() } private void _testSingleQuotesDefault(JsonFactory f, - int offset, int readSize) + int offset, int readSize) throws Exception { // First, let's see that by default they are not allowed String JSON = "[ 'text' ]"; @@ -145,7 +145,7 @@ private void _testSingleQuotesDefault(JsonFactory f, try { p.nextToken(); fail("Expected exception"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected character ('''"); } finally { p.close(); @@ -157,7 +157,7 @@ private void _testSingleQuotesDefault(JsonFactory f, try { p.nextToken(); fail("Expected exception"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected character ('''"); } finally { p.close(); @@ -169,7 +169,7 @@ private void _testSingleQuotesDefault(JsonFactory f, * single quotes, to allow handling invalid (but, alas, common) * JSON. */ - public void testAposQuotingEnabled() + public void testAposQuotingEnabled() throws Exception { final JsonFactory f = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_SINGLE_QUOTES) @@ -186,7 +186,7 @@ public void testAposQuotingEnabled() } private void _testAposQuotingEnabled(JsonFactory f, - int offset, int readSize) + int offset, int readSize) throws Exception { String UNINAME = String.format("Uni%c-key-%c", UNICODE_2BYTES, UNICODE_3BYTES); String UNIVALUE = String.format("Uni%c-value-%c", UNICODE_3BYTES, UNICODE_2BYTES); @@ -196,29 +196,29 @@ private void _testAposQuotingEnabled(JsonFactory f, AsyncReaderWrapper p = createParser(f, JSON, offset, readSize); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentText()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals("1", p.currentText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("foobar", p.currentText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("b", p.currentText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("_abcde1234", p.currentText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("d", p.currentText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("\"", p.currentText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("\"\"", p.currentText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("", p.currentText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("", p.currentText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(UNINAME, p.currentText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(UNIVALUE, p.currentText()); @@ -229,35 +229,35 @@ private void _testAposQuotingEnabled(JsonFactory f, JSON = "{'b':1,'array':[{'b':3}],'ob':{'b':4,'x':0,'y':'"+UNICODE_SEGMENT+"','a':false }}"; p = createParser(f, JSON, offset, readSize); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(3, p.getIntValue()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(4, p.getIntValue()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("x", p.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(0, p.getIntValue()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("y", p.currentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(UNICODE_SEGMENT, p.currentText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.currentName()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); @@ -267,7 +267,7 @@ private void _testAposQuotingEnabled(JsonFactory f, } // test to verify that we implicitly allow escaping of apostrophe - public void testSingleQuotesEscaped() + public void testSingleQuotesEscaped() throws Exception { final JsonFactory f = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_SINGLE_QUOTES) @@ -282,7 +282,7 @@ public void testSingleQuotesEscaped() } private void _testSingleQuotesEscaped(JsonFactory f, - int offset, int readSize) + int offset, int readSize) throws Exception { String JSON = "[ '16\\'' ]"; AsyncReaderWrapper p = createParser(f, JSON, offset, readSize); @@ -294,10 +294,10 @@ private void _testSingleQuotesEscaped(JsonFactory f, p.close(); } - public void testNonStandardNameChars() + public void testNonStandardNameChars() throws Exception { final JsonFactory f = JsonFactory.builder() - .enable(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES) + .enable(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES) .build(); _testNonStandardNameChars(f, 0, 99); _testNonStandardNameChars(f, 0, 6); @@ -309,7 +309,7 @@ public void testNonStandardNameChars() } private void _testNonStandardNameChars(JsonFactory f, - int offset, int readSize) + int offset, int readSize) throws Exception { String JSON = "{ @type : \"mytype\", #color : 123, *error* : true, " +" hyphen-ated : \"yes\", me+my : null" @@ -318,26 +318,26 @@ private void _testNonStandardNameChars(JsonFactory f, assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("@type", p.currentText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("mytype", p.currentText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("#color", p.currentText()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(123, p.getIntValue()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("*error*", p.currentText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("hyphen-ated", p.currentText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("yes", p.currentText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("me+my", p.currentText()); assertToken(JsonToken.VALUE_NULL, p.nextToken()); @@ -345,7 +345,7 @@ private void _testNonStandardNameChars(JsonFactory f, p.close(); } - public void testNonStandarBackslashQuotingForValues(int mode) + public void testNonStandarBackslashQuotingForValues(int mode) throws Exception { _testNonStandarBackslashQuoting(0, 99); _testNonStandarBackslashQuoting(0, 6); @@ -357,7 +357,7 @@ public void testNonStandarBackslashQuotingForValues(int mode) } private void _testNonStandarBackslashQuoting( - int offset, int readSize) + int offset, int readSize) throws Exception { // first: verify that we get an exception JsonFactory f = new JsonFactory(); @@ -367,7 +367,7 @@ private void _testNonStandarBackslashQuoting( p.nextToken(); p.currentText(); fail("Should have thrown an exception for doc <"+JSON+">"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "unrecognized character escape"); } finally { p.close(); @@ -383,7 +383,7 @@ private void _testNonStandarBackslashQuoting( } private AsyncReaderWrapper createParser(JsonFactory f, String doc, - int offset, int readSize) + int offset, int readSize) throws IOException { return asyncForBytes(f, readSize, _jsonDoc(doc), offset); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNumberCoercionTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNumberCoercionTest.java index d814038dfa..6444822c9b 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNumberCoercionTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncNumberCoercionTest.java @@ -4,9 +4,9 @@ import java.math.BigDecimal; import java.math.BigInteger; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser.NumberType; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.exc.InputCoercionException; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; import com.fasterxml.jackson.core.JsonToken; @@ -73,7 +73,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -86,7 +86,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -99,7 +99,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_FLOAT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -110,7 +110,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_FLOAT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -123,7 +123,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -134,7 +134,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -189,7 +189,7 @@ public void testToLongFailing() throws Exception p.getLongValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `long`"); + verifyException(e, "out of range of long"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Long.TYPE, e.getTargetType()); } @@ -201,7 +201,7 @@ public void testToLongFailing() throws Exception p.getLongValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `long`"); + verifyException(e, "out of range of long"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Long.TYPE, e.getTargetType()); } diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncParserNamesTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncParserNamesTest.java index d973f27bb7..8a0b99e76c 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncParserNamesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncParserNamesTest.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; @@ -39,7 +38,7 @@ private void _testWithName(String name) throws IOException assertNull(p.currentToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(name, p.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); @@ -60,18 +59,17 @@ public void testSymbolTable() throws IOException final ByteQuadsCanonicalizer symbols1 = ((NonBlockingJsonParserBase) p.parser()).symbolTableForTests(); assertEquals(0, symbols1.size()); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - // field names not intern()ed by default any more in 3.x - assertEquals(STR1, p.currentName()); -// assertSame(STR1, p.currentName()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); + // field names are interned: + assertSame(STR1, p.currentName()); assertEquals(1, symbols1.size()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("foobar", p.currentName()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); + assertSame("foobar", p.currentName()); assertEquals(2, symbols1.size()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("longername", p.currentName()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); + assertSame("longername", p.currentName()); assertEquals(3, symbols1.size()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(JsonToken.END_OBJECT, p.nextToken()); @@ -88,17 +86,17 @@ public void testSymbolTable() throws IOException assertEquals(3, symbols2.size()); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); // field names are interned: - assertEquals(STR1, p.currentName()); + assertSame(STR1, p.currentName()); assertEquals(3, symbols2.size()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("foobar", p.currentName()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); + assertSame("foobar", p.currentName()); assertEquals(3, symbols2.size()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("longername", p.currentName()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); + assertSame("longername", p.currentName()); assertEquals(3, symbols2.size()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(JsonToken.END_OBJECT, p.nextToken()); @@ -110,36 +108,6 @@ public void testSymbolTable() throws IOException p.close(); } - public void testSymbolTableWithIntern() throws IOException - { - JsonFactory internF = JsonFactory.builder() - .enable(TokenStreamFactory.Feature.INTERN_PROPERTY_NAMES) - .build(); - - final String STR1 = "a"; - byte[] doc = _jsonDoc("{ "+quote(STR1)+":1, \"foobar\":2, \"longername\":3 }"); - AsyncReaderWrapper p = asyncForBytes(internF, 5, doc, 0); - final ByteQuadsCanonicalizer symbols1 = ((NonBlockingJsonParserBase) p.parser()).symbolTableForTests(); - assertEquals(0, symbols1.size()); - assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertSame(STR1, p.currentName()); - assertEquals(1, symbols1.size()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertSame("foobar", p.currentName()); - assertEquals(2, symbols1.size()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertSame("longername", p.currentName()); - assertEquals(3, symbols1.size()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonToken.END_OBJECT, p.nextToken()); - assertNull(p.nextToken()); - assertEquals(3, symbols1.size()); - p.close(); - } - /* /********************************************************** /* Helper methods diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncPointerFromContext563Test.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncPointerFromContext563Test.java index 98bb9baff8..e9006e2b72 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncPointerFromContext563Test.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncPointerFromContext563Test.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncPointerFromContext563Test extends AsyncTestBase @@ -39,13 +38,13 @@ public void _testPointerWithAsyncParser(byte[] doc, int offset, int readSize) th assertEquals("", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // a + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // a assertEquals("/a", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals("/a", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // array + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // array assertEquals("/array", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertEquals("/array", p.getParsingContext().pathAsPointer().toString()); @@ -63,7 +62,7 @@ public void _testPointerWithAsyncParser(byte[] doc, int offset, int readSize) th assertEquals("/array/3", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertEquals("/array/4", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // obInArray + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // obInArray assertEquals("/array/4/obInArray", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // 4 assertEquals("/array/4/obInArray", p.getParsingContext().pathAsPointer().toString()); @@ -72,11 +71,11 @@ public void _testPointerWithAsyncParser(byte[] doc, int offset, int readSize) th assertToken(JsonToken.END_ARRAY, p.nextToken()); // /array assertEquals("/array", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // ob + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // ob assertEquals("/ob", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertEquals("/ob", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // first + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // first assertEquals("/ob/first", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertEquals("/ob/first", p.getParsingContext().pathAsPointer().toString()); @@ -86,11 +85,11 @@ public void _testPointerWithAsyncParser(byte[] doc, int offset, int readSize) th assertEquals("/ob/first/1", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.END_ARRAY, p.nextToken()); assertEquals("/ob/first", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // second + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // second assertEquals("/ob/second", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertEquals("/ob/second", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // sub + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // sub assertEquals("/ob/second/sub", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // 37 assertEquals("/ob/second/sub", p.getParsingContext().pathAsPointer().toString()); @@ -99,7 +98,7 @@ public void _testPointerWithAsyncParser(byte[] doc, int offset, int readSize) th assertToken(JsonToken.END_OBJECT, p.nextToken()); // /ob assertEquals("/ob", p.getParsingContext().pathAsPointer().toString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); // b + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // b assertEquals("/b", p.getParsingContext().pathAsPointer().toString()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); assertEquals("/b", p.getParsingContext().pathAsPointer().toString()); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncRootNumbersTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncRootNumbersTest.java index f4569c4f75..6cd43f2c5f 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncRootNumbersTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncRootNumbersTest.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncRootNumbersTest extends AsyncTestBase diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncRootValuesTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncRootValuesTest.java index b46164b476..16b24c19ef 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncRootValuesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncRootValuesTest.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncRootValuesTest extends AsyncTestBase @@ -121,7 +120,7 @@ private void _testMixedRootSequence(JsonFactory f, // { "a":4 } assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("a", r.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, r.nextToken()); assertEquals(4, r.getIntValue()); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncScalarArrayTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncScalarArrayTest.java index 6231f8f5f2..3920dbf598 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncScalarArrayTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncScalarArrayTest.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.JsonParser.NumberType; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncScalarArrayTest extends AsyncTestBase @@ -125,7 +124,7 @@ public void testLong() throws IOException Long.MIN_VALUE, Long.MAX_VALUE }; ByteArrayOutputStream bytes = new ByteArrayOutputStream(100); JsonFactory f = JSON_F; - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator g = f.createGenerator(bytes); g.writeStartArray(); for (int i = 0; i < input.length; ++i) { g.writeNumber(input[i]); @@ -172,7 +171,7 @@ public void testFloats() throws IOException final float[] input = new float[] { 0.0f, 0.25f, -0.5f, 10000.125f, - 99999.075f }; ByteArrayOutputStream bytes = new ByteArrayOutputStream(100); JsonFactory f = JSON_F; - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator g = f.createGenerator(bytes); g.writeStartArray(); for (int i = 0; i < input.length; ++i) { g.writeNumber(input[i]); @@ -214,7 +213,7 @@ public void testDoubles() throws IOException -99999.075 }; ByteArrayOutputStream bytes = new ByteArrayOutputStream(100); JsonFactory f = JSON_F; - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator g = f.createGenerator(bytes); g.writeStartArray(); for (int i = 0; i < input.length; ++i) { g.writeNumber(input[i]); @@ -278,7 +277,7 @@ public void testBigIntegers() throws IOException }; ByteArrayOutputStream bytes = new ByteArrayOutputStream(100); JsonFactory f = JSON_F; - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator g = f.createGenerator(bytes); g.writeStartArray(); for (int i = 0; i < input.length; ++i) { g.writeNumber(input[i]); @@ -330,7 +329,7 @@ public void testBigDecimals() throws IOException }; ByteArrayOutputStream bytes = new ByteArrayOutputStream(100); JsonFactory f = JSON_F; - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator g = f.createGenerator(bytes); g.writeStartArray(); for (int i = 0; i < input.length; ++i) { g.writeNumber(input[i]); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncScopeMatchingTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncScopeMatchingTest.java index d9154ad955..f4b1d4282c 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncScopeMatchingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncScopeMatchingTest.java @@ -1,9 +1,9 @@ package com.fasterxml.jackson.core.json.async; +import java.io.IOException; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; /** @@ -12,9 +12,9 @@ */ public class AsyncScopeMatchingTest extends AsyncTestBase { - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); - public void testUnclosedArray() throws Exception + public void testUnclosedArray(int mode) throws Exception { AsyncReaderWrapper p = asyncForBytes(JSON_F, 3, _jsonDoc("[ 1, 2 "), 0); assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -24,28 +24,28 @@ public void testUnclosedArray() throws Exception try { p.nextToken(); - fail("Expected an exception for unclosed ARRAY"); - } catch (StreamReadException pe) { - verifyException(pe, "expected a value token"); + fail("Expected an exception for unclosed ARRAY (mode: "+mode+")"); + } catch (JsonParseException pe) { + verifyException(pe, "expected close marker for ARRAY"); } } - public void testUnclosedObject() throws Exception + public void testUnclosedObject(int mode) throws Exception { AsyncReaderWrapper p = asyncForBytes(JSON_F, 3, _jsonDoc("{ \"key\" : 3 "), 0); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); try { p.nextToken(); - fail("Expected an exception for unclosed OBJECT"); - } catch (StreamReadException pe) { - verifyException(pe, "expected an Object property name or END_ARRAY"); + fail("Expected an exception for unclosed OBJECT (mode: "+mode+")"); + } catch (JsonParseException pe) { + verifyException(pe, "expected close marker for OBJECT"); } } - public void testEOFInName() throws Exception + public void testEOFInName(int mode) throws Exception { final String JSON = "{ \"abcd"; AsyncReaderWrapper p = asyncForBytes(JSON_F, 3, _jsonDoc(JSON), 0); @@ -53,8 +53,14 @@ public void testEOFInName() throws Exception try { p.nextToken(); fail("Expected an exception for EOF"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "Unexpected end-of-input"); + } catch (IOException ie) { + // DataInput behaves bit differently + if (mode == MODE_DATA_INPUT) { + verifyException(ie, "end-of-input"); + return; + } } } @@ -68,7 +74,7 @@ public void testMismatchArrayToObject() throws Exception try { p.nextToken(); fail("Expected an exception for incorrectly closed ARRAY"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "Unexpected close marker '}': expected ']'"); } p.close(); @@ -84,13 +90,13 @@ public void testMismatchObjectToArray() throws Exception try { p.nextToken(); fail("Expected an exception for incorrectly closed OBJECT"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "Unexpected close marker ']': expected '}'"); } p.close(); } - public void testMisssingColon() throws Exception + public void testMisssingColon(int mode) throws Exception { final String JSON = "{ \"a\" \"b\" }"; AsyncReaderWrapper p = asyncForBytes(JSON_F, 3, _jsonDoc(JSON), 0); @@ -98,10 +104,10 @@ public void testMisssingColon() throws Exception assertToken(JsonToken.START_OBJECT, p.nextToken()); try { // can be either here, or with next one... - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); p.nextToken(); fail("Expected an exception for missing semicolon"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "was expecting a colon"); } p.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncSimpleNestedTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncSimpleNestedTest.java index def4e8420d..5922db0dfb 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncSimpleNestedTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncSimpleNestedTest.java @@ -1,14 +1,14 @@ package com.fasterxml.jackson.core.json.async; +import java.io.IOException; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncSimpleNestedTest extends AsyncTestBase { - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); /* /********************************************************************** @@ -16,7 +16,7 @@ public class AsyncSimpleNestedTest extends AsyncTestBase /********************************************************************** */ - public void testStuffInObject() + public void testStuffInObject() throws Exception { byte[] data = _jsonDoc(aposToQuotes( "{'foobar':[1,2,-999],'emptyObject':{},'emptyArray':[], 'other':{'':null} }")); @@ -32,13 +32,13 @@ public void testStuffInObject() } private void _testStuffInObject(JsonFactory f, - byte[] data, int offset, int readSize) + byte[] data, int offset, int readSize) throws IOException { AsyncReaderWrapper r = asyncForBytes(f, readSize, data, offset); assertToken(JsonToken.START_OBJECT, r.nextToken()); assertFalse(r.parser().hasTextCharacters()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("foobar", r.currentName()); assertToken(JsonToken.START_ARRAY, r.nextToken()); assertEquals("[", r.currentText()); @@ -50,21 +50,21 @@ private void _testStuffInObject(JsonFactory f, assertEquals(-999, r.getIntValue()); assertToken(JsonToken.END_ARRAY, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("emptyObject", r.currentName()); assertToken(JsonToken.START_OBJECT, r.nextToken()); assertToken(JsonToken.END_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("emptyArray", r.currentName()); assertToken(JsonToken.START_ARRAY, r.nextToken()); assertToken(JsonToken.END_ARRAY, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("other", r.currentName()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("", r.currentName()); assertToken(JsonToken.VALUE_NULL, r.nextToken()); assertToken(JsonToken.END_OBJECT, r.nextToken()); @@ -74,13 +74,13 @@ private void _testStuffInObject(JsonFactory f, // another twist: close in the middle, verify r = asyncForBytes(f, readSize, data, offset); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); r.parser().close(); assertTrue(r.parser().isClosed()); assertNull(r.parser().nextToken()); } - public void testStuffInArray() + public void testStuffInArray() throws Exception { byte[] data = _jsonDoc(aposToQuotes("[true,{'moreStuff':0},[null],{'extraOrdinary':23}]")); JsonFactory f = JSON_F; @@ -95,7 +95,7 @@ public void testStuffInArray() } private void _testStuffInArray(JsonFactory f, - byte[] data, int offset, int readSize) + byte[] data, int offset, int readSize) throws IOException { AsyncReaderWrapper r = asyncForBytes(f, readSize, data, offset); assertToken(JsonToken.START_ARRAY, r.nextToken()); @@ -104,7 +104,7 @@ private void _testStuffInArray(JsonFactory f, assertToken(JsonToken.VALUE_TRUE, r.nextToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); assertEquals("{", r.currentText()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("moreStuff", r.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, r.nextToken()); assertEquals(0L, r.getLongValue()); @@ -115,7 +115,7 @@ private void _testStuffInArray(JsonFactory f, assertToken(JsonToken.END_ARRAY, r.nextToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("extraOrdinary", r.currentName()); assertToken(JsonToken.VALUE_NUMBER_INT, r.nextToken()); assertEquals(23, r.getIntValue()); @@ -126,7 +126,7 @@ private void _testStuffInArray(JsonFactory f, final static String SHORT_NAME = String.format("u-%s", UNICODE_SEGMENT); final static String LONG_NAME = String.format("Unicode-with-some-longer-name-%s", UNICODE_SEGMENT); - public void testStuffInArray2() + public void testStuffInArray2() throws Exception { byte[] data = _jsonDoc(aposToQuotes(String.format( "[{'%s':true},{'%s':false},{'%s':true},{'%s':false}]", @@ -143,31 +143,31 @@ public void testStuffInArray2() } private void _testStuffInArray2(JsonFactory f, - byte[] data, int offset, int readSize) + byte[] data, int offset, int readSize) throws IOException { AsyncReaderWrapper r = asyncForBytes(f, readSize, data, offset); assertToken(JsonToken.START_ARRAY, r.nextToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(SHORT_NAME, r.currentName()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); assertToken(JsonToken.END_OBJECT, r.nextToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(LONG_NAME, r.currentName()); assertToken(JsonToken.VALUE_FALSE, r.nextToken()); assertToken(JsonToken.END_OBJECT, r.nextToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(LONG_NAME, r.currentName()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); assertToken(JsonToken.END_OBJECT, r.nextToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(SHORT_NAME, r.currentName()); assertToken(JsonToken.VALUE_FALSE, r.nextToken()); assertToken(JsonToken.END_OBJECT, r.nextToken()); @@ -181,7 +181,7 @@ private void _testStuffInArray2(JsonFactory f, /********************************************************************** */ - public void testMismatchedArray() + public void testMismatchedArray() throws Exception { byte[] data = _jsonDoc(aposToQuotes("[ }")); @@ -196,19 +196,19 @@ public void testMismatchedArray() } private void _testMismatchedArray(JsonFactory f, - byte[] data, int offset, int readSize) + byte[] data, int offset, int readSize) throws IOException { AsyncReaderWrapper r = asyncForBytes(f, readSize, data, offset); assertToken(JsonToken.START_ARRAY, r.nextToken()); try { r.nextToken(); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected close marker '}': expected ']'"); } } - public void testMismatchedObject() + public void testMismatchedObject() throws Exception { byte[] data = _jsonDoc(aposToQuotes("{ ]")); @@ -223,14 +223,14 @@ public void testMismatchedObject() } private void _testMismatchedObject(JsonFactory f, - byte[] data, int offset, int readSize) + byte[] data, int offset, int readSize) throws IOException { AsyncReaderWrapper r = asyncForBytes(f, readSize, data, offset); assertToken(JsonToken.START_OBJECT, r.nextToken()); try { r.nextToken(); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected close marker ']': expected '}'"); } } diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncSimpleObjectTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncSimpleObjectTest.java index 822bde3da3..9e29475d6e 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncSimpleObjectTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncSimpleObjectTest.java @@ -1,19 +1,17 @@ package com.fasterxml.jackson.core.json.async; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.math.BigDecimal; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.JsonParser.NumberType; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.InputCoercionException; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncSimpleObjectTest extends AsyncTestBase { - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); /* /********************************************************************** @@ -25,7 +23,7 @@ public class AsyncSimpleObjectTest extends AsyncTestBase private final static String UNICODE_LONG_NAME = "Unicode-with-"+UNICODE_3BYTES+"-much-longer"; - public void testBooleans() + public void testBooleans() throws IOException { final JsonFactory f = JSON_F; byte[] data = _jsonDoc(aposToQuotes( @@ -43,14 +41,14 @@ public void testBooleans() } private void _testBooleans(JsonFactory f, - byte[] data, int offset, int readSize) + byte[] data, int offset, int readSize) throws IOException { AsyncReaderWrapper r = asyncForBytes(f, readSize, data, offset); // start with "no token" assertNull(r.currentToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("a", r.currentText()); // by default no cheap access to char[] version: assertFalse(r.parser().hasTextCharacters()); @@ -63,23 +61,23 @@ private void _testBooleans(JsonFactory f, assertToken(JsonToken.VALUE_TRUE, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("b", r.currentText()); assertToken(JsonToken.VALUE_FALSE, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("acdc", r.currentText()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(UNICODE_SHORT_NAME, r.currentText()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("a1234567", r.currentText()); assertToken(JsonToken.VALUE_FALSE, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(UNICODE_LONG_NAME, r.currentText()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); @@ -87,13 +85,13 @@ private void _testBooleans(JsonFactory f, try { r.getDoubleValue(); fail("Should not pass"); - } catch (InputCoercionException e) { + } catch (JsonProcessingException e) { verifyException(e, "Current token (VALUE_TRUE) not numeric"); } try { r.parser().getBinaryValue(); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonProcessingException e) { verifyException(e, "Current token (VALUE_TRUE) not"); verifyException(e, "can not access as binary"); } @@ -109,15 +107,15 @@ private void _testBooleans(JsonFactory f, private final double NUMBER_EXP_D = 1024798.125; private final BigDecimal NUMBER_EXP_BD = new BigDecimal("1243565768679065.1247305834"); - public void testNumbers() + public void testNumbers() throws IOException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(100); JsonFactory f = JSON_F; - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator g = f.createGenerator(bytes); g.writeStartObject(); - g.writeNumberProperty("i1", NUMBER_EXP_I); - g.writeNumberProperty("doubley", NUMBER_EXP_D); - g.writeName("biggieDecimal"); + g.writeNumberField("i1", NUMBER_EXP_I); + g.writeNumberField("doubley", NUMBER_EXP_D); + g.writeFieldName("biggieDecimal"); g.writeNumber(NUMBER_EXP_BD.toString()); g.writeEndObject(); g.close(); @@ -137,28 +135,28 @@ public void testNumbers() } private void _testNumbers(JsonFactory f, - byte[] data, int offset, int readSize) + byte[] data, int offset, int readSize) throws IOException { AsyncReaderWrapper r = asyncForBytes(f, readSize, data, offset); // start with "no token" assertNull(r.currentToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("i1", r.currentText()); assertToken(JsonToken.VALUE_NUMBER_INT, r.nextToken()); assertEquals(NumberType.INT, r.getNumberType()); assertEquals(NUMBER_EXP_I, r.getIntValue()); assertEquals((double)NUMBER_EXP_I, r.getDoubleValue()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("doubley", r.currentText()); assertToken(JsonToken.VALUE_NUMBER_FLOAT, r.nextToken()); assertEquals(NumberType.DOUBLE, r.getNumberType()); assertEquals(NUMBER_EXP_D, r.getDoubleValue()); assertEquals((long) NUMBER_EXP_D, r.getLongValue()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals("biggieDecimal", r.currentText()); assertToken(JsonToken.VALUE_NUMBER_FLOAT, r.nextToken()); // can't really tell double/BigDecimal apart in plain json diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncStringArrayTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncStringArrayTest.java index 90ef1db8d3..d826d17b08 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncStringArrayTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncStringArrayTest.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncStringArrayTest extends AsyncTestBase @@ -30,7 +29,7 @@ public void testShortAsciiStrings() throws IOException final String[] input = new String[] { "Test", "", "1", // 60 chars, to stay short - String.format("%s%s%s%s%s%s%s", + String.format("%s%s%s%s%s%s", str0to9,str0to9,str0to9,str0to9,str0to9,str0to9,str0to9), // "And unicode: "+UNICODE_2BYTES+" / "+UNICODE_3BYTES, // plus let's do back refs: @@ -154,7 +153,7 @@ private void _testStrings(JsonFactory f, String[] values, private byte[] _stringDoc(JsonFactory f, String[] input) throws IOException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(100); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator g = f.createGenerator(bytes); g.writeStartArray(); for (int i = 0; i < input.length; ++i) { g.writeString(input[i]); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncStringObjectTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncStringObjectTest.java index 573a439ba1..e9dd38b545 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncStringObjectTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncStringObjectTest.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncStringObjectTest extends AsyncTestBase @@ -53,7 +52,7 @@ private void _testBasicFieldsNames2(JsonFactory f, assertNull(r.currentToken()); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); if (verifyContents) { assertEquals(UNICODE_SHORT_NAME, r.currentName()); assertEquals(UNICODE_SHORT_NAME, r.currentText()); @@ -65,7 +64,7 @@ private void _testBasicFieldsNames2(JsonFactory f, assertEquals(UNICODE_LONG_NAME, r.currentText()); } - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); if (verifyContents) { assertEquals(UNICODE_LONG_NAME, r.currentName()); assertEquals(UNICODE_LONG_NAME, r.currentText()); @@ -76,7 +75,7 @@ private void _testBasicFieldsNames2(JsonFactory f, } // and ASCII entry - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); if (verifyContents) { assertEquals(ASCII_SHORT_NAME, r.currentName()); assertEquals(ASCII_SHORT_NAME, r.currentText()); @@ -93,17 +92,17 @@ private void _testBasicFieldsNames2(JsonFactory f, if (verifyContents) { r = asyncForBytes(f, readSize, data, offset); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(UNICODE_SHORT_NAME, r.currentTextViaWriter()); assertToken(JsonToken.VALUE_STRING, r.nextToken()); assertEquals(UNICODE_LONG_NAME, r.currentTextViaWriter()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(UNICODE_LONG_NAME, r.currentTextViaWriter()); assertToken(JsonToken.VALUE_STRING, r.nextToken()); assertEquals(UNICODE_SHORT_NAME, r.currentTextViaWriter()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(ASCII_SHORT_NAME, r.currentTextViaWriter()); assertToken(JsonToken.VALUE_STRING, r.nextToken()); assertEquals(ASCII_SHORT_NAME, r.currentTextViaWriter()); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncTokenFilterTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncTokenFilterTest.java index 5dec2d1146..33e77a194d 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncTokenFilterTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncTokenFilterTest.java @@ -1,49 +1,59 @@ package com.fasterxml.jackson.core.json.async; +import java.io.IOException; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.core.filter.FilteringParserDelegate; import com.fasterxml.jackson.core.filter.TokenFilter; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; -import com.fasterxml.jackson.core.json.JsonFactory; // [core#462], [core#463] public class AsyncTokenFilterTest extends AsyncTestBase { - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); private final static String INPUT_STRING = aposToQuotes("{'a': 1, 'b': [2, {'c': 3}]}"); private final static byte[] INPUT_BYTES = utf8Bytes(INPUT_STRING); private final static TokenFilter TOKEN_FILTER = new TokenFilter() { @Override public TokenFilter includeProperty(String name) { - return name.equals("a") ? TokenFilter.INCLUDE_ALL : null; + return name == "a" ? TokenFilter.INCLUDE_ALL : null; } }; + private final static JsonToken[] EXPECTED_TOKENS = new JsonToken[]{ + JsonToken.START_OBJECT, + JsonToken.FIELD_NAME, + JsonToken.VALUE_NUMBER_INT, + JsonToken.END_OBJECT + }; + // Passes if (but only if) all content is actually available - public void testFilteredNonBlockingParserAllContent() + public void testFilteredNonBlockingParserAllContent() throws IOException { - NonBlockingJsonParser nbParser = _nonBlockingParser(); - FilteringParserDelegate filteredParser = new FilteringParserDelegate(nbParser, + NonBlockingJsonParser nonBlockingParser = (NonBlockingJsonParser) JSON_F.createNonBlockingByteArrayParser(); + FilteringParserDelegate filteredParser = new FilteringParserDelegate(nonBlockingParser, TOKEN_FILTER, Inclusion.INCLUDE_ALL_AND_PATH, true); - nbParser.feedInput(INPUT_BYTES, 0, INPUT_BYTES.length); + nonBlockingParser.feedInput(INPUT_BYTES, 0, INPUT_BYTES.length); + int expectedIdx = 0; + while (expectedIdx < EXPECTED_TOKENS.length) { + // grab next token + JsonToken actual = filteredParser.nextToken(); - assertToken(JsonToken.START_OBJECT, filteredParser.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, filteredParser.nextToken()); - assertEquals("a", nbParser.currentName()); - assertToken(JsonToken.VALUE_NUMBER_INT, filteredParser.nextToken()); - assertEquals(1, nbParser.getIntValue()); - assertToken(JsonToken.END_OBJECT, filteredParser.nextToken()); + // make sure it's the right one and mark it as seen. + assertToken(EXPECTED_TOKENS[expectedIdx], actual); + expectedIdx++; + } filteredParser.close(); - nbParser.close(); + nonBlockingParser.close(); } - public void testSkipChildrenFailOnSplit() + public void testSkipChildrenFailOnSplit() throws IOException { - NonBlockingJsonParser nbParser = _nonBlockingParser(); + NonBlockingJsonParser nbParser = (NonBlockingJsonParser) JSON_F.createNonBlockingByteArrayParser(); + @SuppressWarnings("resource") FilteringParserDelegate filteredParser = new FilteringParserDelegate(nbParser, TOKEN_FILTER, Inclusion.INCLUDE_ALL_AND_PATH, true); nbParser.feedInput(INPUT_BYTES, 0, 5); @@ -52,15 +62,11 @@ public void testSkipChildrenFailOnSplit() try { nbParser.skipChildren(); fail("Should not pass!"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "not enough content available"); verifyException(e, "skipChildren()"); } - filteredParser.close(); nbParser.close(); - } - - private NonBlockingJsonParser _nonBlockingParser() { - return (NonBlockingJsonParser) JSON_F.createNonBlockingByteArrayParser(ObjectReadContext.empty()); + filteredParser.close(); } } diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncUnicodeHandlingTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncUnicodeHandlingTest.java index a7b41fd366..05915feaa8 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/AsyncUnicodeHandlingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/AsyncUnicodeHandlingTest.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncUnicodeHandlingTest extends AsyncTestBase @@ -79,7 +78,7 @@ private void _testUnicodeWithSurrogates(JsonFactory f, data = _jsonDoc("{"+quoted+":true}"); r = asyncForBytes(f, readSize, data, 0); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertEquals(TEXT, r.currentName()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); assertToken(JsonToken.END_OBJECT, r.nextToken()); @@ -89,7 +88,7 @@ private void _testUnicodeWithSurrogates(JsonFactory f, // and skipping r = asyncForBytes(f, readSize, data, 0); assertToken(JsonToken.START_OBJECT, r.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, r.nextToken()); + assertToken(JsonToken.FIELD_NAME, r.nextToken()); assertToken(JsonToken.VALUE_TRUE, r.nextToken()); assertToken(JsonToken.END_OBJECT, r.nextToken()); r.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/async/ConfigTest.java b/src/test/java/com/fasterxml/jackson/core/json/async/ConfigTest.java index e510361785..83c959b597 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/async/ConfigTest.java +++ b/src/test/java/com/fasterxml/jackson/core/json/async/ConfigTest.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class ConfigTest extends AsyncTestBase @@ -23,7 +22,8 @@ public void testAsyncParerDefaults() throws IOException JsonParser p = r.parser(); assertTrue(p.canParseAsync()); - assertNull(p.streamReadInputSource()); + assertNull(p.getCodec()); + assertNull(p.getInputSource()); assertEquals(-1, p.releaseBuffered(new StringWriter())); assertEquals(0, p.releaseBuffered(new ByteArrayOutputStream())); diff --git a/src/test/java/com/fasterxml/jackson/core/read/ArrayParsingTest.java b/src/test/java/com/fasterxml/jackson/core/read/ArrayParsingTest.java index 7be7b60e17..cb52d2adc0 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/ArrayParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ArrayParsingTest.java @@ -1,8 +1,6 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; /** @@ -16,61 +14,61 @@ public void testValidEmpty() throws Exception { final String DOC = "[ \n ]"; - JsonParser p = createParserUsingStream(DOC, "UTF-8"); - assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertNull(p.nextToken()); - p.close(); + JsonParser jp = createParserUsingStream(DOC, "UTF-8"); + assertToken(JsonToken.START_ARRAY, jp.nextToken()); + assertToken(JsonToken.END_ARRAY, jp.nextToken()); + assertNull(jp.nextToken()); + jp.close(); } public void testInvalidEmptyMissingClose() throws Exception { final String DOC = "[ "; - JsonParser p = createParserUsingStream(DOC, "UTF-8"); - assertToken(JsonToken.START_ARRAY, p.nextToken()); + JsonParser jp = createParserUsingStream(DOC, "UTF-8"); + assertToken(JsonToken.START_ARRAY, jp.nextToken()); try { - p.nextToken(); + jp.nextToken(); fail("Expected a parsing error for missing array close marker"); - } catch (StreamReadException jex) { + } catch (JsonParseException jex) { verifyException(jex, "expected close marker for ARRAY"); } - p.close(); + jp.close(); } public void testInvalidMissingFieldName() throws Exception { final String DOC = "[ : 3 ] "; - JsonParser p = createParserUsingStream(DOC, "UTF-8"); - assertToken(JsonToken.START_ARRAY, p.nextToken()); + JsonParser jp = createParserUsingStream(DOC, "UTF-8"); + assertToken(JsonToken.START_ARRAY, jp.nextToken()); try { - p.nextToken(); + jp.nextToken(); fail("Expected a parsing error for odd character"); - } catch (StreamReadException jex) { + } catch (JsonParseException jex) { verifyException(jex, "Unexpected character"); } - p.close(); + jp.close(); } public void testInvalidExtraComma() throws Exception { final String DOC = "[ 24, ] "; - JsonParser p = createParserUsingStream(DOC, "UTF-8"); - assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(24, p.getIntValue()); + JsonParser jp = createParserUsingStream(DOC, "UTF-8"); + assertToken(JsonToken.START_ARRAY, jp.nextToken()); + assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertEquals(24, jp.getIntValue()); try { - p.nextToken(); + jp.nextToken(); fail("Expected a parsing error for missing array close marker"); - } catch (StreamReadException jex) { + } catch (JsonParseException jex) { verifyException(jex, "expected a value"); } - p.close(); + jp.close(); } /** @@ -110,38 +108,39 @@ public void testNotMissingValueByEnablingFeature() throws Exception private void _testMissingValueByEnablingFeature(boolean useStream) throws Exception { String DOC = "[ \"a\",,,,\"abc\", ] "; + JsonFactory f = JsonFactory.builder() - .enable(JsonReadFeature.ALLOW_MISSING_VALUES).build(); - - JsonParser p = useStream ? createParserUsingStream(f, DOC, "UTF-8") - : createParserUsingReader(f, DOC); + .enable(JsonReadFeature.ALLOW_MISSING_VALUES) + .build(); + JsonParser jp = useStream ? createParserUsingStream(f, DOC, "UTF-8") + : createParserUsingReader(f, DOC); - assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals("a", p.getValueAsString()); + assertToken(JsonToken.START_ARRAY, jp.nextToken()); + assertToken(JsonToken.VALUE_STRING, jp.nextToken()); + assertEquals("a", jp.getValueAsString()); - assertToken(JsonToken.VALUE_NULL, p.nextToken()); - assertToken(JsonToken.VALUE_NULL, p.nextToken()); - assertToken(JsonToken.VALUE_NULL, p.nextToken()); - assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertToken(JsonToken.VALUE_NULL, p.nextToken()); - assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertNull(p.nextToken()); + assertToken(JsonToken.VALUE_NULL, jp.nextToken()); + assertToken(JsonToken.VALUE_NULL, jp.nextToken()); + assertToken(JsonToken.VALUE_NULL, jp.nextToken()); + assertToken(JsonToken.VALUE_STRING, jp.nextToken()); + assertToken(JsonToken.VALUE_NULL, jp.nextToken()); + assertToken(JsonToken.END_ARRAY, jp.nextToken()); + assertNull(jp.nextToken()); - p.close(); + jp.close(); // And another take DOC = "[,] "; - p = useStream ? createParserUsingStream(f, DOC, "UTF-8") + jp = useStream ? createParserUsingStream(f, DOC, "UTF-8") : createParserUsingReader(f, DOC); - assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertToken(JsonToken.VALUE_NULL, p.nextToken()); - assertToken(JsonToken.VALUE_NULL, p.nextToken()); - assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertNull(p.nextToken()); + assertToken(JsonToken.START_ARRAY, jp.nextToken()); + assertToken(JsonToken.VALUE_NULL, jp.nextToken()); + assertToken(JsonToken.VALUE_NULL, jp.nextToken()); + assertToken(JsonToken.END_ARRAY, jp.nextToken()); + assertNull(jp.nextToken()); - p.close(); + jp.close(); } private void _testMissingValueNotEnablingFeature(boolean useStream) throws Exception { @@ -149,37 +148,38 @@ private void _testMissingValueNotEnablingFeature(boolean useStream) throws Excep JsonFactory f = new JsonFactory(); - JsonParser p = useStream ? createParserUsingStream(f, DOC, "UTF-8") + JsonParser jp = useStream ? createParserUsingStream(f, DOC, "UTF-8") : createParserUsingReader(f, DOC); - assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals("a", p.getValueAsString()); + assertToken(JsonToken.START_ARRAY, jp.nextToken()); + assertToken(JsonToken.VALUE_STRING, jp.nextToken()); + assertEquals("a", jp.getValueAsString()); try { - assertToken(JsonToken.VALUE_STRING, p.nextToken()); + assertToken(JsonToken.VALUE_STRING, jp.nextToken()); fail("Expecting exception here"); } - catch (StreamReadException ex){ + catch(JsonParseException ex){ verifyException(ex, "expected a valid value", "expected a value"); } - p.close(); + jp.close(); } private void _testNotMissingValueByEnablingFeature(boolean useStream) throws Exception { final String DOC = "[ \"a\",\"abc\"] "; JsonFactory f = JsonFactory.builder() - .enable(JsonReadFeature.ALLOW_MISSING_VALUES).build(); - JsonParser p = useStream ? createParserUsingStream(f, DOC, "UTF-8") - : createParserUsingReader(f, DOC); - - assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals("a", p.getValueAsString()); + .enable(JsonReadFeature.ALLOW_MISSING_VALUES) + .build(); + JsonParser jp = useStream ? createParserUsingStream(f, DOC, "UTF-8") + : createParserUsingReader(f, DOC); + + assertToken(JsonToken.START_ARRAY, jp.nextToken()); + assertToken(JsonToken.VALUE_STRING, jp.nextToken()); + assertEquals("a", jp.getValueAsString()); - assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertToken(JsonToken.END_ARRAY, p.nextToken()); + assertToken(JsonToken.VALUE_STRING, jp.nextToken()); + assertToken(JsonToken.END_ARRAY, jp.nextToken()); - p.close(); + jp.close(); } } diff --git a/src/test/java/com/fasterxml/jackson/core/read/CommentParsingTest.java b/src/test/java/com/fasterxml/jackson/core/read/CommentParsingTest.java index ac0ed8ce69..7f24de6dd0 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/CommentParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/CommentParsingTest.java @@ -3,8 +3,6 @@ import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; /** @@ -32,15 +30,16 @@ public class CommentParsingTest * Unit test for verifying that by default comments are not * recognized. */ - public void testDefaultSettings() + public void testDefaultSettings() throws Exception { - JsonFactory f = new JsonFactory(); - assertFalse(f.isEnabled(JsonReadFeature.ALLOW_JAVA_COMMENTS)); - JsonParser p = f.createParser(ObjectReadContext.empty(), new StringReader("[ 1 ]")); + JsonFactory jf = new JsonFactory(); + assertFalse(jf.isEnabled(JsonParser.Feature.ALLOW_COMMENTS)); + JsonParser p = jf.createParser(new StringReader("[ 1 ]")); + assertFalse(p.isEnabled(JsonParser.Feature.ALLOW_COMMENTS)); p.close(); } - public void testCommentsDisabled() + public void testCommentsDisabled() throws Exception { _testDisabled(DOC_WITH_SLASHSTAR_COMMENT, MODE_INPUT_STREAM); _testDisabled(DOC_WITH_SLASHSLASH_COMMENT, MODE_INPUT_STREAM); @@ -52,7 +51,7 @@ public void testCommentsDisabled() _testDisabled(DOC_WITH_SLASHSLASH_COMMENT, MODE_DATA_INPUT); } - public void testCommentsEnabled() + public void testCommentsEnabled() throws Exception { _testEnabled(DOC_WITH_SLASHSTAR_COMMENT, MODE_INPUT_STREAM); _testEnabled(DOC_WITH_SLASHSLASH_COMMENT, MODE_INPUT_STREAM); @@ -64,7 +63,7 @@ public void testCommentsEnabled() _testEnabled(DOC_WITH_SLASHSLASH_COMMENT, MODE_DATA_INPUT); } - public void testCommentsWithUTF8() + public void testCommentsWithUTF8() throws Exception { final String JSON = "/* \u00a9 2099 Yoyodyne Inc. */\n [ \"bar? \u00a9\" ]\n"; _testWithUTF8Chars(JSON, MODE_INPUT_STREAM); @@ -73,10 +72,11 @@ public void testCommentsWithUTF8() _testWithUTF8Chars(JSON, MODE_DATA_INPUT); } - public void testYAMLCommentsBytes() { + public void testYAMLCommentsBytes() throws Exception { final JsonFactory f = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_YAML_COMMENTS) .build(); + _testYAMLComments(f, MODE_INPUT_STREAM); _testCommentsBeforePropValue(f, MODE_INPUT_STREAM, "# foo\n"); _testYAMLComments(f, MODE_INPUT_STREAM_THROTTLED); @@ -85,7 +85,7 @@ public void testYAMLCommentsBytes() { _testCommentsBeforePropValue(f, MODE_DATA_INPUT, "# foo\n"); } - public void testYAMLCommentsChars() { + public void testYAMLCommentsChars() throws Exception { final JsonFactory f = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_YAML_COMMENTS) .build(); @@ -95,7 +95,7 @@ public void testYAMLCommentsChars() { _testCommentsBetweenArrayValues(f, MODE_READER, COMMENT); } - public void testCCommentsBytes() { + public void testCCommentsBytes() throws Exception { final JsonFactory f = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_JAVA_COMMENTS) .build(); @@ -105,7 +105,7 @@ public void testCCommentsBytes() { _testCommentsBeforePropValue(f, MODE_DATA_INPUT, COMMENT); } - public void testCCommentsChars() { + public void testCCommentsChars() throws Exception { final JsonFactory f = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_JAVA_COMMENTS) .build(); @@ -113,7 +113,7 @@ public void testCCommentsChars() { _testCommentsBeforePropValue(f, MODE_READER, COMMENT); } - public void testCppCommentsBytes() { + public void testCppCommentsBytes() throws Exception { final JsonFactory f = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_JAVA_COMMENTS) .build(); @@ -123,7 +123,7 @@ public void testCppCommentsBytes() { _testCommentsBeforePropValue(f, MODE_DATA_INPUT, COMMENT); } - public void testCppCommentsChars() { + public void testCppCommentsChars() throws Exception { final JsonFactory f = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_JAVA_COMMENTS) .build(); @@ -133,7 +133,7 @@ public void testCppCommentsChars() { @SuppressWarnings("resource") private void _testCommentsBeforePropValue(JsonFactory f, - int mode, String comment) + int mode, String comment) throws Exception { for (String arg : new String[] { ":%s123", @@ -153,7 +153,7 @@ private void _testCommentsBeforePropValue(JsonFactory f, } catch (Exception e) { throw new RuntimeException("Failed on '"+DOC+"' due to "+e, e); } - assertEquals(JsonToken.PROPERTY_NAME, t); + assertEquals(JsonToken.FIELD_NAME, t); try { t = p.nextToken(); @@ -170,7 +170,7 @@ private void _testCommentsBeforePropValue(JsonFactory f, @SuppressWarnings("resource") private void _testCommentsBetweenArrayValues(JsonFactory f, - int mode, String comment) + int mode, String comment) throws Exception { for (String tmpl : new String[] { "%s,", @@ -210,7 +210,7 @@ private void _testCommentsBetweenArrayValues(JsonFactory f, } - private void _testYAMLComments(JsonFactory f, int mode) + private void _testYAMLComments(JsonFactory f, int mode) throws Exception { final String DOC = "# foo\n" +" {\"a\" # xyz\n" @@ -224,12 +224,12 @@ private void _testYAMLComments(JsonFactory f, int mode) ; JsonParser p = createParser(f, mode, DOC); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("a", p.currentName()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("a", p.getCurrentName()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(1, p.getIntValue()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("b", p.currentName()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("b", p.getCurrentName()); assertEquals(JsonToken.START_ARRAY, p.nextToken()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(3, p.getIntValue()); @@ -247,7 +247,7 @@ private void _testYAMLComments(JsonFactory f, int mode) /********************************************************** */ - private void _testWithUTF8Chars(String doc, int mode) + private void _testWithUTF8Chars(String doc, int mode) throws IOException { // should basically just stream through JsonParser p = _createParser(doc, mode, true); @@ -259,20 +259,20 @@ private void _testWithUTF8Chars(String doc, int mode) p.close(); } - private void _testDisabled(String doc, int mode) + private void _testDisabled(String doc, int mode) throws IOException { JsonParser p = _createParser(doc, mode, false); try { p.nextToken(); fail("Expected exception for unrecognized comment"); - } catch (StreamReadException je) { + } catch (JsonParseException je) { // Should have something denoting that user may want to enable 'ALLOW_COMMENTS' verifyException(je, "ALLOW_COMMENTS"); } p.close(); } - private void _testEnabled(String doc, int mode) + private void _testEnabled(String doc, int mode) throws IOException { JsonParser p = _createParser(doc, mode, true); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); @@ -282,6 +282,7 @@ private void _testEnabled(String doc, int mode) } private JsonParser _createParser(String doc, int mode, boolean enabled) + throws IOException { final JsonFactory f = JsonFactory.builder() .configure(JsonReadFeature.ALLOW_JAVA_COMMENTS, enabled) diff --git a/src/test/java/com/fasterxml/jackson/core/read/DataInputTest.java b/src/test/java/com/fasterxml/jackson/core/read/DataInputTest.java index 35d12249a1..4b90862581 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/DataInputTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/DataInputTest.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; /* Additional testing for {@link java.io.DataInput} specific * challenges for parsing. @@ -25,7 +24,7 @@ public void testEOFAfterObject() throws Exception { JsonParser p = createParser(JSON_F, MODE_DATA_INPUT, "{ \"value\" : true }"); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertNull(p.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/LocationDuringReaderParsingTest.java b/src/test/java/com/fasterxml/jackson/core/read/LocationDuringReaderParsingTest.java index 265f85fa19..890380e861 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/LocationDuringReaderParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/LocationDuringReaderParsingTest.java @@ -50,7 +50,7 @@ private void testLocationAtEndOfParse(LocationTestCase test) throws Exception private void testInitialLocation(LocationTestCase test) throws Exception { JsonParser p = createParserUsingReader(test.json); - JsonLocation loc = p.currentLocation(); + JsonLocation loc = p.getCurrentLocation(); p.close(); assertLocation(loc, at(1, 1, 0)); @@ -70,12 +70,12 @@ private void testTokenLocations(LocationTestCase test) throws Exception private void assertCurrentLocation(JsonParser p, LocData loc) { - assertLocation(p.currentLocation(), loc); + assertLocation(p.getCurrentLocation(), loc); } private void assertTokenLocation(JsonParser p, LocData loc) { - assertLocation(p.currentTokenLocation(), loc); + assertLocation(p.getTokenLocation(), loc); } private void assertLocation(JsonLocation pLoc, LocData loc) diff --git a/src/test/java/com/fasterxml/jackson/core/read/LocationDuringStreamParsingTest.java b/src/test/java/com/fasterxml/jackson/core/read/LocationDuringStreamParsingTest.java index 9244d68bf8..4d3aa38d6a 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/LocationDuringStreamParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/LocationDuringStreamParsingTest.java @@ -50,7 +50,7 @@ private void testLocationAtEndOfParse(LocationTestCase test) throws Exception private void testInitialLocation(LocationTestCase test) throws Exception { JsonParser p = createParserUsingStream(test.json, "UTF8"); - JsonLocation loc = p.currentLocation(); + JsonLocation loc = p.getCurrentLocation(); p.close(); assertLocation(loc, at(1, 1, 0)); @@ -70,12 +70,12 @@ private void testTokenLocations(LocationTestCase test) throws Exception private void assertCurrentLocation(JsonParser p, LocData loc) { - assertLocation(p.currentLocation(), loc); + assertLocation(p.getCurrentLocation(), loc); } private void assertTokenLocation(JsonParser p, LocData loc) { - assertLocation(p.currentTokenLocation(), loc); + assertLocation(p.getTokenLocation(), loc); } private void assertLocation(JsonLocation pLoc, LocData loc) diff --git a/src/test/java/com/fasterxml/jackson/core/read/LocationInArrayTest.java b/src/test/java/com/fasterxml/jackson/core/read/LocationInArrayTest.java index 2b0bf8cc3f..2904303786 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/LocationInArrayTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/LocationInArrayTest.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; // Tests mostly for [core#229] public class LocationInArrayTest extends com.fasterxml.jackson.core.BaseTest @@ -24,31 +23,31 @@ private void _testOffsetInArrays(boolean useBytes) throws Exception final String DOC = " [10, 251,\n 3 ]"; // first, char based: - p = useBytes ? JSON_F.createParser(ObjectReadContext.empty(), DOC.getBytes("UTF-8")) - : JSON_F.createParser(ObjectReadContext.empty(), DOC.toCharArray()); + p = useBytes ? JSON_F.createParser(DOC.getBytes("UTF-8")) + : JSON_F.createParser(DOC.toCharArray()); assertToken(JsonToken.START_ARRAY, p.nextToken()); - _assertLocation(useBytes, p.currentTokenLocation(), 2L, 1, 3); - _assertLocation(useBytes, p.currentLocation(), 3L, 1, 4); + _assertLocation(useBytes, p.getTokenLocation(), 2L, 1, 3); + _assertLocation(useBytes, p.getCurrentLocation(), 3L, 1, 4); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - _assertLocation(useBytes, p.currentTokenLocation(), 3L, 1, 4); + _assertLocation(useBytes, p.getTokenLocation(), 3L, 1, 4); assertEquals(10, p.getIntValue()); // just to ensure read proceeds to end // 2-digits so - _assertLocation(useBytes, p.currentLocation(), 5L, 1, 6); + _assertLocation(useBytes, p.getCurrentLocation(), 5L, 1, 6); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - _assertLocation(useBytes, p.currentTokenLocation(), 7L, 1, 8); + _assertLocation(useBytes, p.getTokenLocation(), 7L, 1, 8); assertEquals(251, p.getIntValue()); // just to ensure read proceeds to end - _assertLocation(useBytes, p.currentLocation(), 10L, 1, 11); + _assertLocation(useBytes, p.getCurrentLocation(), 10L, 1, 11); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - _assertLocation(useBytes, p.currentTokenLocation(), 15L, 2, 4); + _assertLocation(useBytes, p.getTokenLocation(), 15L, 2, 4); assertEquals(3, p.getIntValue()); - _assertLocation(useBytes, p.currentLocation(), 16L, 2, 5); + _assertLocation(useBytes, p.getCurrentLocation(), 16L, 2, 5); assertToken(JsonToken.END_ARRAY, p.nextToken()); - _assertLocation(useBytes, p.currentTokenLocation(), 18L, 2, 7); - _assertLocation(useBytes, p.currentLocation(), 19L, 2, 8); + _assertLocation(useBytes, p.getTokenLocation(), 18L, 2, 7); + _assertLocation(useBytes, p.getCurrentLocation(), 19L, 2, 8); p.close(); } diff --git a/src/test/java/com/fasterxml/jackson/core/read/LocationInObjectTest.java b/src/test/java/com/fasterxml/jackson/core/read/LocationInObjectTest.java index 100897b3c2..ffd081cc0f 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/LocationInObjectTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/LocationInObjectTest.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; // tests for [core#37] public class LocationInObjectTest extends BaseTest @@ -11,42 +10,42 @@ public void testOffsetWithObjectFieldsUsingUTF8() throws Exception final JsonFactory f = new JsonFactory(); byte[] b = "{\"f1\":\"v1\",\"f2\":{\"f3\":\"v3\"},\"f4\":[true,false],\"f5\":5}".getBytes("UTF-8"); // 1 6 11 16 17 22 28 33 34 39 46 51 - JsonParser p = f.createParser(ObjectReadContext.empty(), b); + JsonParser p = f.createParser(b); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals(1L, p.currentTokenLocation().getByteOffset()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals(1L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals(6L, p.currentTokenLocation().getByteOffset()); + assertEquals(6L, p.getTokenLocation().getByteOffset()); - assertEquals("f2", p.nextName()); - assertEquals(11L, p.currentTokenLocation().getByteOffset()); + assertEquals("f2", p.nextFieldName()); + assertEquals(11L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.START_OBJECT, p.nextValue()); - assertEquals(16L, p.currentTokenLocation().getByteOffset()); + assertEquals(16L, p.getTokenLocation().getByteOffset()); - assertEquals("f3", p.nextName()); - assertEquals(17L, p.currentTokenLocation().getByteOffset()); + assertEquals("f3", p.nextFieldName()); + assertEquals(17L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.VALUE_STRING, p.nextValue()); - assertEquals(22L, p.currentTokenLocation().getByteOffset()); + assertEquals(22L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.END_OBJECT, p.nextToken()); - assertEquals("f4", p.nextName()); - assertEquals(28L, p.currentTokenLocation().getByteOffset()); + assertEquals("f4", p.nextFieldName()); + assertEquals(28L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.START_ARRAY, p.nextValue()); - assertEquals(33L, p.currentTokenLocation().getByteOffset()); + assertEquals(33L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.VALUE_TRUE, p.nextValue()); - assertEquals(34L, p.currentTokenLocation().getByteOffset()); + assertEquals(34L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.VALUE_FALSE, p.nextValue()); - assertEquals(39L, p.currentTokenLocation().getByteOffset()); + assertEquals(39L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.END_ARRAY, p.nextToken()); - assertEquals("f5", p.nextName()); - assertEquals(46L, p.currentTokenLocation().getByteOffset()); + assertEquals("f5", p.nextFieldName()); + assertEquals(46L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(51L, p.currentTokenLocation().getByteOffset()); + assertEquals(51L, p.getTokenLocation().getByteOffset()); assertEquals(JsonToken.END_OBJECT, p.nextToken()); p.close(); @@ -57,42 +56,42 @@ public void testOffsetWithObjectFieldsUsingReader() throws Exception final JsonFactory f = new JsonFactory(); char[] c = "{\"f1\":\"v1\",\"f2\":{\"f3\":\"v3\"},\"f4\":[true,false],\"f5\":5}".toCharArray(); // 1 6 11 16 17 22 28 33 34 39 46 51 - JsonParser p = f.createParser(ObjectReadContext.empty(), c); + JsonParser p = f.createParser(c); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals(1L, p.currentTokenLocation().getCharOffset()); + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals(1L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals(6L, p.currentTokenLocation().getCharOffset()); + assertEquals(6L, p.getTokenLocation().getCharOffset()); - assertEquals("f2", p.nextName()); - assertEquals(11L, p.currentTokenLocation().getCharOffset()); + assertEquals("f2", p.nextFieldName()); + assertEquals(11L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.START_OBJECT, p.nextValue()); - assertEquals(16L, p.currentTokenLocation().getCharOffset()); + assertEquals(16L, p.getTokenLocation().getCharOffset()); - assertEquals("f3", p.nextName()); - assertEquals(17L, p.currentTokenLocation().getCharOffset()); + assertEquals("f3", p.nextFieldName()); + assertEquals(17L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.VALUE_STRING, p.nextValue()); - assertEquals(22L, p.currentTokenLocation().getCharOffset()); + assertEquals(22L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.END_OBJECT, p.nextToken()); - assertEquals("f4", p.nextName()); - assertEquals(28L, p.currentTokenLocation().getCharOffset()); + assertEquals("f4", p.nextFieldName()); + assertEquals(28L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.START_ARRAY, p.nextValue()); - assertEquals(33L, p.currentTokenLocation().getCharOffset()); + assertEquals(33L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.VALUE_TRUE, p.nextValue()); - assertEquals(34L, p.currentTokenLocation().getCharOffset()); + assertEquals(34L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.VALUE_FALSE, p.nextValue()); - assertEquals(39L, p.currentTokenLocation().getCharOffset()); + assertEquals(39L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.END_ARRAY, p.nextToken()); - assertEquals("f5", p.nextName()); - assertEquals(46L, p.currentTokenLocation().getCharOffset()); + assertEquals("f5", p.nextFieldName()); + assertEquals(46L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(51L, p.currentTokenLocation().getCharOffset()); + assertEquals(51L, p.getTokenLocation().getCharOffset()); assertEquals(JsonToken.END_OBJECT, p.nextToken()); p.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/read/LocationOffsets455Test.java b/src/test/java/com/fasterxml/jackson/core/read/LocationOffsets455Test.java index d6956d1348..163e607c95 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/LocationOffsets455Test.java +++ b/src/test/java/com/fasterxml/jackson/core/read/LocationOffsets455Test.java @@ -12,7 +12,7 @@ public void testEOFLocationViaReader() throws Exception JsonParser p = createParserUsingReader("42"); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(42, p.getIntValue()); - JsonLocation loc = p.currentLocation(); + JsonLocation loc = p.getCurrentLocation(); assertEquals(1, loc.getLineNr()); assertEquals(3, loc.getColumnNr()); assertEquals(2, loc.getCharOffset()); @@ -20,7 +20,7 @@ public void testEOFLocationViaReader() throws Exception assertNull(p.nextToken()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(1, loc.getLineNr()); assertEquals(3, loc.getColumnNr()); assertEquals(2, loc.getCharOffset()); @@ -34,13 +34,13 @@ public void testEOFLocationViaStream() throws Exception JsonParser p = createParserUsingStream("42", "UTF-8"); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(42, p.getIntValue()); - JsonLocation loc = p.currentLocation(); + JsonLocation loc = p.getCurrentLocation(); assertEquals(1, loc.getLineNr()); assertEquals(3, loc.getColumnNr()); assertEquals(2, loc.getByteOffset()); assertNull(p.nextToken()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(1, loc.getLineNr()); assertEquals(3, loc.getColumnNr()); assertEquals(2, loc.getByteOffset()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/LocationOffsetsTest.java b/src/test/java/com/fasterxml/jackson/core/read/LocationOffsetsTest.java index 81d5ab90ba..07116763de 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/LocationOffsetsTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/LocationOffsetsTest.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import java.io.IOException; import java.util.Random; @@ -18,16 +17,16 @@ public void testSimpleInitialOffsets() throws Exception final String DOC = "{ }"; // first, char based: - p = JSON_F.createParser(ObjectReadContext.empty(), DOC); + p = JSON_F.createParser(DOC); assertToken(JsonToken.START_OBJECT, p.nextToken()); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(-1L, loc.getByteOffset()); assertEquals(0L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(1, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(-1L, loc.getByteOffset()); assertEquals(1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); @@ -36,17 +35,17 @@ public void testSimpleInitialOffsets() throws Exception p.close(); // then byte-based - - p = JSON_F.createParser(ObjectReadContext.empty(), DOC.getBytes("UTF-8")); + + p = JSON_F.createParser(DOC.getBytes("UTF-8")); assertToken(JsonToken.START_OBJECT, p.nextToken()); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(0L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(1, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(1L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); @@ -64,16 +63,16 @@ public void testOffsetWithInputOffset() throws Exception byte[] b = " { } ".getBytes("UTF-8"); // and then peel them off - p = JSON_F.createParser(ObjectReadContext.empty(), b, 3, b.length - 5); + p = JSON_F.createParser(b, 3, b.length-5); assertToken(JsonToken.START_OBJECT, p.nextToken()); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(0L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(1, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(1L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); @@ -90,16 +89,16 @@ public void testOffsetWithoutInputOffset() throws Exception byte[] b = " { } ".getBytes("UTF-8"); // and then peel them off - p = JSON_F.createParser(ObjectReadContext.empty(), b); + p = JSON_F.createParser(b); assertToken(JsonToken.START_OBJECT, p.nextToken()); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(3L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(4, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(4L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); @@ -121,7 +120,7 @@ public void testWithLazyStringReadDataInput() throws Exception JsonParser p = createParser(JSON_F, MODE_DATA_INPUT, "[\"text\"]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals(1, p.currentLocation().getLineNr()); + assertEquals(1, p.getCurrentLocation().getLineNr()); p.finishToken(); assertEquals("text", p.getText()); p.close(); @@ -133,17 +132,17 @@ private void _testWithLazyStringRead(int readMode) throws Exception assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); // initially location pointing to first character - assertEquals(3, p.currentLocation().getColumnNr()); + assertEquals(3, p.getCurrentLocation().getColumnNr()); p.finishToken(); // but will move once we force reading - assertEquals(8, p.currentLocation().getColumnNr()); + assertEquals(8, p.getCurrentLocation().getColumnNr()); // and no change if we call again (but is ok to call) p.finishToken(); - assertEquals(8, p.currentLocation().getColumnNr()); + assertEquals(8, p.getCurrentLocation().getColumnNr()); // also just for fun, verify content assertEquals("text", p.getText()); - assertEquals(8, p.currentLocation().getColumnNr()); + assertEquals(8, p.getCurrentLocation().getColumnNr()); p.close(); } @@ -156,16 +155,16 @@ public void testUtf8Bom() throws Exception byte[] b = withUtf8Bom("{ }".getBytes()); // and then peel them off - p = JSON_F.createParser(ObjectReadContext.empty(), b); + p = JSON_F.createParser(b); assertToken(JsonToken.START_OBJECT, p.nextToken()); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(3L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(4, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(4L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); @@ -182,16 +181,16 @@ public void testUtf8BomWithPadding() throws Exception byte[] b = withUtf8Bom(" { }".getBytes()); // and then peel them off - p = JSON_F.createParser(ObjectReadContext.empty(), b); + p = JSON_F.createParser(b); assertToken(JsonToken.START_OBJECT, p.nextToken()); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(6L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(7, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(7L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); @@ -208,16 +207,16 @@ public void testUtf8BomWithInputOffset() throws Exception byte[] b = withUtf8Bom(" { }".getBytes()); // and then peel them off - p = JSON_F.createParser(ObjectReadContext.empty(), b); + p = JSON_F.createParser(b); assertToken(JsonToken.START_OBJECT, p.nextToken()); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(6L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(7, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(7L, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); @@ -246,48 +245,48 @@ public void testBigPayload() throws IOException { p = createParserUsingStream(JSON_F, doc, "UTF-8"); assertToken(JsonToken.START_OBJECT, p.nextToken()); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(0, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(1, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(1, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(2, loc.getColumnNr()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - loc = p.currentTokenLocation(); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + loc = p.getTokenLocation(); assertEquals(1, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(2, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(8, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(9, loc.getColumnNr()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(7, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(8, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(8, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(9, loc.getColumnNr()); p.getTextCharacters(); - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertEquals(7, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); assertEquals(8, loc.getColumnNr()); - loc = p.currentLocation(); + loc = p.getCurrentLocation(); assertEquals(doc.length() - 1, loc.getByteOffset()); assertEquals(-1L, loc.getCharOffset()); assertEquals(1, loc.getLineNr()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/NextNameParserTest.java b/src/test/java/com/fasterxml/jackson/core/read/NextNameParserTest.java index 8c6d9f3145..5a4bb003ff 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NextNameParserTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NextNameParserTest.java @@ -33,43 +33,43 @@ private void _testBasicNextName(int mode) throws Exception assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("data", p.currentName()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("primary", p.nextName()); + assertEquals("primary", p.nextFieldName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(-15, p.getIntValue()); - assertEquals("vector", p.nextName()); + assertEquals("vector", p.nextFieldName()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("yes", p.getText()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertEquals("misc", p.nextName()); + assertEquals("misc", p.nextFieldName()); assertToken(JsonToken.VALUE_NULL, p.nextToken()); - assertEquals("name", p.nextName()); + assertEquals("name", p.nextFieldName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("Bob", p.getText()); - assertNull(p.nextName()); + assertNull(p.nextFieldName()); assertToken(JsonToken.END_OBJECT, p.currentToken()); - assertEquals("array", p.nextName()); + assertEquals("array", p.nextFieldName()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("message", p.nextName()); + assertEquals("message", p.nextFieldName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("hello", p.getText()); - assertEquals("value", p.nextName()); + assertEquals("value", p.nextFieldName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(42, p.getIntValue()); - assertEquals("misc", p.nextName()); + assertEquals("misc", p.nextFieldName()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); @@ -77,7 +77,7 @@ private void _testBasicNextName(int mode) throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(2, p.getIntValue()); - assertNull(p.nextName()); + assertNull(p.nextFieldName()); assertToken(JsonToken.END_ARRAY, p.currentToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/NextNameWithMatcherTest.java b/src/test/java/com/fasterxml/jackson/core/read/NextNameWithMatcherTest.java deleted file mode 100644 index c71cf22fed..0000000000 --- a/src/test/java/com/fasterxml/jackson/core/read/NextNameWithMatcherTest.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.fasterxml.jackson.core.read; - -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.json.JsonFactory; -import com.fasterxml.jackson.core.sym.PropertyNameMatcher; -import com.fasterxml.jackson.core.util.Named; - -public class NextNameWithMatcherTest - extends com.fasterxml.jackson.core.BaseTest -{ - private final JsonFactory JSON_F = new JsonFactory(); - - private final List NAMES_1 = Arrays.asList("enabled", "a", "longerName", "otherStuff3"); - private final List NAMES_1_CASE_MISMATCH = Arrays.asList("ENABLED", "A", "LongerName", "otherStuff3"); - - private final List FIELDS_1 = namedFromStrings(NAMES_1); - - private final PropertyNameMatcher MATCHER_CS_1 = JSON_F.constructNameMatcher(FIELDS_1, true); - private final PropertyNameMatcher MATCHER_CI_1 = JSON_F.constructCINameMatcher(FIELDS_1, true, - new Locale("en", "US")); - - private final String DOC_1 = aposToQuotes( - "{ 'a' : 4, 'enabled' : true, 'longerName' : 'Billy-Bob Burger', 'extra' : [ 0], 'otherStuff3' : 0.25 }" - ); - - private final String DOC_1_CASE_MISMATCH = aposToQuotes( - "{ 'A' : 4, 'ENABLED' : true, 'LongerName' : 'Billy-Bob Burger', 'extra' : [0 ], 'otherStuff3' : 0.25 }"); - - public void testSimpleCaseSensitive() throws Exception - { - _testSimpleCaseSensitive(MODE_INPUT_STREAM); - _testSimpleCaseSensitive(MODE_INPUT_STREAM_THROTTLED); - _testSimpleCaseSensitive(MODE_DATA_INPUT); - _testSimpleCaseSensitive(MODE_READER); - } - - private void _testSimpleCaseSensitive(int mode) throws Exception - { - _verifyDoc1(createParser(mode, DOC_1), MATCHER_CS_1, NAMES_1); - } - - public void testSimpleCaseInsensitive() throws Exception - { - _testSimpleCaseInsensitive(MODE_INPUT_STREAM); - _testSimpleCaseInsensitive(MODE_INPUT_STREAM_THROTTLED); - _testSimpleCaseInsensitive(MODE_DATA_INPUT); - _testSimpleCaseInsensitive(MODE_READER); - } - - public void _testSimpleCaseInsensitive(int mode) throws Exception - { - // First, should still pass regular case-matching doc - _verifyDoc1(createParser(mode, DOC_1), MATCHER_CI_1, NAMES_1); - // but then mis-cased one too: - _verifyDoc1(createParser(mode, DOC_1_CASE_MISMATCH), MATCHER_CI_1, NAMES_1_CASE_MISMATCH); - } - - private void _verifyDoc1(JsonParser p, PropertyNameMatcher matcher, - List names) throws Exception - { - assertEquals(PropertyNameMatcher.MATCH_ODD_TOKEN, p.nextNameMatch(matcher)); - assertToken(JsonToken.START_OBJECT, p.currentToken()); - - assertEquals(1, p.nextNameMatch(matcher)); // ("enabled", "a", "longerName", "otherStuff3") - assertEquals(names.get(1), p.currentName()); - assertEquals(PropertyNameMatcher.MATCH_ODD_TOKEN, p.nextNameMatch(matcher)); - assertToken(JsonToken.VALUE_NUMBER_INT, p.currentToken()); - assertEquals(4, p.getIntValue()); - - assertEquals(0, p.nextNameMatch(matcher)); // ("enabled", "a", "longerName", "otherStuff3") - assertEquals(names.get(0), p.currentName()); - assertEquals(PropertyNameMatcher.MATCH_ODD_TOKEN, p.nextNameMatch(matcher)); - assertToken(JsonToken.VALUE_TRUE, p.currentToken()); - - assertEquals(2, p.nextNameMatch(matcher)); // ("enabled", "a", "longerName", "otherStuff3") - assertEquals(names.get(2), p.currentName()); - assertEquals(PropertyNameMatcher.MATCH_ODD_TOKEN, p.nextNameMatch(matcher)); - assertToken(JsonToken.VALUE_STRING, p.currentToken()); - assertEquals("Billy-Bob Burger", p.getText()); - - assertEquals(PropertyNameMatcher.MATCH_UNKNOWN_NAME, p.nextNameMatch(matcher)); - assertEquals("extra", p.currentName()); - assertEquals(PropertyNameMatcher.MATCH_ODD_TOKEN, p.nextNameMatch(matcher)); - assertToken(JsonToken.START_ARRAY, p.currentToken()); - assertEquals(PropertyNameMatcher.MATCH_ODD_TOKEN, p.nextNameMatch(matcher)); - assertToken(JsonToken.VALUE_NUMBER_INT, p.currentToken()); - assertEquals(0, p.getIntValue()); - assertEquals(PropertyNameMatcher.MATCH_ODD_TOKEN, p.nextNameMatch(matcher)); - assertToken(JsonToken.END_ARRAY, p.currentToken()); - - assertEquals(3, p.nextNameMatch(matcher)); // ("enabled", "a", "longerName", "otherStuff3") - assertEquals(names.get(3), p.currentName()); - assertEquals(PropertyNameMatcher.MATCH_ODD_TOKEN, p.nextNameMatch(matcher)); - assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.currentToken()); - assertEquals(0.25, p.getDoubleValue()); - - assertEquals(PropertyNameMatcher.MATCH_END_OBJECT, p.nextNameMatch(matcher)); - assertToken(JsonToken.END_OBJECT, p.currentToken()); - - p.close(); - } -} diff --git a/src/test/java/com/fasterxml/jackson/core/read/NextXxxAccessTest.java b/src/test/java/com/fasterxml/jackson/core/read/NextXxxAccessTest.java index c7790260e9..85efecf850 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NextXxxAccessTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NextXxxAccessTest.java @@ -128,35 +128,35 @@ private void _testIsNextTokenName1(int mode) throws Exception final String DOC = "{\"name\":123,\"name2\":14,\"x\":\"name\"}"; JsonParser p = createParser(mode, DOC); final SerializedString NAME = new SerializedString("name"); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.START_OBJECT, p.currentToken()); assertEquals(JsonTokenId.ID_START_OBJECT, p.currentTokenId()); - assertTrue(p.nextName(NAME)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals(NAME.getValue(), p.currentName()); + assertTrue(p.nextFieldName(NAME)); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals(NAME.getValue(), p.getCurrentName()); assertEquals(NAME.getValue(), p.getText()); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.VALUE_NUMBER_INT, p.currentToken()); assertEquals(123, p.getIntValue()); - assertFalse(p.nextName(NAME)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("name2", p.currentName()); + assertFalse(p.nextFieldName(NAME)); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("name2", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); // do NOT check number value, to enforce skipping - assertFalse(p.nextName(NAME)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("x", p.currentName()); + assertFalse(p.nextFieldName(NAME)); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("x", p.getCurrentName()); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.VALUE_STRING, p.currentToken()); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.END_OBJECT, p.currentToken()); if (mode != MODE_DATA_INPUT) { - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertNull(p.currentToken()); } p.close(); @@ -164,30 +164,30 @@ private void _testIsNextTokenName1(int mode) throws Exception // Actually, try again with slightly different sequence... p = createParser(mode, DOC); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertFalse(p.nextName(new SerializedString("Nam"))); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals(NAME.getValue(), p.currentName()); + assertFalse(p.nextFieldName(new SerializedString("Nam"))); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals(NAME.getValue(), p.getCurrentName()); assertEquals(NAME.getValue(), p.getText()); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.VALUE_NUMBER_INT, p.currentToken()); assertEquals(123, p.getIntValue()); - assertFalse(p.nextName(NAME)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("name2", p.currentName()); + assertFalse(p.nextFieldName(NAME)); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("name2", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertFalse(p.nextName(NAME)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("x", p.currentName()); + assertFalse(p.nextFieldName(NAME)); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("x", p.getCurrentName()); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.VALUE_STRING, p.currentToken()); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.END_OBJECT, p.currentToken()); if (mode != MODE_DATA_INPUT) { - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertNull(p.currentToken()); } p.close(); @@ -198,32 +198,32 @@ private void _testIsNextTokenName2(int mode) throws Exception final String DOC = "{\"name\":123,\"name2\":14,\"x\":\"name\"}"; JsonParser p = createParser(mode, DOC); SerializableString NAME = new SerializedString("name"); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.START_OBJECT, p.currentToken()); - assertTrue(p.nextName(NAME)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals(NAME.getValue(), p.currentName()); + assertTrue(p.nextFieldName(NAME)); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals(NAME.getValue(), p.getCurrentName()); assertEquals(NAME.getValue(), p.getText()); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.VALUE_NUMBER_INT, p.currentToken()); assertEquals(123, p.getIntValue()); - assertFalse(p.nextName(NAME)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("name2", p.currentName()); + assertFalse(p.nextFieldName(NAME)); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("name2", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertFalse(p.nextName(NAME)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("x", p.currentName()); + assertFalse(p.nextFieldName(NAME)); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("x", p.getCurrentName()); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.VALUE_STRING, p.currentToken()); - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertToken(JsonToken.END_OBJECT, p.currentToken()); if (mode != MODE_DATA_INPUT) { - assertFalse(p.nextName(NAME)); + assertFalse(p.nextFieldName(NAME)); assertNull(p.currentToken()); } p.close(); @@ -233,32 +233,32 @@ private void _testIsNextTokenName3(int mode) throws Exception { final String DOC = "{\"name\":123,\"name2\":14,\"x\":\"name\"}"; JsonParser p = createParser(mode, DOC); - assertNull(p.nextName()); + assertNull(p.nextFieldName()); assertToken(JsonToken.START_OBJECT, p.currentToken()); - assertEquals("name", p.nextName()); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("name", p.currentName()); + assertEquals("name", p.nextFieldName()); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("name", p.getCurrentName()); assertEquals("name", p.getText()); - assertNull(p.nextName()); + assertNull(p.nextFieldName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.currentToken()); assertEquals(123, p.getIntValue()); - assertEquals("name2", p.nextName()); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("name2", p.currentName()); + assertEquals("name2", p.nextFieldName()); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("name2", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals("x", p.nextName()); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("x", p.currentName()); + assertEquals("x", p.nextFieldName()); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("x", p.getCurrentName()); - assertNull(p.nextName()); + assertNull(p.nextFieldName()); assertToken(JsonToken.VALUE_STRING, p.currentToken()); - assertNull(p.nextName()); + assertNull(p.nextFieldName()); assertToken(JsonToken.END_OBJECT, p.currentToken()); if (mode != MODE_DATA_INPUT) { - assertNull(p.nextName()); + assertNull(p.nextFieldName()); assertNull(p.currentToken()); } p.close(); @@ -270,11 +270,11 @@ private void _testIsNextTokenName4(int mode) throws Exception JsonParser p = createParser(mode, DOC); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertTrue(p.nextName(new SerializedString("name"))); + assertTrue(p.nextFieldName(new SerializedString("name"))); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(-123, p.getIntValue()); - assertTrue(p.nextName(new SerializedString("name2"))); + assertTrue(p.nextFieldName(new SerializedString("name2"))); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(99, p.getIntValue()); assertToken(JsonToken.END_OBJECT, p.nextToken()); @@ -290,11 +290,11 @@ private void _testIsNextTokenName5(int mode) throws Exception JsonParser p = createParser(mode, DOC); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertTrue(p.nextName(new SerializedString("name"))); + assertTrue(p.nextFieldName(new SerializedString("name"))); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); - assertTrue(p.nextName(new SerializedString("name2"))); + assertTrue(p.nextFieldName(new SerializedString("name2"))); assertToken(JsonToken.VALUE_NULL, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); if (mode != MODE_DATA_INPUT) { @@ -308,10 +308,10 @@ private void _testNextFieldNameIndent(int mode) throws Exception final String DOC = "{\n \"name\" : \n [\n ]\n }"; JsonParser p = createParser(mode, DOC); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertTrue(p.nextName(new SerializedString("name"))); + assertTrue(p.nextFieldName(new SerializedString("name"))); assertToken(JsonToken.START_ARRAY, p.nextToken()); - assertFalse(p.nextName(new SerializedString("x"))); + assertFalse(p.nextFieldName(new SerializedString("x"))); assertToken(JsonToken.END_ARRAY, p.currentToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); if (mode != MODE_DATA_INPUT) { @@ -327,16 +327,16 @@ private void _textNextText(int mode) throws Exception assertNull(p.nextTextValue()); assertToken(JsonToken.START_OBJECT, p.currentToken()); assertNull(p.nextTextValue()); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("a", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("a", p.getCurrentName()); assertEquals("123", p.nextTextValue()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("b", p.currentName()); - assertNull(p.nextName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("b", p.getCurrentName()); + assertNull(p.nextFieldName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.currentToken()); - assertEquals("c", p.nextName()); + assertEquals("c", p.nextFieldName()); assertNull(p.nextTextValue()); assertToken(JsonToken.START_ARRAY, p.currentToken()); @@ -362,17 +362,17 @@ private void _textNextInt(int mode) throws Exception assertEquals(0, p.nextIntValue(0)); assertToken(JsonToken.START_OBJECT, p.currentToken()); assertEquals(0, p.nextIntValue(0)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("a", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("a", p.getCurrentName()); assertEquals(0, p.nextIntValue(0)); assertToken(JsonToken.VALUE_STRING, p.currentToken()); assertEquals("123", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("b", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("b", p.getCurrentName()); assertEquals(5, p.nextIntValue(0)); - assertEquals("c", p.nextName()); + assertEquals("c", p.nextFieldName()); assertEquals(0, p.nextIntValue(0)); assertToken(JsonToken.START_ARRAY, p.currentToken()); @@ -398,17 +398,17 @@ private void _textNextLong(int mode) throws Exception assertEquals(0L, p.nextLongValue(0L)); assertToken(JsonToken.START_OBJECT, p.currentToken()); assertEquals(0L, p.nextLongValue(0L)); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("a", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("a", p.getCurrentName()); assertEquals(0L, p.nextLongValue(0L)); assertToken(JsonToken.VALUE_STRING, p.currentToken()); assertEquals("xyz", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("b", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("b", p.getCurrentName()); assertEquals(-59L, p.nextLongValue(0L)); - assertEquals("c", p.nextName()); + assertEquals("c", p.nextFieldName()); assertEquals(0L, p.nextLongValue(0L)); assertToken(JsonToken.START_ARRAY, p.currentToken()); @@ -434,17 +434,17 @@ private void _textNextBoolean(int mode) throws Exception assertNull(p.nextBooleanValue()); assertToken(JsonToken.START_OBJECT, p.currentToken()); assertNull(p.nextBooleanValue()); - assertToken(JsonToken.PROPERTY_NAME, p.currentToken()); - assertEquals("a", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.currentToken()); + assertEquals("a", p.getCurrentName()); assertNull(p.nextBooleanValue()); assertToken(JsonToken.VALUE_STRING, p.currentToken()); assertEquals("xyz", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("b", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("b", p.getCurrentName()); assertEquals(Boolean.TRUE, p.nextBooleanValue()); - assertEquals("c", p.nextName()); + assertEquals("c", p.nextFieldName()); assertNull(p.nextBooleanValue()); assertToken(JsonToken.START_ARRAY, p.currentToken()); @@ -483,7 +483,7 @@ private void _testIssue34(int mode) throws Exception assertEquals(JsonToken.START_OBJECT, parser.nextToken()); // These will succeed - assertTrue(parser.nextName(fieldName)); + assertTrue(parser.nextFieldName(fieldName)); parser.nextLongValue(-1); assertEquals(JsonToken.END_OBJECT, parser.nextToken()); @@ -492,7 +492,7 @@ private void _testIssue34(int mode) throws Exception assertEquals(JsonToken.START_OBJECT, parser.nextToken()); // This will fail - assertTrue(parser.nextName(fieldName)); + assertTrue(parser.nextFieldName(fieldName)); parser.close(); } @@ -502,7 +502,7 @@ private void _testIssue38(int mode) throws Exception SerializableString fieldName = new SerializedString("field"); JsonParser parser = createParser(mode, DOC); assertEquals(JsonToken.START_OBJECT, parser.nextToken()); - assertTrue(parser.nextName(fieldName)); + assertTrue(parser.nextFieldName(fieldName)); assertEquals(JsonToken.VALUE_STRING, parser.nextToken()); assertEquals("value", parser.getText()); assertEquals(JsonToken.END_OBJECT, parser.nextToken()); @@ -541,7 +541,7 @@ private void _testNextNameWithLong(int mode) throws Exception for (int i = 0; i < count; ++i) { int exp = rnd.nextInt(); SerializableString expName = new SerializedString("f"+exp); - assertTrue(parser.nextName(expName)); + assertTrue(parser.nextFieldName(expName)); assertToken(JsonToken.VALUE_NUMBER_INT, parser.nextToken()); assertEquals(exp % 1000, parser.getIntValue()); } diff --git a/src/test/java/com/fasterxml/jackson/core/read/NonStandardAposQuotedNamesTest.java b/src/test/java/com/fasterxml/jackson/core/read/NonStandardAposQuotedNamesTest.java index 7c253efa6e..619cd90f57 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NonStandardAposQuotedNamesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NonStandardAposQuotedNamesTest.java @@ -1,9 +1,9 @@ package com.fasterxml.jackson.core.read; +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; public class NonStandardAposQuotedNamesTest @@ -54,21 +54,27 @@ private void _testSingleQuotesDefault(int mode) throws Exception { // First, let's see that by default they are not allowed String JSON = "[ 'text' ]"; - try (JsonParser p = createParser(STD_F, mode, JSON)) { - assertToken(JsonToken.START_ARRAY, p.nextToken()); + JsonParser p = createParser(STD_F, mode, JSON); + assertToken(JsonToken.START_ARRAY, p.nextToken()); + try { p.nextToken(); fail("Expected exception"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected character ('''"); + } finally { + p.close(); } JSON = "{ 'a':1 }"; - try (JsonParser p = createParser(STD_F, mode, JSON)) { - assertToken(JsonToken.START_OBJECT, p.nextToken()); + p = createParser(STD_F, mode, JSON); + assertToken(JsonToken.START_OBJECT, p.nextToken()); + try { p.nextToken(); fail("Expected exception"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected character ('''"); + } finally { + p.close(); } } @@ -83,24 +89,24 @@ private void _testSingleQuotesEnabled(int mode) throws Exception assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.getText()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals("1", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("foobar", p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("b", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("_abc\u00A0e'23'", p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("d'foo'", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("\"", p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); //assertEquals("\"\"", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("", p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("", p.getText()); @@ -112,36 +118,36 @@ private void _testSingleQuotesEnabled(int mode) throws Exception JSON = "{'b':1,'array':[{'b':3}],'ob':{'b':4,'x':0,'y':3,'a':false }}"; p = createParser(APOS_F, mode, JSON); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("b", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("b", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("b", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("b", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(3, p.getIntValue()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertToken(JsonToken.END_ARRAY, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("b", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("b", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(4, p.getIntValue()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("x", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("x", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(0, p.getIntValue()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("y", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("y", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(3, p.getIntValue()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("a", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("a", p.getCurrentName()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); @@ -184,7 +190,7 @@ private void _testSingleQuotedKeys721(int mode, String doc, String expKey) throw JsonParser p = createParser(APOS_F, mode, doc); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(expKey, p.nextName()); + assertEquals(expKey, p.nextFieldName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("value", p.getText()); assertToken(JsonToken.END_OBJECT, p.nextToken()); @@ -213,7 +219,7 @@ private void _testSingleQuotedValues721(int mode, String doc, String expValue) t JsonParser p = createParser(APOS_F, mode, doc); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("bar", p.nextName()); + assertEquals("bar", p.nextFieldName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(expValue, p.getText()); assertToken(JsonToken.END_OBJECT, p.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/NonStandardNumberParsingTest.java b/src/test/java/com/fasterxml/jackson/core/read/NonStandardNumberParsingTest.java index ffe7f9d6b9..82537b1211 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NonStandardNumberParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NonStandardNumberParsingTest.java @@ -1,8 +1,6 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; public class NonStandardNumberParsingTest @@ -15,33 +13,33 @@ public class NonStandardNumberParsingTest /** * The format ".NNN" (as opposed to "0.NNN") is not valid JSON, so this should fail */ - public void testLeadingDotInDecimal() { + public void testLeadingDotInDecimal() throws Exception { for (int mode : ALL_MODES) { JsonParser p = createParser(mode, " .123 "); try { p.nextToken(); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected character ('.'"); } p.close(); } } - public void testLeadingDotInDecimalAllowedAsync() { + public void testLeadingDotInDecimalAllowedAsync() throws Exception { _testLeadingDotInDecimalAllowed(JSON_F, MODE_DATA_INPUT); } - public void testLeadingDotInDecimalAllowedBytes() { + public void testLeadingDotInDecimalAllowedBytes() throws Exception { _testLeadingDotInDecimalAllowed(JSON_F, MODE_INPUT_STREAM); _testLeadingDotInDecimalAllowed(JSON_F, MODE_INPUT_STREAM_THROTTLED); } - public void testLeadingDotInDecimalAllowedReader() { + public void testLeadingDotInDecimalAllowedReader() throws Exception { _testLeadingDotInDecimalAllowed(JSON_F, MODE_READER); } - private void _testLeadingDotInDecimalAllowed(JsonFactory f, int mode) + private void _testLeadingDotInDecimalAllowed(JsonFactory f, int mode) throws Exception { JsonParser p = createParser(f, mode, " .125 "); assertEquals(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/NonStandardJsonReadFeaturesTest.java b/src/test/java/com/fasterxml/jackson/core/read/NonStandardParserFeaturesTest.java similarity index 89% rename from src/test/java/com/fasterxml/jackson/core/read/NonStandardJsonReadFeaturesTest.java rename to src/test/java/com/fasterxml/jackson/core/read/NonStandardParserFeaturesTest.java index 534a3562a1..172c066f0b 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NonStandardJsonReadFeaturesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NonStandardParserFeaturesTest.java @@ -1,11 +1,9 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; -public class NonStandardJsonReadFeaturesTest +public class NonStandardParserFeaturesTest extends com.fasterxml.jackson.core.BaseTest { private final JsonFactory STD_F = sharedStreamFactory(); @@ -13,14 +11,14 @@ public class NonStandardJsonReadFeaturesTest private final JsonFactory LEADING_ZERO_F = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS) .build(); - + + @SuppressWarnings("deprecation") public void testDefaults() { - JsonFactory f = new JsonFactory(); - assertFalse(f.isEnabled(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS)); - assertFalse(f.isEnabled(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS)); + assertFalse(STD_F.isEnabled(JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS)); + assertFalse(STD_F.isEnabled(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS)); } - public void testNonStandardAnyCharQuoting() + public void testNonStandardAnyCharQuoting() throws Exception { _testNonStandarBackslashQuoting(MODE_INPUT_STREAM); _testNonStandarBackslashQuoting(MODE_INPUT_STREAM_THROTTLED); @@ -28,7 +26,7 @@ public void testNonStandardAnyCharQuoting() _testNonStandarBackslashQuoting(MODE_READER); } - public void testLeadingZeroesUTF8() { + public void testLeadingZeroesUTF8() throws Exception { _testLeadingZeroes(MODE_INPUT_STREAM, false); _testLeadingZeroes(MODE_INPUT_STREAM, true); _testLeadingZeroes(MODE_INPUT_STREAM_THROTTLED, false); @@ -39,13 +37,13 @@ public void testLeadingZeroesUTF8() { _testLeadingZeroes(MODE_DATA_INPUT, true); } - public void testLeadingZeroesReader() { + public void testLeadingZeroesReader() throws Exception { _testLeadingZeroes(MODE_READER, false); _testLeadingZeroes(MODE_READER, true); } // allow NaN - public void testAllowNaN() { + public void testAllowNaN() throws Exception { _testAllowNaN(MODE_INPUT_STREAM); _testAllowNaN(MODE_INPUT_STREAM_THROTTLED); _testAllowNaN(MODE_DATA_INPUT); @@ -53,7 +51,7 @@ public void testAllowNaN() { } // allow +Inf/-Inf - public void testAllowInfinity() { + public void testAllowInfinity() throws Exception { _testAllowInf(MODE_INPUT_STREAM); _testAllowInf(MODE_INPUT_STREAM_THROTTLED); _testAllowInf(MODE_DATA_INPUT); @@ -66,7 +64,7 @@ public void testAllowInfinity() { /**************************************************************** */ - private void _testNonStandarBackslashQuoting(int mode) + private void _testNonStandarBackslashQuoting(int mode) throws Exception { // first: verify that we get an exception final String JSON = quote("\\'"); @@ -75,7 +73,7 @@ private void _testNonStandarBackslashQuoting(int mode) p.nextToken(); p.getText(); fail("Should have thrown an exception for doc <"+JSON+">"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "unrecognized character escape"); } finally { p.close(); @@ -90,7 +88,7 @@ private void _testNonStandarBackslashQuoting(int mode) p.close(); } - private void _testLeadingZeroes(int mode, boolean appendSpace) + private void _testLeadingZeroes(int mode, boolean appendSpace) throws Exception { // first: verify that we get an exception String JSON = "00003"; @@ -102,7 +100,7 @@ private void _testLeadingZeroes(int mode, boolean appendSpace) p.nextToken(); p.getText(); fail("Should have thrown an exception for doc <"+JSON+">"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "invalid numeric value"); } p.close(); @@ -113,7 +111,7 @@ private void _testLeadingZeroes(int mode, boolean appendSpace) try { p.nextToken(); fail("Should have thrown an exception for doc <"+JSON+">"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "invalid numeric value"); } p.close(); @@ -150,7 +148,7 @@ private void _testLeadingZeroes(int mode, boolean appendSpace) p.close(); } - private void _testAllowNaN(int mode) + private void _testAllowNaN(int mode) throws Exception { final String JSON = "[ NaN]"; @@ -160,7 +158,7 @@ private void _testAllowNaN(int mode) try { p.nextToken(); fail("Expected exception"); - } catch (StreamReadException e) { + } catch (Exception e) { verifyException(e, "non-standard"); } finally { p.close(); @@ -168,7 +166,7 @@ private void _testAllowNaN(int mode) // we can enable it dynamically (impl detail) JsonFactory f = JsonFactory.builder() - .enable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS) + .configure(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS, true) .build(); p = createParser(f, mode, JSON); assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -197,7 +195,7 @@ private void _testAllowNaN(int mode) p.close(); } - private void _testAllowInf(int mode) + private void _testAllowInf(int mode) throws Exception { final String JSON = "[ -INF, +INF, +Infinity, Infinity, -Infinity ]"; @@ -207,11 +205,12 @@ private void _testAllowInf(int mode) try { p.nextToken(); fail("Expected exception"); - } catch (StreamReadException e) { + } catch (Exception e) { verifyException(e, "Non-standard token '-INF'"); } finally { p.close(); } + JsonFactory f = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS) .build(); diff --git a/src/test/java/com/fasterxml/jackson/core/read/NonStandardUnquotedNamesTest.java b/src/test/java/com/fasterxml/jackson/core/read/NonStandardUnquotedNamesTest.java index 8477ec8ca7..2a5977eada 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NonStandardUnquotedNamesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NonStandardUnquotedNamesTest.java @@ -1,17 +1,18 @@ package com.fasterxml.jackson.core.read; -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.json.JsonReadFeature; public class NonStandardUnquotedNamesTest extends com.fasterxml.jackson.core.BaseTest { private final JsonFactory UNQUOTED_FIELDS_F = JsonFactory.builder() - .enable(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES) + .enable(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES) .build(); - + public void testSimpleUnquotedBytes() throws Exception { _testSimpleUnquoted(MODE_INPUT_STREAM); _testSimpleUnquoted(MODE_INPUT_STREAM_THROTTLED); @@ -42,14 +43,13 @@ public void testUnquotedIssue510() throws Exception fullChars[3999] = 'a'; fullChars[4000] = 256; - JsonParser p = UNQUOTED_FIELDS_F.createParser(ObjectReadContext.empty(), - new java.io.StringReader(new String(fullChars))); + JsonParser p = UNQUOTED_FIELDS_F.createParser(new java.io.StringReader(new String(fullChars))); assertToken(JsonToken.START_OBJECT, p.nextToken()); try { p.nextToken(); fail("Should not pass"); - } catch (StreamReadException e) { - verifyException(e, "Unexpected end-of-input within/between Object entries"); + } catch (JsonParseException e) { + ; // should fail here } p.close(); } @@ -77,26 +77,26 @@ private void _testNonStandardNameChars(int mode) throws Exception assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("@type", p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("mytype", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("#color", p.getText()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(123, p.getIntValue()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("*error*", p.getText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("hyphen-ated", p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("yes", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("me+my", p.getText()); assertToken(JsonToken.VALUE_NULL, p.nextToken()); @@ -128,8 +128,8 @@ private void _testLargeUnquoted(int mode) throws Exception assertToken(JsonToken.START_ARRAY, p.nextToken()); for (int i = 0; i < REPS; ++i) { assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("abc"+(i&127), p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("abc"+(i&127), p.getCurrentName()); assertToken(((i&1) != 0) ? JsonToken.VALUE_TRUE : JsonToken.VALUE_FALSE, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); } @@ -143,20 +143,20 @@ private void _testSimpleUnquoted(int mode) throws Exception JsonParser p = createParser(UNQUOTED_FIELDS_F, mode, JSON); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("a", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("a", p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("_foo", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("_foo", p.getCurrentName()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("$", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("$", p.getCurrentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("money!", p.getText()); // and then regular quoted one should still work too: - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals(" ", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals(" ", p.getCurrentName()); assertToken(JsonToken.VALUE_NULL, p.nextToken()); @@ -169,12 +169,12 @@ private void _testSimpleUnquoted(int mode) throws Exception p = createParser(UNQUOTED_FIELDS_F, mode, JSON); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("123", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("123", p.getCurrentName()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("4", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("4", p.getCurrentName()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/NumberCoercionTest.java b/src/test/java/com/fasterxml/jackson/core/read/NumberCoercionTest.java index a9c66a56e2..b2dee09e29 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NumberCoercionTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NumberCoercionTest.java @@ -65,7 +65,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -78,7 +78,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -91,7 +91,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_FLOAT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -102,7 +102,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_FLOAT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -115,7 +115,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -126,7 +126,7 @@ public void testToIntFailing() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Integer.TYPE, e.getTargetType()); } @@ -186,7 +186,7 @@ public void testToLongFailing() throws Exception p.getLongValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `long`"); + verifyException(e, "out of range of long"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Long.TYPE, e.getTargetType()); } @@ -198,7 +198,7 @@ public void testToLongFailing() throws Exception p.getLongValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `long`"); + verifyException(e, "out of range of long"); assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); assertEquals(Long.TYPE, e.getTargetType()); } diff --git a/src/test/java/com/fasterxml/jackson/core/read/NumberOverflowTest.java b/src/test/java/com/fasterxml/jackson/core/read/NumberOverflowTest.java index 2612c4c3b7..8de42c935d 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NumberOverflowTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NumberOverflowTest.java @@ -3,7 +3,6 @@ import java.math.BigInteger; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.exc.InputCoercionException; public class NumberOverflowTest @@ -42,7 +41,7 @@ public void testSimpleLongOverflow() throws Exception long x = p.getLongValue(); fail("Expected an exception for underflow (input "+p.getText()+"): instead, got long value: "+x); } catch (InputCoercionException e) { - verifyException(e, "out of range of `long`"); + verifyException(e, "out of range of long"); } p.close(); @@ -52,9 +51,7 @@ public void testSimpleLongOverflow() throws Exception long x = p.getLongValue(); fail("Expected an exception for underflow (input "+p.getText()+"): instead, got long value: "+x); } catch (InputCoercionException e) { - verifyException(e, "out of range of `long`"); - assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); - assertEquals(Long.TYPE, e.getTargetType()); + verifyException(e, "out of range of long"); } p.close(); } @@ -75,10 +72,8 @@ public void testMaliciousLongOverflow() throws Exception p.getLongValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `long`"); + verifyException(e, "out of range of long"); verifyException(e, "Integer with "+BIG_NUM_LEN+" digits"); - assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); - assertEquals(Long.TYPE, e.getTargetType()); } p.close(); } @@ -97,10 +92,8 @@ public void testMaliciousIntOverflow() throws Exception p.getIntValue(); fail("Should not pass"); } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + verifyException(e, "out of range of int"); verifyException(e, "Integer with "+BIG_NUM_LEN+" digits"); - assertEquals(JsonToken.VALUE_NUMBER_INT, e.getInputType()); - assertEquals(Integer.TYPE, e.getTargetType()); } p.close(); } diff --git a/src/test/java/com/fasterxml/jackson/core/read/NumberParsingTest.java b/src/test/java/com/fasterxml/jackson/core/read/NumberParsingTest.java index be8dabb045..898dec8969 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NumberParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NumberParsingTest.java @@ -2,14 +2,13 @@ import java.io.ByteArrayInputStream; import java.io.CharArrayReader; +import java.io.IOException; import java.io.StringReader; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.exc.InputCoercionException; -import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.core.io.NumberInput; import com.fasterxml.jackson.core.json.JsonReadFeature; @@ -21,7 +20,7 @@ public class NumberParsingTest extends com.fasterxml.jackson.core.BaseTest { - private final TokenStreamFactory FACTORY = sharedStreamFactory(); + private final JsonFactory FACTORY = sharedStreamFactory(); /* /********************************************************************** @@ -29,7 +28,7 @@ public class NumberParsingTest /********************************************************************** */ - public void testSimpleBoolean() + public void testSimpleBoolean() throws Exception { _testSimpleBoolean(MODE_INPUT_STREAM); _testSimpleBoolean(MODE_INPUT_STREAM_THROTTLED); @@ -37,7 +36,7 @@ public void testSimpleBoolean() _testSimpleBoolean(MODE_DATA_INPUT); } - private void _testSimpleBoolean(int mode) + private void _testSimpleBoolean(int mode) throws Exception { JsonParser p = createParser(mode, "[ true ]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -53,7 +52,7 @@ private void _testSimpleBoolean(int mode) /********************************************************************** */ - public void testSimpleInt() + public void testSimpleInt() throws Exception { for (int EXP_I : new int[] { 1234, -999, 0, 1, -2, 123456789 }) { _testSimpleInt(EXP_I, MODE_INPUT_STREAM); @@ -63,7 +62,7 @@ public void testSimpleInt() } } - private void _testSimpleInt(int EXP_I, int mode) + private void _testSimpleInt(int EXP_I, int mode) throws Exception { String DOC = "[ "+EXP_I+" ]"; JsonParser p = createParser(mode, DOC); @@ -135,7 +134,7 @@ private void _testSimpleInt(int EXP_I, int mode) p.close(); } - public void testIntRange() + public void testIntRange() throws Exception { // let's test with readers and streams, separate code paths: for (int mode : ALL_MODES) { @@ -153,7 +152,7 @@ public void testIntRange() } } - public void testIntParsing() + public void testIntParsing() throws Exception { char[] testChars = "123456789".toCharArray(); @@ -175,7 +174,7 @@ public void testIntParsing() assertEquals(0, NumberInput.parseInt(testChars, 1, 1)); } - public void testIntParsingWithStrings() + public void testIntParsingWithStrings() throws Exception { assertEquals(3, NumberInput.parseInt("3")); assertEquals(0, NumberInput.parseInt("0")); @@ -196,7 +195,7 @@ public void testIntParsingWithStrings() /********************************************************************** */ - public void testSimpleLong() + public void testSimpleLong() throws Exception { _testSimpleLong(MODE_INPUT_STREAM); _testSimpleLong(MODE_INPUT_STREAM_THROTTLED); @@ -204,7 +203,7 @@ public void testSimpleLong() _testSimpleLong(MODE_DATA_INPUT); } - private void _testSimpleLong(int mode) + private void _testSimpleLong(int mode) throws Exception { long EXP_L = 12345678907L; @@ -229,7 +228,7 @@ private void _testSimpleLong(int mode) p.close(); } - public void testLongRange() + public void testLongRange() throws Exception { for (int mode : ALL_MODES) { long belowMinInt = -1L + Integer.MIN_VALUE; @@ -259,14 +258,14 @@ public void testLongRange() } } - public void testLongParsing() + public void testLongParsing() throws Exception { char[] testChars = "123456789012345678".toCharArray(); assertEquals(123456789012345678L, NumberInput.parseLong(testChars, 0, testChars.length)); } - public void testLongBoundsChecks() + public void testLongBoundsChecks() throws Exception { String minLong = String.valueOf(Long.MIN_VALUE).substring(1); String belowMinLong = BigInteger.valueOf(Long.MIN_VALUE).subtract(BigInteger.ONE) @@ -308,7 +307,7 @@ public void testLongBoundsChecks() /********************************************************************** */ - public void testBigDecimalRange() + public void testBigDecimalRange() throws Exception { for (int mode : ALL_MODES) { // let's test first values outside of Long range @@ -331,7 +330,7 @@ public void testBigDecimalRange() } // for [core#78] - public void testBigNumbers() + public void testBigNumbers() throws Exception { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 520; ++i) { // input buffer is 512 bytes by default @@ -356,7 +355,7 @@ public void testBigNumbers() /********************************************************************** */ - public void testSimpleDouble() + public void testSimpleDouble() throws Exception { final String[] INPUTS = new String[] { "1234.00", "2.1101567E-16", "1.0e5", "0.0", "1.0", "-1.0", @@ -391,7 +390,7 @@ public void testSimpleDouble() try { t = p.nextToken(); } catch (Exception e) { - throw new RuntimeException("Failed to parse input '"+STR+"' (parser of type "+p.getClass().getSimpleName()+")", e); + throw new Exception("Failed to parse input '"+STR+"' (parser of type "+p.getClass().getSimpleName()+")", e); } assertToken(JsonToken.VALUE_NUMBER_FLOAT, t); @@ -404,7 +403,7 @@ public void testSimpleDouble() } } - public void testFloatBoundary146Chars() + public void testFloatBoundary146Chars() throws Exception { final char[] arr = new char[50005]; for(int i = 500; i != 9000; ++i) { @@ -415,13 +414,13 @@ public void testFloatBoundary146Chars() arr[i + 3] = '-'; arr[i + 4] = '1'; CharArrayReader r = new CharArrayReader(arr, 0, i+5); - JsonParser p = FACTORY.createParser(ObjectReadContext.empty(), r); + JsonParser p = FACTORY.createParser(r); assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); p.close(); } } - public void testFloatBoundary146Bytes() + public void testFloatBoundary146Bytes() throws Exception { final byte[] arr = new byte[50005]; for(int i = 500; i != 9000; ++i) { @@ -432,7 +431,7 @@ public void testFloatBoundary146Bytes() arr[i + 3] = '-'; arr[i + 4] = '1'; ByteArrayInputStream in = new ByteArrayInputStream(arr, 0, i+5); - JsonParser p = FACTORY.createParser(ObjectReadContext.empty(), in); + JsonParser p = FACTORY.createParser(in); assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); p.close(); } @@ -511,7 +510,7 @@ private void _testBigBigDecimals(int mode) throws Exception /********************************************************************** */ - public void testNumbers() + public void testNumbers() throws Exception { _testNumbers(MODE_INPUT_STREAM); _testNumbers(MODE_INPUT_STREAM_THROTTLED); @@ -519,7 +518,7 @@ public void testNumbers() _testNumbers(MODE_DATA_INPUT); } - private void _testNumbers(int mode) + private void _testNumbers(int mode) throws Exception { final String DOC = "[ -13, 8100200300, 13.5, 0.00010, -2.033 ]"; @@ -539,8 +538,8 @@ private void _testNumbers(int mode) try { /*int x =*/ p.getIntValue(); fail("Expected an exception for overflow"); - } catch (InputCoercionException e) { - verifyException(e, "out of range of `int`"); + } catch (Exception e) { + verifyException(e, "out of range of int"); } assertEquals(8100200300.0, p.getDoubleValue()); assertEquals("8100200300", p.getText()); @@ -573,7 +572,7 @@ private void _testNumbers(int mode) * Method that tries to test that number parsing works in cases where * input is split between buffer boundaries. */ - public void testParsingOfLongerSequences() + public void testParsingOfLongerSequences() throws Exception { double[] values = new double[] { 0.01, -10.5, 2.1e9, 4.0e-8 }; StringBuilder sb = new StringBuilder(); @@ -613,7 +612,7 @@ public void testParsingOfLongerSequences() if (input == 0) { p = createParserUsingStream(DOC, "UTF-8"); } else { - p = FACTORY.createParser(ObjectReadContext.empty(), DOC); + p = FACTORY.createParser(DOC); } assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -629,7 +628,7 @@ public void testParsingOfLongerSequences() } // [jackson-core#157] - public void testLongNumbers() + public void testLongNumbers() throws Exception { StringBuilder sb = new StringBuilder(9000); for (int i = 0; i < 9000; ++i) { @@ -642,12 +641,12 @@ public void testLongNumbers() _testLongNumbers(f, NUM, true); } - private void _testLongNumbers(JsonFactory f, String num, boolean useStream) + private void _testLongNumbers(JsonFactory f, String num, boolean useStream) throws Exception { final String doc = "[ "+num+" ]"; JsonParser p = useStream - ? f.createParser(ObjectReadContext.empty(), utf8Bytes(doc)) - : f.createParser(ObjectReadContext.empty(), doc); + ? f.createParser(doc.getBytes("UTF-8")) + : f.createParser(doc); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(num, p.getText()); @@ -655,7 +654,7 @@ private void _testLongNumbers(JsonFactory f, String num, boolean useStream) } // and alternate take on for #157 (with negative num) - public void testLongNumbers2() + public void testLongNumbers2() throws Exception { StringBuilder input = new StringBuilder(); // test this with negative @@ -669,11 +668,11 @@ public void testLongNumbers2() _testIssue160LongNumbers(f, DOC, true); } - private void _testIssue160LongNumbers(JsonFactory f, String doc, boolean useStream) + private void _testIssue160LongNumbers(JsonFactory f, String doc, boolean useStream) throws Exception { JsonParser p = useStream - ? FACTORY.createParser(ObjectReadContext.empty(), utf8Bytes(doc)) - : FACTORY.createParser(ObjectReadContext.empty(), doc); + ? FACTORY.createParser(doc.getBytes("UTF-8")) + : FACTORY.createParser(doc); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); BigInteger v = p.getBigIntegerValue(); assertNull(p.nextToken()); @@ -685,17 +684,18 @@ private void _testIssue160LongNumbers(JsonFactory f, String doc, boolean useStre * Method that tries to test that number parsing works in cases where * input is split between buffer boundaries. */ - public void testParsingOfLongerSequencesWithNonNumeric() + public void testParsingOfLongerSequencesWithNonNumeric() throws Exception { - JsonFactory f = streamFactoryBuilder() - .enable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS).build(); + JsonFactory f = JsonFactory.builder() + .enable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS) + .build(); _testParsingOfLongerSequencesWithNonNumeric(f, MODE_INPUT_STREAM); _testParsingOfLongerSequencesWithNonNumeric(f, MODE_INPUT_STREAM_THROTTLED); _testParsingOfLongerSequencesWithNonNumeric(f, MODE_READER); _testParsingOfLongerSequencesWithNonNumeric(f, MODE_DATA_INPUT); } - private void _testParsingOfLongerSequencesWithNonNumeric(JsonFactory f, int mode) + private void _testParsingOfLongerSequencesWithNonNumeric(JsonFactory f, int mode) throws Exception { double[] values = new double[] { 0.01, -10.5, 2.1e9, 4.0e-8, @@ -740,14 +740,14 @@ private void _testParsingOfLongerSequencesWithNonNumeric(JsonFactory f, int mode /********************************************************** */ - public void testInvalidBooleanAccess() { + public void testInvalidBooleanAccess() throws Exception { _testInvalidBooleanAccess(MODE_INPUT_STREAM); _testInvalidBooleanAccess(MODE_INPUT_STREAM_THROTTLED); _testInvalidBooleanAccess(MODE_READER); _testInvalidBooleanAccess(MODE_DATA_INPUT); } - private void _testInvalidBooleanAccess(int mode) + private void _testInvalidBooleanAccess(int mode) throws Exception { JsonParser p = createParser(mode, "[ \"abc\" ]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -755,20 +755,20 @@ private void _testInvalidBooleanAccess(int mode) try { p.getBooleanValue(); fail("Expected error trying to call getBooleanValue on non-boolean value"); - } catch (InputCoercionException e) { + } catch (JsonParseException e) { verifyException(e, "not of boolean type"); } p.close(); } - public void testInvalidIntAccess() { + public void testInvalidIntAccess() throws Exception { _testInvalidIntAccess(MODE_INPUT_STREAM); _testInvalidIntAccess(MODE_INPUT_STREAM_THROTTLED); _testInvalidIntAccess(MODE_READER); _testInvalidIntAccess(MODE_DATA_INPUT); } - private void _testInvalidIntAccess(int mode) + private void _testInvalidIntAccess(int mode) throws Exception { JsonParser p = createParser(mode, "[ \"abc\" ]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -776,20 +776,20 @@ private void _testInvalidIntAccess(int mode) try { p.getIntValue(); fail("Expected error trying to call getIntValue on non-numeric value"); - } catch (InputCoercionException e) { + } catch (JsonParseException e) { verifyException(e, "can not use numeric value accessors"); } p.close(); } - public void testInvalidLongAccess() { + public void testInvalidLongAccess() throws Exception { _testInvalidLongAccess(MODE_INPUT_STREAM); _testInvalidLongAccess(MODE_INPUT_STREAM_THROTTLED); _testInvalidLongAccess(MODE_READER); _testInvalidLongAccess(MODE_DATA_INPUT); } - private void _testInvalidLongAccess(int mode) + private void _testInvalidLongAccess(int mode) throws Exception { JsonParser p = createParser(mode, "[ false ]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -797,14 +797,14 @@ private void _testInvalidLongAccess(int mode) try { p.getLongValue(); fail("Expected error trying to call getLongValue on non-numeric value"); - } catch (InputCoercionException e) { + } catch (JsonParseException e) { verifyException(e, "can not use numeric value accessors"); } p.close(); } // [core#317] - public void testLongerFloatingPoint() + public void testLongerFloatingPoint() throws Exception { StringBuilder input = new StringBuilder(); for (int i = 1; i < 201; i++) { @@ -816,30 +816,29 @@ public void testLongerFloatingPoint() // test out with both Reader and ByteArrayInputStream JsonParser p; - p = FACTORY.createParser(ObjectReadContext.empty(), new StringReader(DOC)); + p = FACTORY.createParser(new StringReader(DOC)); _testLongerFloat(p, DOC); p.close(); - p = FACTORY.createParser(ObjectReadContext.empty(), - new ByteArrayInputStream(utf8Bytes(DOC))); + p = FACTORY.createParser(new ByteArrayInputStream(DOC.getBytes("UTF-8"))); _testLongerFloat(p, DOC); p.close(); } - private void _testLongerFloat(JsonParser p, String text) + private void _testLongerFloat(JsonParser p, String text) throws IOException { assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); assertEquals(text, p.getText()); assertNull(p.nextToken()); } - public void testInvalidNumber() { + public void testInvalidNumber() throws Exception { for (int mode : ALL_MODES) { JsonParser p = createParser(mode, " -foo "); try { p.nextToken(); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected character ('f'"); } p.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/read/ParserClosingTest.java b/src/test/java/com/fasterxml/jackson/core/read/ParserClosingTest.java index fbf5331c2b..3e4430b8c8 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/ParserClosingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ParserClosingTest.java @@ -3,7 +3,6 @@ import static org.junit.Assert.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import java.io.*; @@ -32,9 +31,12 @@ public void testNoAutoCloseReader() .disable(StreamReadFeature.AUTO_CLOSE_SOURCE) .build(); assertFalse(f.isEnabled(StreamReadFeature.AUTO_CLOSE_SOURCE)); + { + assertFalse(f.isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)); + } @SuppressWarnings("resource") MyReader input = new MyReader(DOC); - JsonParser jp = f.createParser(ObjectReadContext.empty(), input); + JsonParser jp = f.createParser(input); // shouldn't be closed to begin with... assertFalse(input.isClosed()); @@ -53,11 +55,12 @@ public void testNoAutoCloseReader() public void testAutoCloseReader() throws Exception { final String DOC = "[ 1 ]"; + JsonFactory f = JsonFactory.builder() - .enable(StreamReadFeature.AUTO_CLOSE_SOURCE).build(); - assertTrue(f.isEnabled(StreamReadFeature.AUTO_CLOSE_SOURCE)); + .enable(StreamReadFeature.AUTO_CLOSE_SOURCE) + .build(); MyReader input = new MyReader(DOC); - JsonParser jp = f.createParser(ObjectReadContext.empty(), input); + JsonParser jp = f.createParser(input); assertFalse(input.isClosed()); assertToken(JsonToken.START_ARRAY, jp.nextToken()); // but can close half-way through @@ -66,7 +69,7 @@ public void testAutoCloseReader() throws Exception // And then let's test implicit close at the end too: input = new MyReader(DOC); - jp = f.createParser(ObjectReadContext.empty(), input); + jp = f.createParser(input); assertFalse(input.isClosed()); assertToken(JsonToken.START_ARRAY, jp.nextToken()); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); @@ -80,9 +83,10 @@ public void testNoAutoCloseInputStream() throws Exception { final String DOC = "[ 1 ]"; JsonFactory f = JsonFactory.builder() - .disable(StreamReadFeature.AUTO_CLOSE_SOURCE).build(); + .disable(StreamReadFeature.AUTO_CLOSE_SOURCE) + .build(); MyStream input = new MyStream(DOC.getBytes("UTF-8")); - JsonParser jp = f.createParser(ObjectReadContext.empty(), input); + JsonParser jp = f.createParser(input); // shouldn't be closed to begin with... assertFalse(input.isClosed()); @@ -101,7 +105,7 @@ public void testNoAutoCloseInputStream() throws Exception public void testReleaseContentBytes() throws Exception { byte[] input = "[1]foobar".getBytes("UTF-8"); - JsonParser jp = sharedStreamFactory().createParser(ObjectReadContext.empty(), input); + JsonParser jp = sharedStreamFactory().createParser(input); assertToken(JsonToken.START_ARRAY, jp.nextToken()); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); assertToken(JsonToken.END_ARRAY, jp.nextToken()); @@ -116,7 +120,7 @@ public void testReleaseContentBytes() throws Exception public void testReleaseContentChars() throws Exception { - JsonParser jp = sharedStreamFactory().createParser(ObjectReadContext.empty(), "[true]xyz"); + JsonParser jp = sharedStreamFactory().createParser("[true]xyz"); assertToken(JsonToken.START_ARRAY, jp.nextToken()); assertToken(JsonToken.VALUE_TRUE, jp.nextToken()); assertToken(JsonToken.END_ARRAY, jp.nextToken()); @@ -128,7 +132,7 @@ public void testReleaseContentChars() throws Exception assertEquals(0, jp.releaseBuffered(sw)); jp.close(); } - + /* /********************************************************** /* Helper classes diff --git a/src/test/java/com/fasterxml/jackson/core/read/ParserDupHandlingTest.java b/src/test/java/com/fasterxml/jackson/core/read/ParserDupHandlingTest.java index 21e660afc0..465738b631 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/ParserDupHandlingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ParserDupHandlingTest.java @@ -1,8 +1,6 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; public class ParserDupHandlingTest extends com.fasterxml.jackson.core.BaseTest @@ -25,7 +23,7 @@ public void testSimpleDupCheckDisabled() throws Exception { // first: verify no problems if detection NOT enabled final JsonFactory f = new JsonFactory(); - assertFalse(f.isEnabled(StreamReadFeature.STRICT_DUPLICATE_DETECTION)); + assertFalse(f.isEnabled(JsonParser.Feature.STRICT_DUPLICATE_DETECTION)); for (String doc : DUP_DOCS) { _testSimpleDupsOk(doc, f, MODE_INPUT_STREAM); _testSimpleDupsOk(doc, f, MODE_INPUT_STREAM_THROTTLED); @@ -36,30 +34,41 @@ public void testSimpleDupCheckDisabled() throws Exception public void testSimpleDupsBytes() throws Exception { + JsonFactory nonDupF = new JsonFactory(); JsonFactory dupF = JsonFactory.builder() - .enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION).build(); + .enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION) + .build(); for (String doc : DUP_DOCS) { - _testSimpleDupsFail(doc, dupF, MODE_INPUT_STREAM, "a"); + // First, with static setting + _testSimpleDupsFail(doc, dupF, MODE_INPUT_STREAM, "a", false); + // and then dynamic + _testSimpleDupsFail(doc, nonDupF, MODE_INPUT_STREAM, "a", true); - _testSimpleDupsFail(doc, dupF, MODE_INPUT_STREAM_THROTTLED, "a"); + _testSimpleDupsFail(doc, dupF, MODE_INPUT_STREAM_THROTTLED, "a", false); + _testSimpleDupsFail(doc, nonDupF, MODE_INPUT_STREAM_THROTTLED, "a", true); } } public void testSimpleDupsDataInput() throws Exception { + JsonFactory nonDupF = new JsonFactory(); JsonFactory dupF = JsonFactory.builder() - .enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION).build(); + .enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION) + .build(); for (String doc : DUP_DOCS) { - _testSimpleDupsFail(doc, dupF, MODE_DATA_INPUT, "a"); + _testSimpleDupsFail(doc, dupF, MODE_DATA_INPUT, "a", false); + _testSimpleDupsFail(doc, nonDupF, MODE_DATA_INPUT, "a", true); } } public void testSimpleDupsChars() throws Exception { - JsonFactory dupF = JsonFactory.builder() - .enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION).build(); + JsonFactory nonDupF = new JsonFactory(); + JsonFactory dupF = new JsonFactory(); + dupF.enable(JsonParser.Feature.STRICT_DUPLICATE_DETECTION); for (String doc : DUP_DOCS) { - _testSimpleDupsFail(doc, dupF, MODE_READER, "a"); + _testSimpleDupsFail(doc, dupF, MODE_READER, "a", false); + _testSimpleDupsFail(doc, nonDupF, MODE_READER, "a", true); } } @@ -93,15 +102,18 @@ private void _testSimpleDupsOk(final String doc, JsonFactory f, } private void _testSimpleDupsFail(final String doc, JsonFactory f, - int mode, String name) + int mode, String name, boolean lazily) throws Exception { JsonParser p = createParser(f, mode, doc); + if (lazily) { + p.enable(JsonParser.Feature.STRICT_DUPLICATE_DETECTION); + } JsonToken t = p.nextToken(); assertNotNull(t); assertTrue(t.isStructStart()); int depth = 1; - StreamReadException e = null; + JsonParseException e = null; while (depth > 0) { try { @@ -116,7 +128,7 @@ private void _testSimpleDupsFail(final String doc, JsonFactory f, break; default: } - } catch (StreamReadException e0) { + } catch (JsonParseException e0) { e = e0; break; } @@ -126,6 +138,6 @@ private void _testSimpleDupsFail(final String doc, JsonFactory f, if (e == null) { fail("Should have caught exception for dup"); } - verifyException(e, "duplicate Object Property \""+name+"\""); + verifyException(e, "duplicate field '"+name+"'"); } } diff --git a/src/test/java/com/fasterxml/jackson/core/read/ParserErrorHandlingTest.java b/src/test/java/com/fasterxml/jackson/core/read/ParserErrorHandlingTest.java index c29ecbf801..14b2f1c8c0 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/ParserErrorHandlingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ParserErrorHandlingTest.java @@ -1,24 +1,26 @@ package com.fasterxml.jackson.core.read; +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.exc.StreamReadException; public class ParserErrorHandlingTest extends com.fasterxml.jackson.core.BaseTest { - public void testInvalidKeywordsBytes() { + public void testInvalidKeywordsBytes() throws Exception { _testInvalidKeywords(MODE_INPUT_STREAM); _testInvalidKeywords(MODE_INPUT_STREAM_THROTTLED); _testInvalidKeywords(MODE_DATA_INPUT); } - public void testInvalidKeywordsChars() { + public void testInvalidKeywordsChars() throws Exception { _testInvalidKeywords(MODE_READER); } // Tests for [core#105] ("eager number parsing misses errors") - public void testMangledIntsBytes() { + public void testMangledIntsBytes() throws Exception { _testMangledNumbersInt(MODE_INPUT_STREAM); _testMangledNumbersInt(MODE_INPUT_STREAM_THROTTLED); @@ -27,7 +29,7 @@ public void testMangledIntsBytes() { // _testMangledNumbersInt(MODE_DATA_INPUT); } - public void testMangledFloatsBytes() { + public void testMangledFloatsBytes() throws Exception { _testMangledNumbersFloat(MODE_INPUT_STREAM); _testMangledNumbersFloat(MODE_INPUT_STREAM_THROTTLED); @@ -35,7 +37,7 @@ public void testMangledFloatsBytes() { _testMangledNumbersFloat(MODE_DATA_INPUT); } - public void testMangledNumbersChars() { + public void testMangledNumbersChars() throws Exception { _testMangledNumbersInt(MODE_READER); _testMangledNumbersFloat(MODE_READER); } @@ -46,7 +48,7 @@ public void testMangledNumbersChars() { /********************************************************** */ - private void _testInvalidKeywords(int mode) + private void _testInvalidKeywords(int mode) throws Exception { doTestInvalidKeyword1(mode, "nul"); doTestInvalidKeyword1(mode, "Null"); @@ -63,6 +65,7 @@ private void _testInvalidKeywords(int mode) } private void doTestInvalidKeyword1(int mode, String value) + throws IOException { String doc = "{ \"key1\" : "+value+" }"; JsonParser p = createParser(mode, doc); @@ -70,10 +73,10 @@ private void doTestInvalidKeyword1(int mode, String value) // Note that depending on parser impl, we may // get the exception early or late... try { - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); p.nextToken(); fail("Expected an exception for malformed value keyword"); - } catch (StreamReadException jex) { + } catch (JsonParseException jex) { verifyException(jex, "Unrecognized token"); verifyException(jex, value); } finally { @@ -86,7 +89,7 @@ private void doTestInvalidKeyword1(int mode, String value) try { p.nextToken(); fail("Expected an exception for malformed value keyword"); - } catch (StreamReadException jex) { + } catch (JsonParseException jex) { verifyException(jex, "Unrecognized token"); verifyException(jex, value); } finally { @@ -94,26 +97,26 @@ private void doTestInvalidKeyword1(int mode, String value) } } - private void _testMangledNumbersInt(int mode) + private void _testMangledNumbersInt(int mode) throws Exception { JsonParser p = createParser(mode, "123true"); try { JsonToken t = p.nextToken(); fail("Should have gotten an exception; instead got token: "+t); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected space"); } p.close(); } - private void _testMangledNumbersFloat(int mode) + private void _testMangledNumbersFloat(int mode) throws Exception { // Also test with floats JsonParser p = createParser(mode, "1.5false"); try { JsonToken t = p.nextToken(); fail("Should have gotten an exception; instead got token: "+t); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected space"); } p.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/json/JsonReadFeaturesTest.java b/src/test/java/com/fasterxml/jackson/core/read/ParserFeaturesTest.java similarity index 61% rename from src/test/java/com/fasterxml/jackson/core/json/JsonReadFeaturesTest.java rename to src/test/java/com/fasterxml/jackson/core/read/ParserFeaturesTest.java index 76353b9a40..2c03159d6b 100644 --- a/src/test/java/com/fasterxml/jackson/core/json/JsonReadFeaturesTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ParserFeaturesTest.java @@ -1,31 +1,33 @@ -package com.fasterxml.jackson.core.json; +package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; +import com.fasterxml.jackson.core.json.JsonReadFeature; /** * Unit tests for verifying that additional JsonParser.Feature - * and {@link JsonReadFeature} * settings work as expected. */ -public class JsonReadFeaturesTest +public class ParserFeaturesTest extends com.fasterxml.jackson.core.BaseTest { private final JsonFactory JSON_F = sharedStreamFactory(); - public void testStreamReadFeatureDefaults() throws Exception + public void testDefaultSettings() throws Exception { + assertTrue(JSON_F.isEnabled(StreamReadFeature.AUTO_CLOSE_SOURCE)); + _testDefaultSettings(createParser(JSON_F, MODE_INPUT_STREAM, "{}")); _testDefaultSettings(createParser(JSON_F, MODE_READER, "{}")); _testDefaultSettings(createParser(JSON_F, MODE_DATA_INPUT, "{}")); } - public void testJsonReadFeatureDefaultSettings() throws Exception + @SuppressWarnings("deprecation") + public void testDeprecatedDefaultSettings() throws Exception { - assertFalse(JSON_F.isEnabled(JsonReadFeature.ALLOW_JAVA_COMMENTS)); - assertFalse(JSON_F.isEnabled(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS)); - assertFalse(JSON_F.isEnabled(JsonReadFeature.ALLOW_UNQUOTED_PROPERTY_NAMES)); - assertFalse(JSON_F.isEnabled(JsonReadFeature.ALLOW_SINGLE_QUOTES)); + assertFalse(JSON_F.isEnabled(JsonParser.Feature.ALLOW_COMMENTS)); + assertFalse(JSON_F.isEnabled(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS)); + assertFalse(JSON_F.isEnabled(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES)); + assertFalse(JSON_F.isEnabled(JsonParser.Feature.ALLOW_SINGLE_QUOTES)); } public void testQuotesRequired() throws Exception @@ -40,12 +42,10 @@ public void testTabsDefault() throws Exception _testTabsDefault(true); } - public void testTabsEnabledBytes() throws Exception { - _testTabsEnabled(true); - } - - public void testTabsEnabledChars() throws Exception { + public void testTabsEnabled() throws Exception + { _testTabsEnabled(false); + _testTabsEnabled(true); } /* @@ -59,9 +59,9 @@ private void _testDefaultSettings(JsonParser p) throws Exception { assertFalse(p.canReadTypeId()); // [core#619]: - assertFalse(p.streamReadCapabilities().isEnabled(StreamReadCapability.DUPLICATE_PROPERTIES)); - assertFalse(p.streamReadCapabilities().isEnabled(StreamReadCapability.SCALARS_AS_OBJECTS)); - assertFalse(p.streamReadCapabilities().isEnabled(StreamReadCapability.UNTYPED_SCALARS)); + assertFalse(p.getReadCapabilities().isEnabled(StreamReadCapability.DUPLICATE_PROPERTIES)); + assertFalse(p.getReadCapabilities().isEnabled(StreamReadCapability.SCALARS_AS_OBJECTS)); + assertFalse(p.getReadCapabilities().isEnabled(StreamReadCapability.UNTYPED_SCALARS)); p.close(); } @@ -71,45 +71,54 @@ private void _testQuotesRequired(boolean useStream) throws Exception final String JSON = "{ test : 3 }"; final String EXP_ERROR_FRAGMENT = "was expecting double-quote to start"; JsonFactory f = new JsonFactory(); - try (JsonParser p = useStream ? + JsonParser p = useStream ? createParserUsingStream(f, JSON, "UTF-8") : createParserUsingReader(f, JSON) - ) { - assertToken(JsonToken.START_OBJECT, p.nextToken()); + ; + + assertToken(JsonToken.START_OBJECT, p.nextToken()); + try { p.nextToken(); - } catch (StreamReadException je) { + } catch (JsonParseException je) { verifyException(je, EXP_ERROR_FRAGMENT); + } finally { + p.close(); } } + // // // Tests for [JACKSON-208] + private void _testTabsDefault(boolean useStream) throws Exception { - JsonFactory f = streamFactoryBuilder() - .disable(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS).build(); + JsonFactory f = new JsonFactory(); // First, let's see that by default unquoted tabs are illegal String JSON = "[\"tab:\t\"]"; - try (JsonParser p = useStream ? createParserUsingStream(f, JSON, "UTF-8") : createParserUsingReader(f, JSON)) { - assertToken(JsonToken.START_ARRAY, p.nextToken()); + JsonParser p = useStream ? createParserUsingStream(f, JSON, "UTF-8") : createParserUsingReader(f, JSON); + assertToken(JsonToken.START_ARRAY, p.nextToken()); + try { p.nextToken(); p.getText(); fail("Expected exception"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Illegal unquoted character"); + } finally { + p.close(); } } private void _testTabsEnabled(boolean useStream) throws Exception { - JsonFactory f = streamFactoryBuilder() + JsonFactory f = JsonFactory.builder() .configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS, true) .build(); + String FIELD = "a\tb"; String VALUE = "\t"; String JSON = "{ "+quote(FIELD)+" : "+quote(VALUE)+"}"; JsonParser p = useStream ? createParserUsingStream(f, JSON, "UTF-8") : createParserUsingReader(f, JSON); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(FIELD, p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(VALUE, p.getText()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/ParserLinefeedsTest.java b/src/test/java/com/fasterxml/jackson/core/read/ParserLinefeedsTest.java index 0034aea3fb..07695a56bb 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/ParserLinefeedsTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ParserLinefeedsTest.java @@ -47,22 +47,22 @@ private void _testLinefeeds(String lf, boolean useStream) : createParserUsingReader(DOC); assertToken(JsonToken.START_ARRAY, jp.nextToken()); - assertEquals(1, jp.currentLocation().getLineNr()); + assertEquals(1, jp.getCurrentLocation().getLineNr()); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); assertEquals(1, jp.getIntValue()); - assertEquals(1, jp.currentLocation().getLineNr()); + assertEquals(1, jp.getCurrentLocation().getLineNr()); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); assertEquals(2, jp.getIntValue()); - assertEquals(2, jp.currentLocation().getLineNr()); + assertEquals(2, jp.getCurrentLocation().getLineNr()); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); assertEquals(-478, jp.getIntValue()); - assertEquals(3, jp.currentLocation().getLineNr()); + assertEquals(3, jp.getCurrentLocation().getLineNr()); assertToken(JsonToken.END_ARRAY, jp.nextToken()); - assertEquals(4, jp.currentLocation().getLineNr()); + assertEquals(4, jp.getCurrentLocation().getLineNr()); jp.close(); } diff --git a/src/test/java/com/fasterxml/jackson/core/read/ParserScopeMatchingTest.java b/src/test/java/com/fasterxml/jackson/core/read/ParserScopeMatchingTest.java index 4f87f487eb..fbe42fca12 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/ParserScopeMatchingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ParserScopeMatchingTest.java @@ -1,22 +1,25 @@ package com.fasterxml.jackson.core.read; + +import java.io.IOException; + import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; /** * Set of basic unit tests for verifying that Array/Object scopes * are properly matched. */ +@SuppressWarnings("resource") public class ParserScopeMatchingTest extends BaseTest { - public void testUnclosedArray() + public void testUnclosedArray() throws Exception { for (int mode : ALL_MODES) { _testUnclosedArray(mode); } } - public void _testUnclosedArray(int mode) + public void _testUnclosedArray(int mode) throws Exception { JsonParser p = createParser(mode, "[ 1, 2 "); assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -27,43 +30,41 @@ public void _testUnclosedArray(int mode) try { p.nextToken(); fail("Expected an exception for unclosed ARRAY (mode: "+mode+")"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "expected close marker for ARRAY"); } - p.close(); } - public void testUnclosedObject() + public void testUnclosedObject() throws Exception { for (int mode : ALL_MODES) { _testUnclosedObject(mode); } } - private void _testUnclosedObject(int mode) + private void _testUnclosedObject(int mode) throws Exception { JsonParser p = createParser(mode, "{ \"key\" : 3 "); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); try { p.nextToken(); fail("Expected an exception for unclosed OBJECT (mode: "+mode+")"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "expected close marker for OBJECT"); } - p.close(); } - public void testEOFInName() + public void testEOFInName() throws Exception { for (int mode : ALL_MODES) { _testEOFInName(mode); } } - public void _testEOFInName(int mode) + public void _testEOFInName(int mode) throws Exception { final String JSON = "{ \"abcd"; JsonParser p = createParser(mode, JSON); @@ -71,27 +72,25 @@ public void _testEOFInName(int mode) try { p.nextToken(); fail("Expected an exception for EOF"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "Unexpected end-of-input"); - } catch (JacksonException ie) { + } catch (IOException ie) { // DataInput behaves bit differently if (mode == MODE_DATA_INPUT) { verifyException(ie, "end-of-input"); return; } - fail("Should not end up in here"); } - p.close(); } - public void testWeirdToken() + public void testWeirdToken() throws Exception { for (int mode : ALL_MODES) { _testWeirdToken(mode); } } - private void _testWeirdToken(int mode) + private void _testWeirdToken(int mode) throws Exception { final String JSON = "[ nil ]"; JsonParser p = createParser(mode, JSON); @@ -99,20 +98,20 @@ private void _testWeirdToken(int mode) try { p.nextToken(); fail("Expected an exception for weird token"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "Unrecognized token"); } p.close(); } - public void testMismatchArrayToObject() + public void testMismatchArrayToObject() throws Exception { for (int mode : ALL_MODES) { _testMismatchArrayToObject(mode); } } - private void _testMismatchArrayToObject(int mode) + private void _testMismatchArrayToObject(int mode) throws Exception { final String JSON = "[ 1, 2 }"; JsonParser p = createParser(mode, JSON); @@ -122,20 +121,20 @@ private void _testMismatchArrayToObject(int mode) try { p.nextToken(); fail("Expected an exception for incorrectly closed ARRAY"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "Unexpected close marker '}': expected ']'"); } p.close(); } - public void testMismatchObjectToArray() + public void testMismatchObjectToArray() throws Exception { for (int mode : ALL_MODES) { _testMismatchObjectToArray(mode); } } - private void _testMismatchObjectToArray(int mode) + private void _testMismatchObjectToArray(int mode) throws Exception { final String JSON = "{ ]"; JsonParser p = createParser(mode, JSON); @@ -145,20 +144,20 @@ private void _testMismatchObjectToArray(int mode) try { p.nextToken(); fail("Expected an exception for incorrectly closed OBJECT"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "Unexpected close marker ']': expected '}'"); } p.close(); } - public void testMisssingColon() + public void testMisssingColon() throws Exception { for (int mode : ALL_MODES) { _testMisssingColon(mode); } } - private void _testMisssingColon(int mode) + private void _testMisssingColon(int mode) throws Exception { final String JSON = "{ \"a\" \"b\" }"; JsonParser p = createParser(mode, JSON); @@ -166,10 +165,10 @@ private void _testMisssingColon(int mode) assertToken(JsonToken.START_OBJECT, p.nextToken()); try { // can be either here, or with next one... - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); p.nextToken(); fail("Expected an exception for missing semicolon"); - } catch (StreamReadException pe) { + } catch (JsonParseException pe) { verifyException(pe, "was expecting a colon"); } p.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/read/ParserSequenceTest.java b/src/test/java/com/fasterxml/jackson/core/read/ParserSequenceTest.java index ec10156cc6..23d7f412cc 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/ParserSequenceTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ParserSequenceTest.java @@ -9,8 +9,8 @@ public class ParserSequenceTest { public void testSimple() throws Exception { - JsonParser p1 = JSON_FACTORY.createParser(ObjectReadContext.empty(), "[ 1 ]"); - JsonParser p2 = JSON_FACTORY.createParser(ObjectReadContext.empty(), "[ 2 ]"); + JsonParser p1 = JSON_FACTORY.createParser("[ 1 ]"); + JsonParser p2 = JSON_FACTORY.createParser("[ 2 ]"); JsonParserSequence seq = JsonParserSequence.createFlattened(false, p1, p2); assertEquals(2, seq.containedParsersCount()); @@ -48,9 +48,9 @@ public void testSimple() throws Exception public void testMultiLevel() throws Exception { - JsonParser p1 = JSON_FACTORY.createParser(ObjectReadContext.empty(), "[ 1 ] "); - JsonParser p2 = JSON_FACTORY.createParser(ObjectReadContext.empty(), " 5"); - JsonParser p3 = JSON_FACTORY.createParser(ObjectReadContext.empty(), " { } "); + JsonParser p1 = JSON_FACTORY.createParser("[ 1 ] "); + JsonParser p2 = JSON_FACTORY.createParser(" 5"); + JsonParser p3 = JSON_FACTORY.createParser(" { } "); JsonParserSequence seq1 = JsonParserSequence.createFlattened(true, p1, p2); JsonParserSequence seq = JsonParserSequence.createFlattened(false, seq1, p3); assertEquals(3, seq.containedParsersCount()); @@ -76,8 +76,8 @@ public void testInitializationDisabled() throws Exception { // // First, with old legacy settings - JsonParser p1 = JSON_FACTORY.createParser(ObjectReadContext.empty(), "1 2"); - JsonParser p2 = JSON_FACTORY.createParser(ObjectReadContext.empty(), "3 true"); + JsonParser p1 = JSON_FACTORY.createParser("1 2"); + JsonParser p2 = JSON_FACTORY.createParser("3 true"); assertToken(JsonToken.VALUE_NUMBER_INT, p1.nextToken()); assertEquals(1, p1.getIntValue()); assertToken(JsonToken.VALUE_NUMBER_INT, p2.nextToken()); @@ -97,8 +97,8 @@ public void testInitializationDisabled() throws Exception public void testInitializationEnabled() throws Exception { // // and then with new "check for current": - JsonParser p1 = JSON_FACTORY.createParser(ObjectReadContext.empty(), "1 2"); - JsonParser p2 = JSON_FACTORY.createParser(ObjectReadContext.empty(), "3 true"); + JsonParser p1 = JSON_FACTORY.createParser("1 2"); + JsonParser p2 = JSON_FACTORY.createParser("3 true"); assertToken(JsonToken.VALUE_NUMBER_INT, p1.nextToken()); assertEquals(1, p1.getIntValue()); assertToken(JsonToken.VALUE_NUMBER_INT, p2.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/ParserSymbolHandlingTest.java b/src/test/java/com/fasterxml/jackson/core/read/ParserSymbolHandlingTest.java index ee400b46db..e2cab9e0d5 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/ParserSymbolHandlingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ParserSymbolHandlingTest.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; public class ParserSymbolHandlingTest extends com.fasterxml.jackson.core.BaseTest @@ -24,21 +23,21 @@ public void testSymbolsWithNullChars() throws Exception { private void _testSymbolsWithNull(JsonFactory f, boolean useBytes) throws Exception { final String INPUT = "{\"\\u0000abc\" : 1, \"abc\":2}"; - JsonParser parser = useBytes ? f.createParser(ObjectReadContext.empty(), INPUT.getBytes("UTF-8")) - : f.createParser(ObjectReadContext.empty(), INPUT); + JsonParser parser = useBytes ? f.createParser(INPUT.getBytes("UTF-8")) + : f.createParser(INPUT); assertToken(JsonToken.START_OBJECT, parser.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); - String currName = parser.currentName(); + assertToken(JsonToken.FIELD_NAME, parser.nextToken()); + String currName = parser.getCurrentName(); if (!"\u0000abc".equals(currName)) { fail("Expected \\0abc (4 bytes), '"+currName+"' ("+currName.length()+")"); } assertToken(JsonToken.VALUE_NUMBER_INT, parser.nextToken()); assertEquals(1, parser.getIntValue()); - assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); - currName = parser.currentName(); + assertToken(JsonToken.FIELD_NAME, parser.nextToken()); + currName = parser.getCurrentName(); if (!"abc".equals(currName)) { /* for (int i = 0; i < currName.length(); ++i) { diff --git a/src/test/java/com/fasterxml/jackson/core/read/ParserWithObjectsTest.java b/src/test/java/com/fasterxml/jackson/core/read/ParserWithObjectsTest.java index 63af443ecd..ede9765d3f 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/ParserWithObjectsTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/ParserWithObjectsTest.java @@ -3,7 +3,6 @@ import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; /** * Unit tests for verifying that object mapping functionality can @@ -87,7 +86,7 @@ private void _testNextValueBasic(boolean useStream) throws IOException assertToken(JsonToken.START_OBJECT, jp.nextValue()); for (int i = 3; i <= 5; ++i) { assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextValue()); - assertEquals(String.valueOf(i), jp.currentName()); + assertEquals(String.valueOf(i), jp.getCurrentName()); assertEquals(i, jp.getIntValue()); } assertToken(JsonToken.END_OBJECT, jp.nextValue()); @@ -104,7 +103,7 @@ private void _testNextValueBasic(boolean useStream) throws IOException assertToken(JsonToken.START_OBJECT, jp.nextValue()); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextValue()); - assertEquals("a", jp.currentName()); + assertEquals("a", jp.getCurrentName()); assertToken(JsonToken.END_OBJECT, jp.nextValue()); assertToken(JsonToken.END_ARRAY, jp.nextValue()); @@ -122,21 +121,21 @@ private void _testNextValueNested(boolean useStream) throws IOException jp = _getParser("{\"a\": { \"b\" : true, \"c\": false }, \"d\": 3 }", useStream); assertToken(JsonToken.START_OBJECT, jp.nextValue()); - assertNull(jp.currentName()); + assertNull(jp.getCurrentName()); assertToken(JsonToken.START_OBJECT, jp.nextValue()); - assertEquals("a", jp.currentName()); + assertEquals("a", jp.getCurrentName()); assertToken(JsonToken.VALUE_TRUE, jp.nextValue()); - assertEquals("b", jp.currentName()); + assertEquals("b", jp.getCurrentName()); assertToken(JsonToken.VALUE_FALSE, jp.nextValue()); - assertEquals("c", jp.currentName()); + assertEquals("c", jp.getCurrentName()); assertToken(JsonToken.END_OBJECT, jp.nextValue()); // ideally we should match closing marker with field, too: - assertEquals("a", jp.currentName()); + assertEquals("a", jp.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextValue()); - assertEquals("d", jp.currentName()); + assertEquals("d", jp.getCurrentName()); assertToken(JsonToken.END_OBJECT, jp.nextValue()); - assertNull(jp.currentName()); + assertNull(jp.getCurrentName()); assertNull(jp.nextValue()); jp.close(); @@ -144,16 +143,16 @@ private void _testNextValueNested(boolean useStream) throws IOException jp = _getParser("{\"a\": [ false ] }", useStream); assertToken(JsonToken.START_OBJECT, jp.nextValue()); - assertNull(jp.currentName()); + assertNull(jp.getCurrentName()); assertToken(JsonToken.START_ARRAY, jp.nextValue()); - assertEquals("a", jp.currentName()); + assertEquals("a", jp.getCurrentName()); assertToken(JsonToken.VALUE_FALSE, jp.nextValue()); - assertNull(jp.currentName()); + assertNull(jp.getCurrentName()); assertToken(JsonToken.END_ARRAY, jp.nextValue()); // ideally we should match closing marker with field, too: - assertEquals("a", jp.currentName()); + assertEquals("a", jp.getCurrentName()); assertToken(JsonToken.END_OBJECT, jp.nextValue()); - assertNull(jp.currentName()); + assertNull(jp.getCurrentName()); assertNull(jp.nextValue()); jp.close(); } @@ -163,8 +162,8 @@ private JsonParser _getParser(String doc, boolean useStream) { JsonFactory jf = new JsonFactory(); if (useStream) { - return jf.createParser(ObjectReadContext.empty(), doc.getBytes("UTF-8")); + return jf.createParser(doc.getBytes("UTF-8")); } - return jf.createParser(ObjectReadContext.empty(), new StringReader(doc)); + return jf.createParser(new StringReader(doc)); } } diff --git a/src/test/java/com/fasterxml/jackson/core/read/SimpleParserTest.java b/src/test/java/com/fasterxml/jackson/core/read/SimpleParserTest.java index eebda75ad6..baffb22fe3 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/SimpleParserTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/SimpleParserTest.java @@ -1,14 +1,11 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.MockDataInput; import com.fasterxml.jackson.core.util.JsonParserDelegate; import java.io.*; import java.net.URL; -import java.nio.charset.StandardCharsets; import java.util.*; /** @@ -18,53 +15,62 @@ @SuppressWarnings("resource") public class SimpleParserTest extends BaseTest { - public void testInputSourceAccess() + public void testConfig() throws Exception { JsonParser p = createParser(MODE_READER, "[ ]"); - Object src = p.streamReadInputSource(); + Object src = p.getInputSource(); assertNotNull(src); assertTrue(src instanceof Reader); + p.enable(JsonParser.Feature.AUTO_CLOSE_SOURCE); + assertTrue(p.isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)); + p.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE); + assertFalse(p.isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)); + + p.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, true); + assertTrue(p.isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)); + p.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false); + assertFalse(p.isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)); p.close(); p = createParser(MODE_INPUT_STREAM, "[ ]"); - src = p.streamReadInputSource(); + src = p.getInputSource(); assertNotNull(src); assertTrue(src instanceof InputStream); p.close(); p = createParser(MODE_DATA_INPUT, "[ ]"); - src = p.streamReadInputSource(); + src = p.getInputSource(); assertNotNull(src); assertTrue(src instanceof DataInput); p.close(); } - public void testInterningWithStreams() + public void testInterningWithStreams() throws Exception { _testIntern(true, true, "a"); _testIntern(true, false, "b"); } - public void testInterningWithReaders() + public void testInterningWithReaders() throws Exception { _testIntern(false, true, "c"); _testIntern(false, false, "d"); } - private void _testIntern(boolean useStream, boolean enableIntern, String expName) + private void _testIntern(boolean useStream, boolean enableIntern, String expName) throws IOException { JsonFactory f = JsonFactory.builder() - .configure(JsonFactory.Feature.INTERN_PROPERTY_NAMES, enableIntern) + .configure(JsonFactory.Feature.INTERN_FIELD_NAMES, enableIntern) .build(); - assertEquals(enableIntern, f.isEnabled(JsonFactory.Feature.INTERN_PROPERTY_NAMES)); + assertEquals(enableIntern, f.isEnabled(JsonFactory.Feature.INTERN_FIELD_NAMES)); final String JSON = "{ \""+expName+"\" : 1}"; JsonParser p = useStream ? createParserUsingStream(f, JSON, "UTF-8") : createParserUsingReader(f, JSON); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // needs to be same of cours - String actName = p.currentName(); + String actName = p.getCurrentName(); assertEquals(expName, actName); if (enableIntern) { assertSame(expName, actName); @@ -79,7 +85,7 @@ private void _testIntern(boolean useStream, boolean enableIntern, String expName * specification (RFC-4627 or later) is properly parsed at * high-level, without verifying values. */ - public void testSpecExampleSkipping() + public void testSpecExampleSkipping() throws Exception { _doTestSpec(false); } @@ -89,7 +95,7 @@ public void testSpecExampleSkipping() * parsed, and proper values are given for contents of all * events/tokens. */ - public void testSpecExampleFully() + public void testSpecExampleFully() throws Exception { _doTestSpec(true); } @@ -98,7 +104,7 @@ public void testSpecExampleFully() * Unit test that verifies that 3 basic keywords (null, true, false) * are properly parsed in various contexts. */ - public void testKeywords() + public void testKeywords() throws Exception { final String DOC = "{\n" +"\"key1\" : null,\n" @@ -121,9 +127,9 @@ public void testKeywords() p.close(); } - private void _testKeywords(JsonParser p, boolean checkColumn) + private void _testKeywords(JsonParser p, boolean checkColumn) throws Exception { - TokenStreamContext ctxt = p.streamReadContext(); + JsonStreamContext ctxt = p.getParsingContext(); assertEquals("/", ctxt.toString()); assertTrue(ctxt.inRoot()); assertFalse(ctxt.inArray()); @@ -143,62 +149,62 @@ private void _testKeywords(JsonParser p, boolean checkColumn) assertEquals("/", ctxt.toString()); assertTrue(p.hasCurrentToken()); - JsonLocation loc = p.currentTokenLocation(); + JsonLocation loc = p.getTokenLocation(); assertNotNull(loc); assertEquals(1, loc.getLineNr()); if (checkColumn) { assertEquals(1, loc.getColumnNr()); } - ctxt = p.streamReadContext(); + ctxt = p.getParsingContext(); assertFalse(ctxt.inRoot()); assertFalse(ctxt.inArray()); assertTrue(ctxt.inObject()); assertEquals(0, ctxt.getEntryCount()); assertEquals(0, ctxt.getCurrentIndex()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); verifyFieldName(p, "key1"); assertEquals("{\"key1\"}", ctxt.toString()); - assertEquals(2, p.currentTokenLocation().getLineNr()); + assertEquals(2, p.getTokenLocation().getLineNr()); - ctxt = p.streamReadContext(); + ctxt = p.getParsingContext(); assertFalse(ctxt.inRoot()); assertFalse(ctxt.inArray()); assertTrue(ctxt.inObject()); assertEquals(1, ctxt.getEntryCount()); assertEquals(0, ctxt.getCurrentIndex()); - assertEquals("key1", ctxt.currentName()); + assertEquals("key1", ctxt.getCurrentName()); assertToken(JsonToken.VALUE_NULL, p.nextToken()); - assertEquals("key1", ctxt.currentName()); + assertEquals("key1", ctxt.getCurrentName()); - ctxt = p.streamReadContext(); + ctxt = p.getParsingContext(); assertEquals(1, ctxt.getEntryCount()); assertEquals(0, ctxt.getCurrentIndex()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); verifyFieldName(p, "key2"); - ctxt = p.streamReadContext(); + ctxt = p.getParsingContext(); assertEquals(2, ctxt.getEntryCount()); assertEquals(1, ctxt.getCurrentIndex()); - assertEquals("key2", ctxt.currentName()); + assertEquals("key2", ctxt.getCurrentName()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertEquals("key2", ctxt.currentName()); + assertEquals("key2", ctxt.getCurrentName()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); verifyFieldName(p, "key3"); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); verifyFieldName(p, "key4"); assertToken(JsonToken.START_ARRAY, p.nextToken()); - ctxt = p.streamReadContext(); + ctxt = p.getParsingContext(); assertTrue(ctxt.inArray()); - assertNull(ctxt.currentName()); - assertEquals("key4", ctxt.getParent().currentName()); + assertNull(ctxt.getCurrentName()); + assertEquals("key4", ctxt.getParent().getCurrentName()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); assertEquals("[0]", ctxt.toString()); @@ -207,23 +213,23 @@ private void _testKeywords(JsonParser p, boolean checkColumn) assertToken(JsonToken.VALUE_TRUE, p.nextToken()); assertToken(JsonToken.END_ARRAY, p.nextToken()); - ctxt = p.streamReadContext(); + ctxt = p.getParsingContext(); assertTrue(ctxt.inObject()); assertToken(JsonToken.END_OBJECT, p.nextToken()); - ctxt = p.streamReadContext(); + ctxt = p.getParsingContext(); assertTrue(ctxt.inRoot()); - assertNull(ctxt.currentName()); + assertNull(ctxt.getCurrentName()); } - public void testSkipping() { + public void testSkipping() throws Exception { _testSkipping(MODE_INPUT_STREAM); _testSkipping(MODE_INPUT_STREAM_THROTTLED); _testSkipping(MODE_READER); _testSkipping(MODE_DATA_INPUT); } - private void _testSkipping(int mode) + private void _testSkipping(int mode) throws Exception { // InputData has some limitations to take into consideration boolean isInputData = (mode == MODE_DATA_INPUT); @@ -278,14 +284,14 @@ private void _testSkipping(int mode) p.close(); } - public void testNameEscaping() + public void testNameEscaping() throws IOException { _testNameEscaping(MODE_INPUT_STREAM); _testNameEscaping(MODE_READER); _testNameEscaping(MODE_DATA_INPUT); } - private void _testNameEscaping(int mode) + private void _testNameEscaping(int mode) throws IOException { final Map NAME_MAP = new LinkedHashMap(); NAME_MAP.put("", ""); @@ -308,9 +314,9 @@ private void _testNameEscaping(int mode) JsonParser p = createParser(mode, DOC); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); // first, sanity check (field name == getText() - String act = p.currentName(); + String act = p.getCurrentName(); assertEquals(act, getAndVerifyText(p)); if (!expResult.equals(act)) { String msg = "Failed for name #"+entry+"/"+NAME_MAP.size(); @@ -330,7 +336,7 @@ private void _testNameEscaping(int mode) * correctly; mostly to stress-test underlying segment-based * text buffer(s). */ - public void testLongText() { + public void testLongText() throws Exception { // lengths chosen to tease out problems with buffer allocation... _testLongText(310); _testLongText(7700); @@ -338,7 +344,7 @@ public void testLongText() { _testLongText(96000); } - private void _testLongText(int LEN) + private void _testLongText(int LEN) throws Exception { StringBuilder sb = new StringBuilder(LEN + 100); Random r = new Random(LEN); @@ -367,9 +373,9 @@ private void _testLongText(int LEN) // Let's use real generator to get JSON done right StringWriter sw = new StringWriter(LEN + (LEN >> 2)); - JsonGenerator g = JSON_FACTORY.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator g = JSON_FACTORY.createGenerator(sw); g.writeStartObject(); - g.writeName("doc"); + g.writeFieldName("doc"); g.writeString(VALUE); g.writeEndObject(); g.close(); @@ -385,11 +391,11 @@ private void _testLongText(int LEN) p = createParser(type, DOC); break; default: - p = JSON_FACTORY.createParser(ObjectReadContext.empty(), encodeInUTF32BE(DOC)); + p = JSON_FACTORY.createParser(encodeInUTF32BE(DOC)); } assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("doc", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("doc", p.getCurrentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); String act = getAndVerifyText(p); @@ -401,7 +407,7 @@ private void _testLongText(int LEN) } // should still know the field name - assertEquals("doc", p.currentName()); + assertEquals("doc", p.getCurrentName()); assertToken(JsonToken.END_OBJECT, p.nextToken()); // InputDate somewhat special, so: @@ -416,17 +422,17 @@ private void _testLongText(int LEN) * Simple unit test that verifies that passing in a byte array * as source works as expected. */ - public void testBytesAsSource() + public void testBytesAsSource() throws Exception { String JSON = "[ 1, 2, 3, 4 ]"; - byte[] b = utf8Bytes(JSON); + byte[] b = JSON.getBytes("UTF-8"); int offset = 50; int len = b.length; byte[] src = new byte[offset + len + offset]; System.arraycopy(b, 0, src, offset, len); - JsonParser p = JSON_FACTORY.createParser(ObjectReadContext.empty(), src, offset, len); + JsonParser p = JSON_FACTORY.createParser(src, offset, len); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); @@ -443,32 +449,31 @@ public void testBytesAsSource() p.close(); } - public void testUtf8BOMHandling() throws IOException + public void testUtf8BOMHandling() throws Exception { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); // first, write BOM: bytes.write(0xEF); bytes.write(0xBB); bytes.write(0xBF); - bytes.write(utf8Bytes("[ 1 ]")); + bytes.write("[ 1 ]".getBytes("UTF-8")); byte[] input = bytes.toByteArray(); - JsonParser p = JSON_FACTORY.createParser(ObjectReadContext.empty(), input); + JsonParser p = JSON_FACTORY.createParser(input); assertEquals(JsonToken.START_ARRAY, p.nextToken()); - JsonLocation loc = p.currentTokenLocation(); + JsonLocation loc = p.getTokenLocation(); assertEquals(3, loc.getByteOffset()); assertEquals(-1, loc.getCharOffset()); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(JsonToken.END_ARRAY, p.nextToken()); p.close(); - p = JSON_FACTORY.createParser(ObjectReadContext.empty(), - new MockDataInput(input)); + p = JSON_FACTORY.createParser(new MockDataInput(input)); assertEquals(JsonToken.START_ARRAY, p.nextToken()); // same BOM, but DataInput is more restrictive so can skip but offsets // are not reliable... - loc = p.currentTokenLocation(); + loc = p.getTokenLocation(); assertNotNull(loc); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(JsonToken.END_ARRAY, p.nextToken()); @@ -476,7 +481,7 @@ public void testUtf8BOMHandling() throws IOException } // [core#48] - public void testSpacesInURL() throws IOException + public void testSpacesInURL() throws Exception { File f = File.createTempFile("pre fix&stuff", ".txt"); BufferedWriter w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f), "UTF-8")); @@ -484,31 +489,31 @@ public void testSpacesInURL() throws IOException w.close(); URL url = f.toURI().toURL(); - JsonParser p = JSON_FACTORY.createParser(ObjectReadContext.empty(), url); + JsonParser p = JSON_FACTORY.createParser(url); assertToken(JsonToken.START_OBJECT, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); p.close(); } - public void testGetValueAsTextBytes() + public void testGetValueAsTextBytes() throws Exception { _testGetValueAsText(MODE_INPUT_STREAM, false); _testGetValueAsText(MODE_INPUT_STREAM, true); } - public void testGetValueAsTextDataInput() + public void testGetValueAsTextDataInput() throws Exception { _testGetValueAsText(MODE_DATA_INPUT, false); _testGetValueAsText(MODE_DATA_INPUT, true); } - public void testGetValueAsTextChars() + public void testGetValueAsTextChars() throws Exception { _testGetValueAsText(MODE_READER, false); _testGetValueAsText(MODE_READER, true); } - private void _testGetValueAsText(int mode, boolean delegate) + private void _testGetValueAsText(int mode, boolean delegate) throws Exception { String JSON = "{\"a\":1,\"b\":true,\"c\":null,\"d\":\"foo\"}"; JsonParser p = createParser(mode, JSON); @@ -520,26 +525,26 @@ private void _testGetValueAsText(int mode, boolean delegate) assertNull(p.getValueAsString()); assertEquals("foobar", p.getValueAsString("foobar")); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.getText()); assertEquals("a", p.getValueAsString()); assertEquals("a", p.getValueAsString("default")); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals("1", p.getValueAsString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.getValueAsString()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); assertEquals("true", p.getValueAsString()); assertEquals("true", p.getValueAsString("foobar")); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("c", p.getValueAsString()); assertToken(JsonToken.VALUE_NULL, p.nextToken()); // null token returned as Java null, as per javadoc assertNull(p.getValueAsString()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("d", p.getValueAsString()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("foo", p.getValueAsString("default")); @@ -555,41 +560,41 @@ private void _testGetValueAsText(int mode, boolean delegate) p.close(); } - public void testGetTextViaWriter() + public void testGetTextViaWriter() throws Exception { for (int mode : ALL_MODES) { _testGetTextViaWriter(mode); } } - private void _testGetTextViaWriter(int mode) + private void _testGetTextViaWriter(int mode) throws Exception { final String INPUT_TEXT = "this is a sample text for json parsing using readText() method"; final String JSON = "{\"a\":\""+INPUT_TEXT+"\",\"b\":true,\"c\":null,\"d\":\"foobar!\"}"; JsonParser parser = createParser(mode, JSON); assertToken(JsonToken.START_OBJECT, parser.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); - assertEquals("a", parser.currentName()); + assertToken(JsonToken.FIELD_NAME, parser.nextToken()); + assertEquals("a", parser.getCurrentName()); _getAndVerifyText(parser, "a"); assertToken(JsonToken.VALUE_STRING, parser.nextToken()); _getAndVerifyText(parser, INPUT_TEXT); - assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); - assertEquals("b", parser.currentName()); + assertToken(JsonToken.FIELD_NAME, parser.nextToken()); + assertEquals("b", parser.getCurrentName()); assertToken(JsonToken.VALUE_TRUE, parser.nextToken()); _getAndVerifyText(parser, "true"); - assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); - assertEquals("c", parser.currentName()); + assertToken(JsonToken.FIELD_NAME, parser.nextToken()); + assertEquals("c", parser.getCurrentName()); assertToken(JsonToken.VALUE_NULL, parser.nextToken()); _getAndVerifyText(parser, "null"); - assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); - assertEquals("d", parser.currentName()); + assertToken(JsonToken.FIELD_NAME, parser.nextToken()); + assertEquals("d", parser.getCurrentName()); assertToken(JsonToken.VALUE_STRING, parser.nextToken()); _getAndVerifyText(parser, "foobar!"); parser.close(); } - private void _getAndVerifyText(JsonParser p, String exp) + private void _getAndVerifyText(JsonParser p, String exp) throws Exception { Writer writer = new StringWriter(); int len = p.getText(writer); @@ -605,7 +610,7 @@ public void testLongerReadText() throws Exception } } - private void _testLongerReadText(int mode) + private void _testLongerReadText(int mode) throws Exception { StringBuilder builder = new StringBuilder(); for(int i= 0; i < 1000; i++) { @@ -615,8 +620,8 @@ private void _testLongerReadText(int mode) final String JSON = "{\"a\":\""+ longText +"\",\"b\":true,\"c\":null,\"d\":\"foo\"}"; JsonParser parser = createParser(MODE_READER, JSON); assertToken(JsonToken.START_OBJECT, parser.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); - assertEquals("a", parser.currentName()); + assertToken(JsonToken.FIELD_NAME, parser.nextToken()); + assertEquals("a", parser.getCurrentName()); assertToken(JsonToken.VALUE_STRING, parser.nextToken()); Writer writer = new StringWriter(); @@ -634,23 +639,23 @@ private void _testLongerReadText(int mode) */ // [core#142] - public void testHandlingOfInvalidSpaceByteStream() { + public void testHandlingOfInvalidSpaceByteStream() throws Exception { _testHandlingOfInvalidSpace(MODE_INPUT_STREAM); _testHandlingOfInvalidSpaceFromResource(true); } // [core#142] - public void testHandlingOfInvalidSpaceChars() { + public void testHandlingOfInvalidSpaceChars() throws Exception { _testHandlingOfInvalidSpace(MODE_READER); _testHandlingOfInvalidSpaceFromResource(false); } // [core#142] - public void testHandlingOfInvalidSpaceDataInput() { + public void testHandlingOfInvalidSpaceDataInput() throws Exception { _testHandlingOfInvalidSpace(MODE_DATA_INPUT); } - - private void _testHandlingOfInvalidSpace(int mode) + + private void _testHandlingOfInvalidSpace(int mode) throws Exception { final String JSON = "{ \u00A0 \"a\":1}"; @@ -659,7 +664,7 @@ private void _testHandlingOfInvalidSpace(int mode) try { p.nextToken(); fail("Should have failed"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "unexpected character"); // and correct error code verifyException(e, "code 160"); @@ -667,31 +672,30 @@ private void _testHandlingOfInvalidSpace(int mode) p.close(); } - private void _testHandlingOfInvalidSpaceFromResource(boolean useStream) + private void _testHandlingOfInvalidSpaceFromResource(boolean useStream) throws Exception { InputStream in = getClass().getResourceAsStream("/test_0xA0.json"); JsonParser p = useStream - ? JSON_FACTORY.createParser(ObjectReadContext.empty(), in) - : JSON_FACTORY.createParser(ObjectReadContext.empty(), - new InputStreamReader(in, StandardCharsets.UTF_8)); + ? JSON_FACTORY.createParser(in) + : JSON_FACTORY.createParser(new InputStreamReader(in, "UTF-8")); assertToken(JsonToken.START_OBJECT, p.nextToken()); try { - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("request", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("request", p.getCurrentName()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("mac", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("mac", p.getCurrentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertNotNull(p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("data", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("data", p.getCurrentName()); assertToken(JsonToken.START_OBJECT, p.nextToken()); // ... and from there on, just loop while (p.nextToken() != null) { } fail("Should have failed"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "unexpected character"); // and correct error code verifyException(e, "code 160"); @@ -705,7 +709,7 @@ private void _testHandlingOfInvalidSpaceFromResource(boolean useStream) /********************************************************** */ - private void _doTestSpec(boolean verify) + private void _doTestSpec(boolean verify) throws IOException { JsonParser p; diff --git a/src/test/java/com/fasterxml/jackson/core/read/TrailingCommas616Test.java b/src/test/java/com/fasterxml/jackson/core/read/TrailingCommas616Test.java index 22d4e7fabb..69c9d5d03d 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/TrailingCommas616Test.java +++ b/src/test/java/com/fasterxml/jackson/core/read/TrailingCommas616Test.java @@ -1,8 +1,6 @@ package com.fasterxml.jackson.core.read; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.JsonReadFeature; public class TrailingCommas616Test extends BaseTest @@ -12,29 +10,29 @@ public class TrailingCommas616Test extends BaseTest .build(); // [core#616] - public void testRootLevelComma616() + public void testRootLevelComma616() throws Exception { _testRootLevel616(MODE_READER); } - public void testRootLevelComma616Bytes() + public void testRootLevelComma616Bytes() throws Exception { _testRootLevel616(MODE_INPUT_STREAM); _testRootLevel616(MODE_INPUT_STREAM_THROTTLED); } - public void testRootLevelComma616DataInput() + public void testRootLevelComma616DataInput() throws Exception { _testRootLevel616(MODE_DATA_INPUT); } - private void _testRootLevel616(int mode) + private void _testRootLevel616(int mode) throws Exception { JsonParser p = createParser(JSON_F_ALLOW_MISSING, mode, ","); try { p.nextToken(); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Unexpected character (','"); } p.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/read/TrailingCommasTest.java b/src/test/java/com/fasterxml/jackson/core/read/TrailingCommasTest.java index e2299faecc..ea0429e9a9 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/TrailingCommasTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/TrailingCommasTest.java @@ -5,8 +5,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.SerializedString; -import com.fasterxml.jackson.core.json.JsonFactory; -import com.fasterxml.jackson.core.json.JsonFactoryBuilder; import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.json.UTF8DataInputJsonParser; @@ -23,13 +21,13 @@ public class TrailingCommasTest extends BaseTest { private final int mode; public TrailingCommasTest(int mode, List features) { - this.features = new HashSet(features); - JsonFactoryBuilder b = JsonFactory.builder(); - for (JsonReadFeature feature : features) { - b = b.enable(feature); - } - this.factory = b.build(); - this.mode = mode; + this.features = new HashSet(features); + JsonFactoryBuilder b = (JsonFactoryBuilder) JsonFactory.builder(); + for (JsonReadFeature feature : features) { + b = b.enable(feature); + } + factory = b.build(); + this.mode = mode; } @Parameterized.Parameters(name = "Mode {0}, Features {1}") @@ -216,11 +214,11 @@ public void testObjectBasic() throws Exception { assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.getText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.getText()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); @@ -237,7 +235,7 @@ public void testObjectInnerComma() throws Exception { assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.getText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); @@ -265,11 +263,11 @@ public void testObjectTrailingComma() throws Exception { assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.getText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.getText()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); @@ -289,19 +287,19 @@ public void testObjectTrailingCommaWithNextFieldName() throws Exception { JsonParser p = createParser(factory, mode, json); assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals("a", p.nextName()); + assertEquals("a", p.nextFieldName()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertEquals("b", p.nextName()); + assertEquals("b", p.nextFieldName()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); if (features.contains(JsonReadFeature.ALLOW_TRAILING_COMMA)) { - assertEquals(null, p.nextName()); + assertEquals(null, p.nextFieldName()); assertToken(JsonToken.END_OBJECT, p.currentToken()); assertEnd(p); } else { try { - p.nextName(); + p.nextFieldName(); fail("No exception thrown"); } catch (Exception e) { verifyException(e, "Unexpected character ('}' (code 125))"); @@ -318,19 +316,19 @@ public void testObjectTrailingCommaWithNextFieldNameStr() throws Exception { assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertTrue(p.nextName(new SerializedString("a"))); + assertTrue(p.nextFieldName(new SerializedString("a"))); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertTrue(p.nextName(new SerializedString("b"))); + assertTrue(p.nextFieldName(new SerializedString("b"))); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); if (features.contains(JsonReadFeature.ALLOW_TRAILING_COMMA)) { - assertFalse(p.nextName(new SerializedString("c"))); + assertFalse(p.nextFieldName(new SerializedString("c"))); assertToken(JsonToken.END_OBJECT, p.currentToken()); assertEnd(p); } else { try { - p.nextName(new SerializedString("c")); + p.nextFieldName(new SerializedString("c")); fail("No exception thrown"); } catch (Exception e) { verifyException(e, "Unexpected character ('}' (code 125))"); @@ -347,11 +345,11 @@ public void testObjectTrailingCommas() throws Exception { assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a", p.getText()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("b", p.getText()); assertToken(JsonToken.VALUE_FALSE, p.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/read/UTF32ParseTest.java b/src/test/java/com/fasterxml/jackson/core/read/UTF32ParseTest.java index 95e1cf3880..73aca755e1 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/UTF32ParseTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/UTF32ParseTest.java @@ -1,13 +1,13 @@ package com.fasterxml.jackson.core.read; +import java.io.CharConversionException; + import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; // Tests from [jackson-core#382] public class UTF32ParseTest extends BaseTest { - private final JsonFactory FACTORY = newStreamFactory(); + private final JsonFactory FACTORY = new JsonFactory(); public void testSimpleEOFs() throws Exception { @@ -17,11 +17,11 @@ public void testSimpleEOFs() throws Exception }; for (int len = 5; len <= 7; ++len) { - JsonParser parser = FACTORY.createParser(ObjectReadContext.empty(), data, 0, len); + JsonParser parser = FACTORY.createParser(data, 0, len); try { parser.nextToken(); fail("Should not pass"); - } catch (JacksonException e) { + } catch (CharConversionException e) { verifyException(e, "Unexpected EOF"); verifyException(e, "of a 4-byte UTF-32 char"); } @@ -29,7 +29,7 @@ public void testSimpleEOFs() throws Exception } } - public void testSimpleInvalidUTF32() + public void testSimpleInvalidUTF32() throws Exception { // 2 characters, space, then something beyond valid Unicode set byte[] data = { @@ -43,25 +43,24 @@ public void testSimpleInvalidUTF32() 0x01 }; - JsonParser parser = FACTORY.createParser(ObjectReadContext.empty(), data); + JsonParser parser = FACTORY.createParser(data); try { parser.nextToken(); fail("Should not pass"); - } catch (JacksonException e) { + } catch (CharConversionException e) { verifyException(e, "Invalid UTF-32 character 0xfefe0001"); } parser.close(); } - public void testSimpleSevenNullBytes() - { + public void testSimpleSevenNullBytes() throws Exception { byte[] data = new byte[7]; - JsonParser parser = FACTORY.createParser(ObjectReadContext.empty(), data); + JsonParser parser = FACTORY.createParser(/*ObjectReadContext.empty(), */data); try { parser.nextToken(); fail("Should not pass"); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "Illegal character ((CTRL-CHAR, code 0))"); } parser.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/read/UTF8NamesParseTest.java b/src/test/java/com/fasterxml/jackson/core/read/UTF8NamesParseTest.java index 06e6666854..80fd643c46 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/UTF8NamesParseTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/UTF8NamesParseTest.java @@ -49,8 +49,8 @@ private void _testEmptyName(int mode) throws Exception final String DOC = "{ \"\" : \"\" }"; JsonParser p = createParser(mode, DOC); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("", p.getCurrentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("", p.getText()); assertToken(JsonToken.END_OBJECT, p.nextToken()); @@ -74,18 +74,18 @@ private void _testUtf8Name2Bytes(int mode) throws Exception JsonParser p = createParser(mode, DOC); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); - assertTrue(p.hasToken(JsonToken.PROPERTY_NAME)); - assertTrue(p.hasTokenId(JsonTokenId.ID_PROPERTY_NAME)); + assertTrue(p.hasToken(JsonToken.FIELD_NAME)); + assertTrue(p.hasTokenId(JsonTokenId.ID_FIELD_NAME)); - assertEquals(NAME, p.currentName()); + assertEquals(NAME, p.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertTrue(p.hasToken(JsonToken.VALUE_NUMBER_INT)); assertTrue(p.hasTokenId(JsonTokenId.ID_NUMBER_INT)); // should retain name during value entry, too - assertEquals(NAME, p.currentName()); + assertEquals(NAME, p.getCurrentName()); assertToken(JsonToken.END_OBJECT, p.nextToken()); p.close(); @@ -110,10 +110,10 @@ public void _testUtf8Name3Bytes(int mode) throws Exception JsonParser p = createParser(mode, DOC); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals(NAME, p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals(NAME, p.getCurrentName()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); - assertEquals(NAME, p.currentName()); + assertEquals(NAME, p.getCurrentName()); assertToken(JsonToken.END_OBJECT, p.nextToken()); @@ -223,7 +223,7 @@ public void _testUtf8StringValue(int mode, int len) throws Exception p = createParser(mode, bout.toByteArray()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); act = p.getText(); assertEquals(VALUE.length(), act.length()); @@ -257,7 +257,7 @@ private void _testNextFieldName(int mode, byte[] doc) throws IOException SerializedString id = new SerializedString("id"); JsonParser parser = createParser(mode, doc); assertEquals(parser.nextToken(), JsonToken.START_OBJECT); - assertTrue(parser.nextName(id)); + assertTrue(parser.nextFieldName(id)); assertEquals(parser.nextToken(), JsonToken.VALUE_NUMBER_INT); assertEquals(parser.nextToken(), JsonToken.END_OBJECT); parser.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/sym/BinaryNameHashTest.java b/src/test/java/com/fasterxml/jackson/core/sym/BinaryNameHashTest.java deleted file mode 100644 index 6fafc0fa56..0000000000 --- a/src/test/java/com/fasterxml/jackson/core/sym/BinaryNameHashTest.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.fasterxml.jackson.core.sym; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.fasterxml.jackson.core.BaseTest; - -// Specific tests that try to verify proper hashing goodness -public class BinaryNameHashTest extends BaseTest -{ - public void testSuffix1() { - // 14-Nov-2017, tatu: Slightly optimized hashing with shifting, to reduce - // default collision counts - _testSpillEfficiency(generate("", 99), 77, 16, 6, 0); - } - - public void testSuffix2() { - _testSpillEfficiency(generate("base", 39), 33, 6, 0, 0); - } - - public void testSuffix3() { - _testSpillEfficiency(generate("Of ", 139), 122, 16, 1, 0); - } - - public void testSuffix4() { - _testSpillEfficiency(generate("ACE-", 499), 422, 66, 11, 0); - } - - public void testSuffix5() { - // similarly, not so great... - _testSpillEfficiency(generate("SlartiBartFast#", 3000), 1112, 761, 897, 230); - } - - public void testPrefix1() { - _testSpillEfficiency(generate2("", 99), 77, 16, 6, 0); - } - public void testPrefix2() { - _testSpillEfficiency(generate2("base", 39), 29, 8, 2, 0); - } - public void testPrefix3() { - _testSpillEfficiency(generate2("Of ", 139), 116, 16, 7, 0); - } - public void testPrefix4() { - _testSpillEfficiency(generate2("ACE-", 499), 384, 92, 23, 0); - } - - public void testMisc11() { - _testSpillEfficiency(Arrays.asList( - "player", "uri", "title", "width", - "height", "format", "duration", "size", - "bitrate", "copyright", "persons"), - 11, 0, 0, 0); - } - - public void testMisc5() { - _testSpillEfficiency(Arrays.asList("uri", "title", "width", "height", "size"), - 5, 0, 0, 0); - } - - public void testMisc2() { - _testSpillEfficiency(Arrays.asList("content", "images"), - 2, 0, 0, 0); - } - - private void _testSpillEfficiency(List names, - int prim, int sec, int ter, - int expSpills) - { - BinaryNameMatcher quads = _construct(names); - assertEquals(names.size(), quads.totalCount()); - - assertEquals("Primary count not matching", prim, quads.primaryQuadCount()); - assertEquals("Secondary count not matching", sec, quads.secondaryQuadCount()); - assertEquals("Tertiary count not matching", ter, quads.tertiaryQuadCount()); - assertEquals("Spill count not matching", expSpills, quads.spilloverQuadCount()); - } - - private List generate(String base, int count) { - List result = new ArrayList<>(count); - while (--count >= 0) { - String name = base + count; - result.add(name.intern()); - } - return result; - } - - private List generate2(String base, int count) { - List result = new ArrayList<>(count); - while (--count >= 0) { - String name = ""+ count + base; - result.add(name.intern()); - } - return result; - } - - private BinaryNameMatcher _construct(List names) { - return BinaryNameMatcher.construct(names); - /* - BinaryNameMatcher m = BinaryNameMatcher.construct(names); - System.err.println("DEBUG: matcher == "+m); - for (String n : names) { - System.err.println(" '"+n+"'"); - } - return m; - */ - } -} diff --git a/src/test/java/com/fasterxml/jackson/core/sym/BinaryNameMatcherTest.java b/src/test/java/com/fasterxml/jackson/core/sym/BinaryNameMatcherTest.java deleted file mode 100644 index 613095ac6a..0000000000 --- a/src/test/java/com/fasterxml/jackson/core/sym/BinaryNameMatcherTest.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.fasterxml.jackson.core.sym; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.fasterxml.jackson.core.BaseTest; - -public class BinaryNameMatcherTest extends BaseTest -{ - public void testSmallMatching() - { - // First small (1 - 4) - _testMatching("single"); - _testMatching("1", "2a"); - _testMatching("first", "secondlong", "3rd"); - } - - public void testMediumMatching() - { - _testMatching("a", "bcd", "Fittipaldi", "goober"); - - // then bit larger - _testMatching("foo", "bar", "foobar", "fubar", "bizzbah", "grimagnoefwemp"); - - _testMatching("a", "b", "c", "d", "E", "f", "G", "h"); - _testMatching("a", "b", "d", "E", "f", "G"); - _testMatching("areaNames", "audienceSubCategoryNames", "blockNames", "seatCategoryNames", "subTopicNames", - "subjectNames", "topicNames", "topicSubTopics", "venueNames", "events", "performances"); - } - - public void testLargeMatching() - { - // And then generate even bigger - _testMatching(generate("base", 39)); - _testMatching(generate("Of ", 139)); - _testMatching(generate("ACE-", 499)); - - // but ALSO make sure to use longer strings -- need longer pre/suffix - _testMatching(generate2("-longer", 999)); // 9-12 bytes -> 3 quads - _testMatching(generate("slartibartfast-", 3000)); - } - - private List generate(String base, int count) { - List result = new ArrayList<>(count); - while (--count >= 0) { - String name = base + count; - result.add(name.intern()); - } - return result; - } - - private List generate2(String base, int count) { - List result = new ArrayList<>(count); - while (--count >= 0) { - String name = ""+ count + base; - result.add(name.intern()); - } - return result; - } - - private void _testMatching(String... nameArray) { - _testMatching(Arrays.asList(nameArray)); - } - - private void _testMatching(List names) - { - BinaryNameMatcher matcher = _construct(names); - for (int i = 0; i < names.size(); ++i) { - _expectMatch(matcher, names, i); - // but not with suffix - _expectNonMatch(matcher, names.get(i)+"FOOBAR"); - } - } - - private BinaryNameMatcher _construct(List names) - { - // note: strings MUST be intern()ed already - BinaryNameMatcher matcher = BinaryNameMatcher.construct(names); - // ensure `toString()` is legal (just for funsies) - assertNotNull(matcher.toString()); - return matcher; - } - - private void _expectMatch(BinaryNameMatcher matcher, List names, int index) - { - String name = names.get(index); - _expectMatch(matcher, names, index, name); - } - - private void _expectMatch(BinaryNameMatcher matcher, List names, int index, - String name) - { - int match = _match(matcher, name); - if (match != index) { - fail("Should have found '"+name+"' (index #"+index+" of total of "+names.size()+"), didn't: got "+match); - } - // secondary: needs to work via backup-lookup - int match2 = matcher.matchName(name); - if (match2 != index) { - fail("Should have found '"+name+"' (index #"+index+" of total of "+names.size()+") via String lookup: instead got "+match2); - } - } - - private void _expectNonMatch(BinaryNameMatcher matcher, String name) - { - int match = _match(matcher, name); - if (match != -1) { - fail("Should NOT have any-matched '"+name+"'; did match as: "+match); - } - } - - private int _match(BinaryNameMatcher matcher, String name) - { - int[] quads = BinaryNameMatcher._quads(name); - switch (quads.length) { - case 1: - return matcher.matchByQuad(quads[0]); - case 2: - return matcher.matchByQuad(quads[0], quads[1]); - case 3: - return matcher.matchByQuad(quads[0], quads[1], quads[2]); - default: - return matcher.matchByQuad(quads, quads.length); - } - } -} diff --git a/src/test/java/com/fasterxml/jackson/core/sym/FieldMatchersTest.java b/src/test/java/com/fasterxml/jackson/core/sym/FieldMatchersTest.java deleted file mode 100644 index 7fad1ab0b4..0000000000 --- a/src/test/java/com/fasterxml/jackson/core/sym/FieldMatchersTest.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.fasterxml.jackson.core.sym; - -import java.util.*; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.core.BaseTest; -import com.fasterxml.jackson.core.util.Named; - -/** - * Tests for {@link PropertyNameMatcher} implementations - */ -public class FieldMatchersTest extends BaseTest -{ - public void testSmallMatching() - { - // First small (1 - 4) - _testMatching("single"); - _testMatching("1", "2a"); - _testMatching("first", "Second", "third"); - // ... with nulls - _testMatching(null, "b", null); - } - - public void testMediumMatching() - { - _testMatching("a", "bcd", "Fittipaldi", "goober"); - _testMatching("a", "bcd", null, "goober"); - // important: non-null size still small, but full size big(ger) - _testMatching("a", null, null, "goober", "xyz"); - - // then bit larger - _testMatching("foo", "bar", "foobar", "fubar", "bizzbah", "grimagnoefwemp"); - - _testMatching("a", "b", "c", "d", "E", "f", "G", "h"); - _testMatching("a", "b", null, "d", "E", "f", "G", null); - } - - public void testLargeMatching() - { - // And then generate even bigger - _testMatching(generate("base", 39)); - _testMatching(generate("Of ", 139)); - _testMatching(generate("ACE-", 499)); - - List names = generate("ACE-", 250); - names.set(27, null); - names.set(111, null); - } - - private List generate(String base, int count) { - List result = new ArrayList<>(count); - while (--count >= 0) { - String name = base + count; - // important for interned case - result.add(name.intern()); - } - return result; - } - - private void _testMatching(String... nameArray) { - _testMatching(Arrays.asList(nameArray)); - } - - private void _testMatching(List names) { - _testCaseSensitive(names); - _testCaseInsensitive(names); - } - - private void _testCaseSensitive(List names) - { - PropertyNameMatcher matcher = SimpleNameMatcher.construct(null, names); - for (int i = 0; i < names.size(); ++i) { - String name = names.get(i); - if (name != null) { - _expectAnyMatch(matcher, names, i); - // similarly, if different string - _expectAnyMatch(matcher, names, i, new String(name)); - // but not with suffix - _expectNonMatch(matcher, name+"FOOBAR"); - } - } - } - - private void _testCaseInsensitive(List names) - { - final Locale locale = new Locale("en", "US"); - PropertyNameMatcher matcher = SimpleNameMatcher.constructCaseInsensitive(locale, named(names), true); - for (int i = 0; i < names.size(); ++i) { - String name = names.get(i); - if (name != null) { - _expectAnyMatch(matcher, names, i); - _expectAnyMatch(matcher, names, i, new String(name)); - _expectAnyMatch(matcher, names, i, name.toLowerCase()); - _expectAnyMatch(matcher, names, i, name.toUpperCase()); - - // but not if different - _expectNonMatch(matcher, name+"FOOBAR"); - } - } - } - - private void _expectAnyMatch(PropertyNameMatcher matcher, List names, int index) - { - String name = names.get(index); - if (name != null) { - _expectAnyMatch(matcher, names, index, name); - } - } - - private void _expectAnyMatch(PropertyNameMatcher matcher, List names, int index, - String name) - { - if (name == null) { - return; - } - int match = matcher.matchName(name); - if (match != index) { - fail("Should have any-matched #"+index+" (of "+names.size()+") for '"+name+"', did not, got: "+match); - } - } - - private void _expectNonMatch(PropertyNameMatcher matcher, String name) - { - if (name == null) { - return; - } - // make sure to test both intern() and non-intern paths - int match = matcher.matchName(name); - if (match != PropertyNameMatcher.MATCH_UNKNOWN_NAME) { - fail("Should NOT have any-matched '"+name+"'; did match with index #"+match); - } - _expectInternedNonMatch(matcher, name); - } - - private void _expectInternedNonMatch(PropertyNameMatcher matcher, String name) - { - if (name != null) { - // make sure to test both intern() and non-intern paths - int match = matcher.matchName(name); - if (match != PropertyNameMatcher.MATCH_UNKNOWN_NAME) { - fail("Should NOT have intern-matched '"+name+"'; did match with index #"+match); - } - } - } - - private List named(List names) { - return names.stream().map(Named::fromString) - .collect(Collectors.toList()); - } -} diff --git a/src/test/java/com/fasterxml/jackson/core/sym/SymbolTableMergingTest.java b/src/test/java/com/fasterxml/jackson/core/sym/SymbolTableMergingTest.java index 82f78fcb7f..766fada97c 100644 --- a/src/test/java/com/fasterxml/jackson/core/sym/SymbolTableMergingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/sym/SymbolTableMergingTest.java @@ -3,7 +3,6 @@ import java.io.IOException; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.json.ReaderBasedJsonParser; import com.fasterxml.jackson.core.json.UTF8StreamJsonParser; @@ -36,14 +35,14 @@ public void testByteSymbolsWithClose() throws Exception public void testByteSymbolsWithEOF() throws Exception { MyJsonFactory f = new MyJsonFactory(); - JsonParser p = _getParser(f, JSON, true); - while (p.nextToken() != null) { + JsonParser jp = _getParser(f, JSON, true); + while (jp.nextToken() != null) { // shouldn't update before hitting end assertEquals(0, f.byteSymbolCount()); } // but now should have it after hitting EOF assertEquals(3, f.byteSymbolCount()); - p.close(); + jp.close(); assertEquals(3, f.byteSymbolCount()); } @@ -64,14 +63,14 @@ public void testCharSymbolsWithClose() throws Exception public void testCharSymbolsWithEOF() throws Exception { MyJsonFactory f = new MyJsonFactory(); - JsonParser p = _getParser(f, JSON, false); - while (p.nextToken() != null) { + JsonParser jp = _getParser(f, JSON, false); + while (jp.nextToken() != null) { // shouldn't update before hitting end assertEquals(0, f.charSymbolCount()); } // but now should have it assertEquals(3, f.charSymbolCount()); - p.close(); + jp.close(); assertEquals(3, f.charSymbolCount()); } @@ -84,32 +83,32 @@ public void testCharSymbolsWithEOF() throws Exception private void _testWithClose(boolean useBytes) throws IOException { MyJsonFactory f = new MyJsonFactory(); - JsonParser p = _getParser(f, JSON, useBytes); + JsonParser jp = _getParser(f, JSON, useBytes); // Let's check 2 names - assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.START_OBJECT, jp.nextToken()); + assertToken(JsonToken.FIELD_NAME, jp.nextToken()); + assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // shouldn't update before close or EOF: assertEquals(0, useBytes ? f.byteSymbolCount() : f.charSymbolCount()); - p.close(); + jp.close(); // but should after close assertEquals(2, useBytes ? f.byteSymbolCount() : f.charSymbolCount()); } private JsonParser _getParser(MyJsonFactory f, String doc, boolean useBytes) throws IOException { - JsonParser p; + JsonParser jp; if (useBytes) { - p = f.createParser(ObjectReadContext.empty(), doc.getBytes("UTF-8")); - assertEquals(UTF8StreamJsonParser.class, p.getClass()); + jp = f.createParser(doc.getBytes("UTF-8")); + assertEquals(UTF8StreamJsonParser.class, jp.getClass()); assertEquals(0, f.byteSymbolCount()); } else { - p = f.createParser(ObjectReadContext.empty(), doc); - assertEquals(ReaderBasedJsonParser.class, p.getClass()); + jp = f.createParser(doc); + assertEquals(ReaderBasedJsonParser.class, jp.getClass()); assertEquals(0, f.charSymbolCount()); } - return p; + return jp; } } diff --git a/src/test/java/com/fasterxml/jackson/core/sym/SymbolsViaParserTest.java b/src/test/java/com/fasterxml/jackson/core/sym/SymbolsViaParserTest.java index 9f4ea74d72..2b4a458690 100644 --- a/src/test/java/com/fasterxml/jackson/core/sym/SymbolsViaParserTest.java +++ b/src/test/java/com/fasterxml/jackson/core/sym/SymbolsViaParserTest.java @@ -4,7 +4,6 @@ import java.util.HashSet; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; // Tests to guarad against [core#213]: does not verify symbol tables // directly but only indirect issue(s). @@ -43,13 +42,13 @@ private void _test17Chars(boolean useBytes) throws IOException JsonFactory f = new JsonFactory(); JsonParser p = useBytes - ? f.createParser(ObjectReadContext.empty(), doc.getBytes("UTF-8")) - : f.createParser(ObjectReadContext.empty(), doc); - HashSet syms = new HashSet<>(); + ? f.createParser(doc.getBytes("UTF-8")) + : f.createParser(doc); + HashSet syms = new HashSet(); assertToken(JsonToken.START_OBJECT, p.nextToken()); for (int i = 0; i < 50; ++i) { - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - syms.add(p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + syms.add(p.getCurrentName()); assertToken(JsonToken.VALUE_TRUE, p.nextToken()); } assertToken(JsonToken.END_OBJECT, p.nextToken()); @@ -80,11 +79,11 @@ public void _testSymbolTableExpansion(boolean useBytes) throws Exception String field = Integer.toString(i); final String doc = "{ \"" + field + "\" : \"test\" }"; JsonParser parser = useBytes - ? jsonFactory.createParser(ObjectReadContext.empty(), doc.getBytes("UTF-8")) - : jsonFactory.createParser(ObjectReadContext.empty(), doc); + ? jsonFactory.createParser(doc.getBytes("UTF-8")) + : jsonFactory.createParser(doc); assertToken(JsonToken.START_OBJECT, parser.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, parser.nextToken()); - assertEquals(field, parser.currentName()); + assertToken(JsonToken.FIELD_NAME, parser.nextToken()); + assertEquals(field, parser.getCurrentName()); assertToken(JsonToken.VALUE_STRING, parser.nextToken()); assertToken(JsonToken.END_OBJECT, parser.nextToken()); assertNull(parser.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/sym/TestByteBasedSymbols.java b/src/test/java/com/fasterxml/jackson/core/sym/TestByteBasedSymbols.java index 6b5076556b..5bfde49da1 100644 --- a/src/test/java/com/fasterxml/jackson/core/sym/TestByteBasedSymbols.java +++ b/src/test/java/com/fasterxml/jackson/core/sym/TestByteBasedSymbols.java @@ -5,7 +5,6 @@ import java.util.Random; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; /** * Unit test(s) to verify that handling of (byte-based) symbol tables @@ -14,7 +13,7 @@ public class TestByteBasedSymbols extends com.fasterxml.jackson.core.BaseTest { - final static String[] PROPERTY_NAMES = new String[] { + final static String[] FIELD_NAMES = new String[] { "a", "b", "c", "x", "y", "b13", "abcdefg", "a123", "a0", "b0", "c0", "d0", "e0", "f0", "g0", "h0", "x2", "aa", "ba", "ab", "b31", "___x", "aX", "xxx", @@ -43,8 +42,8 @@ public void testSharedSymbols() throws Exception */ while (jp0.nextToken() != JsonToken.START_ARRAY) { } - String doc1 = createDoc(PROPERTY_NAMES, true); - String doc2 = createDoc(PROPERTY_NAMES, false); + String doc1 = createDoc(FIELD_NAMES, true); + String doc2 = createDoc(FIELD_NAMES, false); // Let's run it twice... shouldn't matter for (int x = 0; x < 2; ++x) { @@ -54,12 +53,12 @@ public void testSharedSymbols() throws Exception assertToken(JsonToken.START_OBJECT, jp1.nextToken()); assertToken(JsonToken.START_OBJECT, jp2.nextToken()); - int len = PROPERTY_NAMES.length; + int len = FIELD_NAMES.length; for (int i = 0; i < len; ++i) { - assertToken(JsonToken.PROPERTY_NAME, jp1.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, jp2.nextToken()); - assertEquals(PROPERTY_NAMES[i], jp1.currentName()); - assertEquals(PROPERTY_NAMES[len-(i+1)], jp2.currentName()); + assertToken(JsonToken.FIELD_NAME, jp1.nextToken()); + assertToken(JsonToken.FIELD_NAME, jp2.nextToken()); + assertEquals(FIELD_NAMES[i], jp1.getCurrentName()); + assertEquals(FIELD_NAMES[len-(i+1)], jp2.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, jp1.nextToken()); assertToken(JsonToken.VALUE_NUMBER_INT, jp2.nextToken()); assertEquals(i, jp1.getIntValue()); @@ -116,7 +115,7 @@ public void testIssue207() throws Exception } stringBuilder.append("\n}"); - JsonParser p = jsonF.createParser(ObjectReadContext.empty(), stringBuilder.toString().getBytes("UTF-8")); + JsonParser p = jsonF.createParser(stringBuilder.toString().getBytes("UTF-8")); while (p.nextToken() != null) { } p.close(); } @@ -174,21 +173,21 @@ protected JsonParser createParser(JsonFactory jf, String input) throws IOExcepti { byte[] data = input.getBytes("UTF-8"); InputStream is = new ByteArrayInputStream(data); - return jf.createParser(ObjectReadContext.empty(), is); + return jf.createParser(is); } - private String createDoc(String[] propNames, boolean add) + private String createDoc(String[] fieldNames, boolean add) { StringBuilder sb = new StringBuilder(); sb.append("{ "); - int len = propNames.length; + int len = fieldNames.length; for (int i = 0; i < len; ++i) { if (i > 0) { sb.append(", "); } sb.append('"'); - sb.append(add ? propNames[i] : propNames[len - (i+1)]); + sb.append(add ? fieldNames[i] : fieldNames[len - (i+1)]); sb.append("\" : "); sb.append(i); } diff --git a/src/test/java/com/fasterxml/jackson/core/sym/TestHashCollisionChars.java b/src/test/java/com/fasterxml/jackson/core/sym/TestHashCollisionChars.java index 584e62b896..ff8fb1fa16 100644 --- a/src/test/java/com/fasterxml/jackson/core/sym/TestHashCollisionChars.java +++ b/src/test/java/com/fasterxml/jackson/core/sym/TestHashCollisionChars.java @@ -3,7 +3,6 @@ import java.util.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; /** * Some unit tests to try to exercise part of parser code that @@ -53,27 +52,26 @@ public void testReaderCollisions() throws Exception // First: attempt with exceptions turned on; should catch an exception - JsonFactory f = streamFactoryBuilder() + JsonFactory f = JsonFactory.builder() .enable(JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW) .build(); - JsonParser p = f.createParser(ObjectReadContext.empty(), sb.toString()); + JsonParser p = f.createParser(sb.toString()); try { while (p.nextToken() != null) { ; } fail("Should have failed"); - } catch (JacksonException e) { - verifyException(e, "Longest collision chain in symbol table"); - verifyException(e, "suspect a DoS attack"); + } catch (IllegalStateException e) { + verifyException(e, "hash collision"); } p.close(); // but then without feature, should pass - f = streamFactoryBuilder() + f = JsonFactory.builder() .disable(JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW) .build(); - p = f.createParser(ObjectReadContext.empty(), sb.toString()); + p = f.createParser(sb.toString()); while (p.nextToken() != null) { ; } diff --git a/src/test/java/com/fasterxml/jackson/core/sym/TestSymbolTables.java b/src/test/java/com/fasterxml/jackson/core/sym/TestSymbolTables.java index f4008b9adc..df23ad8d15 100644 --- a/src/test/java/com/fasterxml/jackson/core/sym/TestSymbolTables.java +++ b/src/test/java/com/fasterxml/jackson/core/sym/TestSymbolTables.java @@ -5,7 +5,6 @@ import java.nio.charset.Charset; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; /** * Tests that directly modify/access underlying low-level symbol tables @@ -155,7 +154,7 @@ public void testByteBasedSymbolTable() throws Exception +"}"); JsonFactory f = new JsonFactory(); - JsonParser p = f.createParser(ObjectReadContext.empty(), JSON.getBytes("UTF-8")); + JsonParser p = f.createParser(JSON.getBytes("UTF-8")); ByteQuadsCanonicalizer symbols = _findSymbols(p); assertEquals(0, symbols.size()); _streamThrough(p); @@ -163,13 +162,13 @@ public void testByteBasedSymbolTable() throws Exception p.close(); // and, for fun, try again - p = f.createParser(ObjectReadContext.empty(), JSON.getBytes("UTF-8")); + p = f.createParser(JSON.getBytes("UTF-8")); _streamThrough(p); symbols = _findSymbols(p); assertEquals(8, symbols.size()); p.close(); - p = f.createParser(ObjectReadContext.empty(), JSON.getBytes("UTF-8")); + p = f.createParser(JSON.getBytes("UTF-8")); _streamThrough(p); symbols = _findSymbols(p); assertEquals(8, symbols.size()); @@ -269,12 +268,12 @@ public void testShortNameCollisionsViaParser() throws Exception JsonParser p; // First: ensure that char-based is fine - p = f.createParser(ObjectReadContext.empty(), json); + p = f.createParser(json); while (p.nextToken() != null) { } p.close(); // and then that byte-based - p = f.createParser(ObjectReadContext.empty(), json.getBytes("UTF-8")); + p = f.createParser(json.getBytes("UTF-8")); while (p.nextToken() != null) { } p.close(); } diff --git a/src/test/java/com/fasterxml/jackson/core/sym/TestSymbolsWithMediaItem.java b/src/test/java/com/fasterxml/jackson/core/sym/TestSymbolsWithMediaItem.java index 4270e41f6d..6a3e033cf9 100644 --- a/src/test/java/com/fasterxml/jackson/core/sym/TestSymbolsWithMediaItem.java +++ b/src/test/java/com/fasterxml/jackson/core/sym/TestSymbolsWithMediaItem.java @@ -3,7 +3,6 @@ import java.io.IOException; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; public class TestSymbolsWithMediaItem extends com.fasterxml.jackson.core.BaseTest { @@ -40,14 +39,14 @@ public void testSmallSymbolSetWithBytes() throws IOException ByteQuadsCanonicalizer symbolsRoot = ByteQuadsCanonicalizer.createRoot(SEED); ByteQuadsCanonicalizer symbols = symbolsRoot.makeChild(JsonFactory.Feature.collectDefaults()); JsonFactory f = new JsonFactory(); - JsonParser p = f.createParser(ObjectReadContext.empty(), JSON.getBytes("UTF-8")); + JsonParser p = f.createParser(JSON.getBytes("UTF-8")); JsonToken t; while ((t = p.nextToken()) != null) { - if (t != JsonToken.PROPERTY_NAME) { + if (t != JsonToken.FIELD_NAME) { continue; } - String name = p.currentName(); + String name = p.getCurrentName(); int[] quads = calcQuads(name.getBytes("UTF-8")); if (symbols.findName(quads, quads.length) != null) { @@ -70,14 +69,14 @@ public void testSmallSymbolSetWithChars() throws IOException CharsToNameCanonicalizer symbols = CharsToNameCanonicalizer.createRoot(SEED).makeChild(-1); JsonFactory f = new JsonFactory(); - JsonParser p = f.createParser(ObjectReadContext.empty(), JSON); + JsonParser p = f.createParser(JSON); JsonToken t; while ((t = p.nextToken()) != null) { - if (t != JsonToken.PROPERTY_NAME) { + if (t != JsonToken.FIELD_NAME) { continue; } - String name = p.currentName(); + String name = p.getCurrentName(); char[] ch = name.toCharArray(); symbols.findSymbol(ch, 0, ch.length, symbols.calcHash(name)); } diff --git a/src/test/java/com/fasterxml/jackson/core/sym/TextualNameHashTest.java b/src/test/java/com/fasterxml/jackson/core/sym/TextualNameHashTest.java deleted file mode 100644 index 68a4ae0825..0000000000 --- a/src/test/java/com/fasterxml/jackson/core/sym/TextualNameHashTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.fasterxml.jackson.core.sym; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.fasterxml.jackson.core.BaseTest; - -public class TextualNameHashTest extends BaseTest -{ - public void testSuffix1() { - // 14-Nov-2017, tatu: Slightly optimized hashing with shifting, to reduce - // default collision counts - _testSpillEfficiency(generate("", 99), 0, 0); - } - - public void testSuffix2() { - _testSpillEfficiency(generate("base", 39), 7, 1); - } - - public void testSuffix3() { - _testSpillEfficiency(generate("Of ", 139), 14, 6); - } - - public void testSuffix4() { - _testSpillEfficiency(generate("ACE-", 499), 71, 34); - } - - public void testSuffix5() { - // similarly, not so great... - _testSpillEfficiency(generate("SlartiBartFast#", 3000), 479, 291); - } - - public void testPrefix1() { - _testSpillEfficiency(generate2("", 99), 0, 0); - } - public void testPrefix2() { - _testSpillEfficiency(generate2("base", 39), 5, 0); - } - public void testPrefix3() { - _testSpillEfficiency(generate2("Of ", 139), 15, 0); - } - public void testPrefix4() { - _testSpillEfficiency(generate2("ACE-", 499), 54, 3); - } - - public void testMisc11() { - _testSpillEfficiency(Arrays.asList( - "player", "uri", "title", "width", - "height", "format", "duration", "size", - "bitrate", "copyright", "persons"), - 1, 0); - } - - public void testMisc5() { - _testSpillEfficiency(Arrays.asList("uri", "title", "width", "height", "size"), - 2, 0); - } - - public void testMisc2() { - _testSpillEfficiency(Arrays.asList("content", "images"), 0, 0); - } - - private List generate(String base, int count) { - List result = new ArrayList<>(count); - while (--count >= 0) { - String name = base + count; - result.add(name.intern()); - } - return result; - } - - private List generate2(String base, int count) { - List result = new ArrayList<>(count); - while (--count >= 0) { - String name = ""+ count + base; - result.add(name.intern()); - } - return result; - } - - private void _testSpillEfficiency(List names, - int expSecondary, int expSpills) { - SimpleNameMatcher matcher = SimpleNameMatcher.construct(null, names); - int sec = matcher.secondaryCount(); - int spills = matcher.spillCount(); - - if ((expSecondary != sec) || (expSpills != spills)) { - fail("Expected "+expSecondary+" secondary, "+expSpills+" spills; got "+sec+" / "+spills); - } - } -} diff --git a/src/test/java/com/fasterxml/jackson/core/testsupport/AsyncReaderWrapper.java b/src/test/java/com/fasterxml/jackson/core/testsupport/AsyncReaderWrapper.java index 96d08cba77..7f817af876 100644 --- a/src/test/java/com/fasterxml/jackson/core/testsupport/AsyncReaderWrapper.java +++ b/src/test/java/com/fasterxml/jackson/core/testsupport/AsyncReaderWrapper.java @@ -1,13 +1,14 @@ package com.fasterxml.jackson.core.testsupport; +import java.io.IOException; import java.io.StringWriter; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser.NumberType; +import com.fasterxml.jackson.core.JsonStreamContext; import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.TokenStreamContext; public abstract class AsyncReaderWrapper { @@ -17,14 +18,14 @@ protected AsyncReaderWrapper(JsonParser sr) { _streamReader = sr; } - public JsonToken currentToken() { + public JsonToken currentToken() throws IOException { return _streamReader.currentToken(); } - public String currentText() { + public String currentText() throws IOException { return _streamReader.getText(); } - public String currentTextViaCharacters() + public String currentTextViaCharacters() throws IOException { char[] ch = _streamReader.getTextCharacters(); int start = _streamReader.getTextOffset(); @@ -32,7 +33,7 @@ public String currentTextViaCharacters() return new String(ch, start, len); } - public String currentTextViaWriter() + public String currentTextViaWriter() throws IOException { StringWriter sw = new StringWriter(); int len = _streamReader.getText(sw); @@ -45,30 +46,30 @@ public String currentTextViaWriter() return str; } - public String currentName() { - return _streamReader.currentName(); + public String currentName() throws IOException { + return _streamReader.getCurrentName(); } public JsonParser parser() { return _streamReader; } - public abstract JsonToken nextToken(); + public abstract JsonToken nextToken() throws IOException; - public TokenStreamContext getParsingContext() { - return _streamReader.streamReadContext(); + public JsonStreamContext getParsingContext() { + return _streamReader.getParsingContext(); } - public int getIntValue() { return _streamReader.getIntValue(); } - public long getLongValue() { return _streamReader.getLongValue(); } - public float getFloatValue() { return _streamReader.getFloatValue(); } - public double getDoubleValue() { return _streamReader.getDoubleValue(); } - public BigInteger getBigIntegerValue() { return _streamReader.getBigIntegerValue(); } - public BigDecimal getDecimalValue() { return _streamReader.getDecimalValue(); } - public byte[] getBinaryValue() { return _streamReader.getBinaryValue(); } + public int getIntValue() throws IOException { return _streamReader.getIntValue(); } + public long getLongValue() throws IOException { return _streamReader.getLongValue(); } + public float getFloatValue() throws IOException { return _streamReader.getFloatValue(); } + public double getDoubleValue() throws IOException { return _streamReader.getDoubleValue(); } + public BigInteger getBigIntegerValue() throws IOException { return _streamReader.getBigIntegerValue(); } + public BigDecimal getDecimalValue() throws IOException { return _streamReader.getDecimalValue(); } + public byte[] getBinaryValue() throws IOException { return _streamReader.getBinaryValue(); } - public Number getNumberValue() { return _streamReader.getNumberValue(); } - public NumberType getNumberType() { return _streamReader.getNumberType(); } + public Number getNumberValue() throws IOException { return _streamReader.getNumberValue(); } + public NumberType getNumberType() throws IOException { return _streamReader.getNumberType(); } - public void close() { _streamReader.close(); } + public void close() throws IOException { _streamReader.close(); } public boolean isClosed() { return _streamReader.isClosed(); diff --git a/src/test/java/com/fasterxml/jackson/core/testsupport/AsyncReaderWrapperForByteArray.java b/src/test/java/com/fasterxml/jackson/core/testsupport/AsyncReaderWrapperForByteArray.java index a8894c88d7..c94c9379b3 100644 --- a/src/test/java/com/fasterxml/jackson/core/testsupport/AsyncReaderWrapperForByteArray.java +++ b/src/test/java/com/fasterxml/jackson/core/testsupport/AsyncReaderWrapperForByteArray.java @@ -1,9 +1,10 @@ package com.fasterxml.jackson.core.testsupport; +import java.io.IOException; + import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.async.ByteArrayFeeder; -import com.fasterxml.jackson.core.exc.StreamReadException; /** * Helper class used with async parser @@ -29,14 +30,14 @@ public AsyncReaderWrapperForByteArray(JsonParser sr, int bytesPerCall, } @Override - public JsonToken nextToken() + public JsonToken nextToken() throws IOException { JsonToken token; while ((token = _streamReader.nextToken()) == JsonToken.NOT_AVAILABLE) { - ByteArrayFeeder feeder = (ByteArrayFeeder) _streamReader.nonBlockingInputFeeder(); + ByteArrayFeeder feeder = (ByteArrayFeeder) _streamReader.getNonBlockingInputFeeder(); if (!feeder.needMoreInput()) { - throw new StreamReadException(null, "Got NOT_AVAILABLE, could not feed more input"); + throw new IOException("Got NOT_AVAILABLE, could not feed more input"); } int amount = Math.min(_bytesPerFeed, _end - _offset); if (amount < 1) { // end-of-input? diff --git a/src/test/java/com/fasterxml/jackson/core/testsupport/MockDataInput.java b/src/test/java/com/fasterxml/jackson/core/testsupport/MockDataInput.java index b31fb42ada..11e8f3124f 100644 --- a/src/test/java/com/fasterxml/jackson/core/testsupport/MockDataInput.java +++ b/src/test/java/com/fasterxml/jackson/core/testsupport/MockDataInput.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.core.testsupport; import java.io.*; -import java.nio.charset.StandardCharsets; public class MockDataInput implements DataInput { @@ -11,8 +10,8 @@ public MockDataInput(byte[] data) { _input = new ByteArrayInputStream(data); } - public MockDataInput(String utf8Data) { - _input = new ByteArrayInputStream(utf8Data.getBytes(StandardCharsets.UTF_8)); + public MockDataInput(String utf8Data) throws IOException { + _input = new ByteArrayInputStream(utf8Data.getBytes("UTF-8")); } public MockDataInput(InputStream in) { diff --git a/src/test/java/com/fasterxml/jackson/core/type/TypeReferenceTest.java b/src/test/java/com/fasterxml/jackson/core/type/TypeReferenceTest.java index 2f100933d9..4dd70d026e 100644 --- a/src/test/java/com/fasterxml/jackson/core/type/TypeReferenceTest.java +++ b/src/test/java/com/fasterxml/jackson/core/type/TypeReferenceTest.java @@ -112,6 +112,11 @@ public ResolvedType containedType(int index) { return null; } + @Override + public String containedTypeName(int index) { + return null; + } + @Override public String toCanonical() { return null; diff --git a/src/test/java/com/fasterxml/jackson/core/util/ByteArrayBuilderTest.java b/src/test/java/com/fasterxml/jackson/core/util/ByteArrayBuilderTest.java index 0a40e44caf..59ec2ae0d2 100644 --- a/src/test/java/com/fasterxml/jackson/core/util/ByteArrayBuilderTest.java +++ b/src/test/java/com/fasterxml/jackson/core/util/ByteArrayBuilderTest.java @@ -23,48 +23,8 @@ public void testSimple() throws Exception for (int i = 0; i < 100; ++i) { assertEquals(i, (int) result[i]); } + b.release(); b.close(); } - - public void testAppendFourBytesWithPositive() { - BufferRecycler bufferRecycler = new BufferRecycler(); - ByteArrayBuilder byteArrayBuilder = new ByteArrayBuilder(bufferRecycler); - - assertEquals(0, byteArrayBuilder.size()); - - byteArrayBuilder.appendFourBytes(2); - - assertEquals(4, byteArrayBuilder.size()); - assertEquals(0, byteArrayBuilder.toByteArray()[0]); - assertEquals(0, byteArrayBuilder.toByteArray()[1]); - assertEquals(0, byteArrayBuilder.toByteArray()[2]); - assertEquals(2, byteArrayBuilder.toByteArray()[3]); - byteArrayBuilder.close(); - } - - public void testAppendTwoBytesWithZero() { - ByteArrayBuilder byteArrayBuilder = new ByteArrayBuilder(0); - - assertEquals(0, byteArrayBuilder.size()); - - byteArrayBuilder.appendTwoBytes(0); - - assertEquals(2, byteArrayBuilder.size()); - assertEquals(0, byteArrayBuilder.toByteArray()[0]); - byteArrayBuilder.close(); - } - - public void testFinishCurrentSegment() { - BufferRecycler bufferRecycler = new BufferRecycler(); - ByteArrayBuilder byteArrayBuilder = new ByteArrayBuilder(bufferRecycler, 2); - byteArrayBuilder.appendThreeBytes(2); - - assertEquals(3, byteArrayBuilder.getCurrentSegmentLength()); - - /*byte[] byteArray =*/ byteArrayBuilder.finishCurrentSegment(); - - assertEquals(0, byteArrayBuilder.getCurrentSegmentLength()); - byteArrayBuilder.close(); - } -} \ No newline at end of file +} diff --git a/src/test/java/com/fasterxml/jackson/core/util/JsonParserSequenceTest.java b/src/test/java/com/fasterxml/jackson/core/util/JsonParserSequenceTest.java deleted file mode 100644 index 6a779fd67e..0000000000 --- a/src/test/java/com/fasterxml/jackson/core/util/JsonParserSequenceTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.fasterxml.jackson.core.util; - -import com.fasterxml.jackson.core.BaseTest; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.ObjectReadContext; -import com.fasterxml.jackson.core.io.IOContext; -import com.fasterxml.jackson.core.io.ContentReference; -import com.fasterxml.jackson.core.json.ReaderBasedJsonParser; -import com.fasterxml.jackson.core.json.UTF8StreamJsonParser; -import com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer; -import com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer; -import org.junit.Test; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * Unit tests for class {@link JsonParserSequence}. - * - * @see JsonParserSequence - */ -@SuppressWarnings("resource") -public class JsonParserSequenceTest extends BaseTest -{ - @Test - public void testClose() throws IOException { - IOContext ioContext = new IOContext(new BufferRecycler(), - ContentReference.rawReference(this), true); - ReaderBasedJsonParser readerBasedJsonParser = new ReaderBasedJsonParser( - ObjectReadContext.empty(), - ioContext, - 2, 0, null, CharsToNameCanonicalizer.createRoot()); - JsonParserSequence jsonParserSequence = JsonParserSequence.createFlattened(true, readerBasedJsonParser, readerBasedJsonParser); - - assertFalse(jsonParserSequence.isClosed()); - - jsonParserSequence.close(); - - assertTrue(jsonParserSequence.isClosed()); - assertNull(jsonParserSequence.nextToken()); - } - - @Test - public void testSkipChildren() throws IOException { - JsonParser[] jsonParserArray = new JsonParser[3]; - IOContext ioContext = new IOContext(new BufferRecycler(), - ContentReference.rawReference(jsonParserArray), true); - byte[] byteArray = new byte[8]; - InputStream byteArrayInputStream = new ByteArrayInputStream(byteArray, 0, (byte) 58); - UTF8StreamJsonParser uTF8StreamJsonParser = new UTF8StreamJsonParser(ObjectReadContext.empty(), - ioContext, - 0, 0, byteArrayInputStream, ByteQuadsCanonicalizer.createRoot(), - byteArray, -1, (byte) 9, 0, true); - JsonParserDelegate jsonParserDelegate = new JsonParserDelegate(jsonParserArray[0]); - JsonParserSequence jsonParserSequence = JsonParserSequence.createFlattened(true, uTF8StreamJsonParser, jsonParserDelegate); - JsonParserSequence jsonParserSequenceTwo = (JsonParserSequence) jsonParserSequence.skipChildren(); - - assertEquals(2, jsonParserSequenceTwo.containedParsersCount()); - } -} \ No newline at end of file diff --git a/src/test/java/com/fasterxml/jackson/core/util/RequestPayloadTest.java b/src/test/java/com/fasterxml/jackson/core/util/RequestPayloadTest.java new file mode 100644 index 0000000000..a3412f1b22 --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/core/util/RequestPayloadTest.java @@ -0,0 +1,39 @@ +package com.fasterxml.jackson.core.util; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Unit tests for class {@link RequestPayload}. + * + * @see RequestPayload + **/ +public class RequestPayloadTest { + @Test(expected = IllegalArgumentException.class) + public void testFailsToCreateTakingCharSequenceThrowsIllegalArgumentExceptionOne() { + new RequestPayload(null); + } + + @Test(expected = IllegalArgumentException.class) + public void testFailsToCreateTakingCharSequenceThrowsIllegalArgumentExceptionTwo() { + new RequestPayload(null, "UTF-8"); + } + + @Test + public void testCreateTakingCharSequenceAndCallsGetRawPayload() { + CharSequence charSequence = new String(); + + RequestPayload requestPayload = new RequestPayload(charSequence); + assertEquals("", requestPayload.getRawPayload()); + } + + @Test + public void testCreateTaking2ArgumentsAndCallsGetRawPayload() { + byte[] byteArray = new byte[5]; + RequestPayload requestPayload = new RequestPayload(byteArray, "/ _ \" €"); + + assertSame(byteArray, requestPayload.getRawPayload()); + } + +} \ No newline at end of file diff --git a/src/test/java/com/fasterxml/jackson/core/util/SeparatorsTest.java b/src/test/java/com/fasterxml/jackson/core/util/SeparatorsTest.java index 2f50dfd5fa..6be85f1b45 100644 --- a/src/test/java/com/fasterxml/jackson/core/util/SeparatorsTest.java +++ b/src/test/java/com/fasterxml/jackson/core/util/SeparatorsTest.java @@ -18,14 +18,14 @@ public void testWithArrayValueSeparatorWithDigit() { Separators separatorsTwo = separators.withArrayValueSeparator('5'); assertEquals('5', separatorsTwo.getObjectEntrySeparator()); - assertEquals('5', separatorsTwo.getObjectNameValueSeparator()); + assertEquals('5', separatorsTwo.getObjectFieldValueSeparator()); assertEquals('5', separatorsTwo.getArrayValueSeparator()); assertSame(separatorsTwo, separators); separatorsTwo = separators.withArrayValueSeparator('6'); assertEquals('5', separatorsTwo.getObjectEntrySeparator()); - assertEquals('5', separatorsTwo.getObjectNameValueSeparator()); + assertEquals('5', separatorsTwo.getObjectFieldValueSeparator()); assertEquals('6', separatorsTwo.getArrayValueSeparator()); assertNotSame(separatorsTwo, separators); @@ -38,13 +38,13 @@ public void testWithObjectEntrySeparator() { Separators separatorsThree = separatorsTwo.withObjectEntrySeparator('!'); assertEquals('!', separatorsThree.getObjectEntrySeparator()); - assertEquals('5', separatorsThree.getObjectNameValueSeparator()); + assertEquals('5', separatorsThree.getObjectFieldValueSeparator()); assertSame(separatorsThree, separatorsTwo); assertEquals('5', separators.getArrayValueSeparator()); assertEquals('5', separatorsThree.getArrayValueSeparator()); - assertEquals('5', separators.getObjectNameValueSeparator()); + assertEquals('5', separators.getObjectFieldValueSeparator()); } @Test @@ -55,13 +55,15 @@ public void testWithObjectFieldValueSeparatorWithDigit() { assertEquals('5', separatorsTwo.getArrayValueSeparator()); assertSame(separatorsTwo, separators); assertEquals('5', separatorsTwo.getObjectEntrySeparator()); - assertEquals('5', separatorsTwo.getObjectNameValueSeparator()); + assertEquals('5', separatorsTwo.getObjectFieldValueSeparator()); separatorsTwo = separators.withObjectFieldValueSeparator('6'); assertEquals('5', separatorsTwo.getArrayValueSeparator()); assertNotSame(separatorsTwo, separators); assertEquals('5', separatorsTwo.getObjectEntrySeparator()); - assertEquals('6', separatorsTwo.getObjectNameValueSeparator()); + assertEquals('6', separatorsTwo.getObjectFieldValueSeparator()); + } -} + +} \ No newline at end of file diff --git a/src/test/java/com/fasterxml/jackson/core/util/TestDefaultPrettyPrinter.java b/src/test/java/com/fasterxml/jackson/core/util/TestDefaultPrettyPrinter.java index 51d9750ed0..6a56a049f9 100644 --- a/src/test/java/com/fasterxml/jackson/core/util/TestDefaultPrettyPrinter.java +++ b/src/test/java/com/fasterxml/jackson/core/util/TestDefaultPrettyPrinter.java @@ -5,7 +5,6 @@ import java.io.StringWriter; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; public class TestDefaultPrettyPrinter extends BaseTest { @@ -85,18 +84,13 @@ public void testTabIndent() throws IOException public void testRootSeparator() throws IOException { + DefaultPrettyPrinter pp = new DefaultPrettyPrinter() + .withRootSeparator("|"); final String EXP = "1|2|3"; - ObjectWriteContext ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { - return new DefaultPrettyPrinter() - .withRootSeparator("|"); - } - }; - StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ppContext, sw); + JsonGenerator gen = JSON_F.createGenerator(sw); + gen.setPrettyPrinter(pp); gen.writeNumber(1); gen.writeNumber(2); @@ -105,7 +99,8 @@ public PrettyPrinter getPrettyPrinter() { assertEquals(EXP, sw.toString()); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - gen = JSON_F.createGenerator(ppContext, bytes); + gen = JSON_F.createGenerator(bytes); + gen.setPrettyPrinter(pp); gen.writeNumber(1); gen.writeNumber(2); @@ -114,26 +109,20 @@ public PrettyPrinter getPrettyPrinter() { assertEquals(EXP, bytes.toString("UTF-8")); // Also: let's try removing separator altogether - ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { - return new DefaultPrettyPrinter() - .withRootSeparator((String) null) - .withArrayIndenter(null) - .withObjectIndenter(null) - .withoutSpacesInObjectEntries(); - } - }; - + pp = pp.withRootSeparator((String) null) + .withArrayIndenter(null) + .withObjectIndenter(null) + .withoutSpacesInObjectEntries(); sw = new StringWriter(); - gen = JSON_F.createGenerator(ppContext, sw); + gen = JSON_F.createGenerator(sw); + gen.setPrettyPrinter(pp); gen.writeNumber(1); gen.writeStartArray(); gen.writeNumber(2); gen.writeEndArray(); gen.writeStartObject(); - gen.writeName("a"); + gen.writeFieldName("a"); gen.writeNumber(3); gen.writeEndObject(); gen.close(); @@ -141,31 +130,26 @@ public PrettyPrinter getPrettyPrinter() { assertEquals("1[2]{\"a\":3}", sw.toString()); } - private String _printTestData(final PrettyPrinter pp, boolean useBytes) throws IOException + private String _printTestData(PrettyPrinter pp, boolean useBytes) throws IOException { JsonGenerator gen; StringWriter sw; ByteArrayOutputStream bytes; - ObjectWriteContext ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { return pp; } - }; - if (useBytes) { sw = null; bytes = new ByteArrayOutputStream(); - gen = JSON_F.createGenerator(ppContext, bytes); + gen = JSON_F.createGenerator(bytes); } else { sw = new StringWriter(); bytes = null; - gen = JSON_F.createGenerator(ppContext, sw); + gen = JSON_F.createGenerator(sw); } - + gen.setPrettyPrinter(pp); gen.writeStartObject(); - gen.writeName("name"); + gen.writeFieldName("name"); gen.writeString("John Doe"); - gen.writeName("age"); + gen.writeFieldName("age"); gen.writeNumber(3.14); gen.writeEndObject(); gen.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/util/TestDelegates.java b/src/test/java/com/fasterxml/jackson/core/util/TestDelegates.java index da58e94539..7453ae9c06 100644 --- a/src/test/java/com/fasterxml/jackson/core/util/TestDelegates.java +++ b/src/test/java/com/fasterxml/jackson/core/util/TestDelegates.java @@ -7,16 +7,103 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.JsonParser.NumberType; -import com.fasterxml.jackson.core.json.JsonFactory; +import com.fasterxml.jackson.core.type.ResolvedType; +import com.fasterxml.jackson.core.type.TypeReference; import static org.junit.Assert.assertArrayEquals; public class TestDelegates extends com.fasterxml.jackson.core.BaseTest { + static class BogusSchema implements FormatSchema + { + @Override + public String getSchemaType() { + return "test"; + } + } + static class POJO { public int x = 3; } + static class BogusCodec extends ObjectCodec + { + public Object pojoWritten; + public TreeNode treeWritten; + + @Override + public Version version() { + return Version.unknownVersion(); + } + + @Override + public T readValue(JsonParser p, Class valueType) { + return null; + } + @Override + public T readValue(JsonParser p, TypeReference valueTypeRef) { + return null; + } + @Override + public T readValue(JsonParser p, ResolvedType valueType) { + return null; + } + @Override + public Iterator readValues(JsonParser p, Class valueType) { + return null; + } + @Override + public Iterator readValues(JsonParser p, + TypeReference valueTypeRef) throws IOException { + return null; + } + @Override + public Iterator readValues(JsonParser p, ResolvedType valueType) { + return null; + } + @Override + public void writeValue(JsonGenerator gen, Object value) throws IOException { + gen.writeString("pojo"); + pojoWritten = value; + } + + @Override + public T readTree(JsonParser p) { + return null; + } + @Override + public void writeTree(JsonGenerator gen, TreeNode tree) throws IOException { + gen.writeString("tree"); + treeWritten = tree; + } + + @Override + public TreeNode createObjectNode() { + return null; + } + @Override + public TreeNode createArrayNode() { + return null; + } + @Override + public TreeNode missingNode() { + return null; + } + + @Override + public TreeNode nullNode() { + return null; + } + @Override + public JsonParser treeAsTokens(TreeNode n) { + return null; + } + @Override + public T treeToValue(TreeNode n, Class valueType) { + return null; + } + } + static class BogusTree implements TreeNode { @Override public JsonToken asToken() { @@ -48,11 +135,6 @@ public boolean isMissingNode() { return false; } - @Override - public boolean isEmbeddedValue() { - return false; - } - @Override public boolean isArray() { return false; @@ -63,11 +145,6 @@ public boolean isObject() { return false; } - @Override - public boolean isNull() { - return false; - } - @Override public TreeNode get(String fieldName) { return null; @@ -89,7 +166,7 @@ public TreeNode path(int index) { } @Override - public Iterator propertyNames() { + public Iterator fieldNames() { return null; } @@ -104,7 +181,12 @@ public TreeNode at(String jsonPointerExpression) { } @Override - public JsonParser traverse(ObjectReadContext readCtxt) { + public JsonParser traverse() { + return null; + } + + @Override + public JsonParser traverse(ObjectCodec codec) { return null; } } @@ -118,17 +200,18 @@ public void testParserDelegate() throws IOException { final String TOKEN ="foo"; - JsonParser parser = JSON_F.createParser(ObjectReadContext.empty(), - "[ 1, true, null, { \"a\": \"foo\" }, \"AQI=\" ]"); + JsonParser parser = JSON_F.createParser("[ 1, true, null, { \"a\": \"foo\" }, \"AQI=\" ]"); JsonParserDelegate del = new JsonParserDelegate(parser); // Basic capabilities for parser: assertFalse(del.canParseAsync()); assertFalse(del.canReadObjectId()); assertFalse(del.canReadTypeId()); + assertFalse(del.requiresCustomCodec()); assertEquals(parser.version(), del.version()); // configuration + assertFalse(del.isEnabled(JsonParser.Feature.ALLOW_COMMENTS)); assertFalse(del.isEnabled(StreamReadFeature.IGNORE_UNDEFINED)); assertSame(parser, del.delegate()); assertNull(del.getSchema()); @@ -137,8 +220,8 @@ public void testParserDelegate() throws IOException assertNull(del.currentToken()); assertFalse(del.hasCurrentToken()); assertFalse(del.hasTextCharacters()); - assertNull(del.currentValue()); - assertNull(del.currentName()); + assertNull(del.getCurrentValue()); + assertNull(del.getCurrentName()); assertToken(JsonToken.START_ARRAY, del.nextToken()); assertEquals(JsonTokenId.ID_START_ARRAY, del.currentTokenId()); @@ -150,8 +233,8 @@ public void testParserDelegate() throws IOException assertFalse(del.isExpectedStartObjectToken()); assertFalse(del.isExpectedNumberIntToken()); assertEquals("[", del.getText()); - assertNotNull(del.streamReadContext()); - assertSame(parser.streamReadContext(), del.streamReadContext()); + assertNotNull(del.getParsingContext()); + assertSame(parser.getParsingContext(), del.getParsingContext()); assertToken(JsonToken.VALUE_NUMBER_INT, del.nextToken()); assertEquals(1, del.getIntValue()); @@ -176,26 +259,26 @@ public void testParserDelegate() throws IOException assertToken(JsonToken.VALUE_TRUE, del.nextToken()); assertTrue(del.getBooleanValue()); - assertEquals(parser.currentLocation(), del.currentLocation()); + assertEquals(parser.getCurrentLocation(), del.getCurrentLocation()); assertNull(del.getTypeId()); assertNull(del.getObjectId()); assertToken(JsonToken.VALUE_NULL, del.nextToken()); - assertNull(del.currentValue()); - del.assignCurrentValue(TOKEN); + assertNull(del.getCurrentValue()); + del.setCurrentValue(TOKEN); assertToken(JsonToken.START_OBJECT, del.nextToken()); - assertNull(del.currentValue()); + assertNull(del.getCurrentValue()); - assertToken(JsonToken.PROPERTY_NAME, del.nextToken()); - assertEquals("a", del.currentName()); + assertToken(JsonToken.FIELD_NAME, del.nextToken()); + assertEquals("a", del.getCurrentName()); assertToken(JsonToken.VALUE_STRING, del.nextToken()); assertTrue(del.hasTextCharacters()); assertEquals("foo", del.getText()); assertToken(JsonToken.END_OBJECT, del.nextToken()); - assertEquals(TOKEN, del.currentValue()); + assertEquals(TOKEN, del.getCurrentValue()); assertToken(JsonToken.VALUE_STRING, del.nextToken()); assertArrayEquals(new byte[] { 1, 2 }, del.getBinaryValue()); @@ -212,30 +295,38 @@ public void testParserDelegate() throws IOException /** * Test default, non-overridden generator delegate. */ + @SuppressWarnings("deprecation") public void testGeneratorDelegate() throws IOException { final String TOKEN ="foo"; StringWriter sw = new StringWriter(); - JsonGenerator g0 = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator g0 = JSON_F.createGenerator(sw); JsonGeneratorDelegate del = new JsonGeneratorDelegate(g0); // Basic capabilities for parser: - assertTrue(del.canOmitProperties()); + assertTrue(del.canOmitFields()); + assertFalse(del.canWriteBinaryNatively()); + assertTrue(del.canWriteFormattedNumbers()); assertFalse(del.canWriteObjectId()); assertFalse(del.canWriteTypeId()); assertEquals(g0.version(), del.version()); // configuration + assertTrue(del.isEnabled(JsonGenerator.Feature.QUOTE_FIELD_NAMES)); assertFalse(del.isEnabled(StreamWriteFeature.IGNORE_UNKNOWN)); assertSame(g0, del.delegate()); + assertSame(g0, del.getDelegate()); // deprecated as of 2.11 + + assertFalse(del.canUseSchema(new BogusSchema())); // initial state assertNull(del.getSchema()); + assertNull(del.getPrettyPrinter()); del.writeStartArray(); - assertEquals(1, del.streamWriteOutputBuffered()); + assertEquals(1, del.getOutputBuffered()); del.writeNumber(13); del.writeNumber(BigInteger.ONE); @@ -246,13 +337,13 @@ public void testGeneratorDelegate() throws IOException del.writeString("foo"); // verify that we can actually set/get "current value" as expected, even with delegates - assertNull(del.currentValue()); - del.assignCurrentValue(TOKEN); + assertNull(del.getCurrentValue()); + del.setCurrentValue(TOKEN); del.writeStartObject(null, 0); - assertNull(del.currentValue()); + assertNull(del.getCurrentValue()); del.writeEndObject(); - assertEquals(TOKEN, del.currentValue()); + assertEquals(TOKEN, del.getCurrentValue()); del.writeStartArray(0); del.writeEndArray(); @@ -271,12 +362,12 @@ public void testGeneratorDelegate() throws IOException public void testGeneratorDelegateArrays() throws IOException { StringWriter sw = new StringWriter(); - JsonGenerator g0 = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator g0 = JSON_F.createGenerator(sw); JsonGeneratorDelegate del = new JsonGeneratorDelegate(g0); final Object MARKER = new Object(); del.writeStartArray(MARKER); - assertSame(MARKER, del.currentValue()); + assertSame(MARKER, del.getCurrentValue()); del.writeArray(new int[] { 1, 2, 3 }, 0, 3); del.writeArray(new long[] { 1, 123456, 2 }, 1, 1); @@ -292,12 +383,12 @@ public void testGeneratorDelegateArrays() throws IOException public void testGeneratorDelegateComments() throws IOException { StringWriter sw = new StringWriter(); - JsonGenerator g0 = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator g0 = JSON_F.createGenerator(sw); JsonGeneratorDelegate del = new JsonGeneratorDelegate(g0); final Object MARKER = new Object(); del.writeStartArray(MARKER, 5); - assertSame(MARKER, del.currentValue()); + assertSame(MARKER, del.getCurrentValue()); del.writeNumber((short) 1); del.writeNumber(12L); @@ -315,9 +406,9 @@ public void testGeneratorDelegateComments() throws IOException public void testDelegateCopyMethods() throws IOException { - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), "[123,[true,false]]"); + JsonParser p = JSON_F.createParser("[123,[true,false]]"); StringWriter sw = new StringWriter(); - JsonGenerator g0 = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator g0 = JSON_F.createGenerator(sw); JsonGeneratorDelegate del = new JsonGeneratorDelegate(g0); assertToken(JsonToken.START_ARRAY, p.nextToken()); @@ -338,21 +429,43 @@ public void testDelegateCopyMethods() throws IOException public void testNotDelegateCopyMethods() throws IOException { - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), "[{\"a\":[1,2,{\"b\":3}],\"c\":\"d\"},{\"e\":false},null]"); + JsonParser jp = JSON_F.createParser("[{\"a\":[1,2,{\"b\":3}],\"c\":\"d\"},{\"e\":false},null]"); StringWriter sw = new StringWriter(); - JsonGenerator g = new JsonGeneratorDelegate(JSON_F.createGenerator(ObjectWriteContext.empty(), sw), false) { + JsonGenerator jg = new JsonGeneratorDelegate(JSON_F.createGenerator(sw), false) { @Override - public void writeName(String name) { - super.writeName(name+"-test"); + public void writeFieldName(String name) throws IOException { + super.writeFieldName(name+"-test"); super.writeBoolean(true); - super.writeName(name); + super.writeFieldName(name); } }; - p.nextToken(); - g.copyCurrentStructure(p); - g.flush(); + jp.nextToken(); + jg.copyCurrentStructure(jp); + jg.flush(); assertEquals("[{\"a-test\":true,\"a\":[1,2,{\"b-test\":true,\"b\":3}],\"c-test\":true,\"c\":\"d\"},{\"e-test\":true,\"e\":false},null]", sw.toString()); - p.close(); - g.close(); + jp.close(); + jg.close(); + } + + @SuppressWarnings("resource") + public void testGeneratorWithCodec() throws IOException + { + BogusCodec codec = new BogusCodec(); + StringWriter sw = new StringWriter(); + JsonGenerator g0 = JSON_F.createGenerator(sw); + g0.setCodec(codec); + JsonGeneratorDelegate del = new JsonGeneratorDelegate(g0, false); + del.writeStartArray(); + POJO pojo = new POJO(); + del.writeObject(pojo); + TreeNode tree = new BogusTree(); + del.writeTree(tree); + del.writeEndArray(); + del.close(); + + assertEquals("[\"pojo\",\"tree\"]", sw.toString()); + + assertSame(tree, codec.treeWritten); + assertSame(pojo, codec.pojoWritten); } } diff --git a/src/test/java/com/fasterxml/jackson/core/util/TestNumberPrinting.java b/src/test/java/com/fasterxml/jackson/core/util/TestNumberPrinting.java index 84d8213301..bad5bdbc03 100644 --- a/src/test/java/com/fasterxml/jackson/core/util/TestNumberPrinting.java +++ b/src/test/java/com/fasterxml/jackson/core/util/TestNumberPrinting.java @@ -71,7 +71,7 @@ private void assertIntPrint(int value) if (!exp.equals(act)) { assertEquals("Expected conversion (exp '"+exp+"', len "+exp.length()+"; act len "+act.length()+")", exp, act); } - String alt = Integer.toString(value); + String alt = NumberOutput.toString(value); if (!exp.equals(alt)) { assertEquals("Expected conversion (exp '"+exp+"', len "+exp.length()+"; act len "+act.length()+")", exp, act); } @@ -85,7 +85,7 @@ private void assertLongPrint(long value, int index) if (!exp.equals(act)) { assertEquals("Expected conversion (exp '"+exp+"', len "+exp.length()+"; act len "+act.length()+"; number index "+index+")", exp, act); } - String alt = Long.toString(value); + String alt = NumberOutput.toString(value); if (!exp.equals(alt)) { assertEquals("Expected conversion (exp '"+exp+"', len "+exp.length()+"; act len "+act.length()+"; number index "+index+")", exp, act); } diff --git a/src/test/java/com/fasterxml/jackson/core/util/TestVersionUtil.java b/src/test/java/com/fasterxml/jackson/core/util/TestVersionUtil.java index bb32828010..9d2774e2ee 100644 --- a/src/test/java/com/fasterxml/jackson/core/util/TestVersionUtil.java +++ b/src/test/java/com/fasterxml/jackson/core/util/TestVersionUtil.java @@ -19,6 +19,12 @@ public void testVersionParsing() VersionUtil.parseVersion("1.2.15-foo", "group", "artifact")); } + @SuppressWarnings("deprecation") + public void testMavenVersionParsing() { + assertEquals(new Version(1, 2, 3, "SNAPSHOT", "foo.bar", "foo-bar"), + VersionUtil.mavenVersionFor(TestVersionUtil.class.getClassLoader(), "foo.bar", "foo-bar")); + } + public void testPackageVersionMatches() { assertEquals(PackageVersion.VERSION, VersionUtil.versionFor(UTF8JsonGenerator.class)); } diff --git a/src/test/java/com/fasterxml/jackson/core/write/ArrayGenerationTest.java b/src/test/java/com/fasterxml/jackson/core/write/ArrayGenerationTest.java index f4ecea4bbd..f4c7554067 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/ArrayGenerationTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/ArrayGenerationTest.java @@ -12,7 +12,7 @@ */ public class ArrayGenerationTest extends BaseTest { - private final TokenStreamFactory FACTORY = newStreamFactory(); + private final JsonFactory FACTORY = new JsonFactory(); public void testIntArray() throws Exception { @@ -124,8 +124,8 @@ private void _testIntArray(boolean useBytes, int elements, int pre, int post) th StringWriter sw = new StringWriter(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator gen = useBytes ? FACTORY.createGenerator(ObjectWriteContext.empty(), bytes) - : FACTORY.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = useBytes ? FACTORY.createGenerator(bytes) + : FACTORY.createGenerator(sw); gen.writeArray(values, pre, elements); gen.close(); @@ -137,8 +137,8 @@ private void _testIntArray(boolean useBytes, int elements, int pre, int post) th json = sw.toString(); } - JsonParser p = useBytes ? FACTORY.createParser(ObjectReadContext.empty(), bytes.toByteArray()) - : FACTORY.createParser(ObjectReadContext.empty(), json); + JsonParser p = useBytes ? FACTORY.createParser(bytes.toByteArray()) + : FACTORY.createParser(json); assertToken(JsonToken.START_ARRAY, p.nextToken()); for (int i = 0; i < elements; ++i) { if ((i & 1) == 0) { // alternate @@ -165,8 +165,8 @@ private void _testLongArray(boolean useBytes, int elements, int pre, int post) t StringWriter sw = new StringWriter(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator gen = useBytes ? FACTORY.createGenerator(ObjectWriteContext.empty(), bytes) - : FACTORY.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = useBytes ? FACTORY.createGenerator(bytes) + : FACTORY.createGenerator(sw); gen.writeArray(values, pre, elements); gen.close(); @@ -178,8 +178,8 @@ private void _testLongArray(boolean useBytes, int elements, int pre, int post) t json = sw.toString(); } - JsonParser p = useBytes ? FACTORY.createParser(ObjectReadContext.empty(), bytes.toByteArray()) - : FACTORY.createParser(ObjectReadContext.empty(), json); + JsonParser p = useBytes ? FACTORY.createParser(bytes.toByteArray()) + : FACTORY.createParser(json); assertToken(JsonToken.START_ARRAY, p.nextToken()); for (int i = 0; i < elements; ++i) { if ((i & 1) == 0) { // alternate @@ -206,8 +206,8 @@ private void _testDoubleArray(boolean useBytes, int elements, int pre, int post) StringWriter sw = new StringWriter(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator gen = useBytes ? FACTORY.createGenerator(ObjectWriteContext.empty(), bytes) - : FACTORY.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = useBytes ? FACTORY.createGenerator(bytes) + : FACTORY.createGenerator(sw); gen.writeArray(values, pre, elements); gen.close(); @@ -219,8 +219,8 @@ private void _testDoubleArray(boolean useBytes, int elements, int pre, int post) json = sw.toString(); } - JsonParser p = useBytes ? FACTORY.createParser(ObjectReadContext.empty(), bytes.toByteArray()) - : FACTORY.createParser(ObjectReadContext.empty(), json); + JsonParser p = useBytes ? FACTORY.createParser(bytes.toByteArray()) + : FACTORY.createParser(json); assertToken(JsonToken.START_ARRAY, p.nextToken()); for (int i = 0; i < elements; ++i) { JsonToken t = p.nextToken(); @@ -248,9 +248,8 @@ private void _testStringArray(boolean useBytes, int elements, int pre, int post) StringWriter sw = new StringWriter(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - ObjectWriteContext wctxt = ObjectWriteContext.empty(); - JsonGenerator gen = useBytes ? FACTORY.createGenerator(wctxt, bytes) - : FACTORY.createGenerator(wctxt, sw); + JsonGenerator gen = useBytes ? FACTORY.createGenerator(bytes) + : FACTORY.createGenerator(sw); gen.writeArray(values, pre, elements); gen.close(); @@ -262,9 +261,8 @@ private void _testStringArray(boolean useBytes, int elements, int pre, int post) json = sw.toString(); } - ObjectReadContext rctxt = ObjectReadContext.empty(); - JsonParser p = useBytes ? FACTORY.createParser(rctxt, bytes.toByteArray()) - : FACTORY.createParser(rctxt, json); + JsonParser p = useBytes ? FACTORY.createParser(bytes.toByteArray()) + : FACTORY.createParser(json); assertToken(JsonToken.START_ARRAY, p.nextToken()); for (int i = 0; i < elements; ++i) { JsonToken t = p.nextToken(); diff --git a/src/test/java/com/fasterxml/jackson/core/write/ArrayWriteTest.java b/src/test/java/com/fasterxml/jackson/core/write/ArrayWriteTest.java index ea52e57cce..72d1c44167 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/ArrayWriteTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/ArrayWriteTest.java @@ -1,8 +1,6 @@ package com.fasterxml.jackson.core.write; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamWriteException; -import com.fasterxml.jackson.core.json.JsonFactory; import java.io.*; @@ -13,14 +11,13 @@ public class ArrayWriteTest extends com.fasterxml.jackson.core.BaseTest { - private final JsonFactory JSON_F = newStreamFactory(); - public void testEmptyArrayWrite() + throws Exception { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); - TokenStreamContext ctxt = gen.streamWriteContext(); + JsonStreamContext ctxt = gen.getOutputContext(); assertTrue(ctxt.inRoot()); assertFalse(ctxt.inArray()); assertFalse(ctxt.inObject()); @@ -29,7 +26,7 @@ public void testEmptyArrayWrite() gen.writeStartArray(); - ctxt = gen.streamWriteContext(); + ctxt = gen.getOutputContext(); assertFalse(ctxt.inRoot()); assertTrue(ctxt.inArray()); assertFalse(ctxt.inObject()); @@ -38,7 +35,7 @@ public void testEmptyArrayWrite() gen.writeEndArray(); - ctxt = gen.streamWriteContext(); + ctxt = gen.getOutputContext(); assertTrue("Should be in root, was "+ctxt.typeDesc(), ctxt.inRoot()); assertFalse(ctxt.inArray()); assertFalse(ctxt.inObject()); @@ -55,7 +52,7 @@ public void testEmptyArrayWrite() // Ok, then array with nested empty array sw = new StringWriter(); - gen = new JsonFactory().createGenerator(ObjectWriteContext.empty(), sw); + gen = new JsonFactory().createGenerator(sw); gen.writeStartArray(); gen.writeStartArray(); gen.writeEndArray(); @@ -72,24 +69,26 @@ public void testEmptyArrayWrite() } public void testInvalidArrayWrite() + throws Exception { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); gen.writeStartArray(); // Mismatch: try { gen.writeEndObject(); fail("Expected an exception for mismatched array/object write"); - } catch (StreamWriteException e) { + } catch (JsonGenerationException e) { verifyException(e, "Current context not Object"); } gen.close(); } public void testSimpleArrayWrite() + throws Exception { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); gen.writeStartArray(); gen.writeNumber(13); gen.writeBoolean(true); @@ -97,15 +96,15 @@ public void testSimpleArrayWrite() gen.writeEndArray(); gen.close(); String docStr = sw.toString(); - JsonParser p = createParserUsingReader(docStr); - assertEquals(JsonToken.START_ARRAY, p.nextToken()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(13, p.getIntValue()); - assertEquals(JsonToken.VALUE_TRUE, p.nextToken()); - assertEquals(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals("foobar", p.getText()); - assertEquals(JsonToken.END_ARRAY, p.nextToken()); - assertEquals(null, p.nextToken()); - p.close(); + JsonParser jp = createParserUsingReader(docStr); + assertEquals(JsonToken.START_ARRAY, jp.nextToken()); + assertEquals(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertEquals(13, jp.getIntValue()); + assertEquals(JsonToken.VALUE_TRUE, jp.nextToken()); + assertEquals(JsonToken.VALUE_STRING, jp.nextToken()); + assertEquals("foobar", jp.getText()); + assertEquals(JsonToken.END_ARRAY, jp.nextToken()); + assertEquals(null, jp.nextToken()); + jp.close(); } } diff --git a/src/test/java/com/fasterxml/jackson/core/write/GeneratorBasicTest.java b/src/test/java/com/fasterxml/jackson/core/write/GeneratorBasicTest.java index e65282dd18..46c351d5b9 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/GeneratorBasicTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/GeneratorBasicTest.java @@ -13,7 +13,7 @@ public class GeneratorBasicTest extends com.fasterxml.jackson.core.BaseTest { - private final TokenStreamFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); // // // First, tests for primitive (non-structured) values @@ -27,11 +27,9 @@ public void testStringWrite() throws Exception JsonGenerator gen; ByteArrayOutputStream bout = new ByteArrayOutputStream(); if (useReader != 0) { - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), - new OutputStreamWriter(bout, "UTF-8")); + gen = JSON_F.createGenerator(new OutputStreamWriter(bout, "UTF-8")); } else { - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), - bout, JsonEncoding.UTF8); + gen = JSON_F.createGenerator(bout, JsonEncoding.UTF8); } if (writeString > 0) { gen.writeString(input); @@ -44,8 +42,7 @@ public void testStringWrite() throws Exception } gen.flush(); gen.close(); - JsonParser jp = JSON_F.createParser(ObjectReadContext.empty(), - new ByteArrayInputStream(bout.toByteArray())); + JsonParser jp = JSON_F.createParser(new ByteArrayInputStream(bout.toByteArray())); JsonToken t = jp.nextToken(); assertNotNull("Document \""+bout.toString("UTF-8")+"\" yielded no tokens", t); @@ -84,7 +81,7 @@ public void testBooleanWrite() throws Exception boolean state = (i & 1) == 0; boolean pad = (i & 2) == 0; StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); gen.writeBoolean(state); if (pad) { gen.writeRaw(" "); @@ -109,7 +106,7 @@ public void testNullWrite() for (int i = 0; i < 2; ++i) { boolean pad = (i & 1) == 0; StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); gen.writeNull(); if (pad) { gen.writeRaw(" "); @@ -142,9 +139,9 @@ private void _testRootIntsWrite(boolean useBytes) throws Exception JsonGenerator gen; if (useBytes) { - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), bytes); + gen = JSON_F.createGenerator(bytes); } else { - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + gen = JSON_F.createGenerator(sw); } gen.writeNumber(1); @@ -153,13 +150,18 @@ private void _testRootIntsWrite(boolean useBytes) throws Exception gen.close(); String docStr = useBytes ? bytes.toString("UTF-8") : sw.toString(); - try (JsonParser jp = createParserUsingReader(docStr)) { + + try { + JsonParser jp = createParserUsingReader(docStr); assertEquals(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); assertEquals(1, jp.getIntValue()); assertEquals(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); assertEquals(2, jp.getIntValue()); assertEquals(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); assertEquals(-13, jp.getIntValue()); + jp.close(); + } catch (IOException e) { + fail("Problem with document ["+docStr+"]: "+e.getMessage()); } } @@ -177,19 +179,19 @@ public void _testFieldValueWrites(boolean useBytes) throws Exception JsonGenerator gen; if (useBytes) { - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), bytes); + gen = JSON_F.createGenerator(bytes); } else { - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + gen = JSON_F.createGenerator(sw); } gen.writeStartObject(); - gen.writeNumberProperty("short", (short) 3); - gen.writeNumberProperty("int", 3); - gen.writeNumberProperty("long", 3L); - gen.writeNumberProperty("big", new BigInteger("1707")); - gen.writeNumberProperty("double", 0.25); - gen.writeNumberProperty("float", -0.25f); - gen.writeNumberProperty("decimal", new BigDecimal("17.07")); + gen.writeNumberField("short", (short) 3); + gen.writeNumberField("int", 3); + gen.writeNumberField("long", 3L); + gen.writeNumberField("big", new BigInteger("1707")); + gen.writeNumberField("double", 0.25); + gen.writeNumberField("float", -0.25f); + gen.writeNumberField("decimal", new BigDecimal("17.07")); gen.writeEndObject(); gen.close(); @@ -205,67 +207,67 @@ public void _testFieldValueWrites(boolean useBytes) throws Exception public void testOutputContext() throws Exception { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); - TokenStreamContext ctxt = gen.streamWriteContext(); + JsonGenerator gen = JSON_F.createGenerator(sw); + JsonStreamContext ctxt = gen.getOutputContext(); assertTrue(ctxt.inRoot()); gen.writeStartObject(); - assertTrue(gen.streamWriteContext().inObject()); + assertTrue(gen.getOutputContext().inObject()); - gen.writeName("a"); - assertEquals("a", gen.streamWriteContext().currentName()); + gen.writeFieldName("a"); + assertEquals("a", gen.getOutputContext().getCurrentName()); gen.writeStartArray(); - assertTrue(gen.streamWriteContext().inArray()); + assertTrue(gen.getOutputContext().inArray()); gen.writeStartObject(); - assertTrue(gen.streamWriteContext().inObject()); + assertTrue(gen.getOutputContext().inObject()); - gen.writeName("b"); - ctxt = gen.streamWriteContext(); - assertEquals("b", ctxt.currentName()); + gen.writeFieldName("b"); + ctxt = gen.getOutputContext(); + assertEquals("b", ctxt.getCurrentName()); gen.writeNumber(123); - assertEquals("b", ctxt.currentName()); + assertEquals("b", ctxt.getCurrentName()); - gen.writeName("c"); - assertEquals("c", gen.streamWriteContext().currentName()); + gen.writeFieldName("c"); + assertEquals("c", gen.getOutputContext().getCurrentName()); gen.writeNumber(5); -// assertEquals("c", gen.getOutputContext().currentName()); +// assertEquals("c", gen.getOutputContext().getCurrentName()); - gen.writeName("d"); - assertEquals("d", gen.streamWriteContext().currentName()); + gen.writeFieldName("d"); + assertEquals("d", gen.getOutputContext().getCurrentName()); gen.writeStartArray(); - ctxt = gen.streamWriteContext(); + ctxt = gen.getOutputContext(); assertTrue(ctxt.inArray()); assertEquals(0, ctxt.getCurrentIndex()); assertEquals(0, ctxt.getEntryCount()); gen.writeBoolean(true); - ctxt = gen.streamWriteContext(); + ctxt = gen.getOutputContext(); assertTrue(ctxt.inArray()); // NOTE: index still refers to currently output entry assertEquals(0, ctxt.getCurrentIndex()); assertEquals(1, ctxt.getEntryCount()); gen.writeNumber(3); - ctxt = gen.streamWriteContext(); + ctxt = gen.getOutputContext(); assertTrue(ctxt.inArray()); assertEquals(1, ctxt.getCurrentIndex()); assertEquals(2, ctxt.getEntryCount()); gen.writeEndArray(); - assertTrue(gen.streamWriteContext().inObject()); + assertTrue(gen.getOutputContext().inObject()); gen.writeEndObject(); - assertTrue(gen.streamWriteContext().inArray()); + assertTrue(gen.getOutputContext().inArray()); gen.writeEndArray(); - assertTrue(gen.streamWriteContext().inObject()); + assertTrue(gen.getOutputContext().inObject()); gen.writeEndObject(); - assertTrue(gen.streamWriteContext().inRoot()); + assertTrue(gen.getOutputContext().inRoot()); gen.close(); } @@ -273,13 +275,13 @@ public void testOutputContext() throws Exception public void testGetOutputTarget() throws Exception { OutputStream out = new ByteArrayOutputStream(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), out); - assertSame(out, gen.streamWriteOutputTarget()); + JsonGenerator gen = JSON_F.createGenerator(out); + assertSame(out, gen.getOutputTarget()); gen.close(); StringWriter sw = new StringWriter(); - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); - assertSame(sw, gen.streamWriteOutputTarget()); + gen = JSON_F.createGenerator(sw); + assertSame(sw, gen.getOutputTarget()); gen.close(); } @@ -287,12 +289,12 @@ public void testGetOutputTarget() throws Exception public void testGetOutputBufferd() throws Exception { OutputStream out = new ByteArrayOutputStream(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), out); + JsonGenerator gen = JSON_F.createGenerator(out); _testOutputBuffered(gen); gen.close(); StringWriter sw = new StringWriter(); - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + gen = JSON_F.createGenerator(sw); _testOutputBuffered(gen); gen.close(); } @@ -301,13 +303,13 @@ private void _testOutputBuffered(JsonGenerator gen) throws IOException { gen.writeStartArray(); // 1 byte gen.writeNumber(1234); // 4 bytes - assertEquals(5, gen.streamWriteOutputBuffered()); + assertEquals(5, gen.getOutputBuffered()); gen.flush(); - assertEquals(0, gen.streamWriteOutputBuffered()); + assertEquals(0, gen.getOutputBuffered()); gen.writeEndArray(); - assertEquals(1, gen.streamWriteOutputBuffered()); + assertEquals(1, gen.getOutputBuffered()); gen.close(); - assertEquals(0, gen.streamWriteOutputBuffered()); + assertEquals(0, gen.getOutputBuffered()); } /* @@ -334,29 +336,29 @@ private void doTestIntValueWrite(boolean pad, boolean useBytes) throws Exception if (useBytes) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator gen = JSON_F.createGenerator(bytes); gen.writeNumber(VALUE); if (pad) { gen.writeRaw(" "); } gen.close(); docStr = bytes.toString("UTF-8"); - p = JSON_F.createParser(ObjectReadContext.empty(), bytes.toByteArray()); + p = JSON_F.createParser(bytes.toByteArray()); } else { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); gen.writeNumber(VALUE); if (pad) { gen.writeRaw(" "); } gen.close(); docStr = sw.toString(); - p = JSON_F.createParser(ObjectReadContext.empty(), docStr); + p = JSON_F.createParser(docStr); } JsonToken t = null; try { t = p.nextToken(); - } catch (Exception e) { + } catch (IOException e) { fail("Problem with value "+VALUE+", document ["+docStr+"]: "+e.getMessage()); } assertNotNull("Document \""+docStr+"\" yielded no tokens", t); @@ -390,29 +392,29 @@ private void doTestLongValueWrite(boolean pad, boolean useBytes) throws Exceptio if (useBytes) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), bytes); + JsonGenerator gen = JSON_F.createGenerator(bytes); gen.writeNumber(VALUE); if (pad) { gen.writeRaw(" "); } gen.close(); docStr = bytes.toString("UTF-8"); - p = JSON_F.createParser(ObjectReadContext.empty(), bytes.toByteArray()); + p = JSON_F.createParser(bytes.toByteArray()); } else { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); gen.writeNumber(VALUE); if (pad) { gen.writeRaw(" "); } gen.close(); docStr = sw.toString(); - p = JSON_F.createParser(ObjectReadContext.empty(), docStr); + p = JSON_F.createParser(docStr); } JsonToken t = null; try { t = p.nextToken(); - } catch (Exception e) { + } catch (IOException e) { fail("Problem with number "+VALUE+", document ["+docStr+"]: "+e.getMessage()); } assertNotNull("Document \""+docStr+"\" yielded no tokens", t); diff --git a/src/test/java/com/fasterxml/jackson/core/write/GeneratorCloseTest.java b/src/test/java/com/fasterxml/jackson/core/write/GeneratorCloseTest.java index 24e590ae1e..d3739a41c4 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/GeneratorCloseTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/GeneratorCloseTest.java @@ -1,8 +1,6 @@ package com.fasterxml.jackson.core.write; - import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.ByteOutputStreamForTesting; import com.fasterxml.jackson.core.testsupport.StringWriterForTesting; @@ -22,6 +20,12 @@ */ public class GeneratorCloseTest extends BaseTest { + /* + /********************************************************** + /* Unit tests + /********************************************************** + */ + /** * This unit test checks the default behaviour; with no auto-close, no * automatic closing should occur, nor explicit one unless specific @@ -32,49 +36,49 @@ public void testNoAutoCloseGenerator() throws Exception JsonFactory f = new JsonFactory(); // Check the default settings - assertTrue(f.isEnabled(StreamWriteFeature.AUTO_CLOSE_TARGET)); + assertTrue(f.isEnabled(JsonGenerator.Feature.AUTO_CLOSE_TARGET)); // then change - f = f.rebuild().disable(StreamWriteFeature.AUTO_CLOSE_TARGET).build(); - assertFalse(f.isEnabled(StreamWriteFeature.AUTO_CLOSE_TARGET)); + f.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET); + assertFalse(f.isEnabled(JsonGenerator.Feature.AUTO_CLOSE_TARGET)); @SuppressWarnings("resource") - StringWriterForTesting output = new StringWriterForTesting(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), output); + ByteOutputStreamForTesting output = new ByteOutputStreamForTesting(); + JsonGenerator jg = f.createGenerator(output); // shouldn't be closed to begin with... assertFalse(output.isClosed()); - g.writeNumber(39); + jg.writeNumber(39); // regular close won't close it either: - g.close(); + jg.close(); assertFalse(output.isClosed()); } public void testCloseGenerator() throws Exception { - JsonFactory f = JsonFactory.builder() - .enable(StreamWriteFeature.AUTO_CLOSE_TARGET).build(); + JsonFactory f = new JsonFactory(); + f.enable(JsonGenerator.Feature.AUTO_CLOSE_TARGET); @SuppressWarnings("resource") - StringWriterForTesting output = new StringWriterForTesting(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), output); + ByteOutputStreamForTesting output = new ByteOutputStreamForTesting(); + JsonGenerator jg = f.createGenerator(output); // shouldn't be closed to begin with... assertFalse(output.isClosed()); - g.writeNumber(39); + jg.writeNumber(39); // but close() should now close the writer - g.close(); + jg.close(); assertTrue(output.isClosed()); } public void testNoAutoCloseOutputStream() throws Exception { - JsonFactory f = JsonFactory.builder() - .disable(StreamWriteFeature.AUTO_CLOSE_TARGET).build(); + JsonFactory f = new JsonFactory(); + f.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET); @SuppressWarnings("resource") ByteOutputStreamForTesting output = new ByteOutputStreamForTesting(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), output, JsonEncoding.UTF8); + JsonGenerator jg = f.createGenerator(output, JsonEncoding.UTF8); assertFalse(output.isClosed()); - g.writeNumber(39); - g.close(); + jg.writeNumber(39); + jg.close(); assertFalse(output.isClosed()); } @@ -87,16 +91,16 @@ public void testAutoCloseArraysAndObjects() StringWriter sw = new StringWriter(); // First, test arrays: - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), sw); - g.writeStartArray(); - g.close(); + JsonGenerator jg = f.createGenerator(sw); + jg.writeStartArray(); + jg.close(); assertEquals("[]", sw.toString()); // Then objects sw = new StringWriter(); - g = f.createGenerator(ObjectWriteContext.empty(), sw); - g.writeStartObject(); - g.close(); + jg = f.createGenerator(sw); + jg.writeStartObject(); + jg.close(); assertEquals("{}", sw.toString()); } @@ -107,17 +111,17 @@ public void testNoAutoCloseArraysAndObjects() .disable(StreamWriteFeature.AUTO_CLOSE_CONTENT) .build(); StringWriter sw = new StringWriter(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), sw); - g.writeStartArray(); - g.close(); + JsonGenerator jg = f.createGenerator(sw); + jg.writeStartArray(); + jg.close(); // shouldn't close assertEquals("[", sw.toString()); // Then objects sw = new StringWriter(); - g = f.createGenerator(ObjectWriteContext.empty(), sw); - g.writeStartObject(); - g.close(); + jg = f.createGenerator(sw); + jg.writeStartObject(); + jg.close(); assertEquals("{", sw.toString()); } @@ -127,49 +131,49 @@ public void testAutoFlushOrNot() throws Exception JsonFactory f = new JsonFactory(); assertTrue(f.isEnabled(StreamWriteFeature.FLUSH_PASSED_TO_STREAM)); StringWriterForTesting sw = new StringWriterForTesting(); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), sw); - g.writeStartArray(); - g.writeEndArray(); + JsonGenerator jg = f.createGenerator(sw); + jg.writeStartArray(); + jg.writeEndArray(); assertEquals(0, sw.flushCount); - g.flush(); + jg.flush(); assertEquals(1, sw.flushCount); - g.close(); + jg.close(); // ditto with stream ByteOutputStreamForTesting bytes = new ByteOutputStreamForTesting(); - g = f.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); - g.writeStartArray(); - g.writeEndArray(); + jg = f.createGenerator(bytes, JsonEncoding.UTF8); + jg.writeStartArray(); + jg.writeEndArray(); assertEquals(0, bytes.flushCount); - g.flush(); + jg.flush(); assertEquals(1, bytes.flushCount); assertEquals(2, bytes.toByteArray().length); - g.close(); + jg.close(); // then disable and we should not see flushing again... - f = f.rebuild() - .disable(StreamWriteFeature.FLUSH_PASSED_TO_STREAM) - .build(); + f = JsonFactory.builder() + .disable(StreamWriteFeature.FLUSH_PASSED_TO_STREAM) + .build(); // first with a Writer sw = new StringWriterForTesting(); - g = f.createGenerator(ObjectWriteContext.empty(), sw); - g.writeStartArray(); - g.writeEndArray(); + jg = f.createGenerator(sw); + jg.writeStartArray(); + jg.writeEndArray(); assertEquals(0, sw.flushCount); - g.flush(); + jg.flush(); assertEquals(0, sw.flushCount); - g.close(); + jg.close(); assertEquals("[]", sw.toString()); // and then with OutputStream bytes = new ByteOutputStreamForTesting(); - g = f.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); - g.writeStartArray(); - g.writeEndArray(); + jg = f.createGenerator(bytes, JsonEncoding.UTF8); + jg.writeStartArray(); + jg.writeEndArray(); assertEquals(0, bytes.flushCount); - g.flush(); + jg.flush(); assertEquals(0, bytes.flushCount); - g.close(); + jg.close(); assertEquals(2, bytes.toByteArray().length); } } diff --git a/src/test/java/com/fasterxml/jackson/core/write/GeneratorCopyTest.java b/src/test/java/com/fasterxml/jackson/core/write/GeneratorCopyTest.java index dff3b80747..0def93b985 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/GeneratorCopyTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/GeneratorCopyTest.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import java.io.*; @@ -20,9 +19,9 @@ public void testCopyRootTokens() { JsonFactory jf = JSON_F; final String DOC = "\"text\\non two lines\" true false 2.0 null 1234567890123 "; - JsonParser jp = jf.createParser(ObjectReadContext.empty(), new StringReader(DOC)); + JsonParser jp = jf.createParser(new StringReader(DOC)); StringWriter sw = new StringWriter(); - JsonGenerator gen = jf.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = jf.createGenerator(sw); JsonToken t; @@ -42,9 +41,9 @@ public void testCopyArrayTokens() { JsonFactory jf = JSON_F; final String DOC = "123 [ 1, null, [ false, 1234567890124 ] ]"; - JsonParser jp = jf.createParser(ObjectReadContext.empty(), new StringReader(DOC)); + JsonParser jp = jf.createParser(new StringReader(DOC)); StringWriter sw = new StringWriter(); - JsonGenerator gen = jf.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = jf.createGenerator(sw); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); gen.copyCurrentEvent(jp); @@ -68,9 +67,9 @@ public void testCopyObjectTokens() { JsonFactory jf = JSON_F; final String DOC = "{ \"a\":1, \"b\":[{ \"c\" : null, \"d\" : 0.25 }] }"; - JsonParser jp = jf.createParser(ObjectReadContext.empty(), new StringReader(DOC)); + JsonParser jp = jf.createParser(new StringReader(DOC)); StringWriter sw = new StringWriter(); - JsonGenerator gen = jf.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = jf.createGenerator(sw); assertToken(JsonToken.START_OBJECT, jp.nextToken()); gen.copyCurrentStructure(jp); @@ -81,12 +80,12 @@ public void testCopyObjectTokens() assertEquals("{\"a\":1,\"b\":[{\"c\":null,\"d\":0.25}]}", sw.toString()); // but also sort of special case of field name plus value - jp = jf.createParser(ObjectReadContext.empty(), new StringReader("{\"a\":1,\"b\":null}")); + jp = jf.createParser(new StringReader("{\"a\":1,\"b\":null}")); sw = new StringWriter(); - gen = jf.createGenerator(ObjectWriteContext.empty(), sw); + gen = jf.createGenerator(sw); gen.writeStartObject(); assertToken(JsonToken.START_OBJECT, jp.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, jp.nextToken()); + assertToken(JsonToken.FIELD_NAME, jp.nextToken()); gen.copyCurrentStructure(jp); gen.writeEndObject(); diff --git a/src/test/java/com/fasterxml/jackson/core/write/GeneratorDupHandlingTest.java b/src/test/java/com/fasterxml/jackson/core/write/GeneratorDupHandlingTest.java index a4ec2a2e70..8a7b7074c8 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/GeneratorDupHandlingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/GeneratorDupHandlingTest.java @@ -3,73 +3,98 @@ import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamWriteException; public class GeneratorDupHandlingTest extends com.fasterxml.jackson.core.BaseTest { - public void testSimpleDupsEagerlyBytes() { - _testSimpleDups(true, newStreamFactory()); + public void testSimpleDupsEagerlyBytes() throws Exception { + _testSimpleDups(true, false, new JsonFactory()); } - public void testSimpleDupsEagerlyChars() { - _testSimpleDups(false, newStreamFactory()); + public void testSimpleDupsEagerlyChars() throws Exception { + _testSimpleDups(false, false, new JsonFactory()); + } + + // Testing ability to enable checking after construction of + // generator, not just via JsonFactory + public void testSimpleDupsLazilyBytes() throws Exception { + final JsonFactory f = new JsonFactory(); + assertFalse(f.isEnabled(JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION)); + _testSimpleDups(true, true, f); + } + + public void testSimpleDupsLazilyChars() throws Exception { + final JsonFactory f = new JsonFactory(); + _testSimpleDups(false, true, f); } @SuppressWarnings("resource") - protected void _testSimpleDups(boolean useStream, TokenStreamFactory f) + protected void _testSimpleDups(boolean useStream, boolean lazySetting, JsonFactory f) + throws Exception { // First: fine, when not checking - _writeSimple0(_generator(f, useStream), "a"); - _writeSimple1(_generator(f, useStream), "b"); + if (!lazySetting) { + _writeSimple0(_generator(f, useStream), "a"); + _writeSimple1(_generator(f, useStream), "b"); + } // but not when checking JsonGenerator g1; - f = f.rebuild().enable(StreamWriteFeature.STRICT_DUPLICATE_DETECTION).build(); - g1 = _generator(f, useStream); + if (lazySetting) { + g1 = _generator(f, useStream); + g1.enable(JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION); + } else { + f.enable(JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION); + g1 = _generator(f, useStream); + } try { _writeSimple0(g1, "a"); fail("Should have gotten exception"); - } catch (StreamWriteException e) { - verifyException(e, "duplicate Object property \"a\""); + } catch (JsonGenerationException e) { + verifyException(e, "duplicate field 'a'"); } JsonGenerator g2; - g2 = _generator(f, useStream); + if (lazySetting) { + g2 = _generator(f, useStream); + g2.enable(JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION); + } else { + g2 = _generator(f, useStream); + } try { _writeSimple1(g2, "x"); fail("Should have gotten exception"); - } catch (StreamWriteException e) { - verifyException(e, "duplicate Object property \"x\""); + } catch (JsonGenerationException e) { + verifyException(e, "duplicate field 'x'"); } } - protected JsonGenerator _generator(TokenStreamFactory f, boolean useStream) + protected JsonGenerator _generator(JsonFactory f, boolean useStream) throws IOException { return useStream ? - f.createGenerator(ObjectWriteContext.empty(), new ByteArrayOutputStream()) - : f.createGenerator(ObjectWriteContext.empty(), new StringWriter()); + f.createGenerator(new ByteArrayOutputStream()) + : f.createGenerator(new StringWriter()); } - protected void _writeSimple0(JsonGenerator g, String name) + protected void _writeSimple0(JsonGenerator g, String name) throws IOException { g.writeStartObject(); - g.writeNumberProperty(name, 1); - g.writeNumberProperty(name, 2); + g.writeNumberField(name, 1); + g.writeNumberField(name, 2); g.writeEndObject(); g.close(); } - protected void _writeSimple1(JsonGenerator g, String name) + protected void _writeSimple1(JsonGenerator g, String name) throws IOException { g.writeStartArray(); g.writeNumber(3); g.writeStartObject(); - g.writeNumberProperty("foo", 1); - g.writeNumberProperty("bar", 1); - g.writeNumberProperty(name, 1); - g.writeNumberProperty("bar2", 1); - g.writeNumberProperty(name, 2); + g.writeNumberField("foo", 1); + g.writeNumberField("bar", 1); + g.writeNumberField(name, 1); + g.writeNumberField("bar2", 1); + g.writeNumberField(name, 2); g.writeEndObject(); g.writeEndArray(); g.close(); diff --git a/src/test/java/com/fasterxml/jackson/core/write/GeneratorMiscTest.java b/src/test/java/com/fasterxml/jackson/core/write/GeneratorMiscTest.java index a04fa7e917..9546e60e2b 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/GeneratorMiscTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/GeneratorMiscTest.java @@ -1,10 +1,11 @@ package com.fasterxml.jackson.core.write; import java.io.*; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.concurrent.atomic.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamWriteException; -import com.fasterxml.jackson.core.json.JsonFactory; /** * Set of basic unit tests for verifying basic generator @@ -14,7 +15,7 @@ public class GeneratorMiscTest extends com.fasterxml.jackson.core.BaseTest { - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); /* /********************************************************** @@ -22,14 +23,13 @@ public class GeneratorMiscTest /********************************************************** */ - public void testIsClosed() + public void testIsClosed() throws IOException { for (int i = 0; i < 2; ++i) { boolean stream = ((i & 1) == 0); - ObjectWriteContext writeCtxt = ObjectWriteContext.empty(); JsonGenerator jg = stream ? - JSON_F.createGenerator(writeCtxt, new StringWriter()) - : JSON_F.createGenerator(writeCtxt, new ByteArrayOutputStream(), JsonEncoding.UTF8) + JSON_F.createGenerator(new StringWriter()) + : JSON_F.createGenerator(new ByteArrayOutputStream(), JsonEncoding.UTF8) ; assertFalse(jg.isClosed()); jg.writeStartArray(); @@ -43,16 +43,60 @@ public void testIsClosed() } } + // Also, "very simple" objects are supported even without Codec: + public void testSimpleWriteObject() throws IOException + { + // note: NOT mapping factory, for this test + StringWriter sw = new StringWriter(); + JsonGenerator gen = JSON_F.createGenerator(sw); + gen.writeStartArray(); + + // simple wrappers first + gen.writeObject(1); + gen.writeObject((short) -2); + gen.writeObject((long) 3); + gen.writeObject((byte) -4); + gen.writeObject(0.25); + gen.writeObject(-0.125f); + gen.writeObject(Boolean.TRUE); + gen.close(); + String act = sw.toString().trim(); + assertEquals("[1,-2,3,-4,0.25,-0.125,true]", act); + + // then other basic types + sw = new StringWriter(); + gen = JSON_F.createGenerator(sw); + gen.writeStartArray(); + gen.writeObject(BigInteger.valueOf(1234)); + gen.writeObject(new BigDecimal(0.5)); + gen.writeEndArray(); + gen.close(); + act = sw.toString().trim(); + assertEquals("[1234,0.5]", act); + + // then Atomic types + sw = new StringWriter(); + gen = JSON_F.createGenerator(sw); + gen.writeStartArray(); + gen.writeObject(new AtomicBoolean(false)); + gen.writeObject(new AtomicInteger(13)); + gen.writeObject(new AtomicLong(-127L)); + gen.writeEndArray(); + gen.close(); + act = sw.toString().trim(); + assertEquals("[false,13,-127]", act); + } + /* /********************************************************** /* Tests for raw output /********************************************************** */ - public void testRaw() + public void testRaw() throws IOException { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); gen.writeStartArray(); gen.writeRaw("-123, true"); gen.writeRaw(", \"x\" "); @@ -71,10 +115,10 @@ public void testRaw() jp.close(); } - public void testRawValue() + public void testRawValue() throws IOException { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); gen.writeStartArray(); gen.writeRawValue("7"); gen.writeRawValue("[ null ]"); @@ -105,34 +149,29 @@ public void testRawValue() /** * Unit test that tries to trigger buffer-boundary conditions */ - public void testLongerObjects() + public void testLongerObjects() throws Exception { _testLongerObjects(JSON_F, 0); _testLongerObjects(JSON_F, 1); _testLongerObjects(JSON_F, 2); } - public void _testLongerObjects(JsonFactory jf, int mode) + public void _testLongerObjects(JsonFactory jf, int mode) throws Exception { JsonGenerator g; ByteArrayOutputStream bout = new ByteArrayOutputStream(200); - final ObjectWriteContext writeCtxt = ObjectWriteContext.empty(); switch (mode) { case 0: - try { - g = jf.createGenerator(writeCtxt, new OutputStreamWriter(bout, "UTF-8")); - } catch (IOException e) { - throw new RuntimeException(e); - } + g = jf.createGenerator(new OutputStreamWriter(bout, "UTF-8")); break; case 1: - g = jf.createGenerator(writeCtxt, bout, JsonEncoding.UTF8); + g = jf.createGenerator(bout, JsonEncoding.UTF8); break; case 2: { DataOutputStream dout = new DataOutputStream(bout); - g = jf.createGenerator(writeCtxt, (DataOutput) dout); + g = jf.createGenerator((DataOutput) dout); } break; @@ -154,7 +193,7 @@ public void _testLongerObjects(JsonFactory jf, int mode) } else { name = "__"+index+letter; } - g.writeName(name); + g.writeFieldName(name); g.writeNumber(index-1); } g.writeRaw('\n'); @@ -164,12 +203,12 @@ public void _testLongerObjects(JsonFactory jf, int mode) g.close(); byte[] json = bout.toByteArray(); - JsonParser jp = jf.createParser(ObjectReadContext.empty(), json); + JsonParser jp = jf.createParser(json); assertToken(JsonToken.START_OBJECT, jp.nextToken()); for (int rounds = 0; rounds < 1500; ++rounds) { for (int letter = 'a'; letter <= 'z'; ++letter) { for (int index = 0; index < 20; ++index) { - assertToken(JsonToken.PROPERTY_NAME, jp.nextToken()); + assertToken(JsonToken.FIELD_NAME, jp.nextToken()); String name; if (letter > 'f') { name = "X"+letter+index; @@ -178,7 +217,7 @@ public void _testLongerObjects(JsonFactory jf, int mode) } else { name = "__"+index+letter; } - assertEquals(name, jp.currentName()); + assertEquals(name, jp.getCurrentName()); assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); assertEquals(index-1, jp.getIntValue()); } @@ -195,31 +234,31 @@ public void _testLongerObjects(JsonFactory jf, int mode) */ // NOTE: test for binary data under `base64/` tests - public void testAsEmbedded() + public void testAsEmbedded() throws Exception { JsonGenerator g; StringWriter sw = new StringWriter(); - g = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + g = JSON_F.createGenerator(sw); g.writeEmbeddedObject(null); g.close(); assertEquals("null", sw.toString()); ByteArrayOutputStream bytes = new ByteArrayOutputStream(100); - g = JSON_F.createGenerator(ObjectWriteContext.empty(), bytes); + g = JSON_F.createGenerator(bytes); g.writeEmbeddedObject(null); g.close(); - assertEquals("null", utf8String(bytes)); + assertEquals("null", bytes.toString("UTF-8")); // also, for fun, try illegal unknown thingy try { - g = JSON_F.createGenerator(ObjectWriteContext.empty(), bytes); + g = JSON_F.createGenerator(bytes); // try writing a Class object g.writeEmbeddedObject(getClass()); fail("Expected an exception"); g.close(); // never gets here - } catch (StreamWriteException e) { + } catch (JsonGenerationException e) { verifyException(e, "No native support for"); } } diff --git a/src/test/java/com/fasterxml/jackson/core/write/ObjectWriteTest.java b/src/test/java/com/fasterxml/jackson/core/write/ObjectWriteTest.java index 80f5e61002..15fc5f0e4e 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/ObjectWriteTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/ObjectWriteTest.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.core.write; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamWriteException; import java.io.*; import java.math.BigDecimal; @@ -14,14 +13,13 @@ public class ObjectWriteTest extends BaseTest { - final TokenStreamFactory JSON_F = newStreamFactory(); - public void testEmptyObjectWrite() + throws Exception { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); - TokenStreamContext ctxt = gen.streamWriteContext(); + JsonStreamContext ctxt = gen.getOutputContext(); assertTrue(ctxt.inRoot()); assertFalse(ctxt.inArray()); assertFalse(ctxt.inObject()); @@ -30,7 +28,7 @@ public void testEmptyObjectWrite() gen.writeStartObject(); - ctxt = gen.streamWriteContext(); + ctxt = gen.getOutputContext(); assertFalse(ctxt.inRoot()); assertFalse(ctxt.inArray()); assertTrue(ctxt.inObject()); @@ -39,7 +37,7 @@ public void testEmptyObjectWrite() gen.writeEndObject(); - ctxt = gen.streamWriteContext(); + ctxt = gen.getOutputContext(); assertTrue(ctxt.inRoot()); assertFalse(ctxt.inArray()); assertFalse(ctxt.inObject()); @@ -50,206 +48,217 @@ public void testEmptyObjectWrite() gen.close(); String docStr = sw.toString(); - JsonParser p = createParserUsingReader(docStr); - assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.END_OBJECT, p.nextToken()); - assertEquals(null, p.nextToken()); - p.close(); + JsonParser jp = createParserUsingReader(docStr); + assertEquals(JsonToken.START_OBJECT, jp.nextToken()); + assertEquals(JsonToken.END_OBJECT, jp.nextToken()); + assertEquals(null, jp.nextToken()); + jp.close(); } public void testInvalidObjectWrite() + throws Exception { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); gen.writeStartObject(); // Mismatch: try { gen.writeEndArray(); fail("Expected an exception for mismatched array/object write"); - } catch (StreamWriteException e) { + } catch (JsonGenerationException e) { verifyException(e, "Current context not Array"); } gen.close(); } public void testSimpleObjectWrite() + throws Exception { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); gen.writeStartObject(); - gen.writeName("first"); + gen.writeFieldName("first"); gen.writeNumber(-901); - gen.writeName("sec"); + gen.writeFieldName("sec"); gen.writeBoolean(false); - gen.writeName("3rd!"); // JSON field names are just strings, not ids with restrictions + gen.writeFieldName("3rd!"); // JSON field names are just strings, not ids with restrictions gen.writeString("yee-haw"); gen.writeEndObject(); gen.close(); String docStr = sw.toString(); - JsonParser p = createParserUsingReader(docStr); - assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("first", p.getText()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(-901, p.getIntValue()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("sec", p.getText()); - assertEquals(JsonToken.VALUE_FALSE, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("3rd!", p.getText()); - assertEquals(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals("yee-haw", p.getText()); - assertEquals(JsonToken.END_OBJECT, p.nextToken()); - assertEquals(null, p.nextToken()); - p.close(); + JsonParser jp = createParserUsingReader(docStr); + assertEquals(JsonToken.START_OBJECT, jp.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("first", jp.getText()); + assertEquals(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertEquals(-901, jp.getIntValue()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("sec", jp.getText()); + assertEquals(JsonToken.VALUE_FALSE, jp.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("3rd!", jp.getText()); + assertEquals(JsonToken.VALUE_STRING, jp.nextToken()); + assertEquals("yee-haw", jp.getText()); + assertEquals(JsonToken.END_OBJECT, jp.nextToken()); + assertEquals(null, jp.nextToken()); + jp.close(); } + /** + * Methods to test functionality added for [JACKSON-26] + */ public void testConvenienceMethods() + throws Exception { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); gen.writeStartObject(); final String TEXT = "\"some\nString!\""; - gen.writeNullProperty("null"); - gen.writeBooleanProperty("bt", true); - gen.writeBooleanProperty("bf", false); - gen.writeNumberProperty("short", (short) -12345); - gen.writeNumberProperty("int", Integer.MIN_VALUE + 1707); - gen.writeNumberProperty("long", Integer.MIN_VALUE - 1707L); - gen.writeNumberProperty("big", BigInteger.valueOf(Long.MIN_VALUE).subtract(BigInteger.valueOf(1707))); - gen.writeNumberProperty("float", 17.07F); - gen.writeNumberProperty("double", 17.07); - gen.writeNumberProperty("dec", new BigDecimal("0.1")); - - gen.writeObjectPropertyStart("ob"); - gen.writeStringProperty("str", TEXT); + gen.writeNullField("null"); + gen.writeBooleanField("bt", true); + gen.writeBooleanField("bf", false); + gen.writeNumberField("short", (short) -12345); + gen.writeNumberField("int", Integer.MIN_VALUE + 1707); + gen.writeNumberField("long", Integer.MIN_VALUE - 1707L); + gen.writeNumberField("big", BigInteger.valueOf(Long.MIN_VALUE).subtract(BigInteger.valueOf(1707))); + gen.writeNumberField("float", 17.07F); + gen.writeNumberField("double", 17.07); + gen.writeNumberField("dec", new BigDecimal("0.1")); + + gen.writeObjectFieldStart("ob"); + gen.writeStringField("str", TEXT); gen.writeEndObject(); - gen.writeArrayPropertyStart("arr"); + gen.writeArrayFieldStart("arr"); gen.writeEndArray(); gen.writeEndObject(); gen.close(); String docStr = sw.toString(); - JsonParser p = createParserUsingReader(docStr); - assertEquals(JsonToken.START_OBJECT, p.nextToken()); + JsonParser jp = createParserUsingReader(docStr); + assertEquals(JsonToken.START_OBJECT, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("null", p.getText()); - assertEquals(JsonToken.VALUE_NULL, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("null", jp.getText()); + assertEquals(JsonToken.VALUE_NULL, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("bt", p.getText()); - assertEquals(JsonToken.VALUE_TRUE, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("bt", jp.getText()); + assertEquals(JsonToken.VALUE_TRUE, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("bf", p.getText()); - assertEquals(JsonToken.VALUE_FALSE, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("bf", jp.getText()); + assertEquals(JsonToken.VALUE_FALSE, jp.nextToken()); //Short parsed as int - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("short", p.getText()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("int", p.getText()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonParser.NumberType.INT, p.getNumberType()); - - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("long", p.getText()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonParser.NumberType.LONG, p.getNumberType()); - - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("big", p.getText()); - assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); - assertEquals(JsonParser.NumberType.BIG_INTEGER, p.getNumberType()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("short", jp.getText()); + assertEquals(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertEquals(JsonParser.NumberType.INT, jp.getNumberType()); + + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("int", jp.getText()); + assertEquals(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertEquals(JsonParser.NumberType.INT, jp.getNumberType()); + + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("long", jp.getText()); + assertEquals(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertEquals(JsonParser.NumberType.LONG, jp.getNumberType()); + + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("big", jp.getText()); + assertEquals(JsonToken.VALUE_NUMBER_INT, jp.nextToken()); + assertEquals(JsonParser.NumberType.BIG_INTEGER, jp.getNumberType()); //All floating point types parsed as double - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("float", p.getText()); - assertEquals(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); - assertEquals(JsonParser.NumberType.DOUBLE, p.getNumberType()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("float", jp.getText()); + assertEquals(JsonToken.VALUE_NUMBER_FLOAT, jp.nextToken()); + assertEquals(JsonParser.NumberType.DOUBLE, jp.getNumberType()); //All floating point types parsed as double - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("double", p.getText()); - assertEquals(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); - assertEquals(JsonParser.NumberType.DOUBLE, p.getNumberType()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("double", jp.getText()); + assertEquals(JsonToken.VALUE_NUMBER_FLOAT, jp.nextToken()); + assertEquals(JsonParser.NumberType.DOUBLE, jp.getNumberType()); //All floating point types parsed as double - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("dec", p.getText()); - assertEquals(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); - assertEquals(JsonParser.NumberType.DOUBLE, p.getNumberType()); - - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("ob", p.getText()); - assertEquals(JsonToken.START_OBJECT, p.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - - assertEquals("str", p.getText()); - assertEquals(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals(TEXT, getAndVerifyText(p)); - assertEquals(JsonToken.END_OBJECT, p.nextToken()); - - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("arr", p.getText()); - assertEquals(JsonToken.START_ARRAY, p.nextToken()); - assertEquals(JsonToken.END_ARRAY, p.nextToken()); - - assertEquals(JsonToken.END_OBJECT, p.nextToken()); - assertEquals(null, p.nextToken()); - p.close(); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("dec", jp.getText()); + assertEquals(JsonToken.VALUE_NUMBER_FLOAT, jp.nextToken()); + assertEquals(JsonParser.NumberType.DOUBLE, jp.getNumberType()); + + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("ob", jp.getText()); + assertEquals(JsonToken.START_OBJECT, jp.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + + assertEquals("str", jp.getText()); + assertEquals(JsonToken.VALUE_STRING, jp.nextToken()); + assertEquals(TEXT, getAndVerifyText(jp)); + assertEquals(JsonToken.END_OBJECT, jp.nextToken()); + + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("arr", jp.getText()); + assertEquals(JsonToken.START_ARRAY, jp.nextToken()); + assertEquals(JsonToken.END_ARRAY, jp.nextToken()); + + assertEquals(JsonToken.END_OBJECT, jp.nextToken()); + assertEquals(null, jp.nextToken()); + jp.close(); } + /** + * Tests to cover [JACKSON-164] + */ public void testConvenienceMethodsWithNulls() + throws Exception { StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); gen.writeStartObject(); - gen.writeStringProperty("str", null); - gen.writeNumberProperty("big", (BigInteger) null); - gen.writeNumberProperty("dec", (BigDecimal) null); - gen.writePOJOProperty("obj", null); - gen.writeBinaryProperty("bin", new byte[] { 1, 2 }); + gen.writeStringField("str", null); + gen.writeNumberField("big", (BigInteger) null); + gen.writeNumberField("dec", (BigDecimal) null); + gen.writeObjectField("obj", null); + gen.writeBinaryField("bin", new byte[] { 1, 2 }); gen.writeEndObject(); gen.close(); String docStr = sw.toString(); - JsonParser p = createParserUsingReader(docStr); - assertEquals(JsonToken.START_OBJECT, p.nextToken()); + JsonParser jp = createParserUsingReader(docStr); + assertEquals(JsonToken.START_OBJECT, jp.nextToken()); + + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("str", jp.getCurrentName()); + assertEquals(JsonToken.VALUE_NULL, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("str", p.currentName()); - assertEquals(JsonToken.VALUE_NULL, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("big", p.currentName()); - assertEquals(JsonToken.VALUE_NULL, p.nextToken()); + assertEquals("big", jp.currentName()); + assertEquals(JsonToken.VALUE_NULL, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("dec", p.currentName()); - assertEquals(JsonToken.VALUE_NULL, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("dec", jp.currentName()); + assertEquals(JsonToken.VALUE_NULL, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("obj", p.currentName()); - assertEquals(JsonToken.VALUE_NULL, p.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("obj", jp.getCurrentName()); + assertEquals(JsonToken.VALUE_NULL, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("bin", p.currentName()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); + assertEquals("bin", jp.getCurrentName()); // no native binary indicator in JSON, so: - assertEquals(JsonToken.VALUE_STRING, p.nextToken()); - assertEquals("AQI=", p.getText()); + assertEquals(JsonToken.VALUE_STRING, jp.nextToken()); + assertEquals("AQI=", jp.getText()); - assertEquals(JsonToken.END_OBJECT, p.nextToken()); - p.close(); + assertEquals(JsonToken.END_OBJECT, jp.nextToken()); + jp.close(); } } diff --git a/src/test/java/com/fasterxml/jackson/core/write/PrettyPrinterTest.java b/src/test/java/com/fasterxml/jackson/core/write/PrettyPrinterTest.java index 1f7de310be..96ed9dc9eb 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/PrettyPrinterTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/PrettyPrinterTest.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.core.write; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.io.SerializedString; import com.fasterxml.jackson.core.util.DefaultIndenter; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; @@ -22,12 +21,14 @@ static class CountPrinter extends MinimalPrettyPrinter { @Override public void writeEndObject(JsonGenerator jg, int nrOfEntries) + throws IOException, JsonGenerationException { jg.writeRaw("("+nrOfEntries+")}"); } @Override public void writeEndArray(JsonGenerator jg, int nrOfValues) + throws IOException, JsonGenerationException { jg.writeRaw("("+nrOfValues+")]"); } @@ -49,19 +50,14 @@ public void testObjectCount() throws Exception boolean useBytes = (i > 0); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); StringWriter sw = new StringWriter(); - - ObjectWriteContext ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { return new CountPrinter(); } - }; - - JsonGenerator gen = useBytes ? JSON_F.createGenerator(ppContext, bytes) - : JSON_F.createGenerator(ppContext, sw); + JsonGenerator gen = useBytes ? JSON_F.createGenerator(bytes) + : JSON_F.createGenerator(sw); + gen.setPrettyPrinter(new CountPrinter()); gen.writeStartObject(); - gen.writeName("x"); + gen.writeFieldName("x"); gen.writeStartObject(); - gen.writeNumberProperty("a", 1); - gen.writeNumberProperty("b", 2); + gen.writeNumberField("a", 1); + gen.writeNumberField("b", 2); gen.writeEndObject(); gen.writeEndObject(); gen.close(); @@ -79,13 +75,9 @@ public void testArrayCount() throws Exception boolean useBytes = (i > 0); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); StringWriter sw = new StringWriter(); - ObjectWriteContext ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { return new CountPrinter(); } - }; - - JsonGenerator gen = useBytes ? JSON_F.createGenerator(ppContext, bytes) - : JSON_F.createGenerator(ppContext, sw); + JsonGenerator gen = useBytes ? JSON_F.createGenerator(bytes) + : JSON_F.createGenerator(sw); + gen.setPrettyPrinter(new CountPrinter()); gen.writeStartArray(); gen.writeNumber(6); gen.writeStartArray(); @@ -100,38 +92,38 @@ public void testArrayCount() throws Exception assertEquals(EXP, json); } } + + public void testSimpleDocWithDefault() throws Exception + { + StringWriter sw = new StringWriter(); + JsonGenerator gen = JSON_F.createGenerator(sw); + gen.useDefaultPrettyPrinter(); + _verifyPrettyPrinter(gen, sw); + gen.close(); + } @SuppressWarnings("resource") public void testSimpleDocWithMinimal() throws Exception { StringWriter sw = new StringWriter(); + JsonGenerator gen = JSON_F.createGenerator(sw); // first with standard minimal - ObjectWriteContext ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { return new MinimalPrettyPrinter(); } - }; - JsonGenerator gen = JSON_F.createGenerator(ppContext, sw); + gen.setPrettyPrinter(new MinimalPrettyPrinter()); String docStr = _verifyPrettyPrinter(gen, sw); // which should have no linefeeds, tabs assertEquals(-1, docStr.indexOf('\n')); assertEquals(-1, docStr.indexOf('\t')); // And then with slightly customized variant - ppContext = new ObjectWriteContext.Base() { + gen = new JsonFactory().createGenerator(sw); + gen.setPrettyPrinter(new MinimalPrettyPrinter() { @Override - public PrettyPrinter getPrettyPrinter() { - return new MinimalPrettyPrinter() { - @Override - // use TAB between array values - public void beforeArrayValues(JsonGenerator jg) - { - jg.writeRaw("\t"); - } - }; + // use TAB between array values + public void beforeArrayValues(JsonGenerator jg) throws IOException, JsonGenerationException + { + jg.writeRaw("\t"); } - }; - - gen = new JsonFactory().createGenerator(ppContext, sw); + }); docStr = _verifyPrettyPrinter(gen, sw); assertEquals(-1, docStr.indexOf('\n')); assertTrue(docStr.indexOf('\t') >= 0); @@ -152,11 +144,11 @@ public void testCustomRootSeparatorWithPP() throws Exception // Alternative solution for [jackson-core#26] public void testCustomRootSeparatorWithFactory() throws Exception { - JsonFactory f = JsonFactory.builder() + JsonFactory f = ((JsonFactoryBuilder)JsonFactory.builder()) .rootValueSeparator("##") .build(); StringWriter sw = new StringWriter(); - JsonGenerator gen = f.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = f.createGenerator(sw); gen.writeNumber(13); gen.writeBoolean(false); gen.writeNull(); @@ -167,23 +159,25 @@ public void testCustomRootSeparatorWithFactory() throws Exception public void testCustomSeparatorsWithMinimal() throws Exception { StringWriter sw = new StringWriter(); - ObjectWriteContext ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { - return new MinimalPrettyPrinter().setSeparators(Separators.createDefaultInstance() - .withObjectFieldValueSeparator('=') - .withObjectEntrySeparator(';') - .withArrayValueSeparator('|')); - } - }; - JsonGenerator gen = JSON_F.createGenerator(ppContext, sw); + JsonGenerator gen = JSON_F.createGenerator(sw); + gen.setPrettyPrinter(new MinimalPrettyPrinter().setSeparators(Separators.createDefaultInstance() + .withObjectFieldValueSeparator('=') + .withObjectEntrySeparator(';') + .withArrayValueSeparator('|'))); + _writeTestDocument(gen); gen.close(); + assertEquals("[3|\"abc\"|[true]|{\"f\"=null;\"f2\"=null}]", sw.toString()); // and with byte-backed too ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - gen = JSON_F.createGenerator(ppContext, bytes); + gen = JSON_F.createGenerator(bytes); + gen.setPrettyPrinter(new MinimalPrettyPrinter().setSeparators(Separators.createDefaultInstance() + .withObjectFieldValueSeparator('=') + .withObjectEntrySeparator(';') + .withArrayValueSeparator('|'))); + _writeTestDocument(gen); gen.close(); @@ -193,19 +187,15 @@ public PrettyPrinter getPrettyPrinter() { public void testCustomSeparatorsWithPP() throws Exception { StringWriter sw = new StringWriter(); - ObjectWriteContext ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { - return new DefaultPrettyPrinter().withSeparators(Separators.createDefaultInstance() - .withObjectFieldValueSeparator('=') - .withObjectEntrySeparator(';') - .withArrayValueSeparator('|')); - } - }; - - JsonGenerator gen = new JsonFactory().createGenerator(ppContext, sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); + gen.setPrettyPrinter(new DefaultPrettyPrinter().withSeparators(Separators.createDefaultInstance() + .withObjectFieldValueSeparator('=') + .withObjectEntrySeparator(';') + .withArrayValueSeparator('|'))); + _writeTestDocument(gen); gen.close(); + assertEquals("[ 3| \"abc\"| [ true ]| {" + DefaultIndenter.SYS_LF + " \"f\" = null;" + DefaultIndenter.SYS_LF + " \"f2\" = null" + DefaultIndenter.SYS_LF + @@ -215,21 +205,16 @@ public PrettyPrinter getPrettyPrinter() { public void testCustomSeparatorsWithPPWithoutSpaces() throws Exception { StringWriter sw = new StringWriter(); - ObjectWriteContext ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { - return new DefaultPrettyPrinter().withSeparators(Separators.createDefaultInstance() - .withObjectFieldValueSeparator('=') - .withObjectEntrySeparator(';') - .withArrayValueSeparator('|')) - .withoutSpacesInObjectEntries(); - } - }; - - JsonGenerator gen = new JsonFactory().createGenerator(ppContext, sw); + JsonGenerator gen = new JsonFactory().createGenerator(sw); + gen.setPrettyPrinter(new DefaultPrettyPrinter().withSeparators(Separators.createDefaultInstance() + .withObjectFieldValueSeparator('=') + .withObjectEntrySeparator(';') + .withArrayValueSeparator('|')) + .withoutSpacesInObjectEntries()); _writeTestDocument(gen); gen.close(); + assertEquals("[ 3| \"abc\"| [ true ]| {" + DefaultIndenter.SYS_LF + " \"f\"=null;" + DefaultIndenter.SYS_LF + " \"f2\"=null" + DefaultIndenter.SYS_LF + @@ -261,10 +246,10 @@ private String _verifyPrettyPrinter(JsonGenerator gen, StringWriter sw) throws E assertEquals(JsonToken.END_ARRAY, jp.nextToken()); assertEquals(JsonToken.START_OBJECT, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, jp.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); assertEquals("f", jp.getText()); assertEquals(JsonToken.VALUE_NULL, jp.nextToken()); - assertEquals(JsonToken.PROPERTY_NAME, jp.nextToken()); + assertEquals(JsonToken.FIELD_NAME, jp.nextToken()); assertEquals("f2", jp.getText()); assertEquals(JsonToken.VALUE_NULL, jp.nextToken()); assertEquals(JsonToken.END_OBJECT, jp.nextToken()); @@ -286,10 +271,10 @@ private void _writeTestDocument(JsonGenerator gen) throws IOException { gen.writeEndArray(); gen.writeStartObject(); - gen.writeName("f"); + gen.writeFieldName("f"); gen.writeNull(); // for better test coverage also use alt method - gen.writeName(new SerializedString("f2")); + gen.writeFieldName(new SerializedString("f2")); gen.writeNull(); gen.writeEndObject(); @@ -297,16 +282,11 @@ private void _writeTestDocument(JsonGenerator gen) throws IOException { gen.close(); } - protected String _generateRoot(TokenStreamFactory f, final PrettyPrinter pp) throws IOException + protected String _generateRoot(JsonFactory jf, PrettyPrinter pp) throws IOException { StringWriter sw = new StringWriter(); - ObjectWriteContext ppContext = new ObjectWriteContext.Base() { - @Override - public PrettyPrinter getPrettyPrinter() { - return pp; - } - }; - JsonGenerator gen = f.createGenerator(ppContext, sw); + JsonGenerator gen = jf.createGenerator(sw); + gen.setPrettyPrinter(pp); gen.writeStartObject(); gen.writeEndObject(); gen.writeStartObject(); diff --git a/src/test/java/com/fasterxml/jackson/core/write/RawStringWriteTest.java b/src/test/java/com/fasterxml/jackson/core/write/RawStringWriteTest.java index 317d84e1dd..9676924554 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/RawStringWriteTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/RawStringWriteTest.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.SerializedString; -import com.fasterxml.jackson.core.json.JsonFactory; public class RawStringWriteTest extends com.fasterxml.jackson.core.BaseTest { @@ -21,17 +20,17 @@ public void testUtf8RawStrings() throws Exception // Let's create set of Strings to output; no ctrl chars as we do raw List strings = generateStrings(new Random(28), 750000, false); ByteArrayOutputStream out = new ByteArrayOutputStream(16000); - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), out, JsonEncoding.UTF8); - g.writeStartArray(); + JsonGenerator jgen = JSON_F.createGenerator(out, JsonEncoding.UTF8); + jgen.writeStartArray(); for (byte[] str : strings) { - g.writeRawUTF8String(str, 0, str.length); + jgen.writeRawUTF8String(str, 0, str.length); } - g.writeEndArray(); - g.close(); + jgen.writeEndArray(); + jgen.close(); byte[] json = out.toByteArray(); // Ok: let's verify that stuff was written out ok - JsonParser jp = JSON_F.createParser(ObjectReadContext.empty(), json); + JsonParser jp = JSON_F.createParser(json); assertToken(JsonToken.START_ARRAY, jp.nextToken()); for (byte[] inputBytes : strings) { assertToken(JsonToken.VALUE_STRING, jp.nextToken()); @@ -53,19 +52,19 @@ public void testUtf8StringsWithEscaping() throws Exception // Let's create set of Strings to output; do include control chars too: List strings = generateStrings(new Random(28), 720000, true); ByteArrayOutputStream out = new ByteArrayOutputStream(16000); - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), out, JsonEncoding.UTF8); - g.writeStartArray(); + JsonGenerator jgen = JSON_F.createGenerator(out, JsonEncoding.UTF8); + jgen.writeStartArray(); for (byte[] str : strings) { - g.writeUTF8String(str, 0, str.length); - g.writeRaw('\n'); + jgen.writeUTF8String(str, 0, str.length); + jgen.writeRaw('\n'); } - g.writeEndArray(); - g.close(); + jgen.writeEndArray(); + jgen.close(); byte[] json = out.toByteArray(); // Ok: let's verify that stuff was written out ok - JsonParser jp = JSON_F.createParser(ObjectReadContext.empty(), json); + JsonParser jp = JSON_F.createParser(json); assertToken(JsonToken.START_ARRAY, jp.nextToken()); for (byte[] inputBytes : strings) { assertToken(JsonToken.VALUE_STRING, jp.nextToken()); @@ -87,26 +86,26 @@ public void testWriteRawWithSerializable() throws Exception private void _testWriteRawWithSerializable(JsonFactory f, boolean useBytes) throws Exception { - JsonGenerator g; + JsonGenerator jgen; ByteArrayOutputStream bytes = new ByteArrayOutputStream(); StringWriter sw = new StringWriter(); if (useBytes) { - g = f.createGenerator(ObjectWriteContext.empty(), bytes, JsonEncoding.UTF8); + jgen = f.createGenerator(bytes, JsonEncoding.UTF8); } else { - g = f.createGenerator(ObjectWriteContext.empty(), sw); + jgen = f.createGenerator(sw); } - g.writeStartArray(); - g.writeRawValue(new SerializedString("\"foo\"")); - g.writeRawValue(new SerializedString("12")); - g.writeRaw(new SerializedString(", false")); - g.writeEndArray(); - g.close(); + jgen.writeStartArray(); + jgen.writeRawValue(new SerializedString("\"foo\"")); + jgen.writeRawValue(new SerializedString("12")); + jgen.writeRaw(new SerializedString(", false")); + jgen.writeEndArray(); + jgen.close(); JsonParser p = useBytes - ? f.createParser(ObjectReadContext.empty(), bytes.toByteArray()) - : f.createParser(ObjectReadContext.empty(), sw.toString()); + ? f.createParser(bytes.toByteArray()) + : f.createParser(sw.toString()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/core/write/SerializedStringWriteTest.java b/src/test/java/com/fasterxml/jackson/core/write/SerializedStringWriteTest.java index 2e3eff99d5..6c8b24a4f2 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/SerializedStringWriteTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/SerializedStringWriteTest.java @@ -15,7 +15,7 @@ public class SerializedStringWriteTest final static String VALUE_WITH_QUOTES = "\"Value\""; final static String VALUE2 = _generateLongName(9000); - private final TokenStreamFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); private final SerializedString quotedName = new SerializedString(NAME_WITH_QUOTES); private final SerializedString latin1Name = new SerializedString(NAME_WITH_LATIN1); @@ -24,38 +24,36 @@ public void testSimpleFieldNames() throws Exception { // First using char-backed generator StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); _writeSimple(gen); gen.close(); String json = sw.toString(); - _verifySimple(JSON_F.createParser(ObjectReadContext.empty(), json)); + _verifySimple(JSON_F.createParser(json)); // then using UTF-8 ByteArrayOutputStream out = new ByteArrayOutputStream(); - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), out, JsonEncoding.UTF8); + gen = JSON_F.createGenerator(out, JsonEncoding.UTF8); _writeSimple(gen); gen.close(); byte[] jsonB = out.toByteArray(); - _verifySimple(JSON_F.createParser(ObjectReadContext.empty(), jsonB)); + _verifySimple(JSON_F.createParser(jsonB)); } public void testSimpleValues() throws Exception { // First using char-backed generator StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); _writeSimpleValues(gen); gen.close(); - _verifySimpleValues(JSON_F.createParser(ObjectReadContext.empty(), - new StringReader(sw.toString()))); + _verifySimpleValues(JSON_F.createParser(new StringReader(sw.toString()))); // then using UTF-8 ByteArrayOutputStream out = new ByteArrayOutputStream(); - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), out, JsonEncoding.UTF8); + gen = JSON_F.createGenerator(out, JsonEncoding.UTF8); _writeSimpleValues(gen); gen.close(); - _verifySimpleValues(JSON_F.createParser(ObjectReadContext.empty(), - new ByteArrayInputStream(out.toByteArray()))); + _verifySimpleValues(JSON_F.createParser(new ByteArrayInputStream(out.toByteArray()))); } /* @@ -70,16 +68,16 @@ private void _writeSimple(JsonGenerator gen) throws Exception gen.writeStartArray(); gen.writeStartObject(); - gen.writeName(quotedName); + gen.writeFieldName(quotedName); gen.writeString("a"); - gen.writeName(latin1Name); + gen.writeFieldName(latin1Name); gen.writeString("b"); gen.writeEndObject(); gen.writeStartObject(); - gen.writeName(latin1Name); + gen.writeFieldName(latin1Name); gen.writeString("c"); - gen.writeName(quotedName); + gen.writeFieldName(quotedName); gen.writeString("d"); gen.writeEndObject(); @@ -91,16 +89,16 @@ private void _writeSimpleValues(JsonGenerator gen) throws Exception // Let's just write an array of 2 objects gen.writeStartArray(); gen.writeStartObject(); - gen.writeName(NAME_WITH_QUOTES); + gen.writeFieldName(NAME_WITH_QUOTES); gen.writeString(new SerializedString(VALUE_WITH_QUOTES)); - gen.writeName(NAME_WITH_LATIN1); + gen.writeFieldName(NAME_WITH_LATIN1); gen.writeString(VALUE2); gen.writeEndObject(); gen.writeStartObject(); - gen.writeName(NAME_WITH_LATIN1); + gen.writeFieldName(NAME_WITH_LATIN1); gen.writeString(VALUE_WITH_QUOTES); - gen.writeName(NAME_WITH_QUOTES); + gen.writeFieldName(NAME_WITH_QUOTES); gen.writeString(new SerializedString(VALUE2)); gen.writeEndObject(); @@ -112,22 +110,22 @@ private void _verifySimple(JsonParser p) throws Exception assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(NAME_WITH_QUOTES, p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("a", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(NAME_WITH_LATIN1, p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("b", p.getText()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(NAME_WITH_LATIN1, p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("c", p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(NAME_WITH_QUOTES, p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("d", p.getText()); @@ -142,22 +140,22 @@ private void _verifySimpleValues(JsonParser p) throws Exception assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(NAME_WITH_QUOTES, p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(VALUE_WITH_QUOTES, p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(NAME_WITH_LATIN1, p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(VALUE2, p.getText()); assertToken(JsonToken.END_OBJECT, p.nextToken()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(NAME_WITH_LATIN1, p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(VALUE_WITH_QUOTES, p.getText()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); assertEquals(NAME_WITH_QUOTES, p.getText()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(VALUE2, p.getText()); diff --git a/src/test/java/com/fasterxml/jackson/core/write/UTF8GeneratorTest.java b/src/test/java/com/fasterxml/jackson/core/write/UTF8GeneratorTest.java index c24cff0983..b6398c1479 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/UTF8GeneratorTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/UTF8GeneratorTest.java @@ -4,9 +4,8 @@ import com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate; import com.fasterxml.jackson.core.filter.JsonPointerBasedFilter; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; -import com.fasterxml.jackson.core.io.ContentReference; import com.fasterxml.jackson.core.io.IOContext; -import com.fasterxml.jackson.core.json.JsonFactory; +import com.fasterxml.jackson.core.io.ContentReference; import com.fasterxml.jackson.core.json.UTF8JsonGenerator; import com.fasterxml.jackson.core.util.BufferRecycler; @@ -14,16 +13,14 @@ public class UTF8GeneratorTest extends BaseTest { - private final TokenStreamFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); public void testUtf8Issue462() throws Exception { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); IOContext ioc = new IOContext(new BufferRecycler(), ContentReference.rawReference(bytes), true); - JsonGenerator gen = new UTF8JsonGenerator(ObjectWriteContext.empty(), ioc, 0, 0, bytes, - JsonFactory.DEFAULT_ROOT_VALUE_SEPARATOR, null, null, - 0, '"'); + JsonGenerator gen = new UTF8JsonGenerator(ioc, 0, null, bytes, '"'); String str = "Natuurlijk is alles gelukt en weer een tevreden klant\uD83D\uDE04"; int length = 4000 - 38; @@ -35,7 +32,7 @@ public void testUtf8Issue462() throws Exception gen.close(); // Also verify it's parsable? - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), bytes.toByteArray()); + JsonParser p = JSON_F.createParser(bytes.toByteArray()); for (int i = 1; i <= length; ++i) { assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(1, p.getIntValue()); @@ -51,7 +48,7 @@ public void testSurrogatesWithRaw() throws Exception { final String VALUE = quote("\ud83d\ude0c"); ByteArrayOutputStream out = new ByteArrayOutputStream(); - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), out); + JsonGenerator g = JSON_F.createGenerator(out); g.writeStartArray(); g.writeRaw(VALUE); g.writeEndArray(); @@ -59,7 +56,7 @@ public void testSurrogatesWithRaw() throws Exception final byte[] JSON = out.toByteArray(); - JsonParser jp = JSON_F.createParser(ObjectReadContext.empty(), JSON); + JsonParser jp = JSON_F.createParser(JSON); assertToken(JsonToken.START_ARRAY, jp.nextToken()); assertToken(JsonToken.VALUE_STRING, jp.nextToken()); String str = jp.getText(); @@ -76,7 +73,7 @@ public void testFilteringWithEscapedChars() throws Exception ByteArrayOutputStream out = new ByteArrayOutputStream(); @SuppressWarnings("resource") - JsonGenerator g = JSON_F.createGenerator(ObjectWriteContext.empty(), out); + JsonGenerator g = JSON_F.createGenerator(out); FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(g, new JsonPointerBasedFilter("/escapes"), @@ -88,16 +85,16 @@ public void testFilteringWithEscapedChars() throws Exception gen.writeStartObject(); - gen.writeName("a"); + gen.writeFieldName("a"); gen.writeNumber((int) 123); - gen.writeName("array"); + gen.writeFieldName("array"); gen.writeStartArray(); gen.writeNumber((short) 1); gen.writeNumber((short) 2); gen.writeEndArray(); - gen.writeName("escapes"); + gen.writeFieldName("escapes"); final byte[] raw = SAMPLE_WITH_QUOTES.toString().getBytes("UTF-8"); gen.writeUTF8String(raw, 0, raw.length); @@ -105,11 +102,11 @@ public void testFilteringWithEscapedChars() throws Exception gen.writeEndObject(); gen.close(); - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), out.toByteArray()); + JsonParser p = JSON_F.createParser(out.toByteArray()); assertToken(JsonToken.START_OBJECT, p.nextToken()); - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); - assertEquals("escapes", p.currentName()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); + assertEquals("escapes", p.getCurrentName()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertEquals(SAMPLE_WITH_QUOTES, p.getText()); diff --git a/src/test/java/com/fasterxml/jackson/core/write/WriteTypeIdTest.java b/src/test/java/com/fasterxml/jackson/core/write/WriteTypeIdTest.java index 437fb8cfa6..6defe39bc2 100644 --- a/src/test/java/com/fasterxml/jackson/core/write/WriteTypeIdTest.java +++ b/src/test/java/com/fasterxml/jackson/core/write/WriteTypeIdTest.java @@ -3,11 +3,10 @@ import java.io.StringWriter; import com.fasterxml.jackson.core.BaseTest; +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonGenerationException; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.ObjectWriteContext; -import com.fasterxml.jackson.core.exc.StreamWriteException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.type.WritableTypeId; public class WriteTypeIdTest @@ -15,21 +14,21 @@ public class WriteTypeIdTest { private final JsonFactory JSON_F = sharedStreamFactory(); - public void testNoNativeTypeIdForJson() + public void testNoNativeTypeIdForJson() throws Exception { StringWriter sw = new StringWriter(); - try (JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw)) { - assertFalse(gen.canWriteTypeId()); - try { - gen.writeTypeId("whatever"); - fail("Should not pass"); - } catch (StreamWriteException e) { - verifyException(e, "No native support for writing Type Ids"); - } + JsonGenerator gen = JSON_F.createGenerator(sw); + assertFalse(gen.canWriteTypeId()); + try { + gen.writeTypeId("whatever"); + fail("Should not pass"); + } catch (JsonGenerationException e) { + verifyException(e, "No native support for writing Type Ids"); } + gen.close(); } - public void testBasicTypeIdWriteForObject() + public void testBasicTypeIdWriteForObject() throws Exception { final Object data = new Object(); @@ -41,9 +40,9 @@ public void testBasicTypeIdWriteForObject() typeId.asProperty = "type"; StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); gen.writeTypePrefix(typeId); - gen.writeNumberProperty("value", 13); + gen.writeNumberField("value", 13); gen.writeTypeSuffix(typeId); gen.close(); assertEquals("{\"type\":\"typeId\",\"value\":13}", sw.toString()); @@ -52,9 +51,9 @@ public void testBasicTypeIdWriteForObject() typeId = new WritableTypeId(data, JsonToken.START_OBJECT, "typeId"); typeId.include = WritableTypeId.Inclusion.WRAPPER_ARRAY; sw = new StringWriter(); - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + gen = JSON_F.createGenerator(sw); gen.writeTypePrefix(typeId); - gen.writeNumberProperty("value", 13); + gen.writeNumberField("value", 13); gen.writeTypeSuffix(typeId); gen.close(); @@ -64,9 +63,9 @@ public void testBasicTypeIdWriteForObject() typeId = new WritableTypeId(data, JsonToken.START_OBJECT, "typeId"); typeId.include = WritableTypeId.Inclusion.WRAPPER_OBJECT; sw = new StringWriter(); - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + gen = JSON_F.createGenerator(sw); gen.writeTypePrefix(typeId); - gen.writeNumberProperty("value", 13); + gen.writeNumberField("value", 13); gen.writeTypeSuffix(typeId); gen.close(); assertEquals("{\"typeId\":{\"value\":13}}", sw.toString()); @@ -76,18 +75,18 @@ public void testBasicTypeIdWriteForObject() typeId.include = WritableTypeId.Inclusion.PARENT_PROPERTY; typeId.asProperty = "extId"; sw = new StringWriter(); - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + gen = JSON_F.createGenerator(sw); gen.writeStartObject(); - gen.writeName("value"); + gen.writeFieldName("value"); gen.writeTypePrefix(typeId); - gen.writeNumberProperty("number", 42); + gen.writeNumberField("number", 42); gen.writeTypeSuffix(typeId); gen.writeEndObject(); gen.close(); assertEquals("{\"value\":{\"number\":42},\"extId\":\"typeId\"}", sw.toString()); } - public void testBasicTypeIdWriteForArray() + public void testBasicTypeIdWriteForArray() throws Exception { final Object data = new Object(); @@ -98,7 +97,7 @@ public void testBasicTypeIdWriteForArray() typeId.include = WritableTypeId.Inclusion.WRAPPER_OBJECT; StringWriter sw = new StringWriter(); - JsonGenerator gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + JsonGenerator gen = JSON_F.createGenerator(sw); gen.writeTypePrefix(typeId); gen.writeNumber(13); gen.writeNumber(42); @@ -111,7 +110,7 @@ public void testBasicTypeIdWriteForArray() typeId.include = WritableTypeId.Inclusion.PAYLOAD_PROPERTY; typeId.asProperty = "type"; sw = new StringWriter(); - gen = JSON_F.createGenerator(ObjectWriteContext.empty(), sw); + gen = JSON_F.createGenerator(sw); gen.writeTypePrefix(typeId); gen.writeNumber(13); gen.writeNumber(42); diff --git a/src/test/java/com/fasterxml/jackson/failing/ParserErrorHandling105Test.java b/src/test/java/com/fasterxml/jackson/failing/ParserErrorHandling105Test.java index 961a6fe023..a0f1481ba8 100644 --- a/src/test/java/com/fasterxml/jackson/failing/ParserErrorHandling105Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/ParserErrorHandling105Test.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.failing; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.exc.StreamReadException; // Failing tests for non-root-token problem public class ParserErrorHandling105Test @@ -22,11 +21,11 @@ public void testMangledFloatsBytes() throws Exception { _testMangledNonRootFloats(MODE_DATA_INPUT); } - public void testMangledIntsChars() { + public void testMangledIntsChars() throws Exception { _testMangledNonRootInts(MODE_READER); } - public void testMangledFloatsChars() { + public void testMangledFloatsChars() throws Exception { _testMangledNonRootFloats(MODE_READER); } @@ -36,27 +35,27 @@ public void testMangledFloatsChars() { /********************************************************** */ - private void _testMangledNonRootInts(int mode) + private void _testMangledNonRootInts(int mode) throws Exception { JsonParser p = createParser(mode, "[ 123true ]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); try { JsonToken t = p.nextToken(); fail("Should have gotten an exception; instead got token: "+t); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected space"); } p.close(); } - private void _testMangledNonRootFloats(int mode) + private void _testMangledNonRootFloats(int mode) throws Exception { JsonParser p = createParser(mode, "[ 1.5false ]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); try { JsonToken t = p.nextToken(); fail("Should have gotten an exception; instead got token: "+t); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected space"); } p.close(); diff --git a/src/test/java/com/fasterxml/jackson/failing/ParserErrorHandling679Test.java b/src/test/java/com/fasterxml/jackson/failing/ParserErrorHandling679Test.java index 68a938be33..5f8d541d0f 100644 --- a/src/test/java/com/fasterxml/jackson/failing/ParserErrorHandling679Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/ParserErrorHandling679Test.java @@ -1,8 +1,8 @@ package com.fasterxml.jackson.failing; +import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.exc.StreamReadException; public class ParserErrorHandling679Test extends com.fasterxml.jackson.core.BaseTest @@ -47,7 +47,7 @@ private void _testNonRootMangledFloats679(int mode, String value) throws Excepti JsonToken t = p.nextToken(); Double v = p.getDoubleValue(); fail("Should have gotten an exception for '"+value+"'; instead got ("+t+") number: "+v); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected "); } p.close(); @@ -67,7 +67,7 @@ private void _testNonRootMangledInts(int mode, String value) throws Exception JsonToken t = p.nextToken(); int v = p.getIntValue(); fail("Should have gotten an exception for '"+value+"'; instead got ("+t+") number: "+v); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected "); } p.close(); diff --git a/src/test/java/com/fasterxml/jackson/failing/ParserFilterEmpty708Test.java b/src/test/java/com/fasterxml/jackson/failing/ParserFilterEmpty708Test.java index 77aaa9093b..b44be9c908 100644 --- a/src/test/java/com/fasterxml/jackson/failing/ParserFilterEmpty708Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/ParserFilterEmpty708Test.java @@ -1,14 +1,13 @@ package com.fasterxml.jackson.failing; import com.fasterxml.jackson.core.BaseTest; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.ObjectReadContext; import com.fasterxml.jackson.core.TokenStreamFactory; import com.fasterxml.jackson.core.filter.FilteringParserDelegate; import com.fasterxml.jackson.core.filter.TokenFilter; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; -import com.fasterxml.jackson.core.json.JsonFactory; // for [core#708] public class ParserFilterEmpty708Test extends BaseTest @@ -72,6 +71,6 @@ public void testEmptyObject() throws Exception */ private JsonParser _createParser(TokenStreamFactory f, String json) throws Exception { - return f.createParser(ObjectReadContext.empty(), json); + return f.createParser(json); } } diff --git a/src/test/java/com/fasterxml/jackson/failing/Surrogate223Test.java b/src/test/java/com/fasterxml/jackson/failing/Surrogate223Test.java index 5058782c62..33dd2ae704 100644 --- a/src/test/java/com/fasterxml/jackson/failing/Surrogate223Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/Surrogate223Test.java @@ -5,19 +5,17 @@ import java.io.Writer; import com.fasterxml.jackson.core.BaseTest; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.ObjectReadContext; -import com.fasterxml.jackson.core.ObjectWriteContext; -import com.fasterxml.jackson.core.json.JsonFactory; public class Surrogate223Test extends BaseTest { - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); // for [core#223] - public void testSurrogatesByteBacked() + public void testSurrogatesByteBacked() throws Exception { ByteArrayOutputStream out; JsonGenerator g; @@ -28,7 +26,7 @@ public void testSurrogatesByteBacked() // assertFalse(JSON_F.isEnabled(JsonGenerator.Feature.ESCAPE_UTF8_SURROGATES)); out = new ByteArrayOutputStream(); - g = JSON_F.createGenerator(ObjectWriteContext.empty(), out); + g = JSON_F.createGenerator(out); g.writeStartArray(); g.writeString(toQuote); g.writeEndArray(); @@ -36,7 +34,7 @@ public void testSurrogatesByteBacked() assertEquals(2 + 2 + 4, out.size()); // brackets, quotes, 4-byte encoding // Also parse back to ensure correctness - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), out.toByteArray()); + JsonParser p = JSON_F.createParser(out.toByteArray()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertToken(JsonToken.END_ARRAY, p.nextToken()); @@ -44,7 +42,7 @@ public void testSurrogatesByteBacked() // but may revert back to original behavior out = new ByteArrayOutputStream(); - g = JSON_F.createGenerator(ObjectWriteContext.empty(), out); + g = JSON_F.createGenerator(out); // g.enable(JsonGenerator.Feature.ESCAPE_UTF8_SURROGATES); g.writeStartArray(); g.writeString(toQuote); @@ -54,7 +52,7 @@ public void testSurrogatesByteBacked() } // for [core#223] - public void testSurrogatesCharBacked() + public void testSurrogatesCharBacked() throws Exception { Writer out; JsonGenerator g; @@ -65,7 +63,7 @@ public void testSurrogatesCharBacked() // assertFalse(JSON_F.isEnabled(JsonGenerator.Feature.ESCAPE_UTF8_SURROGATES)); out = new StringWriter(); - g = JSON_F.createGenerator(ObjectWriteContext.empty(), out); + g = JSON_F.createGenerator(out); g.writeStartArray(); g.writeString(toQuote); g.writeEndArray(); @@ -73,7 +71,7 @@ public void testSurrogatesCharBacked() assertEquals(2 + 2 + 2, out.toString().length()); // brackets, quotes, 2 chars as is // Also parse back to ensure correctness - JsonParser p = JSON_F.createParser(ObjectReadContext.empty(), out.toString()); + JsonParser p = JSON_F.createParser(out.toString()); assertToken(JsonToken.START_ARRAY, p.nextToken()); assertToken(JsonToken.VALUE_STRING, p.nextToken()); assertToken(JsonToken.END_ARRAY, p.nextToken()); @@ -81,7 +79,7 @@ public void testSurrogatesCharBacked() // but may revert back to original behavior out = new StringWriter(); - g = JSON_F.createGenerator(ObjectWriteContext.empty(), out); + g = JSON_F.createGenerator(out); // g.enable(JsonGenerator.Feature.ESCAPE_UTF8_SURROGATES); g.writeStartArray(); g.writeString(toQuote); diff --git a/src/test/java/com/fasterxml/jackson/failing/async/AsyncTokenErrorTest.java b/src/test/java/com/fasterxml/jackson/failing/async/AsyncTokenErrorTest.java index c49eba66ee..33316051bc 100644 --- a/src/test/java/com/fasterxml/jackson/failing/async/AsyncTokenErrorTest.java +++ b/src/test/java/com/fasterxml/jackson/failing/async/AsyncTokenErrorTest.java @@ -1,16 +1,16 @@ package com.fasterxml.jackson.failing.async; +import java.io.IOException; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.async.AsyncTestBase; -import com.fasterxml.jackson.core.exc.StreamReadException; -import com.fasterxml.jackson.core.json.JsonFactory; import com.fasterxml.jackson.core.testsupport.AsyncReaderWrapper; public class AsyncTokenErrorTest extends AsyncTestBase { - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); - public void testInvalidKeywordsStartOk() + public void testInvalidKeywordsStartOk() throws Exception { _doTestInvalidKeyword("nul"); _doTestInvalidKeyword("nulla"); @@ -23,14 +23,14 @@ public void testInvalidKeywordsStartOk() _doTestInvalidKeyword("trueenough"); } - public void testInvalidKeywordsStartFail() + public void testInvalidKeywordsStartFail() throws Exception { _doTestInvalidKeyword("Null"); _doTestInvalidKeyword("False"); _doTestInvalidKeyword("C"); } - private void _doTestInvalidKeyword(String value) + private void _doTestInvalidKeyword(String value) throws IOException { String doc = "{ \"key1\" : "+value+" }"; AsyncReaderWrapper p = _createParser(doc); @@ -38,10 +38,10 @@ private void _doTestInvalidKeyword(String value) // Note that depending on parser impl, we may // get the exception early or late... try { - assertToken(JsonToken.PROPERTY_NAME, p.nextToken()); + assertToken(JsonToken.FIELD_NAME, p.nextToken()); p.nextToken(); fail("Expected an exception for malformed value keyword"); - } catch (StreamReadException jex) { + } catch (JsonParseException jex) { verifyException(jex, "Unrecognized token"); verifyException(jex, value); } finally { @@ -54,7 +54,7 @@ private void _doTestInvalidKeyword(String value) try { p.nextToken(); fail("Expected an exception for malformed value keyword"); - } catch (StreamReadException jex) { + } catch (JsonParseException jex) { verifyException(jex, "Unrecognized token"); verifyException(jex, value); } finally { @@ -62,58 +62,58 @@ private void _doTestInvalidKeyword(String value) } } - public void testMangledRootInts() + public void testMangledRootInts() throws Exception { AsyncReaderWrapper p = _createParser("123true"); try { JsonToken t = p.nextToken(); fail("Should have gotten an exception; instead got token: "+t+"; number: "+p.getNumberValue()); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected space"); } p.close(); } - public void testMangledRootFloats() + public void testMangledRootFloats() throws Exception { // Also test with floats AsyncReaderWrapper p = _createParser("1.5false"); try { JsonToken t = p.nextToken(); fail("Should have gotten an exception; instead got token: "+t+"; number: "+p.getNumberValue()); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected space"); } p.close(); } - public void testMangledNonRootInts() + public void testMangledNonRootInts() throws Exception { AsyncReaderWrapper p = _createParser("[ 123true ]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); try { JsonToken t = p.nextToken(); fail("Should have gotten an exception; instead got token: "+t); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected space"); } p.close(); } - public void testMangledNonRootFloats() + public void testMangledNonRootFloats() throws Exception { AsyncReaderWrapper p = _createParser("[ 1.5false ]"); assertToken(JsonToken.START_ARRAY, p.nextToken()); try { JsonToken t = p.nextToken(); fail("Should have gotten an exception; instead got token: "+t); - } catch (StreamReadException e) { + } catch (JsonParseException e) { verifyException(e, "expected space"); } p.close(); } - private AsyncReaderWrapper _createParser(String doc) + private AsyncReaderWrapper _createParser(String doc) throws IOException { return asyncForBytes(JSON_F, 1, _jsonDoc(doc), 1); } diff --git a/src/test/java/com/fasterxml/jackson/failing/filter/BasicParserFilteringTest.java b/src/test/java/com/fasterxml/jackson/failing/filter/BasicParserFilteringTest.java index 8f51de8764..c47a23d8b7 100644 --- a/src/test/java/com/fasterxml/jackson/failing/filter/BasicParserFilteringTest.java +++ b/src/test/java/com/fasterxml/jackson/failing/filter/BasicParserFilteringTest.java @@ -1,21 +1,15 @@ package com.fasterxml.jackson.failing.filter; -import java.io.IOException; -import java.io.StringWriter; - import com.fasterxml.jackson.core.BaseTest; -import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.ObjectReadContext; -import com.fasterxml.jackson.core.ObjectWriteContext; import com.fasterxml.jackson.core.filter.FilteringParserDelegate; import com.fasterxml.jackson.core.filter.TokenFilter; import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; -import com.fasterxml.jackson.core.json.JsonFactory; public class BasicParserFilteringTest extends BaseTest { - private final JsonFactory JSON_F = newStreamFactory(); + private final JsonFactory JSON_F = new JsonFactory(); static class NoArraysFilter extends TokenFilter { @@ -29,7 +23,7 @@ public TokenFilter filterStartArray() { public void testValueOmitsFieldName1() throws Exception { String jsonString = aposToQuotes("{'a':123,'array':[1,2]}"); - JsonParser p0 = JSON_F.createParser(ObjectReadContext.empty(), jsonString); + JsonParser p0 = JSON_F.createParser(jsonString); FilteringParserDelegate p = new FilteringParserDelegate(p0, new NoArraysFilter(), Inclusion.INCLUDE_NON_NULL, @@ -39,22 +33,4 @@ public void testValueOmitsFieldName1() throws Exception assertEquals(aposToQuotes("{'a':123}"), result); assertEquals(0, p.getMatchCount()); } - - private String readAndWrite(JsonFactory f, JsonParser p) throws IOException - { - StringWriter sw = new StringWriter(100); - JsonGenerator g = f.createGenerator(ObjectWriteContext.empty(), sw); - //g.disable(StreamWriteFeature.AUTO_CLOSE_CONTENT); - try { - while (p.nextToken() != null) { - g.copyCurrentEvent(p); - } - } catch (Exception e) { - g.flush(); - fail("Unexpected problem during `readAndWrite`. Output so far: '"+sw+"'; problem: "+e); - } - p.close(); - g.close(); - return sw.toString(); - } } diff --git a/src/test/java/perf/ConcurrencyReadTest.java b/src/test/java/perf/ConcurrencyReadTest.java new file mode 100644 index 0000000000..5de6ccd1b7 --- /dev/null +++ b/src/test/java/perf/ConcurrencyReadTest.java @@ -0,0 +1,80 @@ +package perf; + +import java.io.IOException; +import java.util.concurrent.atomic.AtomicInteger; + +import com.fasterxml.jackson.core.*; + +/** + * Manual performance test to try out various synchronization + * methods for symbol tables. + */ +public class ConcurrencyReadTest +{ + private final static int THREADS = 50; + + private void test() throws Exception + { + final JsonFactory jf = new JsonFactory(); + final byte[] INPUT = "{\"a\":1}".getBytes("UTF-8"); + final AtomicInteger count = new AtomicInteger(); + + for (int i = 0; i < THREADS; ++i) { + new Thread(new Runnable() { + @Override + public void run() + { + try { + while (true) { + parse(jf, INPUT); + count.addAndGet(1); + } + } catch (IOException e) { + System.err.println("PROBLEM: "+e); + } + } + }).start(); + } + + // wait slightly.... + Thread.sleep(200L); + + double totalTime = 0.0; + double totalCount = 0.0; + + while (true) { + long start = System.currentTimeMillis(); + int startCount = count.get(); + + Thread.sleep(1000L); + + int done = count.get() - startCount; + long time = System.currentTimeMillis() - start; + + totalTime += time; + totalCount += done; + + double rate = (double) done / (double) time; + System.out.printf("Rate: %.1f (avg: %.1f)\n", rate, totalCount/totalTime); + } + } + + protected void parse(JsonFactory jf, byte[] input) throws IOException + { + JsonParser jp = jf.createParser(input, 0, input.length); + while (jp.nextToken() != null) { + ; + } + jp.close(); + } + + public static void main(String[] args) throws Exception + { + if (args.length != 0) { + System.err.println("Usage: java ..."); + System.exit(1); + } + new ConcurrencyReadTest().test(); + } + +} diff --git a/src/test/java/perf/EnumByBytesLookup.java b/src/test/java/perf/EnumByBytesLookup.java new file mode 100644 index 0000000000..1f757ac454 --- /dev/null +++ b/src/test/java/perf/EnumByBytesLookup.java @@ -0,0 +1,173 @@ +package perf; + +import java.nio.charset.Charset; +import java.util.Arrays; + +/** + * Trie container/wrapper, in this case implements Enum-value lookup. + * Sample code to possibly use for streamlined-lookup by dictionary, using + * UTF-8 bytes of {@link Enum#name()} as the key. + */ +public class EnumByBytesLookup> +{ + private final static Charset UTF8 = Charset.forName("UTF-8"); + + private final Trie _root; + private final int _size; + + private EnumByBytesLookup(Trie root, int size) { + _root = root; + _size = size; + } + + public static > EnumByBytesLookup buildFor(Class enumClass) + { + Trie root = new Trie(null); + int size = 0; + for (EIN en : enumClass.getEnumConstants()) { + byte[] key = en.name().getBytes(UTF8); + root = root.with(en, key); + ++size; + } + return new EnumByBytesLookup(root, size); + } + + public E find(byte[] rawId) { + return _root.find(rawId); + } + + public int size() { return _size; } +} + +/** + * Trie nodes + */ +class Trie { + private final static byte[] NO_BYTES = new byte[0]; + + private final static Trie[] NO_NODES = new Trie[0]; + + /** + * For leaves, value matched by sequence + */ + private final T _match; + + private final byte[] _nextBytes; + private final Trie[] nextNodes; + + private final int nextCount; + + @SuppressWarnings("unchecked") + Trie(T match) { + this(match, NO_BYTES, (Trie[]) NO_NODES); + } + + private Trie(T match, byte[] nextBytes, Trie[] nextNodes) { + this._match = match; + this._nextBytes = nextBytes; + this.nextNodes = nextNodes; + nextCount = nextBytes.length; + } + + private Trie(Trie base, T match) { + // should we allow duplicate calls with same match? For now, let's not + if (base._match != null) { + throw new IllegalArgumentException("Trying to add same match multiple times"); + } + this._match = match; + _nextBytes = base._nextBytes; + nextNodes = base.nextNodes; + nextCount = base.nextCount; + } + + private Trie(Trie base, byte nextByte, Trie nextNode) { + // should we allow duplicate calls with same match? For now, let's not + if (base._match != null) { + throw new IllegalArgumentException("Trying to add same match multiple times"); + } + _match = base._match; + int size = base._nextBytes.length + 1; + _nextBytes = Arrays.copyOf(base._nextBytes, size); + _nextBytes[size-1] = nextByte; + nextNodes = Arrays.copyOf(base.nextNodes, size); + nextNodes[size-1] = nextNode; + nextCount = size; + } + + /** + * Constructor used when an existing branch needs to be replaced due to addition + */ + private Trie(Trie base, int offset, Trie newNode) { + _match = base._match; + // can keep nextBytes, as they don't change + _nextBytes = base._nextBytes; + // but must create a copy of next nodes, to modify one entry + nextNodes = Arrays.copyOf(base.nextNodes, base.nextNodes.length); + nextNodes[offset] = newNode; + nextCount = base.nextCount; + } + + /** + * "Mutant factory" method: constructs a modified Trie, with specified raw id + * added. + */ + public Trie with(T match, byte[] rawId) { + return with(match, rawId, 0, rawId.length); + } + + private Trie with(T match, byte[] rawId, int start, int end) { + if (start == end) { + return new Trie(this, match); + } + // Ok: two choices; either we follow existing branch; or need to create new one + final byte b = rawId[start++]; + for (int i = 0; i < nextCount; ++i) { + if (_nextBytes[i] == b) { + // existing branch: good day for delegation... + Trie old = nextNodes[i]; + // to keep things truly immutable, copy underlying arrays, then + return new Trie(this, i, old.with(match, rawId, start, end)); + } + } + // simplest recursively, but for fun let's convert to iteration. Start with tail + Trie curr = new Trie(match); + + for (int i = end-1; i >= start; --i) { + curr = new Trie(this, rawId[i], curr); + } + return new Trie(this, b, curr); + } + + public T find(byte[] id) { + return find(id, 0, id.length); + } + + public T find(byte[] id, int offset, int length) { + Trie t = this; + final int end = offset+length; + + for (; offset < end; ++offset) { + byte b = id[offset]; + t = t.next(b); + if (t == null) { + // NOTE: if using null-padding, would trim here + /* + if (b == (byte) 0) { + break; + } + */ + return null; + } + } + return t._match; + } + + private Trie next(int b) { + for (int i = 0; i < nextCount; ++i) { + if (_nextBytes[i] == b) { + return nextNodes[i]; + } + } + return null; + } +} diff --git a/src/test/java/perf/ManualFuzzUTF32.java b/src/test/java/perf/ManualFuzzUTF32.java index 9da86c4dfa..7a378c7da7 100644 --- a/src/test/java/perf/ManualFuzzUTF32.java +++ b/src/test/java/perf/ManualFuzzUTF32.java @@ -3,7 +3,6 @@ import java.io.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; // Tests from [jackson-core#382] public class ManualFuzzUTF32 @@ -18,7 +17,7 @@ public void testFuzz32208() throws Exception System.out.println("Read input, "+doc.length+" bytes..."); - JsonParser p = f.createParser(ObjectReadContext.empty(), doc); + JsonParser p = f.createParser(/*ObjectReadContext.empty(), */ doc); JsonToken t = p.nextToken(); if (t != JsonToken.VALUE_STRING) { diff --git a/src/test/java/perf/ManualIntRead.java b/src/test/java/perf/ManualIntRead.java index 6a2a6f07f6..4bea0273e5 100644 --- a/src/test/java/perf/ManualIntRead.java +++ b/src/test/java/perf/ManualIntRead.java @@ -1,7 +1,6 @@ package perf; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; /** * Manually run micro-benchmark for checking performance of tokenizing @@ -37,7 +36,7 @@ public static void main(String[] args) throws Exception protected void testRead1(int reps) throws Exception { while (--reps >= 0) { - JsonParser p = _factory.createParser(ObjectReadContext.empty(), _jsonChars); + JsonParser p = _factory.createParser(_jsonChars); _stream(p); p.close(); } @@ -47,7 +46,7 @@ protected void testRead1(int reps) throws Exception protected void testRead2(int reps) throws Exception { while (--reps >= 0) { - JsonParser p = _factory.createParser(ObjectReadContext.empty(), _jsonBytes); + JsonParser p = _factory.createParser(_jsonBytes); _stream(p); p.close(); } diff --git a/src/test/java/perf/ManualReadPerfWithMedia.java b/src/test/java/perf/ManualReadPerfWithMedia.java index c87f88a92b..e0db96465b 100644 --- a/src/test/java/perf/ManualReadPerfWithMedia.java +++ b/src/test/java/perf/ManualReadPerfWithMedia.java @@ -1,7 +1,6 @@ package perf; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; public class ManualReadPerfWithMedia extends ParserTestBase { @@ -48,7 +47,7 @@ protected void testRead1(int reps) throws Exception { while (--reps >= 0) { // JsonParser p = _factory.createParser(new StringReader(_json)); - JsonParser p = _factory.createParser(ObjectReadContext.empty(), _json); + JsonParser p = _factory.createParser(_json); _stream(p); p.close(); } @@ -59,7 +58,7 @@ protected void testRead2(int reps) throws Exception { final char[] ch = _json.toCharArray(); while (--reps >= 0) { - JsonParser p = _factory.createParser(ObjectReadContext.empty(), ch, 0, ch.length); + JsonParser p = _factory.createParser(ch, 0, ch.length); _stream(p); p.close(); } diff --git a/src/test/java/perf/ManualSmallTokenRead.java b/src/test/java/perf/ManualSmallTokenRead.java index d1113b5f5b..6791cae773 100644 --- a/src/test/java/perf/ManualSmallTokenRead.java +++ b/src/test/java/perf/ManualSmallTokenRead.java @@ -1,7 +1,6 @@ package perf; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; /** * Manually run micro-benchmark for checking performance of tokenizing @@ -37,7 +36,7 @@ public static void main(String[] args) throws Exception protected void testRead1(int reps) throws Exception { while (--reps >= 0) { - JsonParser p = _factory.createParser(ObjectReadContext.empty(), _jsonChars); + JsonParser p = _factory.createParser(_jsonChars); _stream(p); p.close(); } @@ -47,7 +46,7 @@ protected void testRead1(int reps) throws Exception protected void testRead2(int reps) throws Exception { while (--reps >= 0) { - JsonParser p = _factory.createParser(ObjectReadContext.empty(), _jsonBytes); + JsonParser p = _factory.createParser(_jsonBytes); _stream(p); p.close(); } diff --git a/src/test/java/perf/MediaItem.java b/src/test/java/perf/MediaItem.java index e84a1aec29..2dced900a7 100644 --- a/src/test/java/perf/MediaItem.java +++ b/src/test/java/perf/MediaItem.java @@ -5,7 +5,6 @@ import java.util.*; import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.json.JsonFactory; public class MediaItem { @@ -38,7 +37,7 @@ public void addPhoto(Photo p) { public String asJsonString(JsonFactory f) throws IOException { StringWriter w = new StringWriter(); - JsonGenerator gen = f.createGenerator(ObjectWriteContext.empty(), w); + JsonGenerator gen = f.createGenerator(w); write(gen); gen.close(); w.close(); @@ -49,13 +48,13 @@ public void write(JsonGenerator gen) throws IOException { gen.writeStartObject(); - gen.writeName("content"); + gen.writeFieldName("content"); if (_content == null) { gen.writeNull(); } else { _content.write(gen); } - gen.writeName("photos"); + gen.writeFieldName("photos"); if (_photos == null) { gen.writeNull(); } else { @@ -107,14 +106,14 @@ public Photo(String uri, String title, int w, int h, Size s) public void write(JsonGenerator gen) throws IOException { gen.writeStartObject(); - gen.writeStringProperty("uri", _uri); - gen.writeStringProperty("title", _title); - gen.writeNumberProperty("width", _width); - gen.writeNumberProperty("height", _height); + gen.writeStringField("uri", _uri); + gen.writeStringField("title", _title); + gen.writeNumberField("width", _width); + gen.writeNumberField("height", _height); if (_size == null) { - gen.writeNullProperty("size"); + gen.writeNullField("size"); } else { - gen.writeStringProperty("size", _size.name()); + gen.writeStringField("size", _size.name()); } gen.writeEndObject(); } @@ -139,26 +138,26 @@ public void write(JsonGenerator gen) throws IOException { gen.writeStartObject(); - gen.writeStringProperty("uri", _uri); - gen.writeStringProperty("title", _title); + gen.writeStringField("uri", _uri); + gen.writeStringField("title", _title); - gen.writeNumberProperty("width", _width); - gen.writeNumberProperty("height", _height); + gen.writeNumberField("width", _width); + gen.writeNumberField("height", _height); - gen.writeStringProperty("format", _format); + gen.writeStringField("format", _format); - gen.writeNumberProperty("duration", _duration); - gen.writeNumberProperty("size", _size); - gen.writeNumberProperty("bitrate", _bitrate); - gen.writeStringProperty("copyright", _copyright); + gen.writeNumberField("duration", _duration); + gen.writeNumberField("size", _size); + gen.writeNumberField("bitrate", _bitrate); + gen.writeStringField("copyright", _copyright); if (_player == null) { - gen.writeNullProperty("player"); + gen.writeNullField("player"); } else { - gen.writeStringProperty("player", _player.name()); + gen.writeStringField("player", _player.name()); } - gen.writeName("photos"); + gen.writeFieldName("photos"); if (_persons == null) { gen.writeNull(); } else {