commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject cvs commit: jakarta-commons/codec/src/test/org/apache/commons/codec/binary BinaryTest.java
Date Sun, 21 Mar 2004 01:18:56 GMT
ggregory    2004/03/20 17:18:56

  Modified:    codec/src/java/org/apache/commons/codec/binary Binary.java
               codec/src/test/org/apache/commons/codec/binary
                        BinaryTest.java
  Log:
  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.
  
  
  
  Revision  Changes    Path
  1.7       +94 -258   jakarta-commons/codec/src/java/org/apache/commons/codec/binary/Binary.java
  
  http://cvs.apache.org/viewcvs/jakarta-commons/codec/src/java/org/apache/commons/codec/binary/Binary.java.diff?r1=1.6&r2=1.7
  
  
  1.7       +708 -630  jakarta-commons/codec/src/test/org/apache/commons/codec/binary/BinaryTest.java
  
  http://cvs.apache.org/viewcvs/jakarta-commons/codec/src/test/org/apache/commons/codec/binary/BinaryTest.java.diff?r1=1.6&r2=1.7
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message