Interface Newline


public interface Newline
Represents a type of newline.
Since:
8.2.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Interprets this type of newline as a line separator.
    Interprets this type of newline as a line terminator.
    The string token that represents this newline, e.g.
  • Method Details

    • asSeparator

      NewlineProcessor asSeparator()
      Interprets this type of newline as a line separator.

      Two ways to view newlines, both of which are self-consistent, are that newlines either separate lines or that they terminate lines.

      If a newline is considered a separator, there will be no newline after the last line of a file. Some programs have problems processing the last line of a file if it is not terminated by a newline. On the other hand, programs that expect newline to be used as a separator will interpret a final newline as starting a new (empty) line.

      Conversely, if a newline is considered a terminator, all text lines including the last are expected to be terminated by a newline. If the final character sequence in a text file is not a newline, the final line of the file may be considered to be an improper or incomplete text line, or the file may be considered to be improperly truncated.

      Returns:
      A newline processor that interprets this type of newline as a line separator.
    • asTerminator

      NewlineProcessor asTerminator()
      Interprets this type of newline as a line terminator.

      Two ways to view newlines, both of which are self-consistent, are that newlines either separate lines or that they terminate lines.

      If a newline is considered a separator, there will be no newline after the last line of a file. Some programs have problems processing the last line of a file if it is not terminated by a newline. On the other hand, programs that expect newline to be used as a separator will interpret a final newline as starting a new (empty) line.

      Conversely, if a newline is considered a terminator, all text lines including the last are expected to be terminated by a newline. If the final character sequence in a text file is not a newline, the final line of the file may be considered to be an improper or incomplete text line, or the file may be considered to be improperly truncated.

      Returns:
      A newline processor that interprets this type of newline as a line terminator.
    • token

      String token()
      The string token that represents this newline, e.g. "\n" for Unix newlines.
      Returns:
      The string token that represents this newline.