@Test public void validateJacksonClosesInputStreams() { final Set<String> closedSet = new HashSet<>(); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream( "{ \"a\" : \"b\" }".getBytes() ) { @Override public void close() throws IOException { closedSet.add("closed"); super.close(); } }; Map<String,Object> map = JsonUtils.jsonToMap( byteArrayInputStream ); Assert.assertNotNull( map ); Assert.assertEquals( 1, map.size() ); Assert.assertEquals( 1, closedSet.size() ); }
public static Map<String, Object> jsonToMap( String json ) { return util.jsonToMap( json ); }
JsonUtils { public static Map<String, Object> jsonToMap( String json ) { return util.jsonToMap( json ); } }
JsonUtils { public static Map<String, Object> jsonToMap( String json ) { return util.jsonToMap( json ); }  }
JsonUtils { public static Map<String, Object> jsonToMap( String json ) { return util.jsonToMap( json ); }  static JsonUtil customJsonUtil( ObjectMapper mapper ); @Deprecated static void removeRecursive( Object json, String keyToRemove ); static Map<String, Object> javason( String javason ); static JsonUtil getDefaultJsonUtil(); static Object jsonToObject( String json ); static Object jsonToObject( String json, String charset ); static Object jsonToObject( InputStream in ); static Map<String, Object> jsonToMap( String json ); static Map<String, Object> jsonToMap( String json, String charset ); static Map<String, Object> jsonToMap( InputStream in ); static List<Object> jsonToList( String json ); static List<Object> jsonToList( String json, String charset ); static List<Object> jsonToList( InputStream in ); static Object filepathToObject( String filePath ); static Map<String, Object> filepathToMap( String filePath ); static List<Object> filepathToList( String filePath ); static Object classpathToObject( String classPath ); static Map<String, Object> classpathToMap( String classPath ); static List<Object> classpathToList( String classPath ); static T classpathToType( String classPath, TypeReference<T> typeRef ); static T classpathToType( String classPath, Class<T> aClass ); static T stringToType( String json, TypeReference<T> typeRef ); static T stringToType( String json, Class<T> aClass ); static T fileToType( String filePath, TypeReference<T> typeRef ); static T fileToType( String filePath, Class<T> aClass ); static T streamToType( InputStream in, TypeReference<T> typeRef ); static T streamToType( InputStream in, Class<T> aClass ); @Deprecated static T jsonTo( String json, TypeReference<T> typeRef ); @Deprecated static T jsonTo( InputStream in, TypeReference<T> typeRef ); static String toJsonString( Object obj ); static String toPrettyJsonString( Object obj ); static Object cloneJson( Object obj ); @SuppressWarnings("unchecked") @Deprecated static T navigate(Object source, Object... paths); }
JsonUtils { public static Map<String, Object> jsonToMap( String json ) { return util.jsonToMap( json ); }  static JsonUtil customJsonUtil( ObjectMapper mapper ); @Deprecated static void removeRecursive( Object json, String keyToRemove ); static Map<String, Object> javason( String javason ); static JsonUtil getDefaultJsonUtil(); static Object jsonToObject( String json ); static Object jsonToObject( String json, String charset ); static Object jsonToObject( InputStream in ); static Map<String, Object> jsonToMap( String json ); static Map<String, Object> jsonToMap( String json, String charset ); static Map<String, Object> jsonToMap( InputStream in ); static List<Object> jsonToList( String json ); static List<Object> jsonToList( String json, String charset ); static List<Object> jsonToList( InputStream in ); static Object filepathToObject( String filePath ); static Map<String, Object> filepathToMap( String filePath ); static List<Object> filepathToList( String filePath ); static Object classpathToObject( String classPath ); static Map<String, Object> classpathToMap( String classPath ); static List<Object> classpathToList( String classPath ); static T classpathToType( String classPath, TypeReference<T> typeRef ); static T classpathToType( String classPath, Class<T> aClass ); static T stringToType( String json, TypeReference<T> typeRef ); static T stringToType( String json, Class<T> aClass ); static T fileToType( String filePath, TypeReference<T> typeRef ); static T fileToType( String filePath, Class<T> aClass ); static T streamToType( InputStream in, TypeReference<T> typeRef ); static T streamToType( InputStream in, Class<T> aClass ); @Deprecated static T jsonTo( String json, TypeReference<T> typeRef ); @Deprecated static T jsonTo( InputStream in, TypeReference<T> typeRef ); static String toJsonString( Object obj ); static String toPrettyJsonString( Object obj ); static Object cloneJson( Object obj ); @SuppressWarnings("unchecked") @Deprecated static T navigate(Object source, Object... paths);  }