Code example for ByteArrayBuffer

Methods: toByteArray

0
	private AsyncPostRequest connPost = null;
 
	@Override 
	public void onSuccess(ByteArrayBuffer baf) {
		try { 
			String jsonString = EncodingUtils.getString(baf.toByteArray(), "utf8");
			Log.d("URLHelper", "JSON response = " + jsonString);
			JSONObject obj = null;
			if (!jsonString.equals("") && !jsonString.equals("[]"))
				obj = new JSONObject(jsonString);
			mDelegate.updateModelWithJSONObject(obj, this.serviceId);
		} 
		catch (Exception e) {
			e.printStackTrace();
			mDelegate.connectionFailed(this.serviceId);
		} 
	} 
 
	@Override 
	public void onFail() { 
		mDelegate.connectionFailed(this.serviceId);