Class ConfigurationHandler
java.lang.Object
org.apache.felix.utils.properties.ConfigurationHandler
The
ConfigurationHandler class implements configuration reading
form a java.io.InputStream and writing to a
java.io.OutputStream on behalf of the
FilePersistenceManager class.
cfg = prop "=" value .
prop = symbolic-name . // 1.4.2 of OSGi Core Specification
symbolic-name = token { "." token } .
token = { [ 0..9 ] | [ a..z ] | [ A..Z ] | '_' | '-' } .
value = [ type ] ( "[" values "]" | "(" values ")" | simple ) .
values = simple { "," simple } .
simple = """ stringsimple """ .
type = // 1-char type code .
stringsimple = // quoted string representation of the value .
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Mapprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final Map -
Method Summary
Modifier and TypeMethodDescriptionstatic Dictionaryread(InputStream ins) Reads configuration data from the givenInputStreamand returns a newDictionaryobject containing the data.static Objectstatic voidwrite(OutputStream out, Dictionary properties) Writes the configuration data from theDictionaryto the givenOutputStream.static String
-
Field Details
-
ENCODING
- See Also:
-
TOKEN_NAME
protected static final int TOKEN_NAME- See Also:
-
TOKEN_EQ
protected static final int TOKEN_EQ- See Also:
-
TOKEN_ARR_OPEN
protected static final int TOKEN_ARR_OPEN- See Also:
-
TOKEN_ARR_CLOS
protected static final int TOKEN_ARR_CLOS- See Also:
-
TOKEN_VEC_OPEN
protected static final int TOKEN_VEC_OPEN- See Also:
-
TOKEN_VEC_CLOS
protected static final int TOKEN_VEC_CLOS- See Also:
-
TOKEN_COMMA
protected static final int TOKEN_COMMA- See Also:
-
TOKEN_VAL_OPEN
protected static final int TOKEN_VAL_OPEN- See Also:
-
TOKEN_VAL_CLOS
protected static final int TOKEN_VAL_CLOS- See Also:
-
TOKEN_SPACE
protected static final int TOKEN_SPACE- See Also:
-
TOKEN_COMMENT
protected static final int TOKEN_COMMENT- See Also:
-
TOKEN_SIMPLE_STRING
protected static final int TOKEN_SIMPLE_STRING- See Also:
-
TOKEN_SIMPLE_INTEGER
protected static final int TOKEN_SIMPLE_INTEGER- See Also:
-
TOKEN_SIMPLE_LONG
protected static final int TOKEN_SIMPLE_LONG- See Also:
-
TOKEN_SIMPLE_FLOAT
protected static final int TOKEN_SIMPLE_FLOAT- See Also:
-
TOKEN_SIMPLE_DOUBLE
protected static final int TOKEN_SIMPLE_DOUBLE- See Also:
-
TOKEN_SIMPLE_BYTE
protected static final int TOKEN_SIMPLE_BYTE- See Also:
-
TOKEN_SIMPLE_SHORT
protected static final int TOKEN_SIMPLE_SHORT- See Also:
-
TOKEN_SIMPLE_CHARACTER
protected static final int TOKEN_SIMPLE_CHARACTER- See Also:
-
TOKEN_SIMPLE_BOOLEAN
protected static final int TOKEN_SIMPLE_BOOLEAN- See Also:
-
TOKEN_PRIMITIVE_INT
protected static final int TOKEN_PRIMITIVE_INT- See Also:
-
TOKEN_PRIMITIVE_LONG
protected static final int TOKEN_PRIMITIVE_LONG- See Also:
-
TOKEN_PRIMITIVE_FLOAT
protected static final int TOKEN_PRIMITIVE_FLOAT- See Also:
-
TOKEN_PRIMITIVE_DOUBLE
protected static final int TOKEN_PRIMITIVE_DOUBLE- See Also:
-
TOKEN_PRIMITIVE_BYTE
protected static final int TOKEN_PRIMITIVE_BYTE- See Also:
-
TOKEN_PRIMITIVE_SHORT
protected static final int TOKEN_PRIMITIVE_SHORT- See Also:
-
TOKEN_PRIMITIVE_CHAR
protected static final int TOKEN_PRIMITIVE_CHAR- See Also:
-
TOKEN_PRIMITIVE_BOOLEAN
protected static final int TOKEN_PRIMITIVE_BOOLEAN- See Also:
-
CRLF
- See Also:
-
INDENT
- See Also:
-
COLLECTION_LINE_BREAK
- See Also:
-
code2Type
-
type2Code
-
-
Method Details
-
write
Writes the configuration data from theDictionaryto the givenOutputStream.This method writes at the current location in the stream and does not close the outputstream.
- Parameters:
out- TheOutputStreamto write the configurtion data to.properties- TheDictionaryto write.- Throws:
IOException- If an error occurrs writing to the output stream.
-
write
- Throws:
IOException
-
read
Reads configuration data from the givenInputStreamand returns a newDictionaryobject containing the data.This method reads from the current location in the stream upto the end of the stream but does not close the stream at the end.
- Parameters:
ins- TheInputStreamfrom which to read the configuration data.- Returns:
- A
Dictionaryobject containing the configuration data. This object may be empty if the stream contains no configuration data. - Throws:
IOException- If an error occurrs reading from the stream. This exception is also thrown if a syntax error is encountered.
-
read
- Throws:
IOException
-