question: private String result ( HttpURLConnection conn , boolean input ) throws IOException { StringBuffer sb = new StringBuffer ( ) ; if ( input ) { InputStream is = conn . getInputStream ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( is , "utf-8" ) ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line ) ; } reader . close ( ) ; is . close ( ) ; } Map < String , Object > result = new HashMap < String , Object > ( ) ; result . put ( "code" , conn . getResponseCode ( ) ) ; result . put ( "mesg" , conn . getResponseMessage ( ) ) ; result . put ( "type" , conn . getContentType ( ) ) ; result . put ( "data" , sb ) ; String output = String . valueOf ( conn . getResponseCode ( ) ) ; setOutputResponseCode ( output ) ; Gson gson = new Gson ( ) ; String json = gson . toJson ( result ) ; logger . info ( "json = " + json ) ; return json ; }
target:  Report the result in JSON way