Android Open Source - RestIt Network Util






From Project

Back to project page RestIt.

License

The source code is released under:

Apache License

If you think the Android project RestIt 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 org.restit.network;
//from   ww  w . j  a  va2s .c o  m
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import android.util.Log;

public class NetworkUtil {

  private final static String LOG_TAG = "NetworkUtil";
  
  /**
   * Parse a stream to a string
   * @param stream The stream to parse
   * @return A readable string
   */
  public static String parseStream(InputStream stream)
  {
    String value = null;
    
        if (stream != null) {
        
          BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
      StringBuilder sb = new StringBuilder();
  
      String line = null;
      try
      {
        while ((line = reader.readLine()) != null)
        {
          sb.append(line + "\n");
        }
      } catch (IOException e)
      {
        Log.e(LOG_TAG, e.getLocalizedMessage(), e);
      } finally
      {
        try
        {
          stream.close();
        } catch (IOException e)
        {
          Log.e(LOG_TAG, e.getLocalizedMessage(), e);
        }
      }
  
      value = sb.toString();
    
        }
        
        return value;
  }
}




Java Source Code List

org.restit.model.ServerError.java
org.restit.model.serialization.ServerErrorDeserializer.java
org.restit.model.serialization.ServerErrorSerializer.java
org.restit.network.AsyncCallback.java
org.restit.network.ContentType.java
org.restit.network.IRestItNetworkListener.java
org.restit.network.NetworkNotAvailableException.java
org.restit.network.NetworkUtil.java
org.restit.network.ProgressListener.java
org.restit.network.RequestMethod.java
org.restit.network.RequestOptions.java
org.restit.network.RestItClient.java
org.restit.network.RestItNetworkStatus.java
org.restit.network.RestIt.java
org.restit.network.ServerAsyncTask.java
org.restit.network.ServerErrorException.java
org.restit.network.insecure.NullHostNameVerifier.java
org.restit.network.insecure.NullX509TrustManager.java
org.restit.objectmapping.ClassRegistration.java
org.restit.objectmapping.ObjectMapping.java
org.restit.objectmapping.RestItMapper.java