Skip to content

Commit f9808d1

Browse files
committed
Javadoc
1 parent c785924 commit f9808d1

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

  • src/main/java/org/apache/commons/codec/binary

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

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,19 @@
3232
* This class implements <a href="https://www.ietf.org/rfc/rfc2045#section-6.8">RFC 2045 6.8. Base64 Content-Transfer-Encoding</a>.
3333
* </p>
3434
* <p>
35-
* The class can be parameterized in the following manner with various constructors:
35+
* The class can be parameterized in the following manner with its {@link Builder}:
3636
* </p>
3737
* <ul>
3838
* <li>URL-safe mode: Default off.</li>
3939
* <li>Line length: Default 76. Line length that aren't multiples of 4 will still essentially end up being multiples of 4 in the encoded data.
4040
* <li>Line separator: Default is CRLF ({@code "\r\n"})</li>
41+
* <li>Strict or lenient decoding policy; default is {@link CodecPolicy#LENIENT}.</li>
42+
* <li>Custom decoding table.</li>
43+
* <li>Custom encoding table.</li>
44+
* <li>Padding; defaults is {@code '='}.</li>
4145
* </ul>
4246
* <p>
43-
* The URL-safe parameter is only applied to encode operations. Decoding seamlessly handles both modes.
47+
* The URL-safe parameter is only applied to encode operations. Decoding seamlessly handles both modes, see also {@link Builder#setDecodeTableFormat(DecodeTableFormat)}.
4448
* </p>
4549
* <p>
4650
* Since this class operates directly on byte streams, and not character streams, it is hard-coded to only encode/decode character encodings which are
@@ -55,7 +59,7 @@
5559
*
5660
* <pre>
5761
* Base64 base64 = Base64.builder()
58-
* .setDecodingPolicy(DecodingPolicy.LENIENT) // default is lenient, null resets to default
62+
* .setDecodingPolicy(CodecPolicy.LENIENT) // default is lenient, null resets to default
5963
* .setEncodeTable(customEncodeTable) // default is built in, null resets to default
6064
* .setLineLength(0) // default is none
6165
* .setLineSeparator('\r', '\n') // default is CR LF, null resets to default
@@ -81,7 +85,7 @@ public class Base64 extends BaseNCodec {
8185
*
8286
* <pre>
8387
* Base64 base64 = Base64.builder()
84-
* .setDecodingPolicy(DecodingPolicy.LENIENT) // default is lenient, null resets to default
88+
* .setCodecPolicy(CodecPolicy.LENIENT) // default is lenient, null resets to default
8589
* .setEncodeTable(customEncodeTable) // default is built in, null resets to default
8690
* .setLineLength(0) // default is none
8791
* .setLineSeparator('\r', '\n') // default is CR LF, null resets to default
@@ -323,7 +327,7 @@ public enum DecodeTableFormat {
323327
*
324328
* <pre>
325329
* Base64 base64 = Base64.builder()
326-
* .setDecodingPolicy(DecodingPolicy.LENIENT) // default is lenient, null resets to default
330+
* .setDecodingPolicy(CodecPolicy.LENIENT) // default is lenient, null resets to default
327331
* .setEncodeTable(customEncodeTable) // default is built in, null resets to default
328332
* .setLineLength(0) // default is none
329333
* .setLineSeparator('\r', '\n') // default is CR LF, null resets to default
@@ -358,8 +362,8 @@ private static byte[] calculateDecodeTable(final byte[] encodeTable) {
358362
* Decodes Base64 data into octets.
359363
* <p>
360364
* This method seamlessly handles data encoded in URL-safe or normal mode. For enforcing verification against strict standard Base64 or Base64 URL-safe
361-
* tables, please use {@link #decodeBase64Standard(byte[])} or {@link #decodeBase64UrlSafe(byte[])} methods respectively. This method skips any unknown or
362-
* not supported bytes.
365+
* tables, please use {@link #decodeBase64Standard(byte[])} or {@link #decodeBase64UrlSafe(byte[])} methods respectively. This method skips unknown or
366+
* unsupported bytes.
363367
* </p>
364368
*
365369
* @param base64Data Byte array containing Base64 data.
@@ -373,8 +377,8 @@ public static byte[] decodeBase64(final byte[] base64Data) {
373377
* Decodes a Base64 String into octets.
374378
* <p>
375379
* This method seamlessly handles data encoded in URL-safe or normal mode. For enforcing verification against strict standard Base64 or Base64 URL-safe
376-
* tables, please use {@link #decodeBase64Standard(String)} or {@link #decodeBase64UrlSafe(String)} methods respectively. This method skips any unknown or
377-
* not supported bytes.
380+
* tables, please use {@link #decodeBase64Standard(String)} or {@link #decodeBase64UrlSafe(String)} methods respectively. This method skips unknown or
381+
* unsupported bytes.
378382
* </p>
379383
*
380384
* @param base64String String containing Base64 data.
@@ -389,7 +393,7 @@ public static byte[] decodeBase64(final String base64String) {
389393
* Decodes standard Base64 data into octets.
390394
* <p>
391395
* This implementation is aligned with the <a href="https://www.ietf.org/rfc/rfc2045#:~:text=Table%201%3A%20The%20Base64%20Alphabet">RFC 2045 Table 1: The
392-
* Base64 Alphabet</a>. This method skips any unknown or not supported bytes.
396+
* Base64 Alphabet</a>. This method skips unknown or unsupported bytes.
393397
* </p>
394398
*
395399
* @param base64Data Byte array containing Base64 data.
@@ -404,7 +408,7 @@ public static byte[] decodeBase64Standard(final byte[] base64Data) {
404408
* Decodes a standard Base64 String into octets.
405409
* <p>
406410
* This implementation is aligned with the <a href="https://www.ietf.org/rfc/rfc2045#:~:text=Table%201%3A%20The%20Base64%20Alphabet">RFC 2045 Table 1: The
407-
* Base64 Alphabet</a>. This method skips any unknown or not supported characters.
411+
* Base64 Alphabet</a>. This method skips unknown or unsupported characters.
408412
* </p>
409413
*
410414
* @param base64String String containing Base64 data.
@@ -420,7 +424,7 @@ public static byte[] decodeBase64Standard(final String base64String) {
420424
* <p>
421425
* This implementation is aligned with
422426
* <a href="https://datatracker.ietf.org/doc/html/rfc4648#:~:text=Table%202%3A%20The%20%22URL%20and%20Filename%20safe%22%20Base%2064%20Alphabet">RFC 4648
423-
* Table 2: The "URL and Filename safe" Base 64 Alphabet</a>. This method skips any unknown or not supported characters.
427+
* Table 2: The "URL and Filename safe" Base 64 Alphabet</a>. This method skips unknown or unsupported characters.
424428
* </p>
425429
*
426430
* @param base64Data Byte array containing Base64 data.
@@ -436,7 +440,7 @@ public static byte[] decodeBase64UrlSafe(final byte[] base64Data) {
436440
* <p>
437441
* This implementation is aligned with
438442
* <a href="https://datatracker.ietf.org/doc/html/rfc4648#:~:text=Table%202%3A%20The%20%22URL%20and%20Filename%20safe%22%20Base%2064%20Alphabet">RFC 4648
439-
* Table 2: The "URL and Filename safe" Base 64 Alphabet</a>. This method skips any unknown or not supported characters.
443+
* Table 2: The "URL and Filename safe" Base 64 Alphabet</a>. This method skips unknown or unsupported characters.
440444
* </p>
441445
*
442446
* @param base64String String containing Base64 data.

0 commit comments

Comments
 (0)