In. NET, you can use Convert. ToBase64String (FileUpload1.FileBytes) to Convert the uploaded image file to a string in Base64 format.
Introduce the ws-commons-util-1.0.2.jar package in Java, or the org. python. apache. xerces. impl. dv. util. Base64.decode (youtData) (jython. jar) package can be restored using the following methods
BASE64 encryption algorithm, widely used, especially in e-mail transmission, has a great useThe program code written in Java is as followsImportjava.awt.BorderLayout;ImportJava.awt.EventQueue;Importjava.awt.event.ActionEvent;ImportJava.awt.event.ActionListener;Importjava.io.IOException;ImportJavax.swing.JFrame;ImportJavax.swing.JPanel;ImportJavax.swing.border.EmptyBorder;ImportJavax.swing.JTextArea;ImportJa
The jar package used here is Commons-codec-1.10.jar;
Sample code
1 import java.io.FileInputStream;
2 import java.io.FileOutputStream;
3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.io.OutputStream;
6
7 import org.apache.commons.codec.binary.Base64;
8
9
10 /**
11 * Convert images to Base64
Attach an example of displaying a picture in HTML;
The converted picture
Test instructions: string with N and a string (can have spaces) encoded n timesEncoding: Each character of the string is converted into ASCII code, and ASCII code is converted to 8-bit 2-binary,The binary number is divided into 6 bits (not enough for 0), and then the decimal number is converted into letters in the following wayAfter the conversion to a letter, if the length is not an integer multiple of 4, after the string to fill =For example, the ASCII code of the 84,104,101 turns into 8-bit 2
Generate a QR code image or base64 format string by passing in a string1 Public StaticString Barcode2base64 (String msg)throwsexception{2QRCode x =NewQRCode ();3 //N Represents the number, a represents a-z,b for other characters4X.setqrcodeencodemode (' B ');5 //set error correction level6X.setqrcodeerrorcorrect (' M ');7 //Set version number (1-40)8X.setqrcodeversion (7);9 Ten intwidth = 67+12* (7-1); One
This article describes the Java BASE64 encryption, decryption coding exception handling class, although the code is very short, but can effectively avoid the use of BASE64 encryption and decryption when the problem of performing errors, where the use of Com.gootrip.util package, and introduced java.io all the methods.
The specific function code is as follows:
In. net, you can use convert. tobase64string (fileupload1.filebytes) to convert the uploaded image file to a string in base64 format.
Introduce the ws-commons-util-1.0.2.jar package in Java, or the org. Python. Apache. xerces. impl. DV. util. base64.decode (youtdata) (Jython. Jar) package can be restored using the following methods
String youtData = "R0lGODdhEAA
Summary
Since Adobe released its public PDF reference for the first time in 1993, PDF tools and libraries supporting various languages and platforms have sprung up. However, the support of Adobe Technology in Java application development lags behind.
Since Adobe released its public PDF reference for the first time in 1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.