You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/org/apache/commons/io/input/BoundedInputStream.java
+73-29Lines changed: 73 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -22,15 +22,11 @@
22
22
importjava.io.InputStream;
23
23
24
24
/**
25
-
* This is a stream that will only supply bytes up to a certain length - if its
26
-
* position goes above that, it will stop.
25
+
* Reads bytes up to a maximum length, if its count goes above that, it stops.
27
26
* <p>
28
-
* This is useful to wrap ServletInputStreams. The ServletInputStream will block
29
-
* if you try to read content from it that isn't there, because it doesn't know
30
-
* whether the content hasn't arrived yet or whether the content has finished.
31
-
* So, one of these, initialized with the Content-length sent in the
32
-
* ServletInputStream's header, will stop it blocking, providing it's been sent
33
-
* with a correct content length.
27
+
* This is useful to wrap ServletInputStreams. The ServletInputStream will block if you try to read content from it that isn't there, because it doesn't know
28
+
* whether the content hasn't arrived yet or whether the content has finished. So, one of these, initialized with the Content-length sent in the
29
+
* ServletInputStream's header, will stop it blocking, providing it's been sent with a correct content length.
34
30
* </p>
35
31
*
36
32
* @since 2.0
@@ -40,11 +36,11 @@ public class BoundedInputStream extends InputStream {
40
36
/** The wrapped input stream. */
41
37
privatefinalInputStreaminputStream;
42
38
43
-
/** The max length to read. */
44
-
privatefinallongmaxLength;
39
+
/** The max count of bytes to read. */
40
+
privatefinallongmaxCount;
45
41
46
-
/** The number of bytes already returned. */
47
-
privatelongpos;
42
+
/** The count of bytes read. */
43
+
privatelongcount;
48
44
49
45
/** The marked position. */
50
46
privatelongmark = EOF;
@@ -53,26 +49,26 @@ public class BoundedInputStream extends InputStream {
53
49
privatebooleanpropagateClose = true;
54
50
55
51
/**
56
-
* Creates a new {@link BoundedInputStream} that wraps the given input
52
+
* Constructs a new {@link BoundedInputStream} that wraps the given input
57
53
* stream and is unlimited.
58
54
*
59
-
* @param in The wrapped input stream
55
+
* @param in The wrapped input stream.
60
56
*/
61
57
publicBoundedInputStream(finalInputStreamin) {
62
58
this(in, EOF);
63
59
}
64
60
65
61
/**
66
-
* Creates a new {@link BoundedInputStream} that wraps the given input
62
+
* Constructs a new {@link BoundedInputStream} that wraps the given input
67
63
* stream and limits it to a certain size.
68
64
*
69
-
* @param inputStream The wrapped input stream
70
-
* @param maxLength The maximum number of bytes to return
65
+
* @param inputStream The wrapped input stream.
66
+
* @param maxLength The maximum number of bytes to return.
0 commit comments