uk.ac.ebi.adfconverter.common.tools.file.writer
Class DataFileWriter

java.lang.Object
  extended byuk.ac.ebi.adfconverter.common.tools.file.writer.DataFileWriter

public class DataFileWriter
extends java.lang.Object

This class converts data in memory in a file for output

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
DataFileWriter(java.io.File aFile)
          constructor for converting a data table in a data file
DataFileWriter(java.io.File aFile, boolean hasHeader)
          constructor for converting a data table in data file in memory
 
Method Summary
 void containsHeader(boolean _header)
          Sets the indicator for header row.
 void doOverwrite(boolean _overwrite)
          Sets, if file exists, if the writer over write the existing file
 DataTable horizontalToVerticalTable(DataTable table)
          ConvertTable from a given table in the correct data orientation
 void writeData(DataTable table)
          Writes data in file
 void writeData(DataTable table, java.lang.String enc, java.lang.String delimiter, java.lang.String escape, int orientation, int type)
          write data into file with a specific character encoding
 void writeHorizontalDataTable(DataTable table, java.lang.String enc, java.lang.String delimiter, java.lang.String escape)
          Writes data into a file with a specific character encoding in a Horizontal orientation of data
 void writeHorizontalDataTable(DataTable table, 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
 void writeVerticalDataTable(DataTable table, java.lang.String enc, java.lang.String delimiter, java.lang.String escape)
          Write a data into a file with a specific character encoding in a vertical orientation of data
 void writeVerticalDataTable(DataTable table, java.lang.String enc, java.lang.String delimiter, java.lang.String escape, int type)
          Write data into a file with a specific character encoding in a vertical orientation of data
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFileWriter

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

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

DataFileWriter

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

Parameters:
aFile - a file object of a file containing data
hasHeader - a boolean indicating, if the user want to print the header
Method Detail

containsHeader

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

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

doOverwrite

public void doOverwrite(boolean _overwrite)
Sets, if file exists, if the writer over write the existing file

Parameters:
_overwrite - true if overwriting, false otherwise

horizontalToVerticalTable

public DataTable horizontalToVerticalTable(DataTable table)
ConvertTable from a given table in the correct data orientation

Parameters:
table - the table to change orientation
Returns:
the table in the correct orientation

writeData

public void writeData(DataTable table)
               throws java.io.IOException
Writes data in file

Parameters:
table - the table to write in a file
Throws:
IOException, - if error during access to the file.
java.io.IOException

writeData

public void writeData(DataTable table,
                      java.lang.String enc,
                      java.lang.String delimiter,
                      java.lang.String escape,
                      int orientation,
                      int type)
               throws java.io.IOException
write data into file with a specific character encoding

Parameters:
table - the table to write into a file
enc - a character encoding
delimiter - the delimiter string in a row (line)
escape - the escape string of a row in the file
orientation - the table orientation
type - the table type
Throws:
java.io.IOException - if an errors occurs during data writing.
See Also:
http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html

writeHorizontalDataTable

public void writeHorizontalDataTable(DataTable table,
                                     java.lang.String enc,
                                     java.lang.String delimiter,
                                     java.lang.String escape)
                              throws java.io.IOException
Writes data into a file with a specific character encoding in a Horizontal orientation of data

Parameters:
table - dat table to write
enc - a character encoding
delimiter - the delimiter string in a row (line)
escape - the escape string of a row in the file
Throws:
java.io.IOException - if an errors occurs during data writing.

writeHorizontalDataTable

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

Parameters:
table - dat table to write
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
Throws:
java.io.IOException - if an errors occurs during data writing.
See Also:
DataTable

writeVerticalDataTable

public void writeVerticalDataTable(DataTable table,
                                   java.lang.String enc,
                                   java.lang.String delimiter,
                                   java.lang.String escape)
                            throws java.io.IOException
Write a data into a file with a specific character encoding in a vertical orientation of data

Parameters:
table - dat table to write
enc - a character encoding
delimiter - the delimiter string in a row (line)
escape - the escape string of a row in the file
Throws:
java.io.IOException - if an errors occurs during data writing.

writeVerticalDataTable

public void writeVerticalDataTable(DataTable table,
                                   java.lang.String enc,
                                   java.lang.String delimiter,
                                   java.lang.String escape,
                                   int type)
                            throws java.io.IOException
Write data into a file with a specific character encoding in a vertical orientation of data

Parameters:
table - dat table to write
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
Throws:
java.io.IOException - if an errors occurs during data writing.
See Also:
DataTable


European Bioinformatics InstituteMicroarray Informatics Team