Class HjsonTokenizer

java.lang.Object
org.apache.juneau.marshall.hjson.HjsonTokenizer

public class HjsonTokenizer extends Object
Tokenizer for Hjson format.

Handles quoted strings, quoteless strings, multiline strings, comments, numbers, booleans, null, and structural tokens.

See Also:
  • Constructor Details

    • HjsonTokenizer

      public HjsonTokenizer(Reader reader)
      Constructor.
      Parameters:
      reader - The reader to tokenize.
      Must not be null.
  • Method Details

    • getLine

      public int getLine()
      Returns the current line number (1-based).
      Returns:
      The line number.
    • getColumn

      public int getColumn()
      Returns the current column number (1-based).
      Returns:
      The column number.
    • peek

      Peeks at the next token without consuming it.
      Returns:
      The next token.
      Throws:
      IOException - If a read error occurs.
    • read

      Reads and consumes the next token.
      Returns:
      The next token.
      Throws:
      IOException - If a read error occurs.
    • skipWhitespaceAndComments

      public void skipWhitespaceAndComments() throws IOException
      Skips whitespace and comments.
      Throws:
      IOException - If a read error occurs.
    • readQuotedString

      Reads a quoted string ("..." or '...') with JSON-style escaping.
      Returns:
      The string value.
      Throws:
      IOException - If a read error occurs.
    • readQuotelessString

      Reads a quoteless string (to end of line, trimmed).
      Returns:
      The string value.
      Throws:
      IOException - If a read error occurs.
    • readMultilineString

      public String readMultilineString(int indentBaseline) throws IOException
      Reads a multiline string ('''...'''). Caller must have already consumed the opening '''.
      Parameters:
      indentBaseline - The 1-based column of the first quote in '''; used to strip leading indentation from subsequent lines per Hjson spec.
      Returns:
      The string value (with \n line separators, last newline ignored per spec).
      Throws:
      IOException - If a read error occurs.