Groovy says my Unicode string is too long

前端 未结 2 1140
青春惊慌失措
青春惊慌失措 2021-01-12 15:12

As part of my probably wrong and cumbersome solution to print out a form I have taken a MS-Word document, saved as XML and I\'m trying to store that XML as a groovy string s

2条回答
  •  臣服心动
    2021-01-12 15:44

    Are you embedding this string directly in your groovy code? The jvm itself has a limit on the length of string constants, see the VM Spec if you are interested in details.

    A ugly workaround might be to split the string in smaller parts and concatenate them at runtime. A better solution would be to save the text in an external file and read the contents from your code. You could also package this file along with your code and access it from the classpath using Class#getResourceAsStream.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题