.properties

.properties

Infobox file format
name = Properties
extension = .properties
mime =
owner =
creatorcode =
genre = ASCII
containerfor =
containedby =
extendedfrom =
extendedto =

.properties is a file extension for files mainly used in Java related technologies to store the configurable parameters of an application. They can also be used for storing strings for localization; these are known as Property Resource Bundles.

Each parameter is stored as a pair of strings, one storing the name of the parameter (called the "key"), and the other storing the value.

Format

Each line in a .properties file normally stores a single property. Several formats are possible for each line, including key=value, key = value, key:value, and key value.

.properties files can use the number sign (#) or the exclamation mark (!) as the first non blank character in a line to denote that all text following it is a comment. The backwards slash is used to escape a character. An example of a properties file is provided below.

# You are reading the ".properties" entry. ! The exclamation mark can also mark text as comments. website = http://en.wikipedia.org language = English # The backslash below tells the application to continue reading # the value onto the next line. message = Welcome to Wikipedia! # Add spaces to the key key with spaces = This is the value that could be looked up with the key "key with spaces".

In the example above, website would be a key, and its corresponding value would be http://en.wikipedia.org. While the number sign and the exclamation mark marks text as comments, it has no effect when it is part of a property. Thus, the key message has the value Welcome to Wikipedia! and not Welcome to Wikipedia. Note also that all of the whitespace in front of Wikipedia! is excluded completely.

The encoding of a .properties file is ISO-8859-1, also known as Latin-1. All non-Latin-1 characters must be entered by using Unicode escape characters, e. g. uHHHH where HHHH is a hexadecimal index of the character in the Unicode character set. This allows for using .properties files as resource bundles for localization. A non-Latin-1 text file can be converted to a correct .properties file by using the native2ascii tool that is shipped with the JDK or by using a tool, such as prop2po [Translate Toolkit's [http://translate.sourceforge.net/wiki/toolkit/po2prop po2prop] converts native character encodings in a Gettext PO file into correctly escaped ascii without the need for native2ascii] , that manages the transformation from a bilingual localization format into .properties escaping.

ee also

*Javadoc:SE|package=java.util|java/util|Properties|load(java.io.Reader) - gives the precise semantics of well-formed Java property files
*Javadoc:SE|package=java.util|java/util|PropertyResourceBundle - describes property resource bundles

References


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • .properties — Расширение .properties MIME text/plain Тип формата ASCII .properties  Расширение имени файла, главным образом, применяемый в основном в технологиях Java, для сохранения конфигурационных параметров прикладного ПО. Они также могут быть… …   Википедия

  • .properties — Extension .properties Type de format ASCII modifier  …   Wikipédia en Français

  • Properties —   [Pl.], allgemein die englische Entsprechung für »Eigenschaften«, etwa als Menüpunkt bzw. Registerkarte in englischsprachigen Betriebssystemen oder Anwendungen (z. B. »System/Printer/Properties«); speziell Eigenschaften eines Bindery Objekts… …   Universal-Lexikon

  • properties — index commodities Burton s Legal Thesaurus. William C. Burton. 2006 …   Law dictionary

  • Properties — Property Prop er*ty, n.; pl. {Properties}. [OE. proprete, OF. propret[ e] property, F. propret[ e] neatness, cleanliness, propri[ e]t[ e] property, fr. L. proprietas. See {Proper}, a., and cf. {Propriety}.] [1913 Webster] 1. That which is proper… …   The Collaborative International Dictionary of English

  • Properties —    This term describes stage objects (furnishings, decorations, and personal props) used in the presentation of a play. Except for scenery and costumes, the word properties would describe virtually any other object on the stage …   The Historical Dictionary of the American Theater

  • properties — suspension steer and roll properties …   Mechanics glossary

  • properties — savybės statusas T sritis automatika atitikmenys: angl. properties vok. Eigenschaften, f rus. свойства, n pranc. propriétés, f …   Automatikos terminų žodynas

  • properties — savybė statusas T sritis ekologija ir aplinkotyra apibrėžtis Savitas objekto arba reiškinio požymis. atitikmenys: angl. behavior; characteristic; properties vok. Beschaffenheit, f; Eigenart, f; Eigenschaft, f rus. особенность, f; поведение, n;… …   Ekologijos terminų aiškinamasis žodynas

  • properties — See run flat properties …   Dictionary of automotive terms

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”