"Properties" Files

    
  Prev  Next  Contents  Home
 

This is a standard format widely used in the Java world to specify set of name-value pairs, where all name is unique (a key).

Name-value pairs are specified with name=value format, and each such pair is in its own line. For example:

bgColor=blue
textColor=white
copyright=Copyright (c) 2003, Big Joe All rights reserved. 

If the last character on the line is backslash (\), then the next line is treated as a continuation of the current line; the \ and line break are simply discarded, and any leading whitespace (space, tab, etc.) characters on the continuation line are also discarded and are not part of the value. It is useful if the line would be too long for conveniently reading/editing it:

copyright=Copyright (c) 2003, \
          Big Joe \
          All rights reserved. 

Note that if you accidentally put a space after the \, then it will not work.

In the name or value, Java language escape sequences \t, \n, \r, \f, \\, \", \', and \uxxxx are recognized and converted to single characters. Any other escape sequence will be converted to the character after the backlash (e.g. \x will be converted to x). Note that because of the special meaning of backslash, to put a backslash into the name or value, you have to write two backslashes (\\).

aNativeWindowsPath=C:\\My Documents\\test
someText=First line\nSecond line\nThrid line 

Whitespace is ignored after and before the =, so you can write:

bgColor = blue
textColor = white 

Alternatively, you can use colon or just whitespace to separate the name and value:

bgColor: blue
textColor white 

Thus, if the name contains =, : or whitespace, it must be escaped:

this\ is\ the\ name = something
C\: = /mnt/win 

Empty lines of the file, and the lines that start with # or !, will be ignored. This can be used for commenting:

# colors
bgColor=blue
textColor=white

# other text
copyright=Copyright (c) 2003, Big Joe All rights reserved. 

"properties" files always use ISO-8859-1 charset. If you have to enter a character that is not in the ISO-8859-1 repertoire, you have to use the \uxxxx escape (where xxxx is the hexadecimal UCS code of the character).

Prev  Next  Contents  Home      Report bug   Generated on Dec 16, 2007 10:12 PM GMT
For FMPP version 0.9.13
SourceForge Logo  Powered by FreeMarker