Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data type for large amounts of text?

Tags:

java

types

I'm developing a Java package that makes basic HTTP requests (GET, POST, PUT, and DELETE). Right now, I'm having it just print the output of the request. I would like to store it in a field, but I'm not sure if String supports large amounts of text. Is there a data type for large amounts of text, or is there a reasonable alternative to it? Right now, because I'm just printing it, I can't do anything with the data that is returned (like parse it, if it's JSON).

Any ideas would be helpful.

Edit: The code is online on GitHub.

like image 594
Ethan Turkeltaub Avatar asked Oct 21 '25 05:10

Ethan Turkeltaub


2 Answers

Strings can take up to 2^31 - 1 characters so I suspect are big enough. Data from SO question

like image 57
mmmmmm Avatar answered Oct 23 '25 21:10

mmmmmm


I see that you use BufferedReader in your code. You can just leave the string in there and pass that reader to your JSON parser for instance. Would be more efficient than first creating a String out of it.

like image 27
Wim Deblauwe Avatar answered Oct 23 '25 20:10

Wim Deblauwe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!