Class CollectionPopulatingXMLStreamProcessor
java.lang.Object
com.thirdpartylabs.xmlscalpel.processor.CollectionPopulatingXMLStreamProcessor
- All Implemented Interfaces:
XMLStreamProcessor
public class CollectionPopulatingXMLStreamProcessor extends java.lang.Object implements XMLStreamProcessor
Fill a
Collection with Fragment
objects as they are generated by the
StreamingXMLReader
Tracks progress through the file as the reader extracts nodes
-
Constructor Summary
Constructors Constructor Description CollectionPopulatingXMLStreamProcessor(java.util.Collection<Fragment> collection) -
Method Summary
Modifier and Type Method Description longgetBytesRead()longgetBytesRemaining()longgetBytesTotal()intgetNumProcessed()voidprocess(Fragment fragment)Called by theStreamingXMLReaderas each node is extracted from the filevoidsetBytesTotal(long bytesTotal)Called by theStreamingXMLReaderwhen the reading starts
-
Constructor Details
-
CollectionPopulatingXMLStreamProcessor
- Parameters:
collection- theCollectionto be populated
-
-
Method Details
-
process
Called by theStreamingXMLReaderas each node is extracted from the fileAdds the
Fragmentto the collection set via the c onstructor and updates the bytes read and number of items processed- Specified by:
processin interfaceXMLStreamProcessor- Parameters:
fragment- Wrapper object that contains aDocumentFragmentand anXMLByteLocationobject
-
setBytesTotal
public void setBytesTotal(long bytesTotal)Called by theStreamingXMLReaderwhen the reading starts- Specified by:
setBytesTotalin interfaceXMLStreamProcessor- Parameters:
bytesTotal- The total number of bytes in the file being processed
-
getBytesRemaining
public long getBytesRemaining()- Returns:
- The number of bytes left to process
-
getBytesTotal
public long getBytesTotal()- Returns:
- Total number of bytes in the XML file being parsed, as set by the
StreamingXMLReader
-
getBytesRead
public long getBytesRead()- Returns:
- Number of bytes that have been read by the
StreamingXMLReader
-
getNumProcessed
public int getNumProcessed()- Returns:
- The number of nodes processed. Updated as each node is extracted
-