Package com.aspectran.core.util.apon
Class AponWriter
- java.lang.Object
-
- com.aspectran.core.util.apon.AponFormat
-
- com.aspectran.core.util.apon.AponWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class AponWriter extends AponFormat implements java.io.Flushable, java.io.Closeable
Writes a APON object to an output source.By default, the indentation string is " " (two blanks)
-
-
Field Summary
-
Fields inherited from class com.aspectran.core.util.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, TEXT_LINE_START, TRUE
-
-
Constructor Summary
Constructors Constructor Description AponWriter(java.io.File file)Instantiates a new AponWriter.AponWriter(java.io.Writer writer)Instantiates a new AponWriter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this APON writer.voidcomment(java.lang.String message)Writes a comment to the character-output stream.voidflush()voidsetIndentString(java.lang.String indentString)Specifies the indent string.voidsetNullWritable(boolean nullWritable)Sets whether to write a null parameter.voidsetTypeHintWritable(boolean typeHintWritable)Sets whether write a type hint for values.static java.lang.Stringstringify(Parameters parameters)Converts a Parameters object to an APON formatted string.static java.lang.Stringstringify(Parameters parameters, java.lang.String indentString)Converts a Parameters object to an APON formatted string.voidwrite(Parameter parameter)Write a Parameter object to the character-output stream.voidwrite(Parameters parameters)Write a Parameters object to the character-output stream.-
Methods inherited from class com.aspectran.core.util.apon.AponFormat
escape, unescape
-
-
-
-
Constructor Detail
-
AponWriter
public AponWriter(java.io.Writer writer)
Instantiates a new AponWriter.- Parameters:
writer- the character-output stream
-
AponWriter
public AponWriter(java.io.File file) throws java.io.IOExceptionInstantiates a new AponWriter.- Parameters:
file- a File object to write to- Throws:
java.io.IOException- if an I/O error occurs
-
-
Method Detail
-
setIndentString
public void setIndentString(java.lang.String indentString)
Specifies the indent string.- Parameters:
indentString- the indentation string, by default " " (two blanks).
-
setNullWritable
public void setNullWritable(boolean nullWritable)
Sets whether to write a null parameter.- Parameters:
nullWritable- true, write a null parameter
-
setTypeHintWritable
public void setTypeHintWritable(boolean typeHintWritable)
Sets whether write a type hint for values.- Parameters:
typeHintWritable- true, write a type hint for values
-
write
public void write(Parameters parameters) throws java.io.IOException
Write a Parameters object to the character-output stream.- Parameters:
parameters- the Parameters object to be converted- Throws:
java.io.IOException- if an I/O error occurs
-
write
public void write(Parameter parameter) throws java.io.IOException
Write a Parameter object to the character-output stream.- Parameters:
parameter- the Parameter object to be converted- Throws:
java.io.IOException- if an I/O error occurs
-
comment
public void comment(java.lang.String message) throws java.io.IOExceptionWrites a comment to the character-output stream.- Parameters:
message- the comment to write to a character-output stream- Throws:
java.io.IOException- if an I/O error occurs
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCloses this APON writer.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException- if an I/O error occurs
-
stringify
public static java.lang.String stringify(Parameters parameters)
Converts a Parameters object to an APON formatted string.- Parameters:
parameters- the Parameters object to be converted- Returns:
- a string that contains the APON text
-
stringify
public static java.lang.String stringify(Parameters parameters, java.lang.String indentString)
Converts a Parameters object to an APON formatted string.- Parameters:
parameters- the Parameters object to be convertedindentString- the indentation string- Returns:
- a string that contains the APON text
-
-