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

java.lang.Object
  extended byuk.ac.ebi.adfconverter.common.tools.file.reader.DataFileReaderIntf
Direct Known Subclasses:
DataFileReader

public abstract class DataFileReaderIntf
extends java.lang.Object

This class converts data from a file in a DataTable in Java, for manipulation

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
DataFileReaderIntf(java.io.File aFile)
          constructor for converting a data file in data table in memory
DataFileReaderIntf(java.io.File aFile, boolean hasHeader)
          constructor for converting a data file in data table in memory
 
Method Summary
abstract  void close()
          Closes file access/ reading
 boolean containsHeader()
          Checks if header indicator has been turned on using containsHeader(boolean). .
 void containsHeader(boolean _header)
          Sets the indicator for header row.
abstract  DataTable getData()
          Retrieves data from file
abstract  DataTable getData(int fileFormat)
          Retrieves data from file in a given file format, specifying file format type
abstract  DataTable getData(java.lang.String enc, java.lang.String delimiter, java.lang.String escape, int orientation, int type)
          Retrieves data from file with a specific character encoding
 java.io.File getFile()
          Retrieves the file associated/red by the reader
abstract  DataRow getHorizontalDataRow()
          Retrieves the next datarow in the horizontal datable.
abstract  DataTable getHorizontalDataTable(java.lang.String enc, java.lang.String delimiter, java.lang.String escape)
          Retrieves data from file with a specific character encoding in a vertical orientation of data
abstract  DataTable getHorizontalDataTable(java.lang.String enc, java.lang.String delimiter, java.lang.String escape, int type)
          Retrieves data from file with a specific character encoding in a horizontal orientation of data
abstract  DataTableHeader getHorizontalHeader()
          Retrieves the header of a horizontal data table contained in a file
abstract  DataTable getVerticalDataTable(java.lang.String enc, java.lang.String delimiter, java.lang.String escape)
          Retrieves data from file with a specific character encoding in a vertical orientation of data
abstract  DataTable getVerticalDataTable(java.lang.String enc, java.lang.String delimiter, java.lang.String escape, int type)
          Retrieves data from file with a specific character encoding in a vertical orientation of data
abstract  boolean open(java.lang.String enc, java.lang.String delimiter, java.lang.String escape, int type)
          Open a data file with a given character encoding , delimiter and escape strings , file orientation and file type
 void setSheet(int sheetNumber)
          For Microsoft excel workbook, set the sheet to read
 void setSheet(java.lang.String sheetName)
          For Microsoft excel workbook, set the sheet to read
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFileReaderIntf

public DataFileReaderIntf(java.io.File aFile)
constructor for converting a data file in data table in memory

Parameters:
aFile - a file object of a file containing data

DataFileReaderIntf

public DataFileReaderIntf(java.io.File aFile,
                          boolean hasHeader)
constructor for converting a data file in data table in memory

Parameters:
aFile - a file object of a file containing data
hasHeader - a boolean indicating if the first row is considered as the table header
Method Detail

close

public abstract void close()
Closes file access/ reading


containsHeader

public boolean containsHeader()
Checks if header indicator has been turned on using containsHeader(boolean). .

Returns:
True, if table header indicator has been set to true. False, otherwise.

containsHeader

public void containsHeader(boolean _header)
Sets the indicator for header row.

Parameters:
_header - True if the table contains a header row. False, otherwise.

getData

public abstract DataTable getData()
                           throws java.io.IOException,
                                  IncorrectFile,
                                  IncorrectDataFile
Retrieves data from file

Returns:
the data contained in the data file as DataTable
Throws:
java.io.IOException - if an error occurs during file access
IncorrectFile - if the opened file is incorrect (not as expected)
IncorrectDataFile - if the opened data file is incorrect.(incorrect data type, incorrect file structure)

getData

public abstract DataTable getData(int fileFormat)
                           throws java.io.IOException,
                                  IncorrectFile,
                                  IncorrectDataFile
Retrieves data from file in a given file format, specifying file format type

Parameters:
fileFormat - the file format
Returns:
the data contained in the data file as DataTable
Throws:
java.io.IOException - if an error occurs during file access
IncorrectFile - if the opened file is incorrect (not as expected)
IncorrectDataFile - if the opened data file is incorrect.(incorrect data type, incorrect file structure)

getData

public abstract DataTable getData(java.lang.String enc,
                                  java.lang.String delimiter,
                                  java.lang.String escape,
                                  int orientation,
                                  int type)
                           throws java.io.IOException,
                                  IncorrectFile,
                                  IncorrectDataFile
Retrieves data from file with a specific character encoding

Parameters:
enc - a character encoding
delimiter - the delimiter string in a row (line)
escape - the escape string of a row in the file
type - the type of the data file
Returns:
the retrieved data table from the data file
Throws:
java.io.IOException
IncorrectFile
IncorrectDataFile
See Also:

