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

java.lang.Object
  extended byuk.ac.ebi.adfconverter.common.tools.file.writer.ADFConverterFileWriterImpl
All Implemented Interfaces:
ADFConverterFileWriter
Direct Known Subclasses:
PlainTextFileWriter, WorkBookFileWriterjxl

public abstract class ADFConverterFileWriterImpl
extends java.lang.Object
implements ADFConverterFileWriter

Interface for all file format classes used in writing 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
ADFConverterFileWriterImpl(java.io.File datafile)
          Create an instance of a file writer for a give file
ADFConverterFileWriterImpl(java.io.File datafile, java.lang.String enc)
          Create an instance of a file writer for a give file with a given Java character encoding
 
Method Summary
 void clear()
          Finalization method that closes the file descriptor.
abstract  void closeFile()
          Closes a data text file.
 void isErasable(boolean _erase)
          Sets if a file should be overwritten, if it exists
abstract  void openFile()
          Opens a data file for reading or writing
 void setAppend(boolean append)
          sets if the write writes at the end of the file or overwrite it
abstract  void writeLine(DataBuffer line)
           Write a line in a data file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ADFConverterFileWriterImpl

public ADFConverterFileWriterImpl(java.io.File datafile)
Create an instance of a file writer for a give file

Parameters:
datafile - a file to write into

ADFConverterFileWriterImpl

public ADFConverterFileWriterImpl(java.io.File datafile,
                                  java.lang.String enc)
Create an instance of a file writer for a give file with a given Java character encoding

Parameters:
datafile - a file to write
enc - a specific Java character encoding for writing
See Also:
http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
Method Detail

clear

public void clear()
Finalization method that closes the file descriptor. This would work only if JVM is current (1.3 or later?).


closeFile

public abstract void closeFile()
                        throws java.lang.Exception
Closes a data text file.

Specified by:
closeFile in interface ADFConverterFileWriter
Throws:
java.lang.Exception - if an error occurs during file closing.

isErasable

public void isErasable(boolean _erase)
Sets if a file should be overwritten, if it exists

Specified by:
isErasable in interface ADFConverterFileWriter
Parameters:
_erase - true, if the previous can be overwritten.

openFile

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

Specified by:
openFile in interface ADFConverterFileWriter
Throws:
java.io.IOException - if an error occurs during file opening. (writing permission missing,...)

setAppend

public void setAppend(boolean append)
sets if the write writes at the end of the file or overwrite it

Specified by:
setAppend in interface ADFConverterFileWriter
Parameters:
append - true, if the data will be written at the end of file.

writeLine

public abstract void writeLine(DataBuffer line)
                        throws java.io.IOException

Write a line in a data file.

Specified by:
writeLine in interface ADFConverterFileWriter
Parameters:
line - the line String, containing data items, to write in.
Throws:
java.io.IOException - if an error occurs during file writing.


European Bioinformatics InstituteMicroarray Informatics Team