uk.ac.ebi.adfconverter.common.tools.file.converter
Class DelimiterLineConverter

java.lang.Object
  extended byuk.ac.ebi.adfconverter.common.tools.file.converter.DelimiterLineConverter

public class DelimiterLineConverter
extends java.lang.Object

DelimiterLineConverter is configurable data format that uses any simple delimiter and escape sequence scheme to encode data into a text file.

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:
DataRow

Constructor Summary
DelimiterLineConverter(java.lang.String _delimiter)
          Creates a new instance of DelimiterLineConverter with specified delimiter and escape sequence.
DelimiterLineConverter(java.lang.String _delimiter, java.lang.String _escape)
          Creates a new instance of DelimiterLineConverter with specified delimiter and escape sequence.
 
Method Summary
static DataRow convertLine(DataBuffer line)
          Splits a String (file data line) following the current delimiter and the current escape characters
static DataRow convertLine(DataBuffer line, int length)
          Splits a String (file data line) following the current delimiter and the current escape characters, with a limited number of exporting token in output DataRow
static DataRow convertLine(java.lang.String line)
          Splits a String (file data line) following the current delimiter characters and the current escape characters
static DataRow convertLine(java.lang.String line, int length)
          Splits a String (file data line) following the current delimiter and the current escape characters, with a limited number of exporting token in output DataRow
static DataBuffer format(DataRow row)
          Format a DataRow following the current delimiter for output
static DataBuffer format(DataTableHeader header)
          Format a DataHeaderRow following the current delimiter for output
static void setDelimiter(java.lang.String _delimiter)
          Sets delimiter attribut
static void setEscape(java.lang.String _escape)
          Sets escape attribut
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelimiterLineConverter

public DelimiterLineConverter(java.lang.String _delimiter)
                       throws java.lang.IllegalArgumentException
Creates a new instance of DelimiterLineConverter with specified delimiter and escape sequence.

Parameters:
_delimiter - - character sequence used to separate one element from another one. delimiter CANNOT be NULL or empty string.
Throws:
java.lang.IllegalArgumentException - if an argument is incorrect (null or empty)

DelimiterLineConverter

public DelimiterLineConverter(java.lang.String _delimiter,
                              java.lang.String _escape)
                       throws java.lang.IllegalArgumentException
Creates a new instance of DelimiterLineConverter with specified delimiter and escape sequence.

Parameters:
_delimiter - - character sequence used to separate one element from another one. delimiter CANNOT be NULL or empty string.
_escape - - character sequence used to signal that next character sequence (either delimiter or escape) is part of data.
Throws:
java.lang.IllegalArgumentException - if an argument is incorrect (null or empty)
Method Detail

convertLine

public static DataRow convertLine(DataBuffer line)
Splits a String (file data line) following the current delimiter and the current escape characters

Parameters:
line - the line to convert in data row
Returns:
the DataRow corresponding to the line

convertLine

public static DataRow convertLine(DataBuffer line,
                                  int length)
Splits a String (file data line) following the current delimiter and the current escape characters, with a limited number of exporting token in output DataRow

Parameters:
line - the line to convert in data row
length - the maximal size of the row
Returns:
the DataRow corresponding to the line

convertLine

public static DataRow convertLine(java.lang.String line)
Splits a String (file data line) following the current delimiter characters and the current escape characters

Parameters:
line - the line to convert in data row
Returns:
the DataRow corresponding to the line

convertLine

public static DataRow convertLine(java.lang.String line,
                                  int length)
Splits a String (file data line) following the current delimiter and the current escape characters, with a limited number of exporting token in output DataRow

Parameters:
line - the line to convert in data row
length - the maximal size of the row
Returns:
the DataRow corresponding to the line

format

public static DataBuffer format(DataRow row)
Format a DataRow following the current delimiter for output

Parameters:
row - the row to format
Returns:
a string representing the row following delimiter and escape

format

public static DataBuffer format(DataTableHeader header)
Format a DataHeaderRow following the current delimiter for output

Parameters:
header - the header item list to format
Returns:
a string representing the header following delimiter and escape

setDelimiter

public static void setDelimiter(java.lang.String _delimiter)
Sets delimiter attribut

Parameters:
_delimiter - The new delimiter value.
Throws:
java.lang.IllegalArgumentException - if an argument is incorrect (null or empty).

setEscape

public static void setEscape(java.lang.String _escape)
Sets escape attribut

Parameters:
_escape - The new escape attribut value.
Throws:
java.lang.IllegalArgumentException - if an argument is incorrect (null or empty).


European Bioinformatics InstituteMicroarray Informatics Team