| java.lang.Object org.geotools.caching.util.FeatureMarshaller
FeatureMarshaller | public class FeatureMarshaller (Code) | | Simple marshaller that can write features to an ObjectOutputStream.
Feature is not Serializable, but this is based on the idea that most attributes object are Serializable
(JTS geometries are Serializable), and that attributes which are not simple, are either a collection we can iterate through, or another Feature.
Serialization is then achieved recursively.
Unmarshalling implies to know the FeatureType of the marshalled feature.
Storage format : Header,
Attributes
Header := int : FeatureType hashCode,
String : FeatureType name,
String : Feature ID,
int : number of attributes
Attributes := [Attribute]
Attribute := int : multiplicity, or O if simple, or -1 if FeatureAttribute,
Object|Feature|[Attribute] : attribute value
This implementation does not have the ambition of being robust.
author: Christophe Rousson, SoC 2007, CRG-ULAVAL |
Field Summary | |
final public static int | FEATURE |
FEATURE | final public static int FEATURE(Code) | | marker to indicate an attribute is a feature in the serialized form
|
FeatureMarshaller | public FeatureMarshaller()(Code) | | Default constructor.
User must call setType() to set the FeatureType
before any attempt to marshall/unmarshall a feature.
|
FeatureMarshaller | public FeatureMarshaller(FeatureType t)(Code) | | Creates a new instance of this marshaller
Parameters: t - the FeatureType this marshaller can marshall/unmarsahll |
getType | public FeatureType getType()(Code) | | FeatureType getter
the FeatureType this marshaller marshalls/unmarshalls |
marshallComplexAttribute | protected void marshallComplexAttribute(Object o, ObjectOutputStream s) throws IOException(Code) | | Marshall an attribute into a stream.
Parameters: o - an attribute value which is Serializable, or a feature, or a collection Parameters: s - the stream to write to throws: IOException - |
setType | public void setType(FeatureType t)(Code) | | FeatureType setter
Parameters: t - the FeatureType to use for next marshall/unmarshall ops. |
|
|