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

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

public class WorkBookFileReaderjxl
extends ADFConverterFileReaderImpl
implements DataReader

Interface for all file format classes used in reading data

Version:
$Revision: 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
WorkBookFileReaderjxl(java.io.File datafile)
          Default Constructor for workbook reading
WorkBookFileReaderjxl(java.io.File datafile, java.lang.String enc)
          Constructor for workbook reading with a specific encoding
 
Method Summary
 void closeFile()
          Closes a data text file.
 DataRow getDataLine(java.lang.Integer length)
           Retrieves a data row from a data file Only when termination requirements have been met, the method should return a DataRow object.
 DataBuffer getLine()
           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 By default, opens the first sheet of the workbook
 void setSheet(int sheet)
          Sets in which sheet of the wookbook, is supposed to be read
 void setSheet(java.lang.String _sheet)
          Sets in which sheet of the workbook, is supposed to be read
 boolean sheetExists(int _sheetNumber)
          Tests if a sheet at a given position exists in the workbook
 boolean sheetExists(java.lang.String sheetName)
          Tests if a sheet with a given name exists in the workbook
 
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

WorkBookFileReaderjxl

public WorkBookFileReaderjxl(java.io.File datafile)
Default Constructor for workbook reading

Parameters:
datafile - the workbook file to read

WorkBookFileReaderjxl

public WorkBookFileReaderjxl(java.io.File datafile,
                             java.lang.String enc)
Constructor for workbook reading with a specific encoding

Parameters:
datafile - the workbook file to read
enc - a specific character encoding
Method Detail

closeFile

public void closeFile()
Closes a data text file.

Specified by:
closeFile in interface DataReader
Specified by:
closeFile in class ADFConverterFileReaderImpl

getDataLine

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

Retrieves a data row from a data file Only when termination requirements have been met, the method should return a DataRow object.

Specified by:
getDataLine in interface DataReader
Parameters:
length - the maximal line length
Returns:
line containing data items in one String
Throws:
java.io.IOException - if an error occurs during file reading

getLine

public DataBuffer getLine()
                   throws java.io.IOException

Retrieves a line from a data file Only when termination requirements have been met, the method should return a String object.

Specified by:
getLine in interface ADFConverterFileReader
Specified by:
getLine in class ADFConverterFileReaderImpl
Returns:
line containing data items in one String
Throws:
java.io.IOException - if an error occurs during file reading

openFile

public void openFile()
              throws java.io.IOException
Opens a data file for reading or writing By default, opens the first sheet of the workbook

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

setSheet

public void setSheet(int sheet)
              throws java.io.IOException
Sets in which sheet of the wookbook, is supposed to be read

Parameters:
sheet - the sheet index of the wooksheet to read
Throws:
IOException, - if an error occurs during file reading
java.io.IOException

setSheet

public void setSheet(java.lang.String _sheet)
              throws java.io.IOException
Sets in which sheet of the workbook, is supposed to be read

Parameters:
_sheet - the name of the wooksheet to read
Throws:
IOException, - if an error occurs during workbook reading
java.io.IOException

sheetExists

public boolean sheetExists(int _sheetNumber)
Tests if a sheet at a given position exists in the workbook

Parameters:
_sheetNumber - the position of the sheet to test
Returns:
true if the sheet exists. false, otherwise

sheetExists

public boolean sheetExists(java.lang.String sheetName)
Tests if a sheet with a given name exists in the workbook

Parameters:
sheetName - the name of the sheet to test
Returns:
true if the sheet exists. false, otherwise


European Bioinformatics InstituteMicroarray Informatics Team