Class Mark

  • All Implemented Interfaces:
    java.io.Serializable

    public final class Mark
    extends java.lang.Object
    implements java.io.Serializable
    Location of a problem in the YAML document. Its only use is producing nice error messages. Parser does not use it for any other purposes.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int[] buffer  
      private int column  
      private int index  
      private int line  
      private java.lang.String name  
      private int pointer  
    • Constructor Summary

      Constructors 
      Constructor Description
      Mark​(java.lang.String name, int index, int line, int column, char[] str, int pointer)
      This constructor is only for test
      Mark​(java.lang.String name, int index, int line, int column, int[] buffer, int pointer)
      Creates Mark
    • Field Detail

      • name

        private final java.lang.String name
      • index

        private final int index
      • line

        private final int line
      • column

        private final int column
      • buffer

        private final int[] buffer
      • pointer

        private final int pointer
    • Constructor Detail

      • Mark

        public Mark​(java.lang.String name,
                    int index,
                    int line,
                    int column,
                    int[] buffer,
                    int pointer)
        Creates Mark
        Parameters:
        name - - the name to be used as identifier
        index - - the index from the beginning of the stream
        line - - line of the mark from beginning of the stream
        column - - column of the mark from beginning of the line
        buffer - - the data
        pointer - - the position of the mark from the beginning of the data
      • Mark

        public Mark​(java.lang.String name,
                    int index,
                    int line,
                    int column,
                    char[] str,
                    int pointer)
        This constructor is only for test
        Parameters:
        name - - the name to be used as identifier
        index - - the index from the beginning of the stream
        line - - line of the mark from beginning of the stream
        column - - column of the mark from beginning of the line
        str - - the data
        pointer - - the position of the mark from the beginning of the data
    • Method Detail

      • toCodePoints

        private static int[] toCodePoints​(char[] str)
      • isLineBreak

        private boolean isLineBreak​(int c)
      • createSnippet

        public java.lang.String createSnippet​(int indent,
                                              int maxLength)
        Create readable snippet
        Parameters:
        indent - - the indent
        maxLength - - cut data after this length
        Returns:
        readable piece of YAML where a problem detected
      • createSnippet

        public java.lang.String createSnippet()
        Create readable YAML with indent 4 and n ot longer that 75 characters long
        Returns:
        readable piece of YAML where a problem detected
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getName

        public java.lang.String getName()
        getter
        Returns:
        name of the data stream
      • getLine

        public int getLine()
        starts with 0
        Returns:
        line number
      • getColumn

        public int getColumn()
        starts with 0
        Returns:
        column number
      • getIndex

        public int getIndex()
        starts with 0
        Returns:
        character number
      • getBuffer

        public int[] getBuffer()
        getter
        Returns:
        data with the error
      • getPointer

        public int getPointer()
        getter
        Returns:
        pointer in the data to the error