private static Map < String , Object > readMap ( StreamingInput input ) throws IOException { boolean readEnd = false ; if ( input . peek ( ) == Token . OBJECT_START ) { // Check if the object is wrapped readEnd = true ; input . next ( ) ; } Token t ; Map < String , Object > result = new HashMap < String , Object > ( ) ; while ( ( t = input . peek ( ) ) != Token . OBJECT_END && t != null ) { // Read the key input . next ( Token . KEY ) ; String key = input . getString ( ) ; // Read the value Object value = readDynamic ( input ) ; result . put ( key , value ) ; } if ( readEnd ) { input . next ( Token . OBJECT_END ) ; } return result ; }
Read a single map from the input optionally while reading object start and end tokens .