com.gridsystems.utils.text
Class EOLUtils

java.lang.Object
  extended by com.gridsystems.utils.text.EOLUtils

public final class EOLUtils
extends java.lang.Object

End-Of-Line Management Utilities.

Author:
Gaston Freire, Rodrigo Ruiz

Field Summary
static int DOS
          DOS scheme.
static int MAC
          Mac scheme.
static java.lang.String[] SCHEMENAMES
          String constants with the names of the different EOL schemes, indexed using the above constants.
static int UNDEFINED
          Undefined scheme.
static int UNIX
          Unix scheme.
 
Method Summary
static void applyEOL(java.io.File source, int scheme)
          Applies a scheme of EOL to the source text file.
static java.lang.String applyEOL(java.lang.String source, int scheme)
          Applies a scheme of EOL to the source.
static int detectEOL(java.io.File source)
          Detects what kind of EOL is present in the source text file.
static int detectEOL(java.lang.String source)
          Detects what kind of EOL is present in the source String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIX

public static final int UNIX
Unix scheme.

See Also:
Constant Field Values

DOS

public static final int DOS
DOS scheme.

See Also:
Constant Field Values

MAC

public static final int MAC
Mac scheme.

See Also:
Constant Field Values

UNDEFINED

public static final int UNDEFINED
Undefined scheme.

See Also:
Constant Field Values

SCHEMENAMES

public static final java.lang.String[] SCHEMENAMES
String constants with the names of the different EOL schemes, indexed using the above constants.

Method Detail

detectEOL

public static int detectEOL(java.lang.String source)
Detects what kind of EOL is present in the source String.

Parameters:
source - text to analyze
Returns:
int with the kind of EOL present (see constants above)

detectEOL

public static int detectEOL(java.io.File source)
                     throws java.io.IOException
Detects what kind of EOL is present in the source text file.

Parameters:
source - text file to analyze
Returns:
int with the kind of EOL present (see constants above)
Throws:
java.io.IOException - if error

applyEOL

public static java.lang.String applyEOL(java.lang.String source,
                                        int scheme)
Applies a scheme of EOL to the source.

Parameters:
source - text to convert
scheme - of EOL to apply
Returns:
String with source converted to the scheme

applyEOL

public static void applyEOL(java.io.File source,
                            int scheme)
                     throws java.io.IOException
Applies a scheme of EOL to the source text file.

Parameters:
source - text file to convert
scheme - of EOL to apply
Throws:
java.io.IOException - if error


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.