org.marketcetera.orderloader
Class OrderParser

java.lang.Object
  extended by org.marketcetera.orderloader.OrderParser

public class OrderParser
extends Object

Processes a CSV file and generates trade objects from it.

Since:
1.0.0
Version:
$Id: OrderParser.java 16154 2012-07-14 16:34:05Z colin $
Author:
anshul@marketcetera.com

Field Summary
static String COMMENT_MARKER
           
 
Constructor Summary
OrderParser(RowProcessor inProcessor)
          Creates a parser instance that parses the orders and processes them using the supplied delegate.
 
Method Summary
 int getNumBlankLines()
          Returns the total number of blank lines.
 int getNumComments()
          Returns the total number of lines with comments.
 int getNumLines()
          Returns the total number of lines processed.
 void parseOrders(InputStream inStream)
          Parses rows out of the supplied file and uses the processors to process them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMENT_MARKER

public static final String COMMENT_MARKER
See Also:
Constant Field Values
Constructor Detail

OrderParser

public OrderParser(RowProcessor inProcessor)
Creates a parser instance that parses the orders and processes them using the supplied delegate.

Parameters:
inProcessor - the delegate to use for creating orders from each row and processing them. Cannot be null
Method Detail

getNumLines

public int getNumLines()
Returns the total number of lines processed.

Returns:
the total number of lines processed.

getNumBlankLines

public int getNumBlankLines()
Returns the total number of blank lines.

Returns:
the total number of blank lines.

getNumComments

public int getNumComments()
Returns the total number of lines with comments.

Returns:
the total number of lines with comments.

parseOrders

public void parseOrders(InputStream inStream)
                 throws IOException,
                        OrderParsingException
Parses rows out of the supplied file and uses the processors to process them.

Parameters:
inStream - the input stream with csv input containing orders. The stream is closed when this method returns.
Throws:
IOException - if there was an error opening the supplied file or if the file had no orders to send.
OrderParsingException - if the file didn't have the column headers specified correctly or if the file didn't have any orders.


Copyright © 2012. All Rights Reserved.