j3graham commented on code in PR #370:
URL:
https://github.com/apache/httpcomponents-client/pull/370#discussion_r883266409
##########
httpclient5/src/main/java/org/apache/hc/client5/http/utils/Base64.java:
##########
@@ -30,39 +30,41 @@
import org.apache.hc.core5.annotation.Internal;
-import java.nio.charset.StandardCharsets;
-
import static java.util.Base64.getEncoder;
import static java.util.Base64.getMimeDecoder;
/**
* Provide implementations of the Base64 conversion methods from
commons-codec, delegating to the Java Base64
* implementation.
* <p>
+ * * <ul>Only the features currently used by http-client are implemented here
rather than all the features of commons-coded</ul>
* Notes:
* <p>
* <ul>commons-codec accepts null inputs, so this is also accepted here. This
is not done in the Java 8 implementation</ul>
- * <ul>decoding invalid inputs returns an empty value. The Java 8
implementation throws an exception, which is caught here</ul>
- * <ul>commons-codec decoders accept both standard and url-safe variants of
input. This needs to be remapped for Java 8, as it
- * will accept either one or the other, but not both. This is likely a
rarely-needed requirement, but is provided to avoid
- * compatibility surprises.
+ * <ul>Decoding invalid inputs returns an empty value. The Java 8
implementation throws an exception, which is caught here</ul>
+ * <ul>commons-codec decoders accept both standard and url-safe variants of
input. As this is not a requirement for
+ * httpcommons-client, this is NOT implemented here.
Review Comment:
Done
##########
httpclient5/src/main/java/org/apache/hc/client5/http/utils/Base64.java:
##########
@@ -30,39 +30,41 @@
import org.apache.hc.core5.annotation.Internal;
-import java.nio.charset.StandardCharsets;
-
import static java.util.Base64.getEncoder;
import static java.util.Base64.getMimeDecoder;
/**
* Provide implementations of the Base64 conversion methods from
commons-codec, delegating to the Java Base64
* implementation.
* <p>
+ * * <ul>Only the features currently used by http-client are implemented here
rather than all the features of commons-coded</ul>
* Notes:
* <p>
* <ul>commons-codec accepts null inputs, so this is also accepted here. This
is not done in the Java 8 implementation</ul>
- * <ul>decoding invalid inputs returns an empty value. The Java 8
implementation throws an exception, which is caught here</ul>
- * <ul>commons-codec decoders accept both standard and url-safe variants of
input. This needs to be remapped for Java 8, as it
- * will accept either one or the other, but not both. This is likely a
rarely-needed requirement, but is provided to avoid
- * compatibility surprises.
+ * <ul>Decoding invalid inputs returns an empty value. The Java 8
implementation throws an exception, which is caught here</ul>
+ * <ul>commons-codec decoders accept both standard and url-safe variants of
input. As this is not a requirement for
+ * httpcommons-client, this is NOT implemented here.
* </ul>
- * <ul>Only the features currently used by http-client are implemented here
rather than all the features of commons-coded</ul>
+ * <p>
+ * This class is intended as in interim convenience. Any new code should just
use `java.util.Base64` directly.
*/
@Internal
public class Base64 {
+ private static final Base64 CODEC = new Base64();
private static final byte[] EMPTY_BYTES = new byte[0];
/**
- * Creates a Base64 codec used for decoding (all modes) and encoding in
URL-unsafe mode.
+ * Return an instance of the Base64 codec that use the regular Base64
alphabet
+ * (as opposed to the URL-safe alphabet). Note that unlike the
commons-codec version,
+ * thus class will NOT decode characters from URL-safe alphabet.
*/
public Base64() {
}
/**
- * Creates a Base64 codec used for decoding (all modes) and encoding in
URL-unsafe mode.
+ * Creates a Base64 codec used for decoding and encoding in URL-unsafe
mode.
* <p>
- * As http-client never uses a non-zero length, this feature is not
implemented here.
+ * As httpcommons-client never uses a non-zero length, this feature is not
implemented here.
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]