Saturday, December 29, 2012

About java property file's blank token

About java property file's blank token
Sometimes VC uses blank token in resource file string table since the string value is fully contained in double quotation mark.
But in java's counterpart property configuration file or resource boundle file, no quotation mark is necessary. Then a question arises:
Does java peoperty file can keep blank token? The test shows that it can keep the blank token at the end of the string while it will ignore the blank token in the beginning of the string. It really annoys. The source code shows that (see below):
                if ((c == '=' ||  c == ':') && !precedingBackslash) {//Can use '=' or ':'
                    valueStart = keyLen + 1;
                    hasSep = true;
                    break;
                } else if ((c == ' ' || c == '\t' ||  c == '\f') && !precedingBackslash) {//Ignore the blank at the head
                    valueStart = keyLen + 1;
                    break;
                }//java.util.Properties
Why it add this line "else if ((c == ' ' || c == '\t' ||  c == '\f') && !precedingBackslash)"? I can not fully understand. Maybe it is not a best design in my opinion.

No comments:

Post a Comment