Package org.geotools.xml.gml
Class FCBuffer
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Runnable
,FeatureReader<SimpleFeatureType,
SimpleFeature>
Feature Buffer ... acts as a FeatureReader<SimpleFeatureType, SimpleFeature> by making itself as a seperate thread
prior starting execution with the SAX Parser.
- Author:
- dzwiers
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SAXException
static final int
Last feature is in the bufferprotected SimpleFeatureType
protected static Logger
protected int
static final int
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FCBuffer
(URI document, int capacity, int timeout, SimpleFeatureType ft) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Adds a feature to the buffervoid
close()
Release the underlying resources associated with this stream.int
getFeatureReader
(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.getFeatureReader
(URI document, int capacity, int timeout) getFeatureReader
(URI document, int capacity, int timeout, SimpleFeatureType ft) getFeatureReader
(URI document, int capacity, SimpleFeatureType ft) Return the FeatureType this reader has been configured to create.int
int
getSize()
int
boolean
hasNext()
Query whether this FeatureReader has another Feature.protected void
initHints
(XMLHandlerHints hints) Called before parsing the FeatureCollection.next()
Reads the next Feature in the FeatureReader.peek()
void
void
run()
Methods inherited from class Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
FINISH
public static final int FINISHLast feature is in the buffer- See Also:
-
STOP
public static final int STOP- See Also:
-
logger
-
state
protected int state -
exception
-
ft
-
-
Constructor Details
-
FCBuffer
- Parameters:
ft
- Nullable
-
-
Method Details
-
getSize
public int getSize()- Returns:
- The buffer size
-
getCapacity
public int getCapacity()- Returns:
- The buffer capacity
-
getTimeout
public int getTimeout()- Returns:
- The buffer capacity
-
addFeature
Adds a feature to the buffer- Parameters:
f
- Feature to add- Returns:
- false if unable to add the feature
-
getFeatureReader
public static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document, int capacity) throws 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- Throws:
SAXException
-
getFeatureReader
public static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document, int capacity, SimpleFeatureType ft) throws SAXException - Throws:
SAXException
-
getFeatureReader
public static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document, int capacity, int timeout) throws SAXException - Throws:
SAXException
-
getFeatureReader
public static FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(URI document, int capacity, int timeout, SimpleFeatureType ft) throws SAXException - Throws:
SAXException
-
getFeatureType
Description copied from interface:FeatureReader
Return the FeatureType this reader has been configured to create.- Specified by:
getFeatureType
in interfaceFeatureReader<SimpleFeatureType,
SimpleFeature> - Returns:
- the FeatureType of the Features this FeatureReader will create.
- See Also:
-
next
Description copied from interface:FeatureReader
Reads the next Feature in the FeatureReader.- Specified by:
next
in interfaceFeatureReader<SimpleFeatureType,
SimpleFeature> - Returns:
- The next feature in the reader.
- Throws:
IOException
- If an error occurs reading the Feature.NoSuchElementException
- If there are no more Features in the Reader.- See Also:
-
peek
- Throws:
IOException
NoSuchElementException
- See Also:
-
hasNext
Description copied from interface:FeatureReader
Query whether this FeatureReader has another Feature.- Specified by:
hasNext
in interfaceFeatureReader<SimpleFeatureType,
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:
IOException
- If an error occurs determining if there are more Features.- See Also:
-
close
public void close()Description copied from interface:FeatureReader
Release the underlying resources associated with this stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceFeatureReader<SimpleFeatureType,
SimpleFeature> - See Also:
-
run
public void run() -
initHints
Called before parsing the FeatureCollection. Subclasses may override to set their custom hints. -
getInternalState
public int getInternalState() -
resetTimer
public void resetTimer()
-