Package com.aspectran.utils.apon
Class AponReader
java.lang.Object
com.aspectran.utils.apon.AponFormat
com.aspectran.utils.apon.AponReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
Converts a string in APON format to a Parameters object.
-
Field Summary
Fields inherited from class com.aspectran.utils.apon.AponFormat
COMMENT_LINE_START, CURLY_BRACKET_CLOSE, CURLY_BRACKET_OPEN, DEFAULT_INDENT_STRING, DOUBLE_QUOTE_CHAR, ESCAPE_CHAR, FALSE, NAME_VALUE_SEPARATOR, NEW_LINE, NEW_LINE_CHAR, NO_CONTROL_CHAR, NULL, ROUND_BRACKET_CLOSE, ROUND_BRACKET_OPEN, SINGLE_QUOTE_CHAR, SPACE, SPACE_CHAR, SQUARE_BRACKET_CLOSE, SQUARE_BRACKET_OPEN, SYSTEM_NEW_LINE, TEXT_LINE_START, TRUE
-
Constructor Summary
ConstructorsConstructorDescriptionAponReader
(Reader reader) Instantiates a new AponReader.AponReader
(String text) Instantiates a new AponReader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static Parameters
Converts to a Parameters object from a file.static Parameters
Converts to a Parameters object from a file.static <T extends Parameters>
TConverts into a given Parameters object from a file.static <T extends Parameters>
TConverts into a given Parameters object from a file.static Parameters
Converts to a Parameters object from a character-input stream.static <T extends Parameters>
TConverts into a given Parameters object from a character-input stream.static Parameters
Converts an APON formatted string into a Parameters object.static <T extends Parameters>
Tstatic <T extends Parameters>
TConverts an APON formatted string into a given Parameters object.read()
Reads an APON document into aVariableParameters
object.<T extends Parameters>
Tread
(T parameters) Reads an APON formatted document into the specifiedParameters
object.
-
Constructor Details
-
AponReader
Instantiates a new AponReader.- Parameters:
text
- the APON formatted string
-
AponReader
Instantiates a new AponReader.- Parameters:
reader
- the character stream capable of parsing content into APON
-
-
Method Details
-
read
Reads an APON document into aVariableParameters
object.- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-
read
Reads an APON formatted document into the specifiedParameters
object.- Type Parameters:
T
- the generic type- Parameters:
parameters
- the Parameters object- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
parse
Converts an APON formatted string into a Parameters object.- Parameters:
text
- the APON formatted string- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-
parse
public static <T extends Parameters> T parse(String text, Class<T> requiredType) throws AponParseException - Throws:
AponParseException
-
parse
Converts an APON formatted string into a given Parameters object.- Type Parameters:
T
- the generic type- Parameters:
text
- the APON formatted stringparameters
- the Parameters object- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-
parse
Converts to a Parameters object from a file.- Parameters:
file
- the file to parse- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-
parse
Converts to a Parameters object from a file.- Parameters:
file
- the file to parseencoding
- the character encoding- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-
parse
Converts into a given Parameters object from a file.- Type Parameters:
T
- the generic type- Parameters:
file
- the file to parseparameters
- the Parameters object- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-
parse
public static <T extends Parameters> T parse(File file, String encoding, T parameters) throws AponParseException Converts into a given Parameters object from a file.- Type Parameters:
T
- the generic type- Parameters:
file
- the file to parseencoding
- the character encodingparameters
- the Parameters object- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-
parse
Converts to a Parameters object from a character-input stream.- Parameters:
reader
- the character-input stream- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-
parse
Converts into a given Parameters object from a character-input stream.- Type Parameters:
T
- the generic type- Parameters:
reader
- the character-input streamparameters
- the Parameters object- Returns:
- the Parameters object
- Throws:
AponParseException
- if reading APON format document fails
-