|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.data.vpf.file.VPFFile
This class encapsulates VPF files. By implementing the FeatureType
interface,
it serves as a factory for VPFColumns. Instances of this class should
be created by VPFFileFactory.
Field Summary |
Constructor Summary | |
VPFFile(java.lang.String cPathName)
Constructor. |
Method Summary | |
void |
close()
Close the input stream pointed to by the object |
Feature |
create(java.lang.Object[] attributes)
Create a new feature from the provided attributes It is unclear why one would want to use this method. |
Feature |
create(java.lang.Object[] attributes,
java.lang.String featureID)
Scheduled for removal in Geotools 2.2, please use FeatureFactory. |
Feature |
duplicate(Feature feature)
Create a duplicate of the provided feature, must delegate to an appropriate FeatureFactory create method. |
int |
find(AttributeType type)
Find the position of a given AttributeType. |
int |
find(java.lang.String attName)
Find the position of an AttributeType which matches the given String. |
FeatureType[] |
getAncestors()
Obtain an array of this FeatureType's direct ancestors. |
int |
getAttributeCount()
The number of attribues defined by this schema. |
AttributeType |
getAttributeType(int position)
Gets the schema attributeType at the specified index. |
AttributeType |
getAttributeType(java.lang.String xPath)
Gets the attributeType at this xPath, if the specified attributeType does not exist then null is returned.
|
AttributeType[] |
getAttributeTypes()
AttributeTypes for this FeatureType, all attributes defined by this FeatureType and its super types define schema for feature instances. |
char |
getByteOrder()
Gets the value of byteOrder variable. |
GeometryAttributeType |
getDefaultGeometry()
Gets the default geometry AttributeType. |
java.lang.String |
getDescription()
Gets the value of the description of table content. |
java.lang.String |
getDirectoryName()
Returns the directory name for this file by chopping off the file name and the separator. |
java.lang.String |
getFileName()
Returns the file name (without path) for the file |
java.net.URI |
getNamespace()
Gets the global schema namespace. |
java.lang.String |
getNarrativeTable()
Gets the value of narrativeTable variable file name. |
java.lang.String |
getPathName()
Gets the full path name for this file |
protected int |
getRecordSize()
Method is used to return size in
bytes of records stored in this table. |
Feature |
getRowFromId(java.lang.String idName,
int id)
Returns a row with a matching value for the provided column |
java.lang.String |
getTypeName()
Gets the type name for this schema. |
boolean |
hasAttributeType(java.lang.String xPath)
This is only used twice in the whole geotools code base, and one of those is for a test, so we're removing it from the interface. |
boolean |
hasNext()
Determines if the stream contains storage for another object Who knows how well this will work on variable length objects |
boolean |
isAbstract()
Is this FeatureType an abstract type? |
boolean |
isDescendedFrom(FeatureType type)
A convenience method for calling
FeatureType f1;
FeatureType f2;
f1.isDescendedFrom(f2.getNamespace(), f2.getName());
Question: this method duplicates the information provided by getAncestors().
|
boolean |
isDescendedFrom(java.net.URI nsURI,
java.lang.String typeName)
Test to determine whether this FeatureType is descended from the given FeatureType. |
java.util.AbstractList |
readAllRows()
Generates a list containing all of the features in the file |
protected char |
readChar()
Reads a single byte as a character value |
protected double |
readDouble()
Retrieves a double from the file |
Feature |
readFeature()
Retrieves a feature from the file |
protected java.lang.Object |
readFixedSizeData(char dataType,
int instancesCount)
Retrieves a fixed amount of data from the file |
protected float |
readFloat()
Retrieves a floating point number from the file. |
protected java.lang.Object |
readGeometry(int instancesCount,
int dimensionality,
boolean readDoubles)
Constructs an object which is an instance of Geometry by reading values from the file. |
protected void |
readHeader()
Retrieves a number of attributes from the file header |
protected int |
readInteger()
Retrieves an integer value from the file |
protected byte[] |
readNumber(int cnt)
Reads some byte data from the file |
protected short |
readShort()
Retrieves a short value from the file |
protected java.lang.String |
readString(java.lang.String terminators)
Reads a string value from the file |
protected TripletId |
readTripletId()
Retrieves a triplet object from the file |
protected java.lang.Object |
readVariableSizeData(char dataType)
Retrieves variable sized data from the file by first reading an integer which indicates how many instances of the data type to retrieve |
void |
reset()
Resets the file stream by setting its pointer to the first position after the header. |
protected void |
setPosition(long pos)
Sets the position in the stream |
java.lang.String |
toString()
|
protected void |
unread(long bytes)
Back up a specified number of bytes in the file stream |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.geotools.feature.FeatureType |
equals, hashCode |
Constructor Detail |
public VPFFile(java.lang.String cPathName) throws java.io.IOException, SchemaException
cPathName
- The path to this file
java.io.IOException
- if the path or the file are invalid
SchemaException
- if the contained feature type can not be
constructedMethod Detail |
public Feature create(java.lang.Object[] attributes) throws IllegalAttributeException
create
in interface FeatureType
attributes
- the attributes to used
IllegalAttributeException
- if any of the attributes is invalidpublic Feature create(java.lang.Object[] attributes, java.lang.String featureID) throws IllegalAttributeException
FeatureType
Creates a new feature, with the proper featureID.
create
in interface FeatureType
attributes
- the array of attribute values.featureID
- the feature ID.
IllegalAttributeException
- if the FeatureType does not validate the attributes.public Feature duplicate(Feature feature) throws IllegalAttributeException
FeatureType
The implementation is assumed to make use of AttributeType duplicate as required for a deep copy.
//@deprecated This method will be removed in 2.2, please use FeatureFactory obtained from FactoryFinder
duplicate
in interface FeatureType
feature
-
IllegalAttributeException
public int find(AttributeType type)
FeatureType
Match is based on attribute type name, the resulting index may be used with getAttributeType( index ).
find
in interface FeatureType
type
- The type to search for.
public FeatureType[] getAncestors()
FeatureType
Example Code:
public FeatureType getAncestors()}
return new FeatureType[]{ getSuper(), };
}
getAncestors
in interface FeatureType
public int getAttributeCount()
FeatureType
This method to allows access to the complete schema as defined by this FeatureType and its ancestors.
getAttributeCount
in interface FeatureType
public AttributeType getAttributeType(int position)
FeatureType
The index is specified with respect to the entire Schema (as defined by this FeatureType and it's ancestors).
getAttributeType
in interface FeatureType
public AttributeType getAttributeType(java.lang.String xPath)
FeatureType
null
is returned.
Question: it is unclear how this interacts with the complete schema defined by this FeatureType and its ancestors (in which a given xpath may refer to several AttributeTypes as restrictions are applied.
Perhaps this method should be restricted to a FlatFeatureType? Or should have the option of returning an array of matching AttributeType in order of inheiritence?
getAttributeType
in interface FeatureType
xPath
- XPath pointer to attribute type.
public AttributeType[] getAttributeTypes()
FeatureType
The provided array of AttributeTypes should be considered as adding to (or overriding) the the AttribtueTypes defined by this FeatureTypes ancestors.
Note Well: Client code should not consider the index provided by the find( attName ) method as a valid index into the returned array.
getAttributeTypes
in interface FeatureType
public char getByteOrder()
public GeometryAttributeType getDefaultGeometry()
FeatureType
If the FeatureType has more one geometry it is up to the implementor to determine which geometry is the default. If working with multiple geometries it is best to get the attributeTypes and iterate through them, checking for instances of GeometryAttribtueType.
This should just be used a convenience method when it is known that the features do not have multiple geometries.
getDefaultGeometry
in interface FeatureType
public java.lang.String getDescription()
public java.lang.String getDirectoryName()
public java.lang.String getFileName()
public java.net.URI getNamespace()
FeatureType
This is often used to record the schema prefix (not the URI) required when writing out this Feature using GML. The supporting application will need to be able to start the GMLWriter off with the correct URI information so everything makes sense.
The Registry interface provided by the data module provides an example of how to store associate FeatureType and namespace information. Please note that you may not have duplicate typeNames in the same Namespace.
getNamespace
in interface FeatureType
public java.lang.String getNarrativeTable()
public java.lang.String getPathName()
protected int getRecordSize()
getRecordSize
is used to return size in
bytes of records stored in this table. If table keeps variable length
records -1
should be returned.
int
valuepublic Feature getRowFromId(java.lang.String idName, int id) throws IllegalAttributeException
idName
- The name of the column to look for, such as "id"id
- An identifier for the requested row
IllegalAttributeException
- The feature can not be created due to
illegal attributes in the source filepublic java.lang.String getTypeName()
FeatureType
In GML this must be the element name of the Feature.
getTypeName
in interface FeatureType
public boolean hasAttributeType(java.lang.String xPath)
FeatureType
Question: the comment says we are removing this, but it is not depricated? And how the heck can the number of occurances out of a boolean.
hasAttributeType
in interface FeatureType
xPath
- XPath pointer to attribute type.
public boolean hasNext()
public boolean isAbstract()
FeatureType
When true is returned instances of this Feature cannot be created, instead a child FeatureType must use this FeatureType as its ancestor.
isAbstract
in interface FeatureType
public boolean isDescendedFrom(FeatureType type)
FeatureType
FeatureType f1;
FeatureType f2;
f1.isDescendedFrom(f2.getNamespace(), f2.getName());
Question: this method duplicates the information provided by getAncestors().
isDescendedFrom
in interface FeatureType
type
- The type to compare to.
public boolean isDescendedFrom(java.net.URI nsURI, java.lang.String typeName)
FeatureType
isDescendedFrom
in interface FeatureType
nsURI
- The namespace URI to use.typeName
- The typeName.
public java.util.AbstractList readAllRows() throws java.io.IOException
List
value containing Feature objects
java.io.IOException
- if an error occursprotected char readChar() throws java.io.IOException
char
value
java.io.IOException
- if an error occursprotected java.lang.Object readGeometry(int instancesCount, int dimensionality, boolean readDoubles) throws java.io.IOException
instancesCount
- number of coordinates to readdimensionality
- either 2 or 3readDoubles
- true: read a double value; false: read a float value
java.io.IOException
- on any file IO errorsprotected double readDouble() throws java.io.IOException
double
value
java.io.IOException
- if an error occurspublic Feature readFeature() throws java.io.IOException, IllegalAttributeException
java.io.IOException
- on any file IO errors
IllegalAttributeException
- if any of the attributes retrieved are
illegalprotected java.lang.Object readFixedSizeData(char dataType, int instancesCount) throws java.io.IOException
dataType
- a char
value indicating the data typeinstancesCount
- an int
value indicating the number
of instances to retrieve.
Object
value
java.io.IOException
- if an error occursprotected float readFloat() throws java.io.IOException
float
value
java.io.IOException
- if an error occursprotected void readHeader() throws VPFHeaderFormatException, java.io.IOException
VPFHeaderFormatException
- if an error occurs
java.io.IOException
- if an error occursprotected int readInteger() throws java.io.IOException
int
value
java.io.IOException
- if an error occursprotected byte[] readNumber(int cnt) throws java.io.IOException
cnt
- an int
value indicating the number of bytes to retrieve
byte[]
value
java.io.IOException
- if an error occursprotected short readShort() throws java.io.IOException
short
value
java.io.IOException
- if an error occursprotected java.lang.String readString(java.lang.String terminators) throws java.io.IOException
terminators
- a String
value indicating the terminators to look for
String
value
java.io.IOException
- if an error occursprotected TripletId readTripletId() throws java.io.IOException
TripletId
value
java.io.IOException
- on any IO errorsprotected java.lang.Object readVariableSizeData(char dataType) throws java.io.IOException
dataType
- a char
value indicating the data type
Object
value
java.io.IOException
- if an error occurspublic void reset()
public void close() throws java.io.IOException
java.io.IOException
- in some unlikely situationprotected void setPosition(long pos) throws java.io.IOException
pos
- A 1-indexed position
java.io.IOException
- on any IO failurespublic java.lang.String toString()
protected void unread(long bytes) throws java.io.IOException
bytes
- a long
value
java.io.IOException
- if an error occurspublic int find(java.lang.String attName)
FeatureType
This index may be used with getAttributeType( index ), the search space is the entire schema defined by this FeatureType and its ancestors.
find
in interface FeatureType
attName
- the name to look for
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |