它是确定以消除换行符的Base64编码 [英] Is it ok to remove newline in Base64 encoding

查看:524
本文介绍了它是确定以消除换行符的Base64编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Java应用程序中使用base64编码这使新线( \\ n )每隔76个字符后。我需要把这个带codeD字符串中的属性文件和换行打破了功能。

My java application use base64 encoding which puts a new line (\n) after every 76 character. I need to put this encoded string in a properties file and the newline breaks the functionality.

当我做了连接codedString.replaceAll(\\ n,); 东西都工作正常,但我只是想确保这种预期,我不介绍一个隐藏的问题。

When I do a encodedString.replaceAll("\n", ""); things are working fine, but I just want to make sure that this is expected and I am not introducing a hidden issue.

推荐答案

打破一个base64连接codeD字符串成多行有必要为无法处理长行许多老程序。用Java编写的程序通常可以处理排长队,因为他们并不需要做内存管理自己。只要你的线长度小于64万字应该没有问题。

Breaking a base64 encoded string into multiple lines has been necessary for many old programs that couldn't handle long lines. Programs written in Java can usually handle long lines since they don't need to do the memory management themselves. As long as your lines are shorter than 64 million characters there should be no problem.

既然你不需要换行,你不应该产生他们所有,如果可能的话。

And since you don't need the newlines, you shouldn't generate them at all, if possible.

这篇关于它是确定以消除换行符的Base64编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