Skip to content

Commit 0dcfde0

Browse files
committed
Fix #713: add back BufferRecyclers.getJsonStringEncoder() (removed in 2.10.0)
1 parent abc7f13 commit 0dcfde0

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

release-notes/VERSION-2.x

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ JSON library.
1616

1717
(not yet released)
1818

19-
#712: (partial) Optimize array allocation by JsonStringEncoder
19+
#712: (partial) Optimize array allocation by `JsonStringEncoder`
20+
#713: Add back accidentally removed `JsonStringEncoder` related methods in
21+
`BufferRecyclers` (like `getJsonStringEncoder()`)
2022

2123
2.11.4 (12-Dec-2020)
2224

src/main/java/com/fasterxml/jackson/core/util/BufferRecyclers.java

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.lang.ref.SoftReference;
44

5+
import com.fasterxml.jackson.core.io.JsonStringEncoder;
6+
57
/**
68
* Helper entity used to control access to simple buffer recyling scheme used for
79
* some encoding, decoding tasks.
@@ -94,4 +96,70 @@ public static int releaseBuffers() {
9496
}
9597
return -1;
9698
}
99+
100+
/*
101+
/**********************************************************************
102+
/* Obsolete things re-introduced in 2.12.5 after accidental direct
103+
/* removal from 2.10.0
104+
/**********************************************************************
105+
*/
106+
107+
/**
108+
* Not to be used any more: call {@link JsonStringEncoder#getInstance()} instead.
109+
*
110+
* @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated
111+
* in 2.12.5, to be removed from 3.0)
112+
*/
113+
@Deprecated
114+
public static JsonStringEncoder getJsonStringEncoder() {
115+
return JsonStringEncoder.getInstance();
116+
}
117+
118+
/**
119+
* Not to be used any more: call {@link JsonStringEncoder#getInstance()} (and then
120+
* {@code encodeAsUTF8()}) instead.
121+
*
122+
* @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated
123+
* in 2.12.5, to be removed from 3.0)
124+
*/
125+
@Deprecated
126+
public static byte[] encodeAsUTF8(String text) {
127+
return JsonStringEncoder.getInstance().encodeAsUTF8(text);
128+
}
129+
130+
/**
131+
* Not to be used any more: call {@link JsonStringEncoder#getInstance()} (and then
132+
* {@code quoteAsString()}) instead.
133+
*
134+
* @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated
135+
* in 2.12.5, to be removed from 3.0)
136+
*/
137+
@Deprecated
138+
public static char[] quoteAsJsonText(String rawText) {
139+
return JsonStringEncoder.getInstance().quoteAsString(rawText);
140+
}
141+
142+
/**
143+
* Not to be used any more: call {@link JsonStringEncoder#getInstance()} (and then
144+
* {@code quoteAsString()}) instead.
145+
*
146+
* @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated
147+
* in 2.12.5, to be removed from 3.0)
148+
*/
149+
@Deprecated
150+
public static void quoteAsJsonText(CharSequence input, StringBuilder output) {
151+
JsonStringEncoder.getInstance().quoteAsString(input, output);
152+
}
153+
154+
/**
155+
* Not to be used any more: call {@link JsonStringEncoder#getInstance()} (and then
156+
* {@code quoteAsUTF8()}) instead.
157+
*
158+
* @deprecated Since 2.10 (note: was accidentally removed but reintroduced as deprecated
159+
* in 2.12.5, to be removed from 3.0)
160+
*/
161+
@Deprecated
162+
public static byte[] quoteAsJsonUTF8(String rawText) {
163+
return JsonStringEncoder.getInstance().quoteAsUTF8(rawText);
164+
}
97165
}

0 commit comments

Comments
 (0)