Dave Tolls wrote:This value is cast to an int, since that's what the constructor for the stream expects (which strikes me as slightly dangerous)
So that's the cause. It's the ByteArrayOutputStream which has the limit, not BufferedWriter
To add to this explanation: The maximum array that can be defined in
Java is Integer.MAX_VALUE and as ByteArrayOutputStream creates a byte array to store the data in you are unfortunately limited to that size.