Spiga

随笔档案 - 2008年4月

Base64 encode/decode large file

2008-04-20 21:48 by 江大鱼, 1233 visits, 网摘, 收藏, 编辑
摘要:The class System.Convert provide two basic methods "ToBase64String()" and "Convert.FromBase64String()" to encode a byte array to a base64 string and decode a base64 string to a byte array. It is very good to use them to encode and decode base64. But in some case, it is a disaster. For example, if you want to encode a 4 gb file to base64, the code above must throw an OutOfMemory exception., because you must read the file into a byte array. So we need to look for another way to e 阅读全文