Android Open Source - transloadit-Android-sdk Transloadit Response






From Project

Back to project page transloadit-Android-sdk.

License

The source code is released under:

MIT License

If you think the Android project transloadit-Android-sdk 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 hu.szabot.transloadit;
//w w w  . j a va  2 s . c o  m
import hu.szabot.transloadit.exceptions.NotParseableException;
import hu.szabot.transloadit.parser.IResponseParser;
import hu.szabot.transloadit.parser.JSONResponseParser;

import java.util.HashMap;

/**Handles the whole functionality of Transloadit response*/
public class TransloaditResponse implements IApiResponse
{
  /**Request success flag*/
  private boolean success=false;
  
  /**The response string*/
  private String responseString;
  
  /**The parsed data*/
  private HashMap<String, Object> data;
  
    /**Creates a new TransloaditResponse object with response string string
     * @param responseString The response string
     */
    public TransloaditResponse(String responseString)
    {
      this(responseString,new JSONResponseParser());
      
    }
    
    /**
     * Creates a new TransloaditResponse object with response string string and parser
     * @param responseString The response string
     * @param parser The response parser
     */
    public TransloaditResponse(String responseString,IResponseParser parser)
    {
      this.responseString=responseString;
      
      parser.setResponse(responseString);
      
        try {
      
          data=parser.parse();
          
          if (data.containsKey("ok"))
          {
              success = true;
          }
          
    } catch (NotParseableException e) 
    {
    }
      
    }

  @Override
  public String getResponseString() 
  {
    return responseString;
  }

  @Override
  public HashMap<String, Object> getData() 
  {
    return data;
  }

  @Override
  public boolean isSuccess() {
    return success;
  }

}




Java Source Code List

hu.szabot.transloadit.ApiData.java
hu.szabot.transloadit.IApiRequest.java
hu.szabot.transloadit.IApiResponse.java
hu.szabot.transloadit.ITransloadit.java
hu.szabot.transloadit.TransloaditRequest.java
hu.szabot.transloadit.TransloaditResponse.java
hu.szabot.transloadit.Transloadit.java
hu.szabot.transloadit.assembly.AssemblyBuilder.java
hu.szabot.transloadit.assembly.IAssemblyBuilder.java
hu.szabot.transloadit.assembly.IStep.java
hu.szabot.transloadit.assembly.Step.java
hu.szabot.transloadit.assembly.exceptions.AlreadyDefinedKeyException.java
hu.szabot.transloadit.assembly.exceptions.InvalidFieldKeyException.java
hu.szabot.transloadit.exceptions.FileNotOpenableException.java
hu.szabot.transloadit.exceptions.NotParseableException.java
hu.szabot.transloadit.executor.DefaultHttpExecutor.java
hu.szabot.transloadit.executor.IRequestExecutor.java
hu.szabot.transloadit.executor.ParsedApiData.java
hu.szabot.transloadit.log.TransloaditLogger.java
hu.szabot.transloadit.parser.IRequestParser.java
hu.szabot.transloadit.parser.IResponseParser.java
hu.szabot.transloadit.parser.JSONRequestParser.java
hu.szabot.transloadit.parser.JSONResponseParser.java
hu.szabot.transloadit.utils.ShaUtils.java