# Class CachedData

java.lang.Object
com.codename1.io.services.CachedData

All Implemented Interfaces:
  `Externalizable`

public class CachedData extends java.lang.Object implements Externalizable
Cached data class for use with the cached data service

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CachedData()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `externalize(java.io.DataOutputStream out)`
  Allows us to store an object state, this method must be implemented in order to save the state of an object
  `byte[]`
  `getData()`

  ###### Returns

  `String`
  `getObjectId()`
  The object id must be unique, it is used to identify the object when loaded even when it is obfuscated.
  `String`
  `getUrl()`

  ###### Returns

  `int`
  `getVersion()`
  Returns the version for the current persistance code, the version will be pased to internalized thus allowing the internalize method to recognize classes persisted in older revisions
  `void`
  `internalize(int version, java.io.DataInputStream in)`
  Loads the object from the input stream and allows deserialization
  `void`
  `setData(byte[] data)`

  ###### Parameters

  `void`
  `setUrl(String url)`

  ###### Parameters

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CachedData

    public CachedData()

- ## Method Details

  - ### getVersion

    public int getVersion()

    Returns the version for the current persistance code, the version will be pased to internalized thus allowing the internalize method to recognize classes persisted in older revisions

    ###### Returns

    version number for the persistant code

    Specified by:
      `getVersion` in interface `Externalizable`

  - ### externalize

    public void externalize(java.io.DataOutputStream out) throws java.io.IOException

    Allows us to store an object state, this method must be implemented in order to save the state of an object

    ###### Parameters

    - `out`: the stream into which the object must be serialized

    ###### Throws

    - `java.io.IOException`: the method may throw an exception
    Specified by:
      `externalize` in interface `Externalizable`
    Throws:
      `java.io.IOException`

  - ### internalize

    public void internalize(int version, java.io.DataInputStream in) throws java.io.IOException

    Loads the object from the input stream and allows deserialization

    ###### Parameters

    - `version`: the version the class returned during the externalization processs

    - `in`: the input stream used to load the class

    ###### Throws

    - `java.io.IOException`: the method may throw an exception
    Specified by:
      `internalize` in interface `Externalizable`
    Throws:
      `java.io.IOException`

  - ### getObjectId

    public String getObjectId()
    Description copied from interface: `Externalizable`

    The object id must be unique, it is used to identify the object when loaded even when it is obfuscated.

    ###### Returns

    a unique id

    Specified by:
      `getObjectId` in interface `Externalizable`

  - ### getData

    public byte[] getData()

    ###### Returns

    the data

  - ### setData

    public void setData(byte[] data)

    ###### Parameters

    - `data`: the data to set

  - ### getUrl

    public String getUrl()

    ###### Returns

    the url

  - ### setUrl

    public void setUrl(String url)

    ###### Parameters

    - `url`: the url to set