0

I recently ran into an issue with Groovy where I was attempting to deal with a very large string (100k characters). I got an error that said the string could not be more than 65,535 characters. I did some searches to try to find out more info and ran across this link that said the problem was with the JVM - https://issues.apache.org/jira/browse/GROOVY-2382.

I thought Java ran on the JVM as well and in Java I have had much larger strings. Just trying to understand. Can anyone shed some light on this for me. Thank you in advance.

Sean

2 Answers 2

4

This is a limitation on string literals, i.e. Strings in the source code.

It is not a problem for Strings read from a File or some other InputStream.

You should move your huge String into a separate text file.

Sign up to request clarification or add additional context in comments.

Comments

4

Looking at the source for java.lang.String the limit is that of Integer.MAX_VALUE which is pretty big.

So yes there is a limit but 100K is no where near it.

The limit that the Groovy bug refers to it that of a string literal, this isn't the same as creating a very big string.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.