Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
194 views
in Technique[技术] by (71.8m points)

android - How to read a huge size base64 response in SOAP API?

The given response base64 encode data, but when they are given a huge size file. For the example for an above 100 MB video, I am not able to get a response, when calling the API?before getting out of memory?error. How can I?solve it?
Error : OutOfMemoryError: Failed to allocate a 523993096-byte allocation with 16773216 free bytes and 256MB until OOM [closed].

My code:

try {
val file =
File(this.filesDir, "Project name")
//Base64
val Base64Value = "HFGFGRGRGDCEF"

if (Base64Value != null) {
val byteArr =
Base64.decode(Base64Value, Base64.DEFAULT)
val f = File(file.absolutePath, filename)
f.createNewFile()
val fo = FileOutputStream(f)
fo.write(byteArr)
fo.close()


} else {
return false
}
} catch (e: Exception) {
e.printStackTrace()

return false
}
question from:https://stackoverflow.com/questions/66045724/how-to-read-a-huge-size-base64-response-in-soap-api

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...