Java Base64 conversion, Java Base64 tools

Java Base64 conversion, Java Base64 tools

 

================================

© Copyright sweet potatoes Yao June 20, 2019

http://fanshuyao.iteye.com/

 

Base64 is one of the most common network for the transmission of 8Bit encoding bytecode, Base64 is based on 64 printable characters to binary data representation.

 

A, Base64 advantages and disadvantages

advantage:

1: reducing the http request;

2: Data is the picture;

Disadvantages:

1: If the picture a little bit big, the string will be very, very long;

2, if stored in a database, affect the performance

 

Two, Base64 display:

 

text data of data :,
data: text / plain, text data,
data: text / html, HTML codes
data: text / html; base64, base64 encoded HTML code
data: text / css, CSS codes
data: text / css; base64, base64 encoding CSS code
data:text/JavaScript,Javascript代码
data: text / javascript; base64, base64 encoded Javascript code
data: image / gif; base64, base64 encoded picture data gif
data: image / png; base64, base64 encoded png image data
data: image / jpeg; base64, base64 encoded picture data jpeg
data: image / x-icon; base64, base64 encoded picture data icon


 Html tags use

<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAwADAAAD/2w" alt="Jpeg图片"/>

 CSS is used:

background-image: url("data:image/png;base64,iVBORw0KGgo=...");

 

 

 

 three,

 

 

Java uses Base64 save the picture to the database and display pictures:

https://fanshuyao.iteye.com/blog/2441370

 

================================

© Copyright sweet potatoes Yao June 20, 2019

http://fanshuyao.iteye.com/

 

 

 

Guess you like

Origin fanshuyao.iteye.com/blog/2441994