org.geotools.xml.gml
Class FCBuffer

java.lang.Object
  extended by java.lang.Thread
      extended by org.geotools.xml.gml.FCBuffer
All Implemented Interfaces:
java.lang.Runnable, FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Direct Known Subclasses:
WFSFeatureReader

public class FCBuffer
extends java.lang.Thread
implements FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>

Feature Buffer ... acts as a FeatureReader by making itself as a seperate thread prior starting execution with the SAX Parser.

Author:
dzwiers

Nested Class Summary
static class FCBuffer.StopException
          DOCUMENT ME!
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  org.xml.sax.SAXException exception
           
static int FINISH
          Last feature is in the buffer
protected  org.opengis.feature.simple.SimpleFeatureType ft
           
protected static java.util.logging.Logger logger
          DOCUMENT ME!
protected  int state
          DOCUMENT ME!
static int STOP
          DOCUMENT ME!
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected FCBuffer(java.net.URI document, int capacity, int timeout, org.opengis.feature.simple.SimpleFeatureType ft)
           
 
Method Summary
protected  boolean addFeature(org.opengis.feature.simple.SimpleFeature f)
           Adds a feature to the buffer
 void close()
          Release the underlying resources associated with this stream.
 int getCapacity()
          DOCUMENT ME!
static FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.net.URI document, int capacity)
           The prefered method of using this class, this will return the Feature Reader for the document specified, using the specified buffer capacity.
static FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.net.URI document, int capacity, int timeout)
           
static FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.net.URI document, int capacity, int timeout, org.opengis.feature.simple.SimpleFeatureType ft)
           
static FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.net.URI document, int capacity, org.opengis.feature.simple.SimpleFeatureType ft)
           
 org.opengis.feature.simple.SimpleFeatureType getFeatureType()
          DOCUMENT ME!
 int getInternalState()
           
 int getSize()
          DOCUMENT ME!
 int getTimeout()
          DOCUMENT ME!
 boolean hasNext()
          Query whether this FeatureReader has another Feature.
protected  void initHints(XMLHandlerHints hints)
          Called before parsing the FeatureCollection.
 org.opengis.feature.simple.SimpleFeature next()
          Reads the next Feature in the FeatureReader.
 org.opengis.feature.simple.SimpleFeature peek()
           
 void resetTimer()
           
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FINISH

public static final int FINISH
Last feature is in the buffer

See Also:
Constant Field Values

STOP

public static final int STOP
DOCUMENT ME!

See Also:
Constant Field Values

logger

protected static java.util.logging.Logger logger
DOCUMENT ME!


state

protected int state
DOCUMENT ME!


exception

protected org.xml.sax.SAXException exception

ft

protected org.opengis.feature.simple.SimpleFeatureType ft
Constructor Detail

FCBuffer

protected FCBuffer(java.net.URI document,
                   int capacity,
                   int timeout,
                   org.opengis.feature.simple.SimpleFeatureType ft)
Parameters:
document -
capacity -
timeout -
ft - Nullable
Method Detail

getSize

public int getSize()
DOCUMENT ME!

Returns:
The buffer size

getCapacity

public int getCapacity()
DOCUMENT ME!

Returns:
The buffer capacity

getTimeout

public int getTimeout()
DOCUMENT ME!

Returns:
The buffer capacity

addFeature

protected boolean addFeature(org.opengis.feature.simple.SimpleFeature f)

Adds a feature to the buffer

Parameters:
f - Feature to add
Returns:
false if unable to add the feature

getFeatureReader

public static FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.net.URI document,
                                                                                                                                    int capacity)
                                                                                                                             throws org.xml.sax.SAXException

The prefered method of using this class, this will return the Feature Reader for the document specified, using the specified buffer capacity.

Parameters:
document - URL to parse
capacity -
Throws:
org.xml.sax.SAXException

getFeatureReader

public static FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.net.URI document,
                                                                                                                                    int capacity,
                                                                                                                                    org.opengis.feature.simple.SimpleFeatureType ft)
                                                                                                                             throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getFeatureReader

public static FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.net.URI document,
                                                                                                                                    int capacity,
                                                                                                                                    int timeout)
                                                                                                                             throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getFeatureReader

public static FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.net.URI document,
                                                                                                                                    int capacity,
                                                                                                                                    int timeout,
                                                                                                                                    org.opengis.feature.simple.SimpleFeatureType ft)
                                                                                                                             throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getFeatureType

public org.opengis.feature.simple.SimpleFeatureType getFeatureType()
DOCUMENT ME!

Specified by:
getFeatureType in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Returns:
DOCUMENT ME!
See Also:
FeatureReader.getFeatureType()

next

public org.opengis.feature.simple.SimpleFeature next()
                                              throws java.io.IOException,
                                                     java.util.NoSuchElementException
Description copied from interface: FeatureReader
Reads the next Feature in the FeatureReader.

Specified by:
next in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Returns:
The next feature in the reader.
Throws:
java.io.IOException - If an error occurs reading the Feature.
java.util.NoSuchElementException - If there are no more Features in the Reader.
See Also:
FeatureReader.next()

peek

public org.opengis.feature.simple.SimpleFeature peek()
                                              throws java.io.IOException,
                                                     java.util.NoSuchElementException
Throws:
java.io.IOException
java.util.NoSuchElementException
See Also:
FeatureReader.next()

hasNext

public boolean hasNext()
                throws java.io.IOException
Description copied from interface: FeatureReader
Query whether this FeatureReader has another Feature.

Specified by:
hasNext in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Returns:
True if there are more Features to be read. In other words, true if calls to next would return a feature rather than throwing an exception.
Throws:
java.io.IOException - If an error occurs determining if there are more Features.
See Also:
FeatureReader.hasNext()

close

public void close()
Description copied from interface: FeatureReader
Release the underlying resources associated with this stream.

Specified by:
close in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
See Also:
FeatureReader.close()

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Runnable.run()

initHints

protected void initHints(XMLHandlerHints hints)
Called before parsing the FeatureCollection. Subclasses may override to set their custom hints.


getInternalState

public int getInternalState()

resetTimer

public void resetTimer()


Copyright © 1996-2010 Geotools. All Rights Reserved.