app/src/main/java/com/example/android/quakereport/QueryUtils.java
private static String readFromInputStream(InputStream inputStream) throws IOException{
        StringBuilder output=new StringBuilder();
        if(inputStream != null){
            InputStreamReader inputStreamReader=new InputStreamReader(inputStream, Charset.forName("UTF-8"));
            BufferedReader bufferedReader=new BufferedReader(inputStreamReader);
            String line=bufferedReader.readLine();
            while(line != null){
                output.append(line);
                line=bufferedReader.readLine();
            }

        }
        return output.toString();
    }
/* To convert input stream to string value*/
To convert input stream to string value
To convert input stream to string value
private static String readFromInputStream(InputStream inputStream) throws IOException{
        StringBuilder output=new StringBuilder();
        if(inputStream != null){
            InputStreamReader inputStreamReader=new InputStreamReader(inputStream, Charset.forName("UTF-8"));
            BufferedReader bufferedReader=new BufferedReader(inputStreamReader);
            String line=bufferedReader.readLine();
            while(line != null){
                output.append(line);
                line=bufferedReader.readLine();
            }
        }
        return output.toString();
    }
private static String readFromInputStream ( InputStream inputStream ) throws IOException { StringBuilder output = new StringBuilder ( ) ; if ( inputStream != null ) { InputStreamReader inputStreamReader = new InputStreamReader ( inputStream , Charset . forName ( "UTF-8" ) ) ; BufferedReader bufferedReader = new BufferedReader ( inputStreamReader ) ; String line = bufferedReader . readLine ( ) ; while ( line != null ) { output . append ( line ) ; line = bufferedReader . readLine ( ) ; } } return output . toString ( ) ; }
To convert input stream to string value
To convert input stream to string value