Skip to content

Commit 33f9ab9

Browse files
committed
Clarify use of lineLength <=0
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@669680 13f79535-47bb-0310-9956-ffa450edef68
1 parent 40446e5 commit 33f9ab9

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/java/org/apache/commons/codec/binary/Base64.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ public class Base64 implements BinaryEncoder, BinaryDecoder {
7171

7272
/**
7373
* Line length for encoding. Not used when decoding. Any value of zero or less implies
74-
* so chunking of the base64 encoded data.
74+
* no chunking of the base64 encoded data.
7575
*/
7676
private final int lineLength;
7777

7878
/**
79-
* Line separator for encoding. Not used when decoding. Only used if lineLength >= 1.
79+
* Line separator for encoding. Not used when decoding. Only used if lineLength > 0.
8080
*/
8181
private final byte[] lineSeparator;
8282

@@ -110,7 +110,7 @@ public class Base64 implements BinaryEncoder, BinaryDecoder {
110110
/**
111111
* Variable tracks how many characters have been written to the current line.
112112
* Only used when encoding. We use it to make sure each encoded line never
113-
* goes beyond lineLength (if lineLength >= 0).
113+
* goes beyond lineLength (if lineLength > 0).
114114
*/
115115
private int currentLinePos;
116116

@@ -152,7 +152,9 @@ public Base64() {
152152
* </p>
153153
*
154154
* @param lineLength each line of encoded data will be at most this long
155-
* (rounded up to nearest multiple of 4). Ignored when decoding.
155+
* (rounded up to nearest multiple of 4).
156+
* If lineLength <= 0, then the output will not be divided into lines (chunks).
157+
* Ignored when decoding.
156158
*/
157159
public Base64(int lineLength) {
158160
this(lineLength, CHUNK_SEPARATOR);
@@ -169,8 +171,10 @@ public Base64(int lineLength) {
169171
* </p>
170172
* @param lineLength Each line of encoded data will be at most this long
171173
* (rounded up to nearest multiple of 4). Ignored when decoding.
174+
* If <= 0, then output will not be divided into lines (chunks).
172175
* @param lineSeparator Each line of encoded data will end with this
173176
* sequence of bytes.
177+
* If lineLength <= 0, then the lineSeparator is not used.
174178
* @throws IllegalArgumentException The provided lineSeparator included
175179
* some base64 characters. That's not going to work!
176180
*/

0 commit comments

Comments
 (0)