2012-06-12 67 views

回答

1

我不認爲這是一個實用功能專爲創建它,但它應該是這麼簡單:

import org.apache.commons.codec.binary.Base64; 

byte[] toEncode = { 0xaa, 0xbb, 0xcc }; 
Base64 base64NoLineWrap = new Base64(0); 
String encodedData = base64NoLineWrap.encodeBase64String(toEncode); 
String dataUri = "data:application/octet-stream;base64," + encoded; 
相關問題