web123456

Convert the byte array into a string, and its restore.

import ;

import ;

import ;

import .BASE64Decoder;

import .BASE64Encoder;

 

publicclass test2 {

    publicstatic void main(String[] args) {

      

       byte[]before=newbyte[] {80, 75, 3, 4, 10, 60, 82, -83, 68, 8, 0, 28, 0, 80, 97, 121, 108, 108};

      

       BASE64Encoder enc=new BASE64Encoder();

       String mes=enc.encodeBuffer(before); //Encoding with BASE64

      

       BASE64Decoder dec=new BASE64Decoder();

       byte[]after=null;

       try {

           after =(mes);//Using BASE64decoding

       } catch (IOExceptione) {

           // TODO Auto-generated catch block

           ();

      

      

       System.out.println("before= "+Arrays.toString(before));

       System.out.println("after = "+Arrays.toString(after));

    }

}