org.geotools.xml.gml
Class FCBuffer

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.geotools.xml.gml.FCBuffer
All Implemented Interfaces:
FeatureReader, java.lang.Runnable
Direct Known Subclasses:
WFSFeatureReader

public class FCBuffer
extends java.lang.Thread
implements FeatureReader

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!
 
Field Summary
protected  org.xml.sax.SAXException exception
           
static int FINISH
          Last feature is in the buffer
protected  FeatureType 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, FeatureType ft)
           
 
Method Summary
protected  boolean addFeature(Feature f)
           Adds a feature to the buffer
 void close()
          Release the underlying resources associated with this stream.
 int getCapacity()
          DOCUMENT ME!
static FeatureReader 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 getFeatureReader(java.net.URI document, int capacity, FeatureType ft)
           
static FeatureReader getFeatureReader(java.net.URI document, int capacity, int timeout)
           
static FeatureReader getFeatureReader(java.net.URI document, int capacity, int timeout, FeatureType ft)
           
 FeatureType getFeatureType()
          DOCUMENT ME!
 int getSize()
          DOCUMENT ME!
 int getTimeout()
          DOCUMENT ME!
 boolean hasNext()
          Query whether this FeatureReader has another Feature.
 Feature next()
          Reads the next Feature in the FeatureReader.
 Feature peek()
           
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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 FeatureType ft
Constructor Detail

FCBuffer

protected FCBuffer(java.net.URI document,
                   int capacity,
                   int timeout,
                   FeatureType 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(Feature f)

Adds a feature to the buffer

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

getFeatureReader

public static FeatureReader 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 -
Returns:
Throws:
org.xml.sax.SAXException

getFeatureReader

public static FeatureReader getFeatureReader(java.net.URI document,
                                             int capacity,
                                             FeatureType ft)
                                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getFeatureReader

public static FeatureReader getFeatureReader(java.net.URI document,
                                             int capacity,
                                             int timeout)
                                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getFeatureReader

public static FeatureReader getFeatureReader(java.net.URI document,
                                             int capacity,
                                             int timeout,
                                             FeatureType ft)
                                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getFeatureType

public FeatureType getFeatureType()
DOCUMENT ME!

Specified by:
getFeatureType in interface FeatureReader
Returns:
DOCUMENT ME!
See Also:
FeatureReader.getFeatureType()

next

public Feature 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
Returns:
The next feature in the reader.
Throws:
java.util.NoSuchElementException - If there are no more Features in the Reader.
java.io.IOException - If an error occurs reading the Feature.
See Also:
FeatureReader.next()

peek

public Feature 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
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
See Also:
FeatureReader.close()

run

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


Copyright © GeoTools. All Rights Reserved.