Reading “Continued” Lines
You need to
read lines that are continued with
or that are continued with
leading spaces (such as email or
This functionality is likely to be reused, so it should be
encapsulated in general-purpose classes. I offer the
EscContLineReader reads lines normally, but if a
line ends with the escape character (by default, the backslash), then
the escape character is deleted and the following line is joined to
the preceding line. So if you have lines like this in the input:
Here is something I wanted to say:\ Try and Buy in every way. Go Team!
and you read them using an
readLine( ) method, then you will get the following lines:
Here is something I wanted to say: Try and Buy in every way. Go Team!
Note in particular that my reader does provide a
space character between the abutted parts of the continued line. An
IOException will be thrown if a file ends with the
IndentContLineReader reads lines, but if a line
begins with a space or tab, that line is joined to the preceding
line. This is designed for reading email or Usenet news
(“message”) header lines. Here is an example input file:
From: ian Tuesday, January 1, 2000 8:45 AM EST To: Book-reviewers List Received: by darwinsys.com (OpenBSD 2.6) from localhost at Tuesday, January 1, 2000 8:45 AM EST Subject: Hey, ...