com.univocity.api.entity.text.fixed
Class FixedWidthFormat

java.lang.Object
  extended by com.univocity.api.entity.Configuration
      extended by com.univocity.api.entity.text.TextFormat
          extended by com.univocity.api.entity.text.fixed.FixedWidthFormat

public final class FixedWidthFormat
extends TextFormat

The fixed-width format configuration class. Used by fixed-width data entities in FixedWidthEntityConfiguration.

It provides the following configuration options (in addition to the ones in TextFormat):

Author:
uniVocity Software Pty Ltd - dev@univocity.com
See Also:
FixedWidthEntityConfiguration, TextFormat

Constructor Summary
FixedWidthFormat()
           
 
Method Summary
protected  void copyDefaultsFrom(Configuration defaultConfig)
          Applies default values to undefined settings using a Configuration object.
 char getPadding()
          Returns the character used for filling unwritten spaces in a fixed-width record.
 boolean isPadding(char ch)
          Identifies whether or not a given character is used for representing unwritten spaces in a fixed-width record.
 void setPadding(char padding)
          Defines the character used for filling unwritten spaces in a fixed-width record.
 
Methods inherited from class com.univocity.api.entity.text.TextFormat
getComment, getLineSeparator, getLineSeparatorString, getNormalizedNewline, isComment, isLineSeparator, isLineSeparator, isNormalizedNewLine, setComment, setLineSeparator, setLineSeparator, setNormalizedNewline
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedWidthFormat

public FixedWidthFormat()
Method Detail

getPadding

public final char getPadding()
Returns the character used for filling unwritten spaces in a fixed-width record.

e.g. if a field has a length of 5 characters, but the value is 'ZZ', the field should contain [ZZ   ] (i.e. ZZ followed by 3 unwritten spaces).
If the padding is set to '_', then the field will be written as [ZZ___]

Defaults to ' '

Returns:
the padding character

setPadding

public final void setPadding(char padding)
Defines the character used for filling unwritten spaces in a fixed-width record.

e.g. if a field has a length of 5 characters, but the value is 'ZZ', the field should contain [ZZ ] (i.e. ZZ followed by 3 unwritten spaces).
If the padding is set to '_', then the field will be written as [ZZ___]

Parameters:
padding - the padding character

isPadding

public final boolean isPadding(char ch)
Identifies whether or not a given character is used for representing unwritten spaces in a fixed-width record.

Parameters:
ch - the character to be verified
Returns:
true if the given character is the padding character, otherwise false

copyDefaultsFrom

protected final void copyDefaultsFrom(Configuration defaultConfig)
Applies default values to undefined settings using a Configuration object.

Overrides:
copyDefaultsFrom in class TextFormat
Parameters:
defaultConfig - a configuration object from where to obtain default settings.


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.