Java Reference
In-Depth Information
else
else
br
=
new
new
BufferedReader
(
in
);
}
/** Main processing of the current input source. */
protected
protected
void
void
process
()
throws
throws
IOException
{
String line
;
prologue
();
// emit PostScript prologue, once.
startPage
();
// emit top-of-page (ending previous)
while
while
((
line
=
br
.
readLine
()) !=
null
null
) {
iif
(
line
.
startsWith
(
"\f"
) ||
line
.
trim
().
equals
(
".bp"
)) {
startPage
();
continue
continue
;
}
doLine
(
line
);
}
// finish last page, if not already done.
iif
(
lineNum
!=
0
)
System
.
out
.
println
(
"showpage"
);
}
/** Handle start of page details. */
protected
protected
void
void
startPage
() {
iif
(
pageNum
++ >
0
)
System
.
out
.
println
(
"showpage"
);
lineNum
=
0
;
moveTo
(
leftMargin
,
topMargin
);
}
/** Process one line from the current input */
protected
protected
void
void
doLine
(
String line
) {
tabPos
=
0
;
// count leading (not imbedded) tabs.
for
for
(
int
int
i
=
0
;
i
<
line
.
length
();
i
++) {
iif
(
line
.
charAt
(
i
)==
'\t'
)
tabPos
++;
else
break
break
;
}
String l
=
line
.
trim
();
// removes spaces AND tabs
iif
(
l
.
length
() ==
0
) {