File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed
spring-core/src/main/java/org/springframework/util
spring-web/src/main/java/org/springframework/web/util Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 24
24
import java .util .LinkedList ;
25
25
26
26
/**
27
- * A speedy alternative to {@link java.io.ByteArrayOutputStream}.
27
+ * A speedy alternative to {@link java.io.ByteArrayOutputStream}. Note that
28
+ * this variant does <i>not</i> extend {@code ByteArrayOutputStream}, unlike
29
+ * its sibling {@link ResizableByteArrayOutputStream}.
28
30
*
29
31
* <p>Unlike {@link java.io.ByteArrayOutputStream}, this implementation is backed
30
32
* by a {@link java.util.LinkedList} of {@code byte[]} instead of 1 constantly
35
37
* with the {@link #writeTo(OutputStream)} method.
36
38
*
37
39
* @author Craig Andrews
40
+ * @author Juergen Hoeller
38
41
* @since 4.2
42
+ * @see #resize
43
+ * @see ResizableByteArrayOutputStream
39
44
*/
40
- public final class FastByteArrayOutputStream extends OutputStream {
45
+ public class FastByteArrayOutputStream extends OutputStream {
41
46
42
47
private static final int DEFAULT_BLOCK_SIZE = 256 ;
43
48
Original file line number Diff line number Diff line change 35
35
* @author Brian Clozel
36
36
* @author Juergen Hoeller
37
37
* @since 4.0.3
38
+ * @see #resize
39
+ * @see FastByteArrayOutputStream
38
40
*/
39
41
public class ResizableByteArrayOutputStream extends ByteArrayOutputStream {
40
42
Original file line number Diff line number Diff line change @@ -170,20 +170,23 @@ public byte[] getContentAsByteArray() {
170
170
171
171
/**
172
172
* Return an {@link InputStream} to the cached content.
173
+ * @since 4.2
173
174
*/
174
175
public InputStream getContentInputStream (){
175
176
return this .content .getInputStream ();
176
177
}
177
178
178
179
/**
179
180
* Return the current size of the cached content.
181
+ * @since 4.2
180
182
*/
181
183
public int getContentSize (){
182
184
return this .content .size ();
183
185
}
184
186
185
187
/**
186
188
* Copy the complete cached body content to the response.
189
+ * @since 4.2
187
190
*/
188
191
public void copyBodyToResponse () throws IOException {
189
192
copyBodyToResponse (true );
@@ -193,6 +196,7 @@ public void copyBodyToResponse() throws IOException {
193
196
* Copy the cached body content to the response.
194
197
* @param complete whether to set a corresponding content length
195
198
* for the complete cached body content
199
+ * @since 4.2
196
200
*/
197
201
protected void copyBodyToResponse (boolean complete ) throws IOException {
198
202
if (this .content .size () > 0 ) {
You can’t perform that action at this time.
0 commit comments