All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eg.agent.android.MemoryInformation Maven / Gradle / Ivy

There is a newer version: 2.1.3
Show newest version
package com.eg.agent.android;


import com.eg.google.gson.JsonObject;
import com.eg.google.gson.JsonPrimitive;

public class MemoryInformation {
	 private static MemoryInformation instance=new MemoryInformation();
	 private long memoryUsage;
	 private long[] diskAvailable;
	 private String phoneAppMemory;

	public static MemoryInformation getInstance(){
        return instance;
    }
	 public void setMemoryUsage(long memoryUsage)
	    {
	        this.memoryUsage = memoryUsage;
	    }
	  public void setDiskAvailable(long[] diskAvailable)
	    {
	        this.diskAvailable = diskAvailable;
	    }

	    public long getMemoryUsage()
	    {
	        return this.memoryUsage;
	    }
	    public long[] getDiskAvailable()
	    {
	        return this.diskAvailable;
	    }
	    public void setPhoneAppMemory(String phoneAppMemory) {
	        this.phoneAppMemory = phoneAppMemory;
	    }

	    public String getPhoneAppMemory(){return this.phoneAppMemory;}

	    public JsonObject asJsonObject() {

	        JsonObject data = new JsonObject();
	        data.add("memoryUsage",new JsonPrimitive(this.memoryUsage));
	        data.add("diskAvailable",new JsonPrimitive(String.valueOf(this.diskAvailable)));
	        data.add("phoneAppMemory",new JsonPrimitive(this.phoneAppMemory));
	        return data;
	    }
	    public static MemoryInformation newFromJson(JsonObject jsonObject)
	    {
	    	MemoryInformation info = new MemoryInformation();

	        info.memoryUsage = jsonObject.get("memoryUsage").getAsLong();
	        info.phoneAppMemory = jsonObject.get("phoneAppMemory").getAsString();
	      

	        return info;
	    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy