core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/OJSONReader.java
public int nextChar() throws IOException {
    if (missedChar != null) {
      // RETURNS THE PREVIOUS PARSED CHAR
      c = missedChar.charValue();
      missedChar = null;

    } else {
      int read = in.read();
      if (read == -1)
        return -1;

      c = (char) read;

      if (c == '\\') {
        read = in.read();
        if (read == -1)
          return -1;

        char c2 = (char) read;
        if (c2 == 'u') {
          // DECODE UNICODE CHAR
          final StringBuilder buff = new StringBuilder(8);
          for (int i = 0; i < 4; ++i) {
            read = in.read();
            if (read == -1)
              return -1;

            buff.append((char) read);
          }

          cursor += 6;

          return (char) Integer.parseInt(buff.toString(), 16);
        } else {
          // REMEMBER THE CURRENT CHAR TO RETURN NEXT TIME
          missedChar = c2;
        }
      }
    }

    cursor++;

    if (c == NEW_LINE) {
      ++lineNumber;
      columnNumber = 0;
    } else
      ++columnNumber;

    return (char) c;
  }
public int nextChar() throws IOException {
    if (missedChar != null) {
      // RETURNS THE PREVIOUS PARSED CHAR
      c = missedChar.charValue();
      missedChar = null;

    } else {
      int read = in.read();
      if (read == -1)
        return -1;

      c = (char) read;

      if (c == '\\') {
        read = in.read();
        if (read == -1)
          return -1;

        char c2 = (char) read;
        if (c2 == 'u') {
          // DECODE UNICODE CHAR
          final StringBuilder buff = new StringBuilder(8);
          for (int i = 0; i < 4; ++i) {
            read = in.read();
            if (read == -1)
              return -1;

            buff.append((char) read);
          }

          cursor += 6;

          return (char) Integer.parseInt(buff.toString(), 16);
        } else {
          // REMEMBER THE CURRENT CHAR TO RETURN NEXT TIME
          missedChar = c2;
        }
      }
    }

    cursor++;

    if (c == NEW_LINE) {
      ++lineNumber;
      columnNumber = 0;
    } else
      ++columnNumber;

    return (char) c;
  }
public int nextChar ( ) throws IOException { if ( missedChar != null ) { // RETURNS THE PREVIOUS PARSED CHAR
 c = missedChar . charValue ( ) ; missedChar = null ; } else { int read = in . read ( ) ; if ( read == - 1 ) return - 1 ; c = ( char ) read ; if ( c == ' ' ) { read = in . read ( ) ; if ( read == - 1 ) return - 1 ; char c2 = ( char ) read ; if ( c2 == ' ' ) { // DECODE UNICODE CHAR
 final StringBuilder buff = new StringBuilder ( 8 ) ; for ( int i = 0 ; i < 4 ; ++ i ) { read = in . read ( ) ; if ( read == - 1 ) return - 1 ; buff . append ( ( char ) read ) ; } cursor += 6 ; return ( char ) Integer . parseInt ( buff . toString ( ) , 16 ) ; } else { // REMEMBER THE CURRENT CHAR TO RETURN NEXT TIME
 missedChar = c2 ; } } } cursor ++ ; if ( c == NEW_LINE ) { ++ lineNumber ; columnNumber = 0 ; } else ++ columnNumber ; return ( char ) c ; }
Returns the next character from the input stream. Handles Unicode decoding.
Returns the next character from the input stream . Handles Unicode decoding .