当前位置: 代码迷 >> Web前端 >> Property file natural lines and logical lines "\"
  详细解决方案

Property file natural lines and logical lines "\"

热度:444   发布时间:2012-09-01 09:33:02.0
Property file natural lines and logical lines "\"

Properties are processed in terms of lines. There are two kinds of line, natural lines and logical lines. A natural line is defined as a line of characters that is terminated either by a set of line terminator characters (\n or \r or \r\n) or by the end of the stream. A natural line may be either a blank line, a comment line, or hold all or some of a key-element pair. A logical line holds all the data of a key-element pair, which may be spread out across several adjacent natural lines by escaping the line terminator sequence with a backslash character \. Note that a comment line cannot be extended in this manner; every natural line that is a comment must have its own comment indicator, as described below. Lines are read from input until the end of the stream is reached.

?

?

As another example, the following three lines specify a single property:

?

 fruits                           apple, banana, pear, \
                                  cantaloupe, watermelon, \
                                  kiwi, mango
 

The key is "fruits" and the associated element is:

?

"apple, banana, pear, cantaloupe, watermelon, kiwi, mango"

?

Note that a space appears before each \ so that a space will appear after each comma in the final result; the \, line terminator, and leading white space on the continuation line are merely discarded and are not replaced by one or more other characters.??

?

from : http://download.oracle.com/javase/6/docs/api/java/util/Properties.html

?

  相关解决方案