Java Byte Array Encode encode(byte[] b)

Here you can find the source of encode(byte[] b)

Description

encode

License

Apache License

Declaration

public static byte[] encode(byte[] b) throws MessagingException, IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.mail.MessagingException;
import javax.mail.internet.MimeUtility;
import java.io.*;

public class Main {
    public static byte[] encode(byte[] b) throws MessagingException, IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        OutputStream b64os = MimeUtility.encode(baos, "base64");
        b64os.write(b);//w ww  .j ava  2  s .  c om
        b64os.close();
        return baos.toByteArray();
    }
}

Related

  1. encode(byte[] buf)
  2. encode(byte[] buff)
  3. encode(byte[] buffer, int offset, int len, Writer out)
  4. encode(byte[] bytes)