Property file string length limit (Java)
•
Java
Playing with a properties file, I think it seems to have
I do the following:
File configFile = new File("config.properties"); Properties props = new Properties(); props.put( "cc_server","sort_of_a_long_string_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); FileOutputStream fos = new FileOutputStream( configFile ); PrintWriter pw = new PrintWriter( fos ); props.list( pw ); pw.flush(); pw.close(); System.out.println("done.");
As a result, only the first 37char is saved and expanded to "..." I think properties hash has the right value. Writing to a file seems to be a problem
Is there any way to extend / close this restriction?
TIA
K
Solution
There are no such restrictions
Since you mentioned "..." I have this question: do you show value in jlabel? "..." is a typical way for jlabel to render a string that is too long
There is a simpler way to save properties
File propertiesfile=new File("fileName.props"); propstosave.store(new FileOutputStream(propertiesfile),"groupnames");
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码