com.puppycrawl.tools.checkstyle.checks
Enum LineSeparatorOption

java.lang.Object
  extended by java.lang.Enum<LineSeparatorOption>
      extended by com.puppycrawl.tools.checkstyle.checks.LineSeparatorOption
All Implemented Interfaces:
Serializable, Comparable<LineSeparatorOption>

public enum LineSeparatorOption
extends Enum<LineSeparatorOption>

Represents the options for line separator settings.

Author:
lkuehne
See Also:
NewlineAtEndOfFileCheck

Enum Constant Summary
CR
          Mac-style line separators.
CRLF
          Windows-style line separators.
LF
          Unix-style line separators.
SYSTEM
          System default line separators.
 
Method Summary
 int length()
           
 boolean matches(byte[] aBytes)
           
static LineSeparatorOption valueOf(String name)
          Returns the enum constant of this type with the specified name.
static LineSeparatorOption[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CRLF

public static final LineSeparatorOption CRLF
Windows-style line separators.


CR

public static final LineSeparatorOption CR
Mac-style line separators.


LF

public static final LineSeparatorOption LF
Unix-style line separators.


SYSTEM

public static final LineSeparatorOption SYSTEM
System default line separators.

Method Detail

values

public static LineSeparatorOption[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (LineSeparatorOption c : LineSeparatorOption.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static LineSeparatorOption valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

matches

public boolean matches(byte[] aBytes)
Parameters:
aBytes - a bytes array to check
Returns:
if aBytes is equal to the byte representation of this line separator

length

public int length()
Returns:
the length of the file separator, e.g. 1 for CR, 2 for CRLF, ...

Back to the Checkstyle Home Page