Java Handbook
  • Introduction
  • Numbers
    • Big numbers
    • Binary representation of numbers
  • Operators
  • Hashing
    • Hash Code & Performance
    • How Hash Table Is Created
  • Java 9
    • Modules
    • Other Improvements
  • Concurrency
    • Locking
  • Reactive Programming
    • Event Driven Non-Blocking Frameworks
    • Vert.x
      • Making a game
      • SockJS
    • Netty
    • RxJava
  • Efficient Coding
    • Lombok
  • Quartz Scheduling
Powered by GitBook
On this page
  • Base64
  • Unsafe

Was this helpful?

  1. Java 9

Other Improvements

PreviousModulesNextConcurrency

Last updated 5 years ago

Was this helpful?

Base64

We no longer have to use sun.misc.BASE64Encoder or org.apache.commons.codec.binary.Base64. No we can use class. This is because the were encapsulated and are no longer available.

byte[] toEncode = "dummy string".getBytes();

byte[] encoded = Base64.getEncoder().encode(toEncode);
String encodedString = new String(encoded);

Assert.assertEquals("ZHVtbXkgc3RyaW5n", encodedString);

Unsafe

Unsafe is meant to be used only by internal core Java classes.

java.util.Base64
internal APIs