authorizes file format
Description of Data Content Typical Filename Extensions MIME type/subtype Text and Text-Related Types HTML text data (RFC 1866) html htm text/html Plain text: documents; program listings txt c c++ pl cc h text/plain Excel spreadsheet (Microsoft) xls, xlc, xll, xlm, xlw application/vnd.ms-excel application/x-msexcel application/ms-excel application/msexcel application/x-excel *


getFile

public java.io.File getFile()
Retrieves the file associated/red by the reader

Returns:
the associated file. null, if the file is incorrect

getHorizontalDataRow

public abstract DataRow getHorizontalDataRow()
                                      throws java.io.IOException,
                                             IncorrectDataFile
Retrieves the next datarow in the horizontal datable. Must be call after calling once open method

Returns:
the next retrieved DataRow, if existing. null, otherwise.
Throws:
java.io.IOException
IncorrectDataFile

getHorizontalDataTable

public abstract DataTable getHorizontalDataTable(java.lang.String enc,
                                                 java.lang.String delimiter,
                                                 java.lang.String escape)
                                          throws java.io.IOException,
                                                 IncorrectFile,
                                                 IncorrectDataFile
Retrieves data from file with a specific character encoding in a vertical orientation of data

Parameters:
enc - a character encoding
delimiter - the delimiter string in a row (line)
escape - the escape string of a row in the file
Returns:
contained data as DataTable (each table is in correct composition - accessible as horizontal table)
Throws:
java.io.IOException - if an error occurs during file access
IncorrectFile - if the opened file is incorrect (not as expected)
IncorrectDataFile - if the opened data file is incorrect.(incorrect data type,

getHorizontalDataTable

public abstract DataTable getHorizontalDataTable(java.lang.String enc,
                                                 java.lang.String delimiter,
                                                 java.lang.String escape,
                                                 int type)
                                          throws java.io.IOException,
                                                 IncorrectFile,
                                                 IncorrectDataFile
Retrieves data from file with a specific character encoding in a horizontal orientation of data

Parameters:
enc - a character encoding
delimiter - the delimiter string in a row (line)
escape - the escape string of a row in the file
type - the type of the data file
Returns:
contained data as DataTable (each table is in correct composition - accessible as horizontal table)
Throws:
java.io.IOException - if an error occurs during file access
IncorrectFile - if the opened file is incorrect (not as expected)
IncorrectDataFile - if the opened data file is incorrect.(incorrect data type,
See Also:
DataTable

getHorizontalHeader

public abstract DataTableHeader getHorizontalHeader()
                                             throws java.io.IOException,
                                                    IncorrectDataFile
Retrieves the header of a horizontal data table contained in a file

Returns:
the retrieved DataTableHeader, if the table contains an header. null, otherwise.
Throws:
java.io.IOException
IncorrectDataFile

getVerticalDataTable

public abstract DataTable getVerticalDataTable(java.lang.String enc,
                                               java.lang.String delimiter,
                                               java.lang.String escape)
                                        throws java.io.IOException,
                                               IncorrectFile,
                                               IncorrectDataFile
Retrieves data from file with a specific character encoding in a vertical orientation of data

Parameters:
enc - a character encoding
delimiter - the delimiter string in a row (line)
escape - the escape string of a row in the file
Returns:
contained data as DataTable (each table is in correct composition - accessible as horizontal table)
Throws:
java.io.IOException - if an error occurs during file access
IncorrectFile - if the opened file is incorrect (not as expected)
IncorrectDataFile - if the opened data file is incorrect.(incorrect data type,

getVerticalDataTable

public abstract DataTable getVerticalDataTable(java.lang.String enc,
                                               java.lang.String delimiter,
                                               java.lang.String escape,
                                               int type)
                                        throws java.io.IOException,
                                               IncorrectFile,
                                               IncorrectDataFile
Retrieves data from file with a specific character encoding in a vertical orientation of data

Parameters:
enc - a character encoding
delimiter - the delimiter string in a row (line)
escape - the escape string of a row in the file
type - the type of the data file
Returns:
contained data as DataTable (each table is in correct composition - accessible as horizontal table)
Throws:
java.io.IOException - if an error occurs during file access
IncorrectFile - if the opened file is incorrect (not as expected)
IncorrectDataFile - if the opened data file is incorrect.(incorrect data type,
See Also:
DataTable

open

public abstract boolean open(java.lang.String enc,
                             java.lang.String delimiter,
                             java.lang.String escape,
                             int type)
Open a data file with a given character encoding , delimiter and escape strings , file orientation and file type

Parameters:
enc -
delimiter -
escape -
type -
Returns:
true, if the file is opened correctly.
See Also:
DataTable

setSheet

public void setSheet(int sheetNumber)
For Microsoft excel workbook, set the sheet to read

Parameters:
sheetNumber - the sheet number to read

setSheet

public void setSheet(java.lang.String sheetName)
For Microsoft excel workbook, set the sheet to read

Parameters:
sheetName - the sheet name to read


European Bioinformatics InstituteMicroarray Informatics Team