@@ -109,9 +109,6 @@ public void setEncoding(JsonEncoding enc) {
109109 _encoding = enc ;
110110 }
111111
112- /**
113- * @since 1.6
114- */
115112 public IOContext withEncoding (JsonEncoding enc ) {
116113 _encoding = enc ;
117114 return this ;
@@ -138,29 +135,54 @@ public TextBuffer constructTextBuffer() {
138135 }
139136
140137 /**
138+ * Method for recycling or allocation byte buffer of "read I/O" type.
141139 *<p>
142140 * Note: the method can only be called once during its life cycle.
143141 * This is to protect against accidental sharing.
142+ *
143+ * @return Allocated or recycled byte buffer
144144 */
145145 public byte [] allocReadIOBuffer () {
146146 _verifyAlloc (_readIOBuffer );
147147 return (_readIOBuffer = _bufferRecycler .allocByteBuffer (BufferRecycler .BYTE_READ_IO_BUFFER ));
148148 }
149149
150150 /**
151+ * Variant of {@link #allocReadIOBuffer()} that specifies smallest acceptable
152+ * buffer size.
153+ *
154+ * @param minSize Minimum size of the buffer to recycle or allocate
155+ *
156+ * @return Allocated or recycled byte buffer
157+ *
151158 * @since 2.4
152159 */
153160 public byte [] allocReadIOBuffer (int minSize ) {
154161 _verifyAlloc (_readIOBuffer );
155162 return (_readIOBuffer = _bufferRecycler .allocByteBuffer (BufferRecycler .BYTE_READ_IO_BUFFER , minSize ));
156163 }
157-
164+
165+ /**
166+ * Method for recycling or allocation byte buffer of "write encoding" type.
167+ *<p>
168+ * Note: the method can only be called once during its life cycle.
169+ * This is to protect against accidental sharing.
170+ *
171+ * @return Allocated or recycled byte buffer
172+ */
158173 public byte [] allocWriteEncodingBuffer () {
159174 _verifyAlloc (_writeEncodingBuffer );
160175 return (_writeEncodingBuffer = _bufferRecycler .allocByteBuffer (BufferRecycler .BYTE_WRITE_ENCODING_BUFFER ));
161176 }
162177
163178 /**
179+ * Variant of {@link #allocWriteEncodingBuffer()} that specifies smallest acceptable
180+ * buffer size.
181+ *
182+ * @param minSize Minimum size of the buffer to recycle or allocate
183+ *
184+ * @return Allocated or recycled byte buffer
185+ *
164186 * @since 2.4
165187 */
166188 public byte [] allocWriteEncodingBuffer (int minSize ) {
@@ -169,14 +191,26 @@ public byte[] allocWriteEncodingBuffer(int minSize) {
169191 }
170192
171193 /**
172- * @since 2.1
194+ * Method for recycling or allocation byte buffer of "base 64 encode/decode" type.
195+ *<p>
196+ * Note: the method can only be called once during its life cycle.
197+ * This is to protect against accidental sharing.
198+ *
199+ * @return Allocated or recycled byte buffer
173200 */
174201 public byte [] allocBase64Buffer () {
175202 _verifyAlloc (_base64Buffer );
176203 return (_base64Buffer = _bufferRecycler .allocByteBuffer (BufferRecycler .BYTE_BASE64_CODEC_BUFFER ));
177204 }
178205
179206 /**
207+ * Variant of {@link #allocBase64Buffer()} that specifies smallest acceptable
208+ * buffer size.
209+ *
210+ * @param minSize Minimum size of the buffer to recycle or allocate
211+ *
212+ * @return Allocated or recycled byte buffer
213+ *
180214 * @since 2.9
181215 */
182216 public byte [] allocBase64Buffer (int minSize ) {
@@ -189,9 +223,7 @@ public char[] allocTokenBuffer() {
189223 return (_tokenCBuffer = _bufferRecycler .allocCharBuffer (BufferRecycler .CHAR_TOKEN_BUFFER ));
190224 }
191225
192- /**
193- * @since 2.4
194- */
226+ // @since 2.4
195227 public char [] allocTokenBuffer (int minSize ) {
196228 _verifyAlloc (_tokenCBuffer );
197229 return (_tokenCBuffer = _bufferRecycler .allocCharBuffer (BufferRecycler .CHAR_TOKEN_BUFFER , minSize ));
@@ -210,12 +242,13 @@ public char[] allocNameCopyBuffer(int minSize) {
210242 /**
211243 * Method to call when all the processing buffers can be safely
212244 * recycled.
245+ *
246+ * @param buf Buffer instance to release (return for recycling)
213247 */
214248 public void releaseReadIOBuffer (byte [] buf ) {
215249 if (buf != null ) {
216- /* Let's do sanity checks to ensure once-and-only-once release,
217- * as well as avoiding trying to release buffers not owned
218- */
250+ // Let's do sanity checks to ensure once-and-only-once release,
251+ // as well as avoiding trying to release buffers not owned
219252 _verifyRelease (buf , _readIOBuffer );
220253 _readIOBuffer = null ;
221254 _bufferRecycler .releaseByteBuffer (BufferRecycler .BYTE_READ_IO_BUFFER , buf );
@@ -224,9 +257,8 @@ public void releaseReadIOBuffer(byte[] buf) {
224257
225258 public void releaseWriteEncodingBuffer (byte [] buf ) {
226259 if (buf != null ) {
227- /* Let's do sanity checks to ensure once-and-only-once release,
228- * as well as avoiding trying to release buffers not owned
229- */
260+ // Let's do sanity checks to ensure once-and-only-once release,
261+ // as well as avoiding trying to release buffers not owned
230262 _verifyRelease (buf , _writeEncodingBuffer );
231263 _writeEncodingBuffer = null ;
232264 _bufferRecycler .releaseByteBuffer (BufferRecycler .BYTE_WRITE_ENCODING_BUFFER , buf );
@@ -268,9 +300,9 @@ public void releaseNameCopyBuffer(char[] buf) {
268300 }
269301
270302 /*
271- /**********************************************************
303+ /**********************************************************************
272304 /* Internal helpers
273- /**********************************************************
305+ /**********************************************************************
274306 */
275307
276308 protected final void _verifyAlloc (Object buffer ) {
0 commit comments