Class ConfigurationHandler
- java.lang.Object
-
- org.apache.felix.utils.properties.ConfigurationHandler
-
public class ConfigurationHandler extends java.lang.Object
TheConfigurationHandler
class implements configuration reading form ajava.io.InputStream
and writing to ajava.io.OutputStream
on behalf of theFilePersistenceManager
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
Fields Modifier and Type Field Description protected static java.util.Map
code2Type
protected static java.lang.String
COLLECTION_LINE_BREAK
protected static java.lang.String
CRLF
protected static java.lang.String
ENCODING
protected static java.lang.String
INDENT
protected static int
TOKEN_ARR_CLOS
protected static int
TOKEN_ARR_OPEN
protected static int
TOKEN_COMMA
protected static int
TOKEN_COMMENT
protected static int
TOKEN_EQ
protected static int
TOKEN_NAME
protected static int
TOKEN_PRIMITIVE_BOOLEAN
protected static int
TOKEN_PRIMITIVE_BYTE
protected static int
TOKEN_PRIMITIVE_CHAR
protected static int
TOKEN_PRIMITIVE_DOUBLE
protected static int
TOKEN_PRIMITIVE_FLOAT
protected static int
TOKEN_PRIMITIVE_INT
protected static int
TOKEN_PRIMITIVE_LONG
protected static int
TOKEN_PRIMITIVE_SHORT
protected static int
TOKEN_SIMPLE_BOOLEAN
protected static int
TOKEN_SIMPLE_BYTE
protected static int
TOKEN_SIMPLE_CHARACTER
protected static int
TOKEN_SIMPLE_DOUBLE
protected static int
TOKEN_SIMPLE_FLOAT
protected static int
TOKEN_SIMPLE_INTEGER
protected static int
TOKEN_SIMPLE_LONG
protected static int
TOKEN_SIMPLE_SHORT
protected static int
TOKEN_SIMPLE_STRING
protected static int
TOKEN_SPACE
protected static int
TOKEN_VAL_CLOS
protected static int
TOKEN_VAL_OPEN
protected static int
TOKEN_VEC_CLOS
protected static int
TOKEN_VEC_OPEN
protected static java.util.Map
type2Code
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Dictionary
read(java.io.InputStream ins)
Reads configuration data from the givenInputStream
and returns a newDictionary
object containing the data.static java.lang.Object
read(java.lang.String value)
static void
write(java.io.OutputStream out, java.util.Dictionary properties)
Writes the configuration data from theDictionary
to the givenOutputStream
.static java.lang.String
write(java.lang.Object value)
-
-
-
Field Detail
-
ENCODING
protected static final java.lang.String ENCODING
- See Also:
- Constant Field Values
-
TOKEN_NAME
protected static final int TOKEN_NAME
- See Also:
- Constant Field Values
-
TOKEN_EQ
protected static final int TOKEN_EQ
- See Also:
- Constant Field Values
-
TOKEN_ARR_OPEN
protected static final int TOKEN_ARR_OPEN
- See Also:
- Constant Field Values
-
TOKEN_ARR_CLOS
protected static final int TOKEN_ARR_CLOS
- See Also:
- Constant Field Values
-
TOKEN_VEC_OPEN
protected static final int TOKEN_VEC_OPEN
- See Also:
- Constant Field Values
-
TOKEN_VEC_CLOS
protected static final int TOKEN_VEC_CLOS
- See Also:
- Constant Field Values
-
TOKEN_COMMA
protected static final int TOKEN_COMMA
- See Also:
- Constant Field Values
-
TOKEN_VAL_OPEN
protected static final int TOKEN_VAL_OPEN
- See Also:
- Constant Field Values
-
TOKEN_VAL_CLOS
protected static final int TOKEN_VAL_CLOS
- See Also:
- Constant Field Values
-
TOKEN_SPACE
protected static final int TOKEN_SPACE
- See Also:
- Constant Field Values
-
TOKEN_COMMENT
protected static final int TOKEN_COMMENT
- See Also:
- Constant Field Values
-
TOKEN_SIMPLE_STRING
protected static final int TOKEN_SIMPLE_STRING
- See Also:
- Constant Field Values
-
TOKEN_SIMPLE_INTEGER
protected static final int TOKEN_SIMPLE_INTEGER
- See Also:
- Constant Field Values
-
TOKEN_SIMPLE_LONG
protected static final int TOKEN_SIMPLE_LONG
- See Also:
- Constant Field Values
-
TOKEN_SIMPLE_FLOAT
protected static final int TOKEN_SIMPLE_FLOAT
- See Also:
- Constant Field Values
-
TOKEN_SIMPLE_DOUBLE
protected static final int TOKEN_SIMPLE_DOUBLE
- See Also:
- Constant Field Values
-
TOKEN_SIMPLE_BYTE
protected static final int TOKEN_SIMPLE_BYTE
- See Also:
- Constant Field Values
-
TOKEN_SIMPLE_SHORT
protected static final int TOKEN_SIMPLE_SHORT
- See Also:
- Constant Field Values
-
TOKEN_SIMPLE_CHARACTER
protected static final int TOKEN_SIMPLE_CHARACTER
- See Also:
- Constant Field Values
-
TOKEN_SIMPLE_BOOLEAN
protected static final int TOKEN_SIMPLE_BOOLEAN
- See Also:
- Constant Field Values
-
TOKEN_PRIMITIVE_INT
protected static final int TOKEN_PRIMITIVE_INT
- See Also:
- Constant Field Values
-
TOKEN_PRIMITIVE_LONG
protected static final int TOKEN_PRIMITIVE_LONG
- See Also:
- Constant Field Values
-
TOKEN_PRIMITIVE_FLOAT
protected static final int TOKEN_PRIMITIVE_FLOAT
- See Also:
- Constant Field Values
-
TOKEN_PRIMITIVE_DOUBLE
protected static final int TOKEN_PRIMITIVE_DOUBLE
- See Also:
- Constant Field Values
-
TOKEN_PRIMITIVE_BYTE
protected static final int TOKEN_PRIMITIVE_BYTE
- See Also:
- Constant Field Values
-
TOKEN_PRIMITIVE_SHORT
protected static final int TOKEN_PRIMITIVE_SHORT
- See Also:
- Constant Field Values
-
TOKEN_PRIMITIVE_CHAR
protected static final int TOKEN_PRIMITIVE_CHAR
- See Also:
- Constant Field Values
-
TOKEN_PRIMITIVE_BOOLEAN
protected static final int TOKEN_PRIMITIVE_BOOLEAN
- See Also:
- Constant Field Values
-
CRLF
protected static final java.lang.String CRLF
- See Also:
- Constant Field Values
-
INDENT
protected static final java.lang.String INDENT
- See Also:
- Constant Field Values
-
COLLECTION_LINE_BREAK
protected static final java.lang.String COLLECTION_LINE_BREAK
- See Also:
- Constant Field Values
-
code2Type
protected static final java.util.Map code2Type
-
type2Code
protected static final java.util.Map type2Code
-
-
Method Detail
-
write
public static void write(java.io.OutputStream out, java.util.Dictionary properties) throws java.io.IOException
Writes the configuration data from theDictionary
to the givenOutputStream
.This method writes at the current location in the stream and does not close the outputstream.
- Parameters:
out
- TheOutputStream
to write the configurtion data to.properties
- TheDictionary
to write.- Throws:
java.io.IOException
- If an error occurrs writing to the output stream.
-
write
public static java.lang.String write(java.lang.Object value) throws java.io.IOException
- Throws:
java.io.IOException
-
read
public static java.util.Dictionary read(java.io.InputStream ins) throws java.io.IOException
Reads configuration data from the givenInputStream
and returns a newDictionary
object 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
- TheInputStream
from which to read the configuration data.- Returns:
- A
Dictionary
object containing the configuration data. This object may be empty if the stream contains no configuration data. - Throws:
java.io.IOException
- If an error occurrs reading from the stream. This exception is also thrown if a syntax error is encountered.
-
read
public static java.lang.Object read(java.lang.String value) throws java.io.IOException
- Throws:
java.io.IOException
-
-