0

I'm going to use sun.misc.BASE64Decoder 's decodeBuffer(String inputString) in my code. Multiple threads will be calling this function on the same decoder object.

Is this thread safe ?

Thanks and regards, Raj

raj
  • 3,769
  • 4
  • 25
  • 43
  • 2
    Uhm, it is generally a bad idea to rely on anything sun.*. Why don't you use Guava? It has BASE64 encoding classes, and as everything Guava, it is fast and works very reliably – fge Apr 08 '14 at 07:15
  • 1
    Better than that, immutable. [link to javadoc](http://docs.guava-libraries.googlecode.com/git-history/v16.0.1/javadoc/com/google/common/io/BaseEncoding.html) – fge Apr 08 '14 at 07:21
  • 1
    Note that Java SE 8 introduced a Base64 decoder: http://docs.oracle.com/javase/8/docs/api/java/util/Base64.Decoder.html – Puce Apr 08 '14 at 08:20

1 Answers1

1

I suggest to use javax.xml.bind.DatatypeConverter.parseBase64Binary(String lexicalXSDBase64Binary)instead. It's standard Java API, besides it is thread-safe

Evgeniy Dorofeev
  • 133,369
  • 30
  • 199
  • 275