Commit 68e73be
committed
PR: Bugzilla Bug 27813 Alterations to Binary.java and its unit test for 1.3 release
Submitted by: Alex Karasulu
Reviewed by: Gary Gregory
Patch partially applied and modified:
(1) The bitset methods and tests do not compile on <1.4. I've fixed that in another patch attached to this ticket if/when we want to use it here.
(2) I did not include the bit set methods in this pass as they seem to be out of context for this class but would like to discuss this. The Binary codec as is today converts between byte arrays and "0/1" strings. If we want to convert to and from BitSet objects, maybe this is another codec or a BitSetUtils class in [lang]?
(3) All Java strings are Unicode, so the use of "ASCII" in comments and method names is misleading IMO, especially when what is meant are "Strings of 0s and 1s" so I'd like to not use "Ascii" in method names. I'll try to address that on commons-dev.
(4) I've also renamed the instance method "byte[] decode(Object)" to "toByteArray" because the name "decode" was being overloaded but not overriden, which to makes the class more confusing to understand IMHO considering the codec interfaces Decoder, StringDecoder, and BinaryDecoder. I found this tricky since Binary is NOT a StringDecoder but a BinaryDecoder. Using "decode" the method look like a framework implementation method when it is not. This is all I suppose a reflection on how truly useful these interfaces are in the first place, a different topic I know.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/codec/trunk@130319 13f79535-47bb-0310-9956-ffa450edef681 parent b5b9171 commit 68e73be
2 files changed
Lines changed: 804 additions & 890 deletions
File tree
- src
- java/org/apache/commons/codec/binary
- test/org/apache/commons/codec/binary
0 commit comments