1
1
package com .fasterxml .jackson .core .io ;
2
2
3
+ import com .fasterxml .jackson .core .ErrorReportConfiguration ;
3
4
import com .fasterxml .jackson .core .JsonEncoding ;
4
5
import com .fasterxml .jackson .core .StreamReadConstraints ;
5
6
import com .fasterxml .jackson .core .StreamWriteConstraints ;
@@ -68,6 +69,11 @@ public class IOContext
68
69
*/
69
70
protected final StreamReadConstraints _streamReadConstraints ;
70
71
72
+ /**
73
+ * @since 2.16
74
+ */
75
+ protected final ErrorReportConfiguration _errorReportConfiguration ;
76
+
71
77
/**
72
78
* @since 2.16
73
79
*/
@@ -129,18 +135,38 @@ public class IOContext
129
135
* @param managedResource Whether input source is managed (owned) by Jackson library
130
136
*
131
137
* @since 2.16
138
+ * @deprecated Since 2.16, use {@link #IOContext(StreamReadConstraints, StreamWriteConstraints, BufferRecycler,
139
+ * ContentReference, boolean, ErrorReportConfiguration)} instead.
132
140
*/
141
+ @ Deprecated
133
142
public IOContext (StreamReadConstraints src , StreamWriteConstraints swc , BufferRecycler br ,
134
143
ContentReference contentRef , boolean managedResource )
135
144
{
136
- _streamReadConstraints = (src == null ) ?
137
- StreamReadConstraints .defaults () : src ;
138
- _streamWriteConstraints = (swc == null ) ?
139
- StreamWriteConstraints .defaults () : swc ;
145
+ this (src , swc , br , contentRef , managedResource , ErrorReportConfiguration .defaults ());
146
+ }
147
+
148
+ /**
149
+ * Main constructor to use.
150
+ *
151
+ * @param src constraints for streaming reads
152
+ * @param swc constraints for streaming writes
153
+ * @param br BufferRecycler to use, if any ({@code null} if none)
154
+ * @param contentRef Input source reference for location reporting
155
+ * @param managedResource Whether input source is managed (owned) by Jackson library
156
+ * @param erc Error report configuration to use
157
+ *
158
+ * @since 2.16
159
+ */
160
+ public IOContext (StreamReadConstraints src , StreamWriteConstraints swc , BufferRecycler br ,
161
+ ContentReference contentRef , boolean managedResource , ErrorReportConfiguration erc )
162
+ {
163
+ _streamReadConstraints = src ;
164
+ _streamWriteConstraints = swc ;
140
165
_bufferRecycler = br ;
141
166
_contentReference = contentRef ;
142
167
_sourceRef = contentRef .getRawContent ();
143
168
_managedResource = managedResource ;
169
+ _errorReportConfiguration = erc ;
144
170
}
145
171
146
172
/**
@@ -150,19 +176,14 @@ public IOContext(StreamReadConstraints src, StreamWriteConstraints swc, BufferRe
150
176
* @param managedResource Whether input source is managed (owned) by Jackson library
151
177
*
152
178
* @since 2.15
153
- * @deprecated use v2.16 constructor with additional <code>StreamWriteConstraints</code>
179
+ * @deprecated Since 2.16. Use {@link #IOContext(StreamReadConstraints, StreamWriteConstraints, BufferRecycler,
180
+ * ContentReference, boolean, ErrorReportConfiguration)} instead.
154
181
*/
155
182
@ Deprecated
156
183
public IOContext (StreamReadConstraints src , BufferRecycler br ,
157
184
ContentReference contentRef , boolean managedResource )
158
185
{
159
- _streamReadConstraints = (src == null ) ?
160
- StreamReadConstraints .defaults () : src ;
161
- _streamWriteConstraints = StreamWriteConstraints .defaults ();
162
- _bufferRecycler = br ;
163
- _contentReference = contentRef ;
164
- _sourceRef = contentRef .getRawContent ();
165
- _managedResource = managedResource ;
186
+ this (src , StreamWriteConstraints .defaults (), br , contentRef , managedResource , ErrorReportConfiguration .defaults ());
166
187
}
167
188
168
189
/**
@@ -199,6 +220,16 @@ public StreamWriteConstraints streamWriteConstraints() {
199
220
return _streamWriteConstraints ;
200
221
}
201
222
223
+ /**
224
+ * @return Configured {@link ErrorReportConfiguration}, containing configured values for
225
+ * handling error reporting.
226
+ *
227
+ * @since 2.16
228
+ */
229
+ public ErrorReportConfiguration errorReportConfiguration () {
230
+ return _errorReportConfiguration ;
231
+ }
232
+
202
233
public void setEncoding (JsonEncoding enc ) {
203
234
_encoding = enc ;
204
235
}
0 commit comments