爪哇 - Base64编码字符串和缩小文字 [英] Java - Base64 string in and out of a text
本文介绍了爪哇 - Base64编码字符串和缩小文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要写的base64含带codeD文本到文本文件字符串,然后再读取该字符串从文本文件返回到一个字符串变量。
I need to write string containing base64 encoded text to a text file and then later read that string back from the text file to a string variable.
如何能做到这一点,以便有没有数据丢失是由于编码问题?
How can i do it so that there is no data loss due to encoding issues?
推荐答案
的Base64 是唯一的A-Z,A- Z,0-9,+和/。所以应该没有编码的问题。只要你能带code的Ascii正常。 Base64编码的发明重新present字节 7位字符的。
Base64 is only A–Z, a–z, 0–9, + and /. So there should be no encoding problem. As long as you're able to encode Ascii properly. Base64 was invented to represent bytes in 7-bit characters.
要带code和德code可以使用的commons codeC的Base64 。
To encode and decode you can use commons codec Base64.
这篇关于爪哇 - Base64编码字符串和缩小文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文