Codec

Home

Apache Commons Codec (TM) software provides implementations of common encoders and decoders
such as Base64, Hex, Phonetic and URLs.

Impetus

Codec was formed as an attempt to focus development effort on one
definitive implementation of the Base64 encoder. At the time of
Codec's proposal, there were approximately 34 different Java
classes that dealt with Base64 encoding spread over the
Foundation's CVS repository. Developers in the Jakarta Tomcat
project had implemented an original version of the Base64 codec
which had been copied by the Commons HttpClient and Apache XML
project's XML-RPC subproject. After almost one year, the two
forked versions of Base64 had significantly diverged from one
another. XML-RPC had applied numerous fixes and patches which
were not applied to the Commons HttpClient Base64. Different
subprojects had differing implementations at various levels
of compliance with the
RFC 2045
.

Out of that confusing duplication of effort sprang this simple
attempt to encourage code reuse among various projects. While
this package contains a abstract framework for the creation of
encoders and decoders, Codec itself is primarily focused on
providing functional utilities for working with common encodings.

Chunking Base64 binary data in Java

2 responses to “Chunking Base64 binary data in Java”

  1. David Phillips

    String building using concatenation is not efficient. You should a StringBuilder instead. But even better, in this example you’re joining strings together, so you can use Guava’s Joiner:

    return Joiner.on(‘\n’).join(Splitter.fixedLength(76).split(encodedText));

    Also, calling getBytes() on String is usually wrong as it uses the platform default character encoding, which means you get different results on different platforms. You usually want getBytes(Charsets.UTF_8)).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值