Menu

#1 Allow user to pass in byte[] to encode method

open
nobody
General (2)
5
2007-07-06
2007-07-06
Michael P
No

Hi Mikael,

Could you please add the following two methods to your encoder? This would be very helpful if like in my case you have a cached byte array that you want to write to.

/**
* Returns the size required to encode sArr
*/
int getEncodedSize(byte[] sArr,
boolean lineSep)

/**
* Encodes sArr into dArr starting at dOffset
*/
void encodeToByte(byte[] sArr,
byte[] dArr,
int dOffset,
boolean lineSep)

I've attached a modified Base64.java file with these methods implemented, not 100% sure they work though. Do you have a JUnit test case for this class? Otherwise I could get started on one.

Regards,
Michael

Discussion

  • Michael P

    Michael P - 2007-07-06

    Modified Base64.java

     
  • Mikael Grev

    Mikael Grev - 2007-08-14

    Logged In: YES
    user_id=1097780
    Originator: NO

    Hello Michael,

    Sorry for the late response but I thought that sourceforge would send notification mails and haven't checked here until now.

    Can I add you as a developer so that you can commit the files?

    I have no JUnit tests. I tested it very thoroughly against the other implementations but never did it as a unit test, which I regret now of course. If you still want to add this you are very welcome. You can them also add yourself as an author to the license denoting what you've added.

    Cheers,
    Mikael

     

Log in to post a comment.

MongoDB Logo MongoDB