DataFile 1.4

com.infomata.data
Class FixedWidthFormat

java.lang.Object
  extended bycom.infomata.data.FixedWidthFormat
All Implemented Interfaces:
DataFormat

public class FixedWidthFormat
extends java.lang.Object
implements DataFormat

Data file format that uses fixed width to define each item per row of data.

Version:
$Revision: 1.1 $
Author:
Sam Kim

Constructor Summary
FixedWidthFormat(int[] widths)
          Creates a new FixedWidthFormat instance.
 
Method Summary
 java.lang.String format(DataRow row)
          Formats the data contained in DataRow object into a String according to pre-defined widths.
 DataRow parseLine(java.lang.String line)
          Parses a line of text containing data contained according to pre-defined character widths.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedWidthFormat

public FixedWidthFormat(int[] widths)
Creates a new FixedWidthFormat instance.

Parameters:
widths - list of width of each item contained in data file in correct order.
Method Detail

parseLine

public DataRow parseLine(java.lang.String line)
Parses a line of text containing data contained according to pre-defined character widths.

Specified by:
parseLine in interface DataFormat
Parameters:
line - String object containing data.
Returns:
DataRow object containing data parsed from line.

format

public java.lang.String format(DataRow row)
Formats the data contained in DataRow object into a String according to pre-defined widths.

Specified by:
format in interface DataFormat
Parameters:
row - DataRow containing data to be written to file.
Returns:
line of text containing data in specified widths.

DataFile 1.4

Copyright © 2004 Infomata. All Rights Reserved.