org.geotools.data.pickle
Class PickledFeatureProtocol
java.lang.Object
org.geotools.data.pickle.PickledFeatureProtocol
- public abstract class PickledFeatureProtocol
- extends java.lang.Object
PickledFeatureProtocol encapsulates the ability to read and write a
FeatureCollection to java input/output streams. The writing of Features and
FeatureTypes is done in an implementation independent manner.
The protocol uses two files, one to store FeatureTypes and associated
ObjectStream Class related information, henceforth refered to as the
"schema file". The second file is used to store
Feature records themselves, henceforth refered to as the "feature file".
This technique allows random access to Features by tricking the
ObjectInputStream and allowing it to "share" Class definitions during the
reading process.
The format for the schema file is:
magic "0xdeca"
byte version
Class FeaturePickler
(byte 1, FeaturePickler)*
byte 0
short numberOfclasses
Class*
The format for the feature file is:
magic "0xdeca"
byte version
short numberOfFeatures
(FeaturePicklerEntry)*
Where FeaturePickler is the actual object and a FeaturePicklerEntry is the
record written by the FeaturePickler (representing a pickled Feature).
NOTES:
- should be rewritten as subclass of ObjectOutputStream/InputStream.
+ two stream constructors (types + features)
+ override writeObject to intercept classes
+ add writeCollection method which follows the logic of this...
- Author:
- Ian Schneider
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CURRENT_VERSION
public static final int CURRENT_VERSION
- See Also:
- Constant Field Values
PickledFeatureProtocol
public PickledFeatureProtocol()
getReader
public static PickledFeatureProtocol getReader(java.io.InputStream fin,
java.io.InputStream sin)
throws java.io.IOException
- Throws:
java.io.IOException
getWriter
public static PickledFeatureProtocol getWriter(java.io.OutputStream fout,
java.io.OutputStream sout)
throws java.io.IOException
- Throws:
java.io.IOException
getWriter
public static PickledFeatureProtocol getWriter(int version,
java.io.OutputStream fout,
java.io.OutputStream sout)
throws java.io.IOException
- Throws:
java.io.IOException
initRead
protected abstract void initRead(java.io.InputStream fin,
java.io.InputStream sin)
throws java.io.IOException
- Throws:
java.io.IOException
initWrite
protected abstract void initWrite(java.io.OutputStream fout,
java.io.OutputStream sout)
throws java.io.IOException
- Throws:
java.io.IOException
version
protected abstract int version()
read
public abstract void read(FeatureCollection fc)
throws java.io.IOException,
java.lang.ClassNotFoundException,
SchemaException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
SchemaException
read
public abstract Feature read(int idx)
throws java.io.IOException,
java.lang.ClassNotFoundException,
SchemaException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
SchemaException
write
public abstract void write(FeatureCollection fc)
throws java.io.IOException
- Throws:
java.io.IOException
close
public abstract void close()
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © GeoTools. All Rights Reserved.