private static void processAttachmentFile(Uri uri, boolean z, File file) throws IOException {
   InputStream openInputStream;
   Closeable fileOutputStream = new FileOutputStream(file);
   if (z) {
     openInputStream =
         FacebookSdk.getApplicationContext().getContentResolver().openInputStream(uri);
   } else {
     try {
       openInputStream = new FileInputStream(uri.getPath());
     } catch (Throwable th) {
       Utility.closeQuietly(fileOutputStream);
     }
   }
   Utility.copyAndCloseInputStream(openInputStream, fileOutputStream);
   Utility.closeQuietly(fileOutputStream);
 }
 private static void processAttachmentBitmap(Bitmap bitmap, File file) throws IOException {
   Closeable fileOutputStream = new FileOutputStream(file);
   try {
     bitmap.compress(CompressFormat.JPEG, 100, fileOutputStream);
   } finally {
     Utility.closeQuietly(fileOutputStream);
   }
 }
  public static String readStreamToString(InputStream inputStream) throws IOException {
    BufferedInputStream bufferedInputStream = null;
    InputStreamReader reader = null;
    try {
      bufferedInputStream = new BufferedInputStream(inputStream);
      reader = new InputStreamReader(bufferedInputStream);
      StringBuilder stringBuilder = new StringBuilder();

      final int bufferSize = 1024 * 2;
      char[] buffer = new char[bufferSize];
      int n = 0;
      while ((n = reader.read(buffer)) != -1) {
        stringBuilder.append(buffer, 0, n);
      }

      return stringBuilder.toString();
    } finally {
      closeQuietly(bufferedInputStream);
      closeQuietly(reader);
    }
  }