Class AponReader

java.lang.Object
com.aspectran.utils.apon.AponFormat
com.aspectran.utils.apon.AponReader
All Implemented Interfaces:
Closeable, AutoCloseable

public class AponReader extends AponFormat implements Closeable
Converts a string in APON format to a Parameters object.
  • Constructor Details

    • AponReader

      public AponReader(String text)
      Instantiates a new AponReader.
      Parameters:
      text - the APON formatted string
    • AponReader

      public AponReader(Reader reader)
      Instantiates a new AponReader.
      Parameters:
      reader - the character stream capable of parsing content into APON
  • Method Details

    • read

      public Parameters read() throws AponParseException
      Reads an APON document into a VariableParameters object.
      Returns:
      the Parameters object
      Throws:
      AponParseException - if reading APON format document fails
    • read

      public <T extends Parameters> T read(T parameters) throws AponParseException
      Reads an APON formatted document into the specified Parameters 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

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • parse

      public static Parameters parse(String text) throws AponParseException
      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

      public static <T extends Parameters> T parse(String text, T parameters) throws AponParseException
      Converts an APON formatted string into a given Parameters object.
      Type Parameters:
      T - the generic type
      Parameters:
      text - the APON formatted string
      parameters - the Parameters object
      Returns:
      the Parameters object
      Throws:
      AponParseException - if reading APON format document fails
    • parse

      public static Parameters parse(File file) throws AponParseException
      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

      public static Parameters parse(File file, String encoding) throws AponParseException
      Converts to a Parameters object from a file.
      Parameters:
      file - the file to parse
      encoding - the character encoding
      Returns:
      the Parameters object
      Throws:
      AponParseException - if reading APON format document fails
    • parse

      public static <T extends Parameters> T parse(File file, T parameters) throws AponParseException
      Converts into a given Parameters object from a file.
      Type Parameters:
      T - the generic type
      Parameters:
      file - the file to parse
      parameters - 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 parse
      encoding - the character encoding
      parameters - the Parameters object
      Returns:
      the Parameters object
      Throws:
      AponParseException - if reading APON format document fails
    • parse

      public static Parameters parse(Reader reader) throws AponParseException
      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

      public static <T extends Parameters> T parse(Reader reader, T parameters) throws AponParseException
      Converts into a given Parameters object from a character-input stream.
      Type Parameters:
      T - the generic type
      Parameters:
      reader - the character-input stream
      parameters - the Parameters object
      Returns:
      the Parameters object
      Throws:
      AponParseException - if reading APON format document fails