Android Open Source - growthpush-android I O Utils






From Project

Back to project page growthpush-android.

License

The source code is released under:

Apache License

If you think the Android project growthpush-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.growthpush.utils;
//  w ww .  j  av a  2 s .  com
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import android.os.Build;

public class IOUtils {

  public static String toString(InputStream inputStream) throws IOException {

    InputStreamReader objReader = new InputStreamReader(inputStream);
    BufferedReader bufferedReader = new BufferedReader(objReader);
    StringBuilder stringBuilder = new StringBuilder();

    try {

      String line = null;
      while ((line = bufferedReader.readLine()) != null) {
        stringBuilder.append(line);
      }

      return stringBuilder.toString();

    } catch (IOException e) {
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
        throw new IOException("Failed to convert InputStream to String.", e);
      else
        throw new IOException("Failed to convert InputStream to String.");
    } finally {

      if (inputStream != null) {
        try {
          inputStream.close();
        } catch (IOException e) {
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
            throw new IOException("Failed to close InputStream.", e);
          else
            throw new IOException("Failed to close InputStream.");
        }
      }

    }

  }

}




Java Source Code List

com.growthpush.BroadcastReceiver.java
com.growthpush.GrowthPushException.java
com.growthpush.GrowthPush.java
com.growthpush.Logger.java
com.growthpush.Preference.java
com.growthpush.Thread.java
com.growthpush.bridge.ExternalFrameworkBridge.java
com.growthpush.bridge.ExternalFrameworkBroadcastReceiver.java
com.growthpush.growthpushsample.MainActivity.java
com.growthpush.handler.BaseReceiveHandler.java
com.growthpush.handler.DefaultReceiveHandler.java
com.growthpush.handler.OnlyAlertReceiveHandler.java
com.growthpush.handler.OnlyNotificationReceiveHandler.java
com.growthpush.handler.ReceiveHandler.java
com.growthpush.model.ClientStatus.java
com.growthpush.model.Client.java
com.growthpush.model.Environment.java
com.growthpush.model.Error.java
com.growthpush.model.Event.java
com.growthpush.model.Model.java
com.growthpush.model.Tag.java
com.growthpush.utils.DeviceUtils.java
com.growthpush.utils.IOUtils.java
com.growthpush.utils.PermissionUtils.java
com.growthpush.utils.SystemUtils.java
com.growthpush.view.AlertActivity.java
com.growthpush.view.AlertFragment.java
com.growthpush.view.DialogCallback.java