
artoria.codec.support.ApacheBase64 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of artoria-extend Show documentation
Show all versions of artoria-extend Show documentation
Artoria is a java technology framework based on the facade pattern.
The newest version!
package artoria.codec.support;
import static artoria.common.constant.Numbers.MINUS_ONE;
import static artoria.common.constant.Numbers.ZERO;
public class ApacheBase64 extends Base64 {
private final org.apache.commons.codec.binary.Base64 apacheBase64;
public ApacheBase64() {
this(false, false, MINUS_ONE, null);
}
public ApacheBase64(boolean urlSafe) {
this(urlSafe, false, MINUS_ONE, null);
}
public ApacheBase64(boolean mime, int lineLength, byte[] lineSeparator) {
this(false, mime, lineLength, lineSeparator);
}
protected ApacheBase64(boolean urlSafe, boolean mime, int lineLength, byte[] lineSeparator) {
super(urlSafe, mime, lineLength, lineSeparator);
if (mime) {
lineLength = lineLength > ZERO ? lineLength : DEFAULT_MIME_LINE_LENGTH;
}
else { lineLength = MINUS_ONE; }
apacheBase64 = new org.apache.commons.codec.binary.Base64(
lineLength, lineSeparator, urlSafe
);
}
@Override
public byte[] encode(byte[] source) {
return apacheBase64.encode(source);
}
@Override
public byte[] decode(byte[] source) {
return apacheBase64.decode(source);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy