Skip to content

Commit c6812d6

Browse files
committed
- Javadoc.
- Remove extraneous () in return statements. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/codec/trunk@130317 13f79535-47bb-0310-9956-ffa450edef68
1 parent 98b5bc5 commit c6812d6

1 file changed

Lines changed: 25 additions & 19 deletions

File tree

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

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,42 @@
2222
import org.apache.commons.codec.EncoderException;
2323

2424
/**
25-
* Provides encode/decode for RFC 2045 Base64 as
26-
* defined by RFC 2045, by Freed and Borenstein.
25+
* Provides Base64 encoding and decoding as defined by RFC 2045.
26+
*
27+
* <p>This class implements section <cite>6.8. Base64 Content-Transfer-Encoding</cite>
28+
* from RFC 2045 <cite>Multipurpose Internet Mail Extensions (MIME) Part One:
29+
* Format of Internet Message Bodies</cite> by Freed and Borenstein.</p>
2730
*
2831
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
2932
* @author Apache Software Foundation
3033
* @since 1.0-dev
31-
* @version $Id: Base64.java,v 1.17 2004/02/29 04:08:31 tobrien Exp $
34+
* @version $Id: Base64.java,v 1.18 2004/03/18 17:34:56 ggregory Exp $
3235
*/
3336
public class Base64 implements BinaryEncoder, BinaryDecoder {
3437

3538
/**
36-
* Chunk size according to RFC 2045
39+
* Chunk size according to RFC 2045.
40+
*
41+
* <p>The {@value} character limit does not count the trailing CRLF, but counts
42+
* all other characters, including any equal signs.</p>
43+
*
44+
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 2.1</a>
3745
*/
3846
static final int CHUNK_SIZE = 76;
3947

4048
/**
4149
* Chunk separator, we use a newline to separate chunks
42-
* of encoded data (if you ask for it to be chunked)
50+
* of encoded data (if you ask for it to be chunked).
4351
*/
4452
static final byte[] CHUNK_SEPARATOR = "\n".getBytes();
4553

4654
/**
47-
* The bsae length
55+
* The base length.
4856
*/
4957
static final int BASELENGTH = 255;
5058

5159
/**
52-
* Lookup length
60+
* Lookup length.
5361
*/
5462
static final int LOOKUPLENGTH = 64;
5563

@@ -59,27 +67,27 @@ public class Base64 implements BinaryEncoder, BinaryDecoder {
5967
static final int EIGHTBIT = 8;
6068

6169
/**
62-
* Used when encoding something which has fewer than 24 bits
70+
* Used when encoding something which has fewer than 24 bits.
6371
*/
6472
static final int SIXTEENBIT = 16;
6573

6674
/**
67-
* Constant used to determine how many bits data contains
75+
* Used to determine how many bits data contains.
6876
*/
6977
static final int TWENTYFOURBITGROUP = 24;
7078

7179
/**
72-
* Used to get the number of Quadruples
80+
* Used to get the number of Quadruples.
7381
*/
7482
static final int FOURBYTE = 4;
7583

7684
/**
77-
* Used to test the sign of a byte
85+
* Used to test the sign of a byte.
7886
*/
7987
static final int SIGN = -128;
8088

8189
/**
82-
* Byte used to pad output
90+
* Byte used to pad output.
8391
*/
8492
static final byte PAD = (byte) '=';
8593

@@ -133,7 +141,7 @@ private static boolean isBase64(byte octect) {
133141
}
134142

135143
/**
136-
* This array tests a given byte array to see if it contains
144+
* Tests a given byte array to see if it contains
137145
* only valid characters within the Base64 alphabet.
138146
*
139147
* @param arrayOctect byte array to test
@@ -166,7 +174,7 @@ public static boolean isArrayByteBase64(byte[] arrayOctect) {
166174
* @return Base64 characters
167175
*/
168176
public static byte[] encodeBase64(byte[] binaryData) {
169-
return (encodeBase64(binaryData, false));
177+
return encodeBase64(binaryData, false);
170178
}
171179

172180
/**
@@ -177,7 +185,7 @@ public static byte[] encodeBase64(byte[] binaryData) {
177185
* @return Base64 characters chunked in 76 character blocks
178186
*/
179187
public static byte[] encodeBase64Chunked(byte[] binaryData) {
180-
return (encodeBase64(binaryData, true));
188+
return encodeBase64(binaryData, true);
181189
}
182190

183191

@@ -215,9 +223,7 @@ public Object decode(Object pObject) throws DecoderException {
215223
* @return a byte array containing binary data
216224
*/
217225
public byte[] decode(byte[] pArray) {
218-
byte[] result;
219-
result = decodeBase64(pArray);
220-
return (result);
226+
return decodeBase64(pArray);
221227
}
222228

223229
/**
@@ -524,7 +530,7 @@ public Object encode(Object pObject) throws EncoderException {
524530
* @return A byte array containing only Base64 character data
525531
*/
526532
public byte[] encode(byte[] pArray) {
527-
return (encodeBase64(pArray, false));
533+
return encodeBase64(pArray, false);
528534
}
529535

530536
}

0 commit comments

Comments
 (0)