question: protected static String readStream ( InputStream stream ) throws OneDriveAPIException { if ( stream == null ) { return null ; } InputStreamReader reader = new InputStreamReader ( stream , StandardCharsets . UTF_8 ) ; StringBuilder builder = new StringBuilder ( ) ; char [ ] buffer = new char [ BUFFER_SIZE ] ; try { int read ; while ( ( read = reader . read ( buffer , 0 , BUFFER_SIZE ) ) != - 1 ) { builder . append ( buffer , 0 , read ) ; } stream . close ( ) ; } catch ( IOException e ) { throw new OneDriveAPIException ( "Couldn't read the stream from OneDrive API." , e ) ; } return builder . toString ( ) ; }
target:  Returns the input stream as a string, then close it.