Class CachedData

java.lang.Object
com.codename1.io.services.CachedData
All Implemented Interfaces:
Externalizable

public class CachedData extends Object implements Externalizable
Cached data class for use with the cached data service
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Allows us to store an object state, this method must be implemented in order to save the state of an object
    byte[]
    Returns
    The object id must be unique, it is used to identify the object when loaded even when it is obfuscated.
    Returns
    int
    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, DataInputStream in)
    Loads the object from the input stream and allows deserialization
    void
    setData(byte[] data)
    Parameters
    void
    Parameters

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • 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(DataOutputStream out) throws 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:
      IOException
    • internalize

      public void internalize(int version, DataInputStream in) throws 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:
      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