@Override public void close() throws OneDriveAPIException {
  if (closed) {
    return;
  }
  try {
    InputStream stream=connection.getInputStream();
    byte[] buffer=new byte[BUFFER_SIZE];
    int n=stream.read(buffer);
    while (n != -1) {
      n=stream.read(buffer);
    }
    stream.close();
    if (inputStream != null) {
      inputStream.close();
    }
    closed=true;
  }
 catch (  IOException e) {
    throw new OneDriveAPIException("Couldn't close the connection to OneDrive API due to a network error.",e);
  }
}

@ Override public void close ( ) throws OneDriveAPIException { if ( closed ) { return ; } try { InputStream stream = connection . getInputStream ( ) ; byte [ ] buffer = new byte [ BUFFER_SIZE ] ; int n = stream . read ( buffer ) ; while ( n != - 1 ) { n = stream . read ( buffer ) ; } stream . close ( ) ; if ( inputStream != null ) { inputStream . close ( ) ; } closed = true ; } catch ( IOException e ) { throw new OneDriveAPIException ( "Couldn't close the connection to OneDrive API due to a network error." , e ) ; } }
disconnects the response , close the input stream , so body can no longer be read after .
