Class CachedData
java.lang.Object
com.codename1.io.services.CachedData
- All Implemented Interfaces:
Externalizable
Cached data class for use with the cached data service
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAllows us to store an object state, this method must be implemented in order to save the state of an objectbyte[]getData()Returns
The object id must be unique, it is used to identify the object when loaded even when it is obfuscated.getUrl()Returns
intReturns 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 revisionsvoidinternalize(int version, DataInputStream in) Loads the object from the input stream and allows deserializationvoidsetData(byte[] data) Parameters
voidParameters
-
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:
getVersionin interfaceExternalizable
-
externalize
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:
externalizein interfaceExternalizable- Throws:
IOException
-
internalize
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:
internalizein interfaceExternalizable- Throws:
IOException
-
-
getObjectId
Description copied from interface:ExternalizableThe 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:
getObjectIdin interfaceExternalizable
-
getData
public byte[] getData()Returns
the data
-
setData
public void setData(byte[] data) Parameters
data: the data to set
-
getUrl
Returns
the url
-
setUrl
Parameters
url: the url to set
-