public class IOWrapper extends Object implements IOInterface
inputEncoding, inputseparator, outputEncoding, outputseparator| Constructor and Description |
|---|
IOWrapper() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeOutput()
simply close the outputfile you must call this method before the program
terminates
|
ResultSet |
execQuery(String query) |
IOIterator |
getLineIterator()
returns the IOIterator to iterate over file data
|
static void |
main(String[] args) |
IOIterator |
select(String tablename)
select all cols from table "tablename" and returns an iterator
|
IOIterator |
select(String tablename,
String[] cols)
select the "cols" from table "tablename" and returns an iterator
|
IOIterator |
sendInputQuery(String query)
iterates over the resultset of a given query please read the
IOIteratorInterface code
|
boolean |
sendOutputQuery(String query)
send a query to database
|
void |
setupInput(String inputfile)
setup the inputfile for reading uses the separator to determine the
amount of columns (use a simple split(separator)
|
void |
setupInput(String inputfile,
int cols)
setup (open) the inputfile for reading
|
void |
setupInput(String database,
String username,
String password)
same as setupOutput( String ), but with hostname="localhost" and
port=3306
|
void |
setupInput(String database,
String username,
String password,
String hostname,
int port)
setup the database to write in open a connection to db
|
void |
setupOutput(String outputfile)
setup the outputfile to write in you must call the closeOutput() to flush
and close the outputfile
|
void |
setupOutput(String database,
String username,
String password)
same as above, but with hostname="localhost" and port=3306
|
void |
setupOutput(String database,
String username,
String password,
String hostname,
int port)
same as for setupInput, but for writing
|
boolean |
writeLine(String line)
write a line to an open file see
de.uni_leipzig.asv.utils.IOInterface#setupOutput(java.lang.String)
|
public IOIterator getLineIterator() throws IOWrapperException
IOInterfacegetLineIterator in interface IOInterfaceIOWrapperExceptionpublic boolean writeLine(String line) throws IOWrapperException
IOInterfacewriteLine in interface IOInterfaceIOWrapperExceptionpublic void closeOutput()
throws IOWrapperException
IOInterfacecloseOutput in interface IOInterfaceIOWrapperExceptionpublic void setupInput(String inputfile, int cols) throws IOWrapperException
IOInterfacesetupInput in interface IOInterfaceinputfile - the name of the input filecols - in file, separated by tabs - use 0 for auto-detection (dynamic
col-count)IOWrapperExceptionpublic void setupInput(String inputfile) throws IOWrapperException
IOInterfacesetupInput in interface IOInterfaceinputfile - to open the file for readIOWrapperExceptionpublic void setupOutput(String outputfile) throws IOWrapperException
IOInterfacesetupOutput in interface IOInterfaceoutputfile - to open the file to write intoIOWrapperExceptionpublic void setupInput(String database, String username, String password, String hostname, int port) throws IOWrapperException
IOInterfacesetupInput in interface IOInterfacedatabase - name, "de" for exampleusername - to log inpassword - to log inhostname - the database runs onport - =
database portIOWrapperExceptionpublic void setupInput(String database, String username, String password) throws IOWrapperException
IOInterfacesetupInput in interface IOInterfaceIOWrapperExceptionpublic void setupOutput(String database, String username, String password, String hostname, int port) throws IOWrapperException
IOInterfacesetupOutput in interface IOInterfaceIOWrapperExceptionpublic void setupOutput(String database, String username, String password) throws IOWrapperException
IOInterfacesetupOutput in interface IOInterfaceIOWrapperExceptionpublic IOIterator select(String tablename, String[] cols) throws IOWrapperException
IOInterfaceselect in interface IOInterfaceIOWrapperExceptionpublic IOIterator select(String tablename) throws IOWrapperException
IOInterfaceselect in interface IOInterfaceIOWrapperExceptionpublic IOIterator sendInputQuery(String query) throws IOWrapperException
IOInterfacesendInputQuery in interface IOInterfaceIOWrapperExceptionpublic boolean sendOutputQuery(String query) throws IOWrapperException
IOInterfacesendOutputQuery in interface IOInterfaceIOWrapperExceptionpublic static void main(String[] args) throws IOWrapperException, IOIteratorException, InterruptedException
Copyright © 2013. All rights reserved.