uk.ac.ebi.adfconverter.common.tools.file.reader
Class PlainTextDataFileReader

java.lang.Object
  extended byuk.ac.ebi.adfconverter.common.tools.file.reader.ADFConverterFileReaderImpl
      extended byuk.ac.ebi.adfconverter.common.tools.file.reader.PlainTextFileReader
          extended byuk.ac.ebi.adfconverter.common.tools.file.reader.PlainTextDataFileReader
All Implemented Interfaces:
ADFConverterFileReader, DataReader

public class PlainTextDataFileReader
extends PlainTextFileReader
implements DataReader

Interface for all file format classes used in reading data

Version:
1 ADF MAGE-TOOL - MicroArray Informatics Team / European Bioinformatics Institute (EBI) ArrayExpress License: ============================================================================== Copyright (c) 2002 The European Bioinformatics Institute. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name ArrayExpress must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact arrayexpress@ebi.ac.uk 4. Products derived from this software may not be called "ArrayExpress" nor may "ArrayExpress" appear in their names without prior written permission of the ArrayExpress developers. 5. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by ArrayExpress (http://www.ebi.ac.uk/arrayexpress)" THIS SOFTWARE IS PROVIDED BY THE ARRAYEXPRESS GROUP ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARRAYEXPRESS GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The European Bioinformatics Institute may publish revised and/or new versions of this license with new releases of ArrayExpress software. ==============================================================================
Author:
Pierre MARGUERITE
See Also:
DataTable

Constructor Summary
PlainTextDataFileReader(java.io.File datafile)
          Constructor for reader of data contained in tabular file
PlainTextDataFileReader(java.io.File datafile, java.lang.String enc)
          Constructor for reader of data contained in tabular file
PlainTextDataFileReader(java.io.File datafile, java.lang.String enc, java.lang.String delimiter, java.lang.String escape)
          Constructor of the class, Set a text file to read, an character encoding, an data delimiter and an escape character
 
Method Summary
 void closeFile()
          Closes a data text file.
 DataRow getDataLine(java.lang.Integer length)
           Retrieves a line from a data file Only when termination requirements have been met, the method should return a String object.
 void openFile()
          Opens a data file for reading or writing
 void setDelimiter(java.lang.String delimiter)
          sets the delimiter character used in the data to delimit data
 void setEscape(java.lang.String escape)
          sets the escape character used in the data to delimit data
 
Methods inherited from class uk.ac.ebi.adfconverter.common.tools.file.reader.PlainTextFileReader
getLine
 
Methods inherited from class uk.ac.ebi.adfconverter.common.tools.file.reader.ADFConverterFileReaderImpl
clear, finalize, getLineNumber
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.ebi.adfconverter.common.tools.file.reader.DataReader
getLineNumber
 

Constructor Detail

PlainTextDataFileReader

public PlainTextDataFileReader(java.io.File datafile)
Constructor for reader of data contained in tabular file

Parameters:
datafile - the file containing data

PlainTextDataFileReader

public PlainTextDataFileReader(java.io.File datafile,
                               java.lang.String enc)
Constructor for reader of data contained in tabular file

Parameters:
datafile - the file containing data
enc - specific character encoding

PlainTextDataFileReader

public PlainTextDataFileReader(java.io.File datafile,
                               java.lang.String enc,
                               java.lang.String delimiter,
                               java.lang.String escape)
Constructor of the class, Set a text file to read, an character encoding, an data delimiter and an escape character

Parameters:
datafile - the file to read
enc - the character encoding
delimiter - the data delimiter
escape - the escape character
Method Detail

closeFile

public void closeFile()
Closes a data text file.

Specified by:
closeFile in interface DataReader
Overrides:
closeFile in class PlainTextFileReader

getDataLine

public DataRow getDataLine(java.lang.Integer length)
                    throws java.io.IOException,
                           IncorrectDataFile

Retrieves a line from a data file Only when termination requirements have been met, the method should return a String object. A length Integer Object can be provided to limit the retrieve line to this length

Specified by:
getDataLine in interface DataReader
Parameters:
length - the length of the current line
Returns:
line containing data items in one String
Throws:
java.io.IOException
IncorrectDataFile

openFile

public void openFile()
              throws java.io.IOException
Opens a data file for reading or writing

Specified by:
openFile in interface DataReader
Overrides:
openFile in class PlainTextFileReader
Throws:
java.io.IOException - if an error occurs

setDelimiter

public void setDelimiter(java.lang.String delimiter)
sets the delimiter character used in the data to delimit data

Parameters:
delimiter - the data delimiter string

setEscape

public void setEscape(java.lang.String escape)
sets the escape character used in the data to delimit data

Parameters:
escape - the escape string


European Bioinformatics InstituteMicroarray Informatics Team