[java-support] branch master updated: Add a Base32 support class.
Scott Cantor
cantor.2 at osu.edu
Fri Jan 20 17:24:09 EST 2017
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=bc7c2d968c8a2b7844ab8bef5cf969d83e403dd9
The following commit(s) were added to refs/heads/master by this push:
new bc7c2d9 Add a Base32 support class.
bc7c2d9 is described below
commit bc7c2d968c8a2b7844ab8bef5cf969d83e403dd9
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Jan 20 17:24:07 2017 -0500
Add a Base32 support class.
---
.../{Base64Support.java => Base32Support.java} | 26 ++++++++++------------
.../java/support/codec/Base64Support.java | 2 --
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java b/src/main/java/net/shibboleth/utilities/java/support/codec/Base32Support.java
similarity index 79%
copy from src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java
copy to src/main/java/net/shibboleth/utilities/java/support/codec/Base32Support.java
index 1218ef5..aafcf00 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/codec/Base32Support.java
@@ -22,20 +22,18 @@ import javax.annotation.Nonnull;
import net.shibboleth.utilities.java.support.logic.Constraint;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
-import org.apache.commons.codec.binary.Base64;
-
-// Checkstyle: AbstractClassName OFF
+import org.apache.commons.codec.binary.Base32;
/**
- * Helper class for working with {@link Base64}.
+ * Helper class for working with {@link Base32}.
*
* <p>
* This helper class specifically addresses that waste of the Apache Codec encode/decode static methods creating new
- * instances of the {@link Base64} for every operation. It also provides the helper method to produce both chunked and
+ * instances of the {@link Base32} for every operation. It also provides the helper method to produce both chunked and
* unchunked encoded content as strings.
* </p>
*/
-public final class Base64Support {
+public final class Base32Support {
/** Chunk the encoded data into 76-character lines broken by CRLF characters. */
public static final boolean CHUNKED = true;
@@ -44,23 +42,23 @@ public final class Base64Support {
public static final boolean UNCHUNKED = false;
/** Encoder used to produce chunked output. */
- private static final Base64 CHUNKED_ENCODER = new Base64(76, new byte[] { '\n' });
+ private static final Base32 CHUNKED_ENCODER = new Base32(76, new byte[] { '\n' });
/** Encoder used to produce unchunked output. */
- private static final Base64 UNCHUNKED_ENCODER = new Base64(0, new byte[] { '\n' });
+ private static final Base32 UNCHUNKED_ENCODER = new Base32(0, new byte[] { '\n' });
/** Constructor. */
- private Base64Support() {
+ private Base32Support() {
}
/**
- * Base64 encodes the given binary data.
+ * Base32 encodes the given binary data.
*
* @param data data to encode
* @param chunked whether the encoded data should be chunked or not
*
- * @return the base64 encoded data
+ * @return the base32 encoded data
*/
@Nonnull public static String encode(@Nonnull final byte[] data, final boolean chunked) {
Constraint.isNotNull(data, "Binary data to be encoded can not be null");
@@ -72,14 +70,14 @@ public final class Base64Support {
}
/**
- * Decodes (un)chunked Base64 encoded data.
+ * Decodes (un)chunked Base32 encoded data.
*
- * @param data Base64 encoded data
+ * @param data Base32 encoded data
*
* @return the decoded data
*/
@Nonnull public static byte[] decode(@Nonnull final String data) {
- Constraint.isNotNull(data, "Base64 encoded data can not be null");
+ Constraint.isNotNull(data, "Base32 encoded data cannot be null");
return CHUNKED_ENCODER.decode(data);
}
}
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java b/src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java
index 1218ef5..eedfbb2 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java
@@ -24,8 +24,6 @@ import net.shibboleth.utilities.java.support.primitive.StringSupport;
import org.apache.commons.codec.binary.Base64;
-// Checkstyle: AbstractClassName OFF
-
/**
* Helper class for working with {@link Base64}.
*
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list