nz.ac.waikato.mcennis.rat.parser
Class ToFileParser

java.lang.Object
  extended by nz.ac.waikato.mcennis.rat.parser.AbstractParser
      extended by nz.ac.waikato.mcennis.rat.parser.ToFileParser
All Implemented Interfaces:
Parser

public class ToFileParser
extends AbstractParser

Class for writing the contents of a data stream to a file. Designed to be called from multiple instances and writing to the same directory without corruption.


Constructor Summary
ToFileParser()
          Create a FileParser saving to the temporary directory.
ToFileParser(java.lang.String location)
          Create a FileParser saving to the given location.
 
Method Summary
 Parser duplicate()
          Create an exact copy of this object
 ParsedObject get()
          Intentionally null
 java.lang.String getFilename()
           
 java.lang.String getSubDirectory()
           
 void parse(java.io.InputStream data, Crawler crawler, Properties site)
          Same as parse
 void parse(java.io.InputStream data, Properties site)
          Save to the next available file number
 void set(ParsedObject o)
          Intentionally a no-op
 void setCount(java.lang.Integer i)
          Set the count to a pre-set value - used if continuing a previous run
 void setFilename(java.lang.String filename)
           
 void setSubDirectory(java.lang.String subDirectory)
           
 
Methods inherited from class nz.ac.waikato.mcennis.rat.parser.AbstractParser
check, check, getName, getParameter, getParameter, init, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToFileParser

public ToFileParser()
Create a FileParser saving to the temporary directory.


ToFileParser

public ToFileParser(java.lang.String location)
Create a FileParser saving to the given location.

Parameters:
location - directory the files are saved in.
Method Detail

parse

public void parse(java.io.InputStream data,
                  Properties site)
Save to the next available file number

Specified by:
parse in interface Parser
Specified by:
parse in class AbstractParser
Parameters:
data - data to be saved

parse

public void parse(java.io.InputStream data,
                  Crawler crawler,
                  Properties site)
Same as parse

Specified by:
parse in interface Parser
Specified by:
parse in class AbstractParser
Parameters:
data - stream to be saved to a file
crawler - ignored

duplicate

public Parser duplicate()
Description copied from interface: Parser
Create an exact copy of this object

Specified by:
duplicate in interface Parser
Specified by:
duplicate in class AbstractParser
Returns:
new Parser object

setCount

public void setCount(java.lang.Integer i)
Set the count to a pre-set value - used if continuing a previous run

Parameters:
i - filenumber to be set to

get

public ParsedObject get()
Intentionally null

Specified by:
get in interface Parser
Specified by:
get in class AbstractParser
Returns:
null

set

public void set(ParsedObject o)
Intentionally a no-op

Specified by:
set in interface Parser
Specified by:
set in class AbstractParser
Parameters:
o - ignored

getFilename

public java.lang.String getFilename()

setFilename

public void setFilename(java.lang.String filename)

getSubDirectory

public java.lang.String getSubDirectory()

setSubDirectory

public void setSubDirectory(java.lang.String subDirectory)

Get Relational Analysis Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads